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.
StackGenVis/frontend/node_modules/map-limit/test.js

40 lines
846 B

4 years ago
var test = require('tape')
var mapl = require('./')
test('basic', function(t) {
var items = [1, 2, 3, 4, 5]
var goals = [2, 4, 6, 8,10]
t.plan(2)
mapl(items, 5, function(item, next) {
next(null, item * 2)
}, function(err, results) {
t.ifError(err)
t.deepEqual(results, goals)
})
})
test('stalled', function(t) {
var items = [1, 2, 3, 4, 5, 6, 7, 8]
var goals = [2, 4, 6, 8,10,12,14,16]
var n = 0
t.plan(6)
mapl(items, 2, function(item, next) {
setTimeout(function() {
n += 1
next(null, item * 2)
}, 150)
}, function(err, results) {
t.ifError(err)
t.deepEqual(results, goals)
})
setTimeout(function() { t.equal(n, 2) }, 225)
setTimeout(function() { t.equal(n, 4) }, 350)
setTimeout(function() { t.equal(n, 6) }, 475)
setTimeout(function() { t.equal(n, 8) }, 625)
})