StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics
https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
838 B
30 lines
838 B
var falafel = require('../');
|
|
var test = require('tape');
|
|
|
|
test('for loop', function (t) {
|
|
t.plan(7);
|
|
|
|
var src = '(function () {'
|
|
+ 'var sum = 0;'
|
|
+ 'for (var i = 0; i < 10; i++)'
|
|
+ 'sum += i;'
|
|
+ 'if (true)'
|
|
+ 'for (var i = 0; i < 10; i++)'
|
|
+ 'sum += i;'
|
|
+ 'return sum;'
|
|
+ '})()';
|
|
|
|
var output = falafel(src, function (node) {
|
|
if (node.type === 'ForStatement') {
|
|
t.equal(node.update.source(), 'i++');
|
|
t.equal(node.update.type, "UpdateExpression");
|
|
node.update.update('i+=2');
|
|
}
|
|
if (node.type === 'UpdateExpression') {
|
|
t.equal(node.source(), 'i++');
|
|
}
|
|
});
|
|
|
|
var res = Function('return ' + output)();
|
|
t.equal(res, 2 + 4 + 6 + 8 + 2 + 4 + 6 + 8);
|
|
});
|
|
|