time-to-botec/squiggle/node_modules/jstat/test/vector/sumsqerr-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
992 B
JavaScript

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