diff options
Diffstat (limited to 'includes/external/school/node_modules/cuint/test')
38 files changed, 0 insertions, 2950 deletions
diff --git a/includes/external/school/node_modules/cuint/test/UINT32-test.js b/includes/external/school/node_modules/cuint/test/UINT32-test.js deleted file mode 100644 index 4b6536a..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT32-test.js +++ /dev/null @@ -1,220 +0,0 @@ -var assert = require('assert') -var UINT32 = require('..').UINT32 - -describe('UINT32 constructor', function () { - - describe('with no parameters', function () { - - it('should properly initialize', function (done) { - var u = UINT32() - - assert.equal( u._low, 0 ) - assert.equal( u._high, 0 ) - done() - }) - - }) - - describe('with low and high bits', function () { - - describe('0, 0', function () { - it('should properly initialize', function (done) { - var u = UINT32(0, 0) - - assert.equal( u._low, 0 ) - assert.equal( u._high, 0 ) - done() - }) - }) - - describe('1, 0', function () { - it('should properly initialize', function (done) { - var u = UINT32(1, 0) - - assert.equal( u._low, 1 ) - assert.equal( u._high, 0 ) - done() - }) - }) - - describe('0, 1', function () { - it('should properly initialize', function (done) { - var u = UINT32(0, 1) - - assert.equal( u._low, 0 ) - assert.equal( u._high, 1 ) - done() - }) - }) - - describe('3, 5', function () { - it('should properly initialize', function (done) { - var u = UINT32(3, 5) - - assert.equal( u._low, 3 ) - assert.equal( u._high, 5 ) - done() - }) - }) - - }) - - describe('with number', function () { - - describe('0', function () { - it('should properly initialize', function (done) { - var u = UINT32(0) - - assert.equal( u._low, 0 ) - assert.equal( u._high, 0 ) - done() - }) - }) - - describe('1', function () { - it('should properly initialize', function (done) { - var u = UINT32(1) - - assert.equal( u._low, 1 ) - assert.equal( u._high, 0 ) - done() - }) - }) - - describe('3', function () { - it('should properly initialize', function (done) { - var u = UINT32(3) - - assert.equal( u._low, 3 ) - assert.equal( u._high, 0 ) - done() - }) - }) - - describe('with high bit', function () { - it('should properly initialize', function (done) { - var u = UINT32( Math.pow(2,17)+123 ) - - assert.equal( u._low, 123 ) - assert.equal( u._high, 2 ) - done() - }) - }) - - }) - - describe('with string', function () { - - describe('"0"', function () { - it('should properly initialize', function (done) { - var u = UINT32('0') - - assert.equal( u._low, 0 ) - assert.equal( u._high, 0 ) - done() - }) - }) - - describe('"1"', function () { - it('should properly initialize', function (done) { - var u = UINT32('1') - - assert.equal( u._low, 1 ) - assert.equal( u._high, 0 ) - done() - }) - }) - - describe('10', function () { - it('should properly initialize', function (done) { - var u = UINT32('10') - - assert.equal( u._low, 10 ) - assert.equal( u._high, 0 ) - done() - }) - }) - - describe('with high bit', function () { - it('should properly initialize', function (done) { - var u = UINT32( '' + (Math.pow(2,17)+123) ) - - assert.equal( u._low, 123 ) - assert.equal( u._high, 2 ) - done() - }) - }) - - describe('with radix 10', function () { - it('should properly initialize', function (done) { - var u = UINT32( '123', 10 ) - - assert.equal( u._low, 123 ) - assert.equal( u._high, 0 ) - done() - }) - }) - - describe('with radix 2', function () { - it('should properly initialize', function (done) { - var u = UINT32( '1111011', 2 ) - - assert.equal( u._low, 123 ) - assert.equal( u._high, 0 ) - done() - }) - }) - - describe('with radix 16', function () { - it('should properly initialize', function (done) { - var u = UINT32( '7B', 16 ) - - assert.equal( u._low, 123 ) - assert.equal( u._high, 0 ) - done() - }) - }) - - describe('8000 with radix 16', function () { - it('should properly initialize', function (done) { - var u = UINT32( '8000', 16 ) - - assert.equal( u._low, 32768 ) - assert.equal( u._high, 0 ) - done() - }) - }) - - describe('80000000 with radix 16', function () { - it('should properly initialize', function (done) { - var u = UINT32( '80000000', 16 ) - - assert.equal( u._low, 0 ) - assert.equal( u._high, 32768 ) - done() - }) - }) - - describe('maximum unsigned 32 bits value in base 2', function () { - it('should properly initialize', function (done) { - var u = UINT32( Array(33).join('1'), 2 ) - - assert.equal( u._low, 65535 ) - assert.equal( u._high, 65535 ) - done() - }) - }) - - describe('maximum unsigned 32 bits value in base 16', function () { - it('should properly initialize', function (done) { - var u = UINT32( Array(9).join('F'), 16 ) - - assert.equal( u._low, 65535 ) - assert.equal( u._high, 65535 ) - done() - }) - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT32_add-test.js b/includes/external/school/node_modules/cuint/test/UINT32_add-test.js deleted file mode 100644 index f42968c..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT32_add-test.js +++ /dev/null @@ -1,109 +0,0 @@ -var assert = require('assert') -var UINT32 = require('..').UINT32 - -describe('add method', function () { - - describe('0+0', function () { - - it('should return 0', function (done) { - var u = UINT32(0).add( UINT32(0) ) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('0+1', function () { - - it('should return 1', function (done) { - var u = UINT32(0).add( UINT32(1) ) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - - describe('1+0', function () { - - it('should return 0', function (done) { - var u = UINT32(1).add( UINT32(0) ) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - - describe('1+1', function () { - - it('should return 2', function (done) { - var u = UINT32(1).add( UINT32(1) ) - - assert.equal( u.toNumber(), 2 ) - done() - }) - - }) - - describe('low bit+high bit', function () { - - it('should return n', function (done) { - var n = Math.pow(2, 17) - var u = UINT32(123).add( UINT32(n) ) - - assert.equal( u.toNumber(), 123 + n ) - done() - }) - - }) - - describe('high bit+low bit', function () { - - it('should return n', function (done) { - var n = Math.pow(2, 17) - var u = UINT32(n).add( UINT32(123) ) - - assert.equal( u.toNumber(), 123 + n ) - done() - }) - - }) - - describe('high bit+high bit', function () { - - it('should return n', function (done) { - var n = Math.pow(2, 17) - var u = UINT32(n).add( UINT32(n) ) - - assert.equal( u.toNumber(), n + n ) - done() - }) - - }) - - describe('overflow', function () { - - it('should return n', function (done) { - var n = 'FFFFFFFF' - var u = UINT32(n, 16).add( UINT32(n, 16) ) - - assert.equal( u.toNumber(), -2 ) - done() - }) - - }) - - describe('high bit+high bit 2', function () { - - it('should return n', function (done) { - var u = UINT32('326648991').add( UINT32('265443576') ) - - assert.equal( u.toNumber(), 592092567 ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT32_and-test.js b/includes/external/school/node_modules/cuint/test/UINT32_and-test.js deleted file mode 100644 index 9e36d68..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT32_and-test.js +++ /dev/null @@ -1,64 +0,0 @@ -var assert = require('assert') -var UINT32 = require('..').UINT32 - -describe('and method', function () { - - describe('0&1', function () { - - it('should return 0', function (done) { - var u = UINT32(0).and( UINT32(1) ) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('1&2', function () { - - it('should return 0', function (done) { - var u = UINT32(1).and( UINT32(2) ) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('1&2^16', function () { - - it('should return 0', function (done) { - var n = Math.pow(2, 16) - var u = UINT32(1).and( UINT32(n) ) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('2^16&1', function () { - - it('should return 0', function (done) { - var n = Math.pow(2, 16) - var u = UINT32(n).and( UINT32(1) ) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('2^16&2^16', function () { - - it('should return n', function (done) { - var n = Math.pow(2, 16) - var u = UINT32(n).and( UINT32(n) ) - - assert.equal( u.toNumber(), n ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT32_div-test.js b/includes/external/school/node_modules/cuint/test/UINT32_div-test.js deleted file mode 100644 index 6464662..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT32_div-test.js +++ /dev/null @@ -1,114 +0,0 @@ -var assert = require('assert') -var UINT32 = require('..').UINT32 - -describe('div method', function () { - - describe('1/0', function () { - - it('should throw', function (done) { - assert.throws( - function () { - UINT32(1).div( UINT32(0) ) - } - , function (err) { - if (err instanceof Error) return true - } - ) - - - done() - }) - - }) - - describe('0/1', function () { - - it('should return 0', function (done) { - var u = UINT32(2).div( UINT32(1) ) - - assert.equal( u.toNumber(), 2 ) - done() - }) - - }) - - describe('2/1', function () { - - it('should return 2', function (done) { - var u = UINT32(0).div( UINT32(1) ) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('1/2', function () { - - it('should return 0', function (done) { - var u = UINT32(1).div( UINT32(2) ) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('low bit/high bit', function () { - - it('should return n', function (done) { - var n = Math.pow(2, 17) - var u = UINT32(3).div( UINT32(n) ) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('high bit/low bit', function () { - - it('should return n', function (done) { - var n = Math.pow(2, 17) - var u = UINT32(n).div( UINT32(3) ) - - assert.equal( u.toNumber(), (n/3)|0 ) - assert.equal( u.remainder.toNumber(), 2 ) - done() - }) - - }) - - describe('high bit/high bit', function () { - - it('should return n', function (done) { - var n = 'FFFFFFFF' - var u = UINT32(n, 16).div( UINT32(n, 16) ) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - - describe('high bit/high bit 2', function () { - - it('should return n', function (done) { - var u = UINT32('3266489917').div( UINT32('668265263') ) - - assert.equal( u.toNumber(), 4 ) - done() - }) - - }) - - describe('374761393/(16^3)', function () { - it('should return 91494', function (done) { - var u = UINT32('374761393').div( UINT32(16*16*16) ) - - assert.equal( u.toNumber(), 91494 ) - done() - }) - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT32_equals-test.js b/includes/external/school/node_modules/cuint/test/UINT32_equals-test.js deleted file mode 100644 index 157bc01..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT32_equals-test.js +++ /dev/null @@ -1,62 +0,0 @@ -var assert = require('assert') -var UINT32 = require('..').UINT32 - -describe('equals method', function () { - - describe('0==0', function () { - - it('should return true', function (done) { - var u = UINT32(0).equals( UINT32(0) ) - - assert( u ) - done() - }) - - }) - - describe('1==1', function () { - - it('should return true', function (done) { - var u = UINT32(1).equals( UINT32(1) ) - - assert( u ) - done() - }) - - }) - - describe('low bit', function () { - - it('should return true', function (done) { - var u = UINT32(3).equals( UINT32(3) ) - - assert( u ) - done() - }) - - }) - - describe('high bit', function () { - - it('should return true', function (done) { - var n = Math.pow(2, 17) - var u = UINT32(n).equals( UINT32(n) ) - - assert( u ) - done() - }) - - }) - - describe('1!=2', function () { - - it('should return false', function (done) { - var u = UINT32(1).equals( UINT32(2) ) - - assert( !u ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT32_greaterThan-test.js b/includes/external/school/node_modules/cuint/test/UINT32_greaterThan-test.js deleted file mode 100644 index 034f827..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT32_greaterThan-test.js +++ /dev/null @@ -1,52 +0,0 @@ -var assert = require('assert') -var UINT32 = require('..').UINT32 - -describe('greaterThan method', function () { - - describe('0>1', function () { - - it('should return false', function (done) { - var u = UINT32(0).greaterThan( UINT32(1) ) - - assert( !u ) - done() - }) - - }) - - describe('1>2', function () { - - it('should return false', function (done) { - var u = UINT32(1).greaterThan( UINT32(2) ) - - assert( !u ) - done() - }) - - }) - - describe('1>2^16', function () { - - it('should return false', function (done) { - var n = Math.pow(2, 16) - var u = UINT32(1).greaterThan( UINT32(n) ) - - assert( !u ) - done() - }) - - }) - - describe('2^16>1', function () { - - it('should return true', function (done) { - var n = Math.pow(2, 16) - var u = UINT32(n).greaterThan( UINT32(1) ) - - assert( u ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT32_lessThan-test.js b/includes/external/school/node_modules/cuint/test/UINT32_lessThan-test.js deleted file mode 100644 index 95ca0d9..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT32_lessThan-test.js +++ /dev/null @@ -1,52 +0,0 @@ -var assert = require('assert') -var UINT32 = require('..').UINT32 - -describe('lessThan method', function () { - - describe('0<1', function () { - - it('should return true', function (done) { - var u = UINT32(0).lessThan( UINT32(1) ) - - assert( u ) - done() - }) - - }) - - describe('1<2', function () { - - it('should return true', function (done) { - var u = UINT32(1).lessThan( UINT32(2) ) - - assert( u ) - done() - }) - - }) - - describe('1<2^16', function () { - - it('should return true', function (done) { - var n = Math.pow(2, 16) - var u = UINT32(1).lessThan( UINT32(n) ) - - assert( u ) - done() - }) - - }) - - describe('2^16<1', function () { - - it('should return false', function (done) { - var n = Math.pow(2, 16) - var u = UINT32(n).lessThan( UINT32(1) ) - - assert( !u ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT32_multiply-test.js b/includes/external/school/node_modules/cuint/test/UINT32_multiply-test.js deleted file mode 100644 index 353fc79..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT32_multiply-test.js +++ /dev/null @@ -1,75 +0,0 @@ -var assert = require('assert') -var UINT32 = require('..').UINT32 - -describe('multiply method', function () { - - describe('0*0', function () { - - it('should return 0', function (done) { - var u = UINT32(0).multiply( UINT32(0) ) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('1*0', function () { - - it('should return 0', function (done) { - var u = UINT32(1).multiply( UINT32(0) ) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('0*1', function () { - - it('should return 0', function (done) { - var u = UINT32(0).multiply( UINT32(1) ) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('low bit*high bit', function () { - - it('should return n', function (done) { - var n = Math.pow(2, 17) - var u = UINT32(3).multiply( UINT32(n) ) - - assert.equal( u.toNumber(), 3*n ) - done() - }) - - }) - - describe('high bit*low bit', function () { - - it('should return n', function (done) { - var n = Math.pow(2, 17) - var u = UINT32(n).multiply( UINT32(3) ) - - assert.equal( u.toNumber(), 3*n ) - done() - }) - - }) - - describe('high bit*high bit', function () { - - it('should return n', function (done) { - var n = 'FFFFFFFF' - var u = UINT32(n, 16).multiply( UINT32(n, 16) ) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT32_negate-test.js b/includes/external/school/node_modules/cuint/test/UINT32_negate-test.js deleted file mode 100644 index 6c8defa..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT32_negate-test.js +++ /dev/null @@ -1,51 +0,0 @@ -var assert = require('assert') -var UINT32 = require('..').UINT32 - -describe('negate method', function () { - - describe('0', function () { - - it('should return 0', function (done) { - var u = UINT32(0).negate() - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('1', function () { - - it('should return -1', function (done) { - var u = UINT32(1).negate() - - assert.equal( u.toNumber(), -1 ) - done() - }) - - }) - - describe('low bit', function () { - - it('should return -n', function (done) { - var u = UINT32(3).negate() - - assert.equal( u.toNumber(), -3 ) - done() - }) - - }) - - describe('high bit', function () { - - it('should return -n', function (done) { - var n = Math.pow(2, 17) - var u = UINT32(n).negate() - - assert.equal( u.toNumber(), -n ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT32_not-test.js b/includes/external/school/node_modules/cuint/test/UINT32_not-test.js deleted file mode 100644 index 9b8e3fd..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT32_not-test.js +++ /dev/null @@ -1,45 +0,0 @@ -var assert = require('assert') -var UINT32 = require('..').UINT32 - -describe('not method', function () { - - describe('0', function () { - - it('should return 2^32-1', function (done) { - var u = UINT32(0).not() - - assert.equal( u.toString(16), 'ffffffff' ) - done() - }) - - }) - - describe('1', function () { - - it('should return 2^32-2', function (done) { - var u = UINT32(1).not() - - assert.equal( u.toString(16), 'fffffffe' ) - done() - }) - - }) - - describe('2^31', function() { - var u = UINT32(0x7FFFFFFF).not() - - assert.equal( u.toString(16), '80000000') - }) - - describe('all bits set', function () { - - it('should return 0', function (done) { - var u = UINT32(0xFFFFFFFF).not() - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT32_or-test.js b/includes/external/school/node_modules/cuint/test/UINT32_or-test.js deleted file mode 100644 index 54d24c4..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT32_or-test.js +++ /dev/null @@ -1,52 +0,0 @@ -var assert = require('assert') -var UINT32 = require('..').UINT32 - -describe('or method', function () { - - describe('0|1', function () { - - it('should return 1', function (done) { - var u = UINT32(0).or( UINT32(1) ) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - - describe('1|2', function () { - - it('should return 3', function (done) { - var u = UINT32(1).or( UINT32(2) ) - - assert.equal( u.toNumber(), 3 ) - done() - }) - - }) - - describe('1|2^16', function () { - - it('should return n+1', function (done) { - var n = Math.pow(2, 16) - var u = UINT32(1).or( UINT32(n) ) - - assert.equal( u.toNumber(), n+1 ) - done() - }) - - }) - - describe('2^16|1', function () { - - it('should return n+1', function (done) { - var n = Math.pow(2, 16) - var u = UINT32(n).or( UINT32(1) ) - - assert.equal( u.toNumber(), n+1 ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT32_rotateLeft-test.js b/includes/external/school/node_modules/cuint/test/UINT32_rotateLeft-test.js deleted file mode 100644 index 3a758ee..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT32_rotateLeft-test.js +++ /dev/null @@ -1,51 +0,0 @@ -var assert = require('assert') -var UINT32 = require('..').UINT32 - -describe('rotateLeft method', function () { - - describe('0rotl1', function () { - - it('should return 0', function (done) { - var u = UINT32(0).rotateLeft(1) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('1rotl2', function () { - - it('should return 4', function (done) { - var u = UINT32(1).rotateLeft(2) - - assert.equal( u.toNumber(), 4 ) - done() - }) - - }) - - describe('1rotl16', function () { - - it('should return 2^16', function (done) { - var n = Math.pow(2, 16) - var u = UINT32(1).rotateLeft(16) - - assert.equal( u.toNumber(), n ) - done() - }) - - }) - - describe('1rotl32', function () { - - it('should return 1', function (done) { - var u = UINT32(1).rotateLeft(32) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT32_rotateRight-test.js b/includes/external/school/node_modules/cuint/test/UINT32_rotateRight-test.js deleted file mode 100644 index 1c0e927..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT32_rotateRight-test.js +++ /dev/null @@ -1,51 +0,0 @@ -var assert = require('assert') -var UINT32 = require('..').UINT32 - -describe('rotateRight method', function () { - - describe('0rotr1', function () { - - it('should return 0', function (done) { - var u = UINT32(0).rotateRight(1) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('4rotr1', function () { - - it('should return 2', function (done) { - var u = UINT32(4).rotateRight(1) - - assert.equal( u.toNumber(), 2 ) - done() - }) - - }) - - describe('2^16rotr16', function () { - - it('should return 1', function (done) { - var n = Math.pow(2, 16) - var u = UINT32(n).rotateRight(16) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - - describe('1rotr32', function () { - - it('should return 1', function (done) { - var u = UINT32(1).rotateRight(32) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT32_shiftLeft-test.js b/includes/external/school/node_modules/cuint/test/UINT32_shiftLeft-test.js deleted file mode 100644 index 79acd0a..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT32_shiftLeft-test.js +++ /dev/null @@ -1,73 +0,0 @@ -var assert = require('assert') -var UINT32 = require('..').UINT32 - -describe('shiftLeft method', function () { - - describe('0<<1', function () { - - it('should return 0', function (done) { - var u = UINT32(0).shiftLeft(1) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('1<<2', function () { - - it('should return 4', function (done) { - var u = UINT32(1).shiftLeft(2) - - assert.equal( u.toNumber(), 4 ) - done() - }) - - }) - - describe('1<<16', function () { - - it('should return 2^16', function (done) { - var n = Math.pow(2, 16) - var u = UINT32(1).shiftLeft(16) - - assert.equal( u.toNumber(), n ) - done() - }) - - }) - - describe('1<<32', function () { - - it('should return 0', function (done) { - var u = UINT32(1).shiftLeft(32) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('1<<31', function () { - - it('should return 2^31', function (done) { - var u = UINT32(1).shiftLeft(31) - - assert.equal( u.toString(16), '80000000' ) - done() - }) - - }) - - describe('9<<28', function () { - - it('should return 2^31', function (done) { - var u = UINT32(9).shiftLeft(28) - - assert.equal( u.toString(16), '90000000' ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT32_shiftRight-test.js b/includes/external/school/node_modules/cuint/test/UINT32_shiftRight-test.js deleted file mode 100644 index 5b0b711..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT32_shiftRight-test.js +++ /dev/null @@ -1,95 +0,0 @@ -var assert = require('assert') -var UINT32 = require('..').UINT32 - -describe('shiftRight method', function () { - - describe('0>>1', function () { - - it('should return 0', function (done) { - var u = UINT32(0).shiftRight(1) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('4>>2', function () { - - it('should return 1', function (done) { - var u = UINT32(4).shiftRight(2) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - - describe('2^16>>16', function () { - - it('should return 1', function (done) { - var n = Math.pow(2, 16) - var u = UINT32(n).shiftRight(16) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - - describe('1>>32', function () { - - it('should return 0', function (done) { - var u = UINT32(1).shiftRight(32) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('2^31>>31', function () { - - it('should return 1', function (done) { - var u = UINT32('80000000', 16).shiftRight(31) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - - describe('2^28>>28', function () { - - it('should return 1', function (done) { - var u = UINT32('10000000', 16).shiftRight(28) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - - describe('2^31+2^28>>31', function () { - - it('should return 1', function (done) { - var u = UINT32('90000000', 16).shiftRight(31) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - - describe('2^31+2^28>>28', function () { - - it('should return 9', function (done) { - var u = UINT32('90000000', 16).shiftRight(28) - - assert.equal( u.toNumber(), 9 ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT32_subtract-test.js b/includes/external/school/node_modules/cuint/test/UINT32_subtract-test.js deleted file mode 100644 index 9fa5488..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT32_subtract-test.js +++ /dev/null @@ -1,75 +0,0 @@ -var assert = require('assert') -var UINT32 = require('..').UINT32 - -describe('subtract method', function () { - - describe('0-0', function () { - - it('should return 0', function (done) { - var u = UINT32(0).subtract( UINT32(0) ) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('1-0', function () { - - it('should return 1', function (done) { - var u = UINT32(1).subtract( UINT32(0) ) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - - describe('0-1', function () { - - it('should return -1', function (done) { - var u = UINT32(0).subtract( UINT32(1) ) - - assert.equal( u.toNumber(), -1 ) - done() - }) - - }) - - describe('low bit-high bit', function () { - - it('should return 0', function (done) { - var n = Math.pow(2, 17) - var u = UINT32(1).subtract( UINT32(n) ) - - assert.equal( u.toNumber(), 1-n ) - done() - }) - - }) - - describe('high bit-low bit', function () { - - it('should return n', function (done) { - var n = Math.pow(2, 17) - var u = UINT32(n).subtract( UINT32(123) ) - - assert.equal( u.toNumber(), n - 123 ) - done() - }) - - }) - - describe('high bit-high bit', function () { - - it('should return n', function (done) { - var n = Math.pow(2, 17) - var u = UINT32(n+1).subtract( UINT32(n) ) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT32_toNumber-test.js b/includes/external/school/node_modules/cuint/test/UINT32_toNumber-test.js deleted file mode 100644 index a80c557..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT32_toNumber-test.js +++ /dev/null @@ -1,63 +0,0 @@ -var assert = require('assert') -var UINT32 = require('..').UINT32 - -describe('toNumber method', function () { - - describe('from 0', function () { - - it('should return 0', function (done) { - var u = UINT32(0).toNumber() - - assert.equal( u, 0 ) - done() - }) - - }) - - describe('from low bit number', function () { - - it('should return the number', function (done) { - var u = UINT32(123).toNumber() - - assert.equal( u, 123 ) - done() - }) - - }) - - describe('from high bit number', function () { - - it('should return the number', function (done) { - var n = Math.pow(2,17) - var u = UINT32(n).toNumber() - - assert.equal( u, n ) - done() - }) - - }) - - describe('from high and low bit number', function () { - - it('should return the number', function (done) { - var n = Math.pow(2,17) + 123 - var u = UINT32(n).toNumber() - - assert.equal( u, n ) - done() - }) - - }) - - describe('toNumber and toString', function () { - - it('should return the same result for 100 random numbers', function () { - for (var i=0; i<100; i++) { - var u = UINT32(Math.floor(Math.random() * 0xffffffff)); - assert.equal(u.toNumber(), parseInt(u.toString())); - } - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT32_toString-test.js b/includes/external/school/node_modules/cuint/test/UINT32_toString-test.js deleted file mode 100644 index 0bebbce..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT32_toString-test.js +++ /dev/null @@ -1,74 +0,0 @@ -var assert = require('assert') -var UINT32 = require('..').UINT32 - -describe('toString method', function () { - - describe('from 0', function () { - - it('should return "0"', function (done) { - var u = UINT32(0).toString() - - assert.equal( u, '0' ) - done() - }) - - }) - - describe('from low bit number', function () { - - it('should return the number', function (done) { - var u = UINT32(123).toString() - - assert.equal( u, '123' ) - done() - }) - - }) - - describe('from high bit number', function () { - - it('should return the number', function (done) { - var n = Math.pow(2,17) - var u = UINT32(n).toString() - - assert.equal( u, ''+n ) - done() - }) - - }) - - describe('from high and low bit number', function () { - - it('should return the number', function (done) { - var n = Math.pow(2,17) + 123 - var u = UINT32(n).toString() - - assert.equal( u, ''+n ) - done() - }) - - }) - - describe('< radix', function () { - - it('should return the number', function (done) { - var u = UINT32(4).toString() - - assert.equal( u, '4' ) - done() - }) - - }) - - describe('= radix', function () { - - it('should return the number', function (done) { - var u = UINT32(2).toString(2) - - assert.equal( u, '10' ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT32_xor-test.js b/includes/external/school/node_modules/cuint/test/UINT32_xor-test.js deleted file mode 100644 index 39dcca4..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT32_xor-test.js +++ /dev/null @@ -1,64 +0,0 @@ -var assert = require('assert') -var UINT32 = require('..').UINT32 - -describe('xor method', function () { - - describe('0^1', function () { - - it('should return 1', function (done) { - var u = UINT32(0).xor( UINT32(1) ) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - - describe('1^2', function () { - - it('should return 3', function (done) { - var u = UINT32(1).xor( UINT32(2) ) - - assert.equal( u.toNumber(), 3 ) - done() - }) - - }) - - describe('1^2^16', function () { - - it('should return n+1', function (done) { - var n = Math.pow(2, 16) - var u = UINT32(1).xor( UINT32(n) ) - - assert.equal( u.toNumber(), n+1 ) - done() - }) - - }) - - describe('2^16^1', function () { - - it('should return n+1', function (done) { - var n = Math.pow(2, 16) - var u = UINT32(n).xor( UINT32(1) ) - - assert.equal( u.toNumber(), n+1 ) - done() - }) - - }) - - describe('2^16^2^16', function () { - - it('should return 0', function (done) { - var n = Math.pow(2, 16) - var u = UINT32(n).xor( UINT32(n) ) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT64-test.js b/includes/external/school/node_modules/cuint/test/UINT64-test.js deleted file mode 100644 index 7f0f44e..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT64-test.js +++ /dev/null @@ -1,284 +0,0 @@ -var assert = require('assert') -var UINT64 = require('..').UINT64 - -describe('UINT64 constructor', function () { - - describe('with no parameters', function () { - - it('should properly initialize', function (done) { - var u = UINT64() - - assert.equal( u._a00, 0 ) - assert.equal( u._a16, 0 ) - assert.equal( u._a32, 0 ) - assert.equal( u._a48, 0 ) - done() - }) - - }) - - describe('with low and high bits', function () { - - describe('0, 0', function () { - it('should properly initialize', function (done) { - var u = UINT64(0, 0) - - assert.equal( u._a00, 0 ) - assert.equal( u._a16, 0 ) - assert.equal( u._a32, 0 ) - assert.equal( u._a48, 0 ) - done() - }) - }) - - describe('1, 0', function () { - it('should properly initialize', function (done) { - var u = UINT64(1, 0) - - assert.equal( u._a00, 1 ) - assert.equal( u._a16, 0 ) - assert.equal( u._a32, 0 ) - assert.equal( u._a48, 0 ) - done() - }) - }) - - describe('0, 1', function () { - it('should properly initialize', function (done) { - var u = UINT64(0, 1) - - assert.equal( u._a00, 0 ) - assert.equal( u._a16, 0 ) - assert.equal( u._a32, 1 ) - assert.equal( u._a48, 0 ) - done() - }) - }) - - describe('3, 5', function () { - it('should properly initialize', function (done) { - var u = UINT64(3, 5) - - assert.equal( u._a00, 3 ) - assert.equal( u._a16, 0 ) - assert.equal( u._a32, 5 ) - assert.equal( u._a48, 0 ) - done() - }) - }) - - }) - - describe('with number', function () { - - describe('0', function () { - it('should properly initialize', function (done) { - var u = UINT64(0) - - assert.equal( u._a00, 0 ) - assert.equal( u._a16, 0 ) - assert.equal( u._a32, 0 ) - assert.equal( u._a48, 0 ) - done() - }) - }) - - describe('1', function () { - it('should properly initialize', function (done) { - var u = UINT64(1) - - assert.equal( u._a00, 1 ) - assert.equal( u._a16, 0 ) - assert.equal( u._a32, 0 ) - assert.equal( u._a48, 0 ) - done() - }) - }) - - describe('3', function () { - it('should properly initialize', function (done) { - var u = UINT64(3) - - assert.equal( u._a00, 3 ) - assert.equal( u._a16, 0 ) - assert.equal( u._a32, 0 ) - assert.equal( u._a48, 0 ) - done() - }) - }) - - describe('with high bit', function () { - it('should properly initialize', function (done) { - var u = UINT64( Math.pow(2,17)+123 ) - - assert.equal( u._a00, 123 ) - assert.equal( u._a16, 2 ) - assert.equal( u._a32, 0 ) - assert.equal( u._a48, 0 ) - done() - }) - }) - - }) - - describe('with string', function () { - - describe('"0"', function () { - it('should properly initialize', function (done) { - var u = UINT64('0') - - assert.equal( u._a00, 0 ) - assert.equal( u._a16, 0 ) - assert.equal( u._a32, 0 ) - assert.equal( u._a48, 0 ) - done() - }) - }) - - describe('"1"', function () { - it('should properly initialize', function (done) { - var u = UINT64('1') - - assert.equal( u._a00, 1 ) - assert.equal( u._a16, 0 ) - assert.equal( u._a32, 0 ) - assert.equal( u._a48, 0 ) - done() - }) - }) - - describe('10', function () { - it('should properly initialize', function (done) { - var u = UINT64('10') - - assert.equal( u._a00, 10 ) - assert.equal( u._a16, 0 ) - assert.equal( u._a32, 0 ) - assert.equal( u._a48, 0 ) - done() - }) - }) - - describe('with high bit', function () { - it('should properly initialize', function (done) { - var u = UINT64( '' + (Math.pow(2,17)+123) ) - - assert.equal( u._a00, 123 ) - assert.equal( u._a16, 2 ) - assert.equal( u._a32, 0 ) - assert.equal( u._a48, 0 ) - done() - }) - }) - - describe('with radix 10', function () { - it('should properly initialize', function (done) { - var u = UINT64( '123', 10 ) - - assert.equal( u._a00, 123 ) - assert.equal( u._a16, 0 ) - assert.equal( u._a32, 0 ) - assert.equal( u._a48, 0 ) - done() - }) - }) - - describe('with radix 2', function () { - it('should properly initialize', function (done) { - var u = UINT64( '1111011', 2 ) - - assert.equal( u._a00, 123 ) - assert.equal( u._a16, 0 ) - assert.equal( u._a32, 0 ) - assert.equal( u._a48, 0 ) - done() - }) - }) - - describe('with radix 16', function () { - it('should properly initialize', function (done) { - var u = UINT64( '7B', 16 ) - - assert.equal( u._a00, 123 ) - assert.equal( u._a16, 0 ) - assert.equal( u._a32, 0 ) - assert.equal( u._a48, 0 ) - done() - }) - }) - - describe('8000 with radix 16', function () { - it('should properly initialize', function (done) { - var u = UINT64( '8000', 16 ) - - assert.equal( u._a00, 32768 ) - assert.equal( u._a16, 0 ) - assert.equal( u._a32, 0 ) - assert.equal( u._a48, 0 ) - done() - }) - }) - - describe('80000000 with radix 16', function () { - it('should properly initialize', function (done) { - var u = UINT64( '80000000', 16 ) - - assert.equal( u._a00, 0 ) - assert.equal( u._a16, 32768 ) - assert.equal( u._a32, 0 ) - assert.equal( u._a48, 0 ) - done() - }) - }) - - describe('800000000000 with radix 16', function () { - it('should properly initialize', function (done) { - var u = UINT64( '800000000000', 16 ) - - assert.equal( u._a00, 0 ) - assert.equal( u._a16, 0 ) - assert.equal( u._a32, 32768 ) - assert.equal( u._a48, 0 ) - done() - }) - }) - - describe('8000000000000000 with radix 16', function () { - it('should properly initialize', function (done) { - var u = UINT64( '8000000000000000', 16 ) - - assert.equal( u._a00, 0 ) - assert.equal( u._a16, 0 ) - assert.equal( u._a32, 0 ) - assert.equal( u._a48, 32768 ) - done() - }) - }) - - describe('maximum unsigned 64 bits value in base 2', function () { - it('should properly initialize', function (done) { - var u = UINT64( Array(65).join('1'), 2 ) - - assert.equal( u._a00, 65535 ) - assert.equal( u._a16, 65535 ) - assert.equal( u._a32, 65535 ) - assert.equal( u._a48, 65535 ) - done() - }) - }) - - describe('maximum unsigned 64 bits value in base 16', function () { - it('should properly initialize', function (done) { - var u = UINT64( Array(17).join('F'), 16 ) - - assert.equal( u._a00, 65535 ) - assert.equal( u._a16, 65535 ) - assert.equal( u._a32, 65535 ) - assert.equal( u._a48, 65535 ) - done() - }) - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT64_add-test.js b/includes/external/school/node_modules/cuint/test/UINT64_add-test.js deleted file mode 100644 index 0559c5d..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT64_add-test.js +++ /dev/null @@ -1,120 +0,0 @@ -var assert = require('assert') -var UINT64 = require('..').UINT64 - -describe('add method', function () { - - describe('0+0', function () { - - it('should return 0', function (done) { - var u = UINT64(0).add( UINT64(0) ) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('0+1', function () { - - it('should return 1', function (done) { - var u = UINT64(0).add( UINT64(1) ) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - - describe('1+0', function () { - - it('should return 0', function (done) { - var u = UINT64(1).add( UINT64(0) ) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - - describe('1+1', function () { - - it('should return 2', function (done) { - var u = UINT64(1).add( UINT64(1) ) - - assert.equal( u.toNumber(), 2 ) - done() - }) - - }) - - describe('low bit+high bit', function () { - - it('should return n', function (done) { - var n = Math.pow(2, 17) - var u = UINT64(123).add( UINT64(n) ) - - assert.equal( u.toNumber(), 123 + n ) - done() - }) - - }) - - describe('high bit+low bit', function () { - - it('should return n', function (done) { - var n = Math.pow(2, 17) - var u = UINT64(n).add( UINT64(123) ) - - assert.equal( u.toNumber(), 123 + n ) - done() - }) - - }) - - describe('high bit+high bit', function () { - - it('should return n', function (done) { - var n = Math.pow(2, 17) - var u = UINT64(n).add( UINT64(n) ) - - assert.equal( u.toNumber(), n + n ) - done() - }) - - }) - - describe('overflow', function () { - - it('should return n', function (done) { - var n = 'FFFFFFFF' - var u = UINT64(n, 16).add( UINT64(n, 16) ) - - assert.equal( u.toNumber(), -2 ) - done() - }) - - }) - - describe('high bit+high bit 2', function () { - - it('should return n', function (done) { - var u = UINT64('326648991').add( UINT64('265443576') ) - - assert.equal( u.toNumber(), 592092567 ) - done() - }) - - }) - - describe('high bit+high bit 3', function () { - - it('should return n', function (done) { - var u = UINT64('800000000000', 16).add( UINT64('100000000000', 16) ) - - assert.equal( u.toString(16), '900000000000' ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT64_and-test.js b/includes/external/school/node_modules/cuint/test/UINT64_and-test.js deleted file mode 100644 index 5e9cdf4..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT64_and-test.js +++ /dev/null @@ -1,64 +0,0 @@ -var assert = require('assert') -var UINT64 = require('..').UINT64 - -describe('and method', function () { - - describe('0&1', function () { - - it('should return 0', function (done) { - var u = UINT64(0).and( UINT64(1) ) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('1&2', function () { - - it('should return 0', function (done) { - var u = UINT64(1).and( UINT64(2) ) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('1&2^16', function () { - - it('should return 0', function (done) { - var n = Math.pow(2, 16) - var u = UINT64(1).and( UINT64(n) ) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('2^16&1', function () { - - it('should return 0', function (done) { - var n = Math.pow(2, 16) - var u = UINT64(n).and( UINT64(1) ) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('2^16&2^16', function () { - - it('should return n', function (done) { - var n = Math.pow(2, 16) - var u = UINT64(n).and( UINT64(n) ) - - assert.equal( u.toNumber(), n ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT64_div-test.js b/includes/external/school/node_modules/cuint/test/UINT64_div-test.js deleted file mode 100644 index 567f6c0..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT64_div-test.js +++ /dev/null @@ -1,105 +0,0 @@ -var assert = require('assert') -var UINT64 = require('..').UINT64 - -describe('div method', function () { - - describe('1/0', function () { - - it('should throw', function (done) { - assert.throws( - function () { - UINT64(1).div( UINT64(0) ) - } - , function (err) { - if (err instanceof Error) return true - } - ) - - - done() - }) - - }) - - describe('0/1', function () { - - it('should return 0', function (done) { - var u = UINT64(2).div( UINT64(1) ) - - assert.equal( u.toNumber(), 2 ) - done() - }) - - }) - - describe('2/1', function () { - - it('should return 2', function (done) { - var u = UINT64(0).div( UINT64(1) ) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('1/2', function () { - - it('should return 0', function (done) { - var u = UINT64(1).div( UINT64(2) ) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('low bit/high bit', function () { - - it('should return n', function (done) { - var n = Math.pow(2, 17) - var u = UINT64(3).div( UINT64(n) ) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('high bit/low bit', function () { - - it('should return n', function (done) { - var n = Math.pow(2, 17) - var u = UINT64(n).div( UINT64(3) ) - - assert.equal( u.toNumber(), (n/3)|0 ) - assert.equal( u.remainder.toNumber(), 2 ) - done() - }) - - }) - - describe('high bit/high bit', function () { - - it('should return n', function (done) { - var n = 'FFFFFFFF' - var u = UINT64(n, 16).div( UINT64(n, 16) ) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - - describe('high bit/high bit 2', function () { - - it('should return n', function (done) { - var u = UINT64('3266489917').div( UINT64('668265263') ) - - assert.equal( u.toNumber(), 4 ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT64_equals-test.js b/includes/external/school/node_modules/cuint/test/UINT64_equals-test.js deleted file mode 100644 index 6672c4d..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT64_equals-test.js +++ /dev/null @@ -1,62 +0,0 @@ -var assert = require('assert') -var UINT64 = require('..').UINT64 - -describe('equals method', function () { - - describe('0==0', function () { - - it('should return true', function (done) { - var u = UINT64(0).equals( UINT64(0) ) - - assert( u ) - done() - }) - - }) - - describe('1==1', function () { - - it('should return true', function (done) { - var u = UINT64(1).equals( UINT64(1) ) - - assert( u ) - done() - }) - - }) - - describe('low bit', function () { - - it('should return true', function (done) { - var u = UINT64(3).equals( UINT64(3) ) - - assert( u ) - done() - }) - - }) - - describe('high bit', function () { - - it('should return true', function (done) { - var n = Math.pow(2, 17) - var u = UINT64(n).equals( UINT64(n) ) - - assert( u ) - done() - }) - - }) - - describe('1!=2', function () { - - it('should return false', function (done) { - var u = UINT64(1).equals( UINT64(2) ) - - assert( !u ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT64_greaterThan-test.js b/includes/external/school/node_modules/cuint/test/UINT64_greaterThan-test.js deleted file mode 100644 index 988672e..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT64_greaterThan-test.js +++ /dev/null @@ -1,52 +0,0 @@ -var assert = require('assert') -var UINT64 = require('..').UINT64 - -describe('greaterThan method', function () { - - describe('0>1', function () { - - it('should return false', function (done) { - var u = UINT64(0).greaterThan( UINT64(1) ) - - assert( !u ) - done() - }) - - }) - - describe('1>2', function () { - - it('should return false', function (done) { - var u = UINT64(1).greaterThan( UINT64(2) ) - - assert( !u ) - done() - }) - - }) - - describe('1>2^16', function () { - - it('should return false', function (done) { - var n = Math.pow(2, 16) - var u = UINT64(1).greaterThan( UINT64(n) ) - - assert( !u ) - done() - }) - - }) - - describe('2^16>1', function () { - - it('should return true', function (done) { - var n = Math.pow(2, 16) - var u = UINT64(n).greaterThan( UINT64(1) ) - - assert( u ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT64_lessThan-test.js b/includes/external/school/node_modules/cuint/test/UINT64_lessThan-test.js deleted file mode 100644 index 262eb19..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT64_lessThan-test.js +++ /dev/null @@ -1,52 +0,0 @@ -var assert = require('assert') -var UINT64 = require('..').UINT64 - -describe('lessThan method', function () { - - describe('0<1', function () { - - it('should return true', function (done) { - var u = UINT64(0).lessThan( UINT64(1) ) - - assert( u ) - done() - }) - - }) - - describe('1<2', function () { - - it('should return true', function (done) { - var u = UINT64(1).lessThan( UINT64(2) ) - - assert( u ) - done() - }) - - }) - - describe('1<2^16', function () { - - it('should return true', function (done) { - var n = Math.pow(2, 16) - var u = UINT64(1).lessThan( UINT64(n) ) - - assert( u ) - done() - }) - - }) - - describe('2^16<1', function () { - - it('should return false', function (done) { - var n = Math.pow(2, 16) - var u = UINT64(n).lessThan( UINT64(1) ) - - assert( !u ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT64_multiply-test.js b/includes/external/school/node_modules/cuint/test/UINT64_multiply-test.js deleted file mode 100644 index 14b5d15..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT64_multiply-test.js +++ /dev/null @@ -1,75 +0,0 @@ -var assert = require('assert') -var UINT64 = require('..').UINT64 - -describe('multiply method', function () { - - describe('0*0', function () { - - it('should return 0', function (done) { - var u = UINT64(0).multiply( UINT64(0) ) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('1*0', function () { - - it('should return 0', function (done) { - var u = UINT64(1).multiply( UINT64(0) ) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('0*1', function () { - - it('should return 0', function (done) { - var u = UINT64(0).multiply( UINT64(1) ) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('low bit*high bit', function () { - - it('should return n', function (done) { - var n = Math.pow(2, 17) - var u = UINT64(3).multiply( UINT64(n) ) - - assert.equal( u.toNumber(), 3*n ) - done() - }) - - }) - - describe('high bit*low bit', function () { - - it('should return n', function (done) { - var n = Math.pow(2, 17) - var u = UINT64(n).multiply( UINT64(3) ) - - assert.equal( u.toNumber(), 3*n ) - done() - }) - - }) - - describe('high bit*high bit', function () { - - it('should return n', function (done) { - var n = 'FFFFFFFF' - var u = UINT64(n, 16).multiply( UINT64(n, 16) ) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT64_negate-test.js b/includes/external/school/node_modules/cuint/test/UINT64_negate-test.js deleted file mode 100644 index 0647ac5..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT64_negate-test.js +++ /dev/null @@ -1,51 +0,0 @@ -var assert = require('assert') -var UINT64 = require('..').UINT64 - -describe('negate method', function () { - - describe('0', function () { - - it('should return 0', function (done) { - var u = UINT64(0).negate() - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('1', function () { - - it('should return -1', function (done) { - var u = UINT64(1).negate() - - assert.equal( u.toNumber(), -1 ) - done() - }) - - }) - - describe('low bit', function () { - - it('should return -n', function (done) { - var u = UINT64(3).negate() - - assert.equal( u.toNumber(), -3 ) - done() - }) - - }) - - describe('high bit', function () { - - it('should return -n', function (done) { - var n = Math.pow(2, 17) - var u = UINT64(n).negate() - - assert.equal( u.toNumber(), -n ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT64_not-test.js b/includes/external/school/node_modules/cuint/test/UINT64_not-test.js deleted file mode 100644 index a606cdb..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT64_not-test.js +++ /dev/null @@ -1,45 +0,0 @@ -var assert = require('assert') -var UINT64 = require('..').UINT64 - -describe('not method', function () { - - describe('0', function () { - - it('should return 2^64-1', function (done) { - var u = UINT64(0).not() - - assert.equal( u.toString(16), 'ffffffffffffffff' ) - done() - }) - - }) - - describe('1', function () { - - it('should return 2^64-2', function (done) { - var u = UINT64(1).not() - - assert.equal( u.toString(16), 'fffffffffffffffe' ) - done() - }) - - }) - - describe('2^63', function() { - var u = UINT64(0xFFFF, 0xFFFF, 0xFFFF, 0x7FFF).not() - - assert.equal( u.toString(16), '8000000000000000') - }) - - describe('all bits set', function () { - - it('should return 0', function (done) { - var u = UINT64(0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF).not() - - assert.equal( u.toString(), '0' ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT64_or-test.js b/includes/external/school/node_modules/cuint/test/UINT64_or-test.js deleted file mode 100644 index 9f9f254..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT64_or-test.js +++ /dev/null @@ -1,52 +0,0 @@ -var assert = require('assert') -var UINT64 = require('..').UINT64 - -describe('or method', function () { - - describe('0|1', function () { - - it('should return 1', function (done) { - var u = UINT64(0).or( UINT64(1) ) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - - describe('1|2', function () { - - it('should return 3', function (done) { - var u = UINT64(1).or( UINT64(2) ) - - assert.equal( u.toNumber(), 3 ) - done() - }) - - }) - - describe('1|2^16', function () { - - it('should return n+1', function (done) { - var n = Math.pow(2, 16) - var u = UINT64(1).or( UINT64(n) ) - - assert.equal( u.toNumber(), n+1 ) - done() - }) - - }) - - describe('2^16|1', function () { - - it('should return n+1', function (done) { - var n = Math.pow(2, 16) - var u = UINT64(n).or( UINT64(1) ) - - assert.equal( u.toNumber(), n+1 ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT64_rotateLeft-test.js b/includes/external/school/node_modules/cuint/test/UINT64_rotateLeft-test.js deleted file mode 100644 index 11643eb..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT64_rotateLeft-test.js +++ /dev/null @@ -1,51 +0,0 @@ -var assert = require('assert') -var UINT64 = require('..').UINT64 - -describe('rotateLeft method', function () { - - describe('0rotl1', function () { - - it('should return 0', function (done) { - var u = UINT64(0).rotateLeft(1) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('1rotl2', function () { - - it('should return 4', function (done) { - var u = UINT64(1).rotateLeft(2) - - assert.equal( u.toNumber(), 4 ) - done() - }) - - }) - - describe('1rotl16', function () { - - it('should return 2^16', function (done) { - var n = Math.pow(2, 16) - var u = UINT64(1).rotateLeft(16) - - assert.equal( u.toNumber(), n ) - done() - }) - - }) - - describe('1rotl32', function () { - - it('should return 1', function (done) { - var u = UINT64(1).rotateLeft(32) - - assert.equal( u.toString(16), '100000000' ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT64_rotateRight-test.js b/includes/external/school/node_modules/cuint/test/UINT64_rotateRight-test.js deleted file mode 100644 index 45505f4..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT64_rotateRight-test.js +++ /dev/null @@ -1,51 +0,0 @@ -var assert = require('assert') -var UINT64 = require('..').UINT64 - -describe('rotateRight method', function () { - - describe('0rotr1', function () { - - it('should return 0', function (done) { - var u = UINT64(0).rotateRight(1) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('4rotr1', function () { - - it('should return 2', function (done) { - var u = UINT64(4).rotateRight(1) - - assert.equal( u.toNumber(), 2 ) - done() - }) - - }) - - describe('2^16rotr16', function () { - - it('should return 1', function (done) { - var n = Math.pow(2, 16) - var u = UINT64(n).rotateRight(16) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - - describe('1rotr32', function () { - - it('should return 1', function (done) { - var u = UINT64(1).rotateRight(32) - - assert.equal( u.toString(16), '100000000' ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT64_shiftLeft-test.js b/includes/external/school/node_modules/cuint/test/UINT64_shiftLeft-test.js deleted file mode 100644 index d85e346..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT64_shiftLeft-test.js +++ /dev/null @@ -1,73 +0,0 @@ -var assert = require('assert') -var UINT64 = require('..').UINT64 - -describe('shiftLeft method', function () { - - describe('0<<1', function () { - - it('should return 0', function (done) { - var u = UINT64(0).shiftLeft(1) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('1<<2', function () { - - it('should return 4', function (done) { - var u = UINT64(1).shiftLeft(2) - - assert.equal( u.toNumber(), 4 ) - done() - }) - - }) - - describe('1<<16', function () { - - it('should return 2^16', function (done) { - var n = Math.pow(2, 16) - var u = UINT64(1).shiftLeft(16) - - assert.equal( u.toNumber(), n ) - done() - }) - - }) - - describe('1<<32', function () { - - it('should return 0', function (done) { - var u = UINT64(1).shiftLeft(32) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('1<<31', function () { - - it('should return 2^31', function (done) { - var u = UINT64(1).shiftLeft(31) - - assert.equal( u.toString(16), '80000000' ) - done() - }) - - }) - - describe('9<<28', function () { - - it('should return 2^31', function (done) { - var u = UINT64(9).shiftLeft(28) - - assert.equal( u.toString(16), '90000000' ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT64_shiftRight-test.js b/includes/external/school/node_modules/cuint/test/UINT64_shiftRight-test.js deleted file mode 100644 index 261a37f..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT64_shiftRight-test.js +++ /dev/null @@ -1,95 +0,0 @@ -var assert = require('assert') -var UINT64 = require('..').UINT64 - -describe('shiftRight method', function () { - - describe('0>>1', function () { - - it('should return 0', function (done) { - var u = UINT64(0).shiftRight(1) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('4>>2', function () { - - it('should return 1', function (done) { - var u = UINT64(4).shiftRight(2) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - - describe('2^16>>16', function () { - - it('should return 1', function (done) { - var n = Math.pow(2, 16) - var u = UINT64(n).shiftRight(16) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - - describe('1>>32', function () { - - it('should return 0', function (done) { - var u = UINT64(1).shiftRight(32) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('2^31>>31', function () { - - it('should return 1', function (done) { - var u = UINT64('80000000', 16).shiftRight(31) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - - describe('2^28>>28', function () { - - it('should return 1', function (done) { - var u = UINT64('10000000', 16).shiftRight(28) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - - describe('2^31+2^28>>31', function () { - - it('should return 1', function (done) { - var u = UINT64('90000000', 16).shiftRight(31) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - - describe('2^31+2^28>>28', function () { - - it('should return 9', function (done) { - var u = UINT64('90000000', 16).shiftRight(28) - - assert.equal( u.toNumber(), 9 ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT64_subtract-test.js b/includes/external/school/node_modules/cuint/test/UINT64_subtract-test.js deleted file mode 100644 index 895a177..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT64_subtract-test.js +++ /dev/null @@ -1,75 +0,0 @@ -var assert = require('assert') -var UINT64 = require('..').UINT64 - -describe('subtract method', function () { - - describe('0-0', function () { - - it('should return 0', function (done) { - var u = UINT64(0).subtract( UINT64(0) ) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - - describe('1-0', function () { - - it('should return 1', function (done) { - var u = UINT64(1).subtract( UINT64(0) ) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - - describe('0-1', function () { - - it('should return -1', function (done) { - var u = UINT64(0).subtract( UINT64(1) ) - - assert.equal( u.toNumber(), -1 ) - done() - }) - - }) - - describe('low bit-high bit', function () { - - it('should return 0', function (done) { - var n = Math.pow(2, 17) - var u = UINT64(1).subtract( UINT64(n) ) - - assert.equal( u.toNumber(), 1-n ) - done() - }) - - }) - - describe('high bit-low bit', function () { - - it('should return n', function (done) { - var n = Math.pow(2, 17) - var u = UINT64(n).subtract( UINT64(123) ) - - assert.equal( u.toNumber(), n - 123 ) - done() - }) - - }) - - describe('high bit-high bit', function () { - - it('should return n', function (done) { - var n = Math.pow(2, 17) - var u = UINT64(n+1).subtract( UINT64(n) ) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT64_toNumber-test.js b/includes/external/school/node_modules/cuint/test/UINT64_toNumber-test.js deleted file mode 100644 index 9f3f9c1..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT64_toNumber-test.js +++ /dev/null @@ -1,63 +0,0 @@ -var assert = require('assert') -var UINT64 = require('..').UINT64 - -describe('toNumber method', function () { - - describe('from 0', function () { - - it('should return 0', function (done) { - var u = UINT64(0).toNumber() - - assert.equal( u, 0 ) - done() - }) - - }) - - describe('from low bit number', function () { - - it('should return the number', function (done) { - var u = UINT64(123).toNumber() - - assert.equal( u, 123 ) - done() - }) - - }) - - describe('from high bit number', function () { - - it('should return the number', function (done) { - var n = Math.pow(2,17) - var u = UINT64(n).toNumber() - - assert.equal( u, n ) - done() - }) - - }) - - describe('from high and low bit number', function () { - - it('should return the number', function (done) { - var n = Math.pow(2,17) + 123 - var u = UINT64(n).toNumber() - - assert.equal( u, n ) - done() - }) - - }) - - describe('toNumber and toString', function () { - - it('should return the same result for 100 random numbers', function () { - for (var i=0; i<100; i++) { - var u = UINT64(Math.floor(Math.random() * 0xffffffff), 0); - assert.equal(u.toNumber(), parseInt(u.toString())); - } - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT64_toString-test.js b/includes/external/school/node_modules/cuint/test/UINT64_toString-test.js deleted file mode 100644 index cb1316a..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT64_toString-test.js +++ /dev/null @@ -1,74 +0,0 @@ -var assert = require('assert') -var UINT64 = require('..').UINT64 - -describe('toString method', function () { - - describe('from 0', function () { - - it('should return "0"', function (done) { - var u = UINT64(0).toString() - - assert.equal( u, '0' ) - done() - }) - - }) - - describe('from low bit number', function () { - - it('should return the number', function (done) { - var u = UINT64(123).toString() - - assert.equal( u, '123' ) - done() - }) - - }) - - describe('from high bit number', function () { - - it('should return the number', function (done) { - var n = Math.pow(2,17) - var u = UINT64(n).toString() - - assert.equal( u, ''+n ) - done() - }) - - }) - - describe('from high and low bit number', function () { - - it('should return the number', function (done) { - var n = Math.pow(2,17) + 123 - var u = UINT64(n).toString() - - assert.equal( u, ''+n ) - done() - }) - - }) - - describe('< radix', function () { - - it('should return the number', function (done) { - var u = UINT64(4).toString() - - assert.equal( u, '4' ) - done() - }) - - }) - - describe('= radix', function () { - - it('should return the number', function (done) { - var u = UINT64(2).toString(2) - - assert.equal( u, '10' ) - done() - }) - - }) - -}) diff --git a/includes/external/school/node_modules/cuint/test/UINT64_xor-test.js b/includes/external/school/node_modules/cuint/test/UINT64_xor-test.js deleted file mode 100644 index 0a05fdb..0000000 --- a/includes/external/school/node_modules/cuint/test/UINT64_xor-test.js +++ /dev/null @@ -1,64 +0,0 @@ -var assert = require('assert') -var UINT64 = require('..').UINT64 - -describe('xor method', function () { - - describe('0^1', function () { - - it('should return 1', function (done) { - var u = UINT64(0).xor( UINT64(1) ) - - assert.equal( u.toNumber(), 1 ) - done() - }) - - }) - - describe('1^2', function () { - - it('should return 3', function (done) { - var u = UINT64(1).xor( UINT64(2) ) - - assert.equal( u.toNumber(), 3 ) - done() - }) - - }) - - describe('1^2^16', function () { - - it('should return n+1', function (done) { - var n = Math.pow(2, 16) - var u = UINT64(1).xor( UINT64(n) ) - - assert.equal( u.toNumber(), n+1 ) - done() - }) - - }) - - describe('2^16^1', function () { - - it('should return n+1', function (done) { - var n = Math.pow(2, 16) - var u = UINT64(n).xor( UINT64(1) ) - - assert.equal( u.toNumber(), n+1 ) - done() - }) - - }) - - describe('2^16^2^16', function () { - - it('should return 0', function (done) { - var n = Math.pow(2, 16) - var u = UINT64(n).xor( UINT64(n) ) - - assert.equal( u.toNumber(), 0 ) - done() - }) - - }) - -}) |