time-to-botec/squiggle/node_modules/jstat/test/vector/range-test.js
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00

41 lines
950 B
JavaScript

var vows = require('vows');
var assert = require('assert');
var suite = vows.describe('jStat.range');
require('../env.js');
suite.addBatch({
'range': {
'topic': function() {
return jStat;
},
'return basic range': function(jStat) {
assert.equal(jStat.range([1, 2, 3]), 2);
},
'range from instance': function(jStat) {
assert.equal(jStat([1, 2, 3]).range(), 2);
},
'range matrix cols': function(jStat) {
assert.deepEqual(jStat([[1, 2], [3, 4]]).range(), [2, 2]);
}
},
'#range vector': {
'topic': function() {
jStat([1, 2, 3]).range(this.callback);
},
'range callback': function(val, stat) {
assert.equal(val, 2);
}
},
'#range matrix cols': {
'topic': function() {
jStat([[1, 2], [3, 4]]).range(this.callback);
},
'range matrix cols callback': function(val, stat) {
assert.deepEqual(val, [2, 2]);
}
}
});
suite.export(module);