Closed t-mochizuki closed 6 years ago
Node version is v0.12.4.
I have confirmed following tests.
/* * use mocha to test me * http://visionmedia.github.com/mocha/ */ var assert, Combinatorics; if (this['window'] !== this) { assert = require("assert"); Combinatorics = require('../.'); } var is_deeply = function (a, e, m) { return function () { assert.equal(JSON.stringify(a), JSON.stringify(e), m) } }; describe('Combinatorics.power', function () { var a = [], c = Combinatorics.power(a); it(c, is_deeply(c.toArray(), [ [] ])); a = 'abc'.split(''), c = Combinatorics.power(a); it(a, is_deeply(c.toArray(), [ [], ["a"], ["b"], ["a", "b"], ["c"], ["a", "c"], ["b", "c"], ["a", "b", "c"] ])); it(0+c, is_deeply(0+c, c.toArray().length)); it(c.length, is_deeply(c.length, c.toArray().length)); it(a, is_deeply(c.filter(function(a){return a.length === 2}), Combinatorics.combination(a,2).toArray() )); a = ["a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "d0"] c = Combinatorics.power(a); it(a, is_deeply(c.toArray(), [])); a = ["a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "d0", "d1"] c = Combinatorics.power(a); it(a, is_deeply(c.toArray(), [[]])); });
I added two tests to test/power.js. But, I think that its two tests should not be passed.
Node version is v0.12.4.
I have confirmed following tests.
I added two tests to test/power.js. But, I think that its two tests should not be passed.