time-to-botec/squiggle/node_modules/jstat/test/vector/meansqerr-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
1.0 KiB
JavaScript

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