time-to-botec

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

map-test.js (520B)


      1 var vows = require('vows');
      2 var assert = require('assert');
      3 var suite = vows.describe('jStat.map');
      4 
      5 require('../env.js');
      6 
      7 suite.addBatch({
      8   'map': {
      9     'topic': function() {
     10       return jStat;
     11     },
     12     'return map': function(jStat) {
     13       assert.deepEqual(jStat.map([[1, 2], [3, 4]], function(x) {
     14         return x * 2;
     15       }), [[2, 4], [6, 8]]);
     16       assert.deepEqual(jStat([[1, 2], [3, 4]]).map(function(x) {
     17         return x * 2;
     18       }).toArray(), [[2, 4], [6, 8]]);
     19     }
     20   }
     21 });
     22 
     23 suite.export(module);