time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

det-test.js (768B)


      1 var vows = require('vows');
      2 var assert = require('assert');
      3 var suite = vows.describe('jStat');
      4 
      5 require('../env.js');
      6 
      7 suite.addBatch({
      8   'linearalgebra': {
      9     'topic': function() {
     10       return jStat;
     11     },
     12     "test det on 2x2 matrix": function (jStat) {
     13       var A = [
     14         [4, 6],
     15         [3, 8],
     16       ];
     17       assert.equal(jStat.det(A), 14);
     18     },
     19     'test det works': function(jStat) {
     20       var A = [[1, 2, 3], [4, 5, -6], [7, -8, 9]];
     21       assert.equal(jStat.det(A), -360);
     22     },
     23     "test bug #270": function (jStat) {
     24       var A = [
     25         [310, -228, -190, 108],
     26         [-228, 310, 108, -190],
     27         [-190, 108, 310, -228],
     28         [108, -190, -228, 310],
     29       ];
     30       assert.equal(jStat.det(A), 0);
     31     },
     32   }
     33 });
     34 
     35 suite.export(module);