dimensions-test.js (812B)
1 var vows = require('vows'); 2 var assert = require('assert'); 3 var suite = vows.describe('jStat.dimensions'); 4 5 require('../env.js'); 6 7 function noop() { } 8 9 suite.addBatch({ 10 'dimensions': { 11 'topic': function() { 12 return jStat; 13 }, 14 'dimention of matrix': function(jStat) { 15 assert.deepEqual(jStat.dimensions([[1], [4], [5]]), { rows: 3, cols: 1 }); 16 assert.deepEqual(jStat([[1], [4], [5]]).dimensions(), 17 { rows: 3, cols: 1 }); 18 assert.isTrue(jStat([[1], [3]]).dimensions(noop) instanceof jStat); 19 } 20 }, 21 '#dimensions': { 22 'topic': function() { 23 jStat([[1, 2, 3], [4, 5, 6]]).dimensions(this.callback); 24 }, 25 'dimensions sends value': function(val, stat) { 26 assert.deepEqual(val, { rows: 2, cols: 3 }); 27 } 28 } 29 }); 30 31 suite.export(module);