filer/perf/simple-statistics/test/factorial.test.js

23 lines
586 B
JavaScript
Raw Permalink Normal View History

2014-12-17 07:54:29 +00:00
var test = require('tape');
var ss = require('../');
test('factorial', function(t) {
test('can return null given a negative number', function(t) {
t.equal(null, ss.factorial(-1));
t.end();
});
test('can calculate 0! = 1', function(t) {
t.equal(ss.factorial(0), 1);
t.end();
});
test('can calculate 1! = 1', function(t) {
t.equal(ss.factorial(1), 1);
t.end();
});
test('can calculate 100! = 1', function(t) {
t.equal(ss.factorial(100), 9.33262154439441e+157);
t.end();
});
t.end();
});