summaryrefslogtreecommitdiff
path: root/school/node_modules/cuint/test
diff options
context:
space:
mode:
Diffstat (limited to 'school/node_modules/cuint/test')
-rw-r--r--school/node_modules/cuint/test/UINT32-test.js220
-rw-r--r--school/node_modules/cuint/test/UINT32_add-test.js109
-rw-r--r--school/node_modules/cuint/test/UINT32_and-test.js64
-rw-r--r--school/node_modules/cuint/test/UINT32_div-test.js114
-rw-r--r--school/node_modules/cuint/test/UINT32_equals-test.js62
-rw-r--r--school/node_modules/cuint/test/UINT32_greaterThan-test.js52
-rw-r--r--school/node_modules/cuint/test/UINT32_lessThan-test.js52
-rw-r--r--school/node_modules/cuint/test/UINT32_multiply-test.js75
-rw-r--r--school/node_modules/cuint/test/UINT32_negate-test.js51
-rw-r--r--school/node_modules/cuint/test/UINT32_not-test.js45
-rw-r--r--school/node_modules/cuint/test/UINT32_or-test.js52
-rw-r--r--school/node_modules/cuint/test/UINT32_rotateLeft-test.js51
-rw-r--r--school/node_modules/cuint/test/UINT32_rotateRight-test.js51
-rw-r--r--school/node_modules/cuint/test/UINT32_shiftLeft-test.js73
-rw-r--r--school/node_modules/cuint/test/UINT32_shiftRight-test.js95
-rw-r--r--school/node_modules/cuint/test/UINT32_subtract-test.js75
-rw-r--r--school/node_modules/cuint/test/UINT32_toNumber-test.js63
-rw-r--r--school/node_modules/cuint/test/UINT32_toString-test.js74
-rw-r--r--school/node_modules/cuint/test/UINT32_xor-test.js64
-rw-r--r--school/node_modules/cuint/test/UINT64-test.js284
-rw-r--r--school/node_modules/cuint/test/UINT64_add-test.js120
-rw-r--r--school/node_modules/cuint/test/UINT64_and-test.js64
-rw-r--r--school/node_modules/cuint/test/UINT64_div-test.js105
-rw-r--r--school/node_modules/cuint/test/UINT64_equals-test.js62
-rw-r--r--school/node_modules/cuint/test/UINT64_greaterThan-test.js52
-rw-r--r--school/node_modules/cuint/test/UINT64_lessThan-test.js52
-rw-r--r--school/node_modules/cuint/test/UINT64_multiply-test.js75
-rw-r--r--school/node_modules/cuint/test/UINT64_negate-test.js51
-rw-r--r--school/node_modules/cuint/test/UINT64_not-test.js45
-rw-r--r--school/node_modules/cuint/test/UINT64_or-test.js52
-rw-r--r--school/node_modules/cuint/test/UINT64_rotateLeft-test.js51
-rw-r--r--school/node_modules/cuint/test/UINT64_rotateRight-test.js51
-rw-r--r--school/node_modules/cuint/test/UINT64_shiftLeft-test.js73
-rw-r--r--school/node_modules/cuint/test/UINT64_shiftRight-test.js95
-rw-r--r--school/node_modules/cuint/test/UINT64_subtract-test.js75
-rw-r--r--school/node_modules/cuint/test/UINT64_toNumber-test.js63
-rw-r--r--school/node_modules/cuint/test/UINT64_toString-test.js74
-rw-r--r--school/node_modules/cuint/test/UINT64_xor-test.js64
38 files changed, 2950 insertions, 0 deletions
diff --git a/school/node_modules/cuint/test/UINT32-test.js b/school/node_modules/cuint/test/UINT32-test.js
new file mode 100644
index 0000000..4b6536a
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT32-test.js
@@ -0,0 +1,220 @@
+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/school/node_modules/cuint/test/UINT32_add-test.js b/school/node_modules/cuint/test/UINT32_add-test.js
new file mode 100644
index 0000000..f42968c
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT32_add-test.js
@@ -0,0 +1,109 @@
+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/school/node_modules/cuint/test/UINT32_and-test.js b/school/node_modules/cuint/test/UINT32_and-test.js
new file mode 100644
index 0000000..9e36d68
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT32_and-test.js
@@ -0,0 +1,64 @@
+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/school/node_modules/cuint/test/UINT32_div-test.js b/school/node_modules/cuint/test/UINT32_div-test.js
new file mode 100644
index 0000000..6464662
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT32_div-test.js
@@ -0,0 +1,114 @@
+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/school/node_modules/cuint/test/UINT32_equals-test.js b/school/node_modules/cuint/test/UINT32_equals-test.js
new file mode 100644
index 0000000..157bc01
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT32_equals-test.js
@@ -0,0 +1,62 @@
+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/school/node_modules/cuint/test/UINT32_greaterThan-test.js b/school/node_modules/cuint/test/UINT32_greaterThan-test.js
new file mode 100644
index 0000000..034f827
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT32_greaterThan-test.js
@@ -0,0 +1,52 @@
+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/school/node_modules/cuint/test/UINT32_lessThan-test.js b/school/node_modules/cuint/test/UINT32_lessThan-test.js
new file mode 100644
index 0000000..95ca0d9
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT32_lessThan-test.js
@@ -0,0 +1,52 @@
+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/school/node_modules/cuint/test/UINT32_multiply-test.js b/school/node_modules/cuint/test/UINT32_multiply-test.js
new file mode 100644
index 0000000..353fc79
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT32_multiply-test.js
@@ -0,0 +1,75 @@
+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/school/node_modules/cuint/test/UINT32_negate-test.js b/school/node_modules/cuint/test/UINT32_negate-test.js
new file mode 100644
index 0000000..6c8defa
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT32_negate-test.js
@@ -0,0 +1,51 @@
+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/school/node_modules/cuint/test/UINT32_not-test.js b/school/node_modules/cuint/test/UINT32_not-test.js
new file mode 100644
index 0000000..9b8e3fd
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT32_not-test.js
@@ -0,0 +1,45 @@
+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/school/node_modules/cuint/test/UINT32_or-test.js b/school/node_modules/cuint/test/UINT32_or-test.js
new file mode 100644
index 0000000..54d24c4
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT32_or-test.js
@@ -0,0 +1,52 @@
+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/school/node_modules/cuint/test/UINT32_rotateLeft-test.js b/school/node_modules/cuint/test/UINT32_rotateLeft-test.js
new file mode 100644
index 0000000..3a758ee
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT32_rotateLeft-test.js
@@ -0,0 +1,51 @@
+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/school/node_modules/cuint/test/UINT32_rotateRight-test.js b/school/node_modules/cuint/test/UINT32_rotateRight-test.js
new file mode 100644
index 0000000..1c0e927
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT32_rotateRight-test.js
@@ -0,0 +1,51 @@
+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/school/node_modules/cuint/test/UINT32_shiftLeft-test.js b/school/node_modules/cuint/test/UINT32_shiftLeft-test.js
new file mode 100644
index 0000000..79acd0a
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT32_shiftLeft-test.js
@@ -0,0 +1,73 @@
+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/school/node_modules/cuint/test/UINT32_shiftRight-test.js b/school/node_modules/cuint/test/UINT32_shiftRight-test.js
new file mode 100644
index 0000000..5b0b711
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT32_shiftRight-test.js
@@ -0,0 +1,95 @@
+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/school/node_modules/cuint/test/UINT32_subtract-test.js b/school/node_modules/cuint/test/UINT32_subtract-test.js
new file mode 100644
index 0000000..9fa5488
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT32_subtract-test.js
@@ -0,0 +1,75 @@
+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/school/node_modules/cuint/test/UINT32_toNumber-test.js b/school/node_modules/cuint/test/UINT32_toNumber-test.js
new file mode 100644
index 0000000..a80c557
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT32_toNumber-test.js
@@ -0,0 +1,63 @@
+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/school/node_modules/cuint/test/UINT32_toString-test.js b/school/node_modules/cuint/test/UINT32_toString-test.js
new file mode 100644
index 0000000..0bebbce
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT32_toString-test.js
@@ -0,0 +1,74 @@
+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/school/node_modules/cuint/test/UINT32_xor-test.js b/school/node_modules/cuint/test/UINT32_xor-test.js
new file mode 100644
index 0000000..39dcca4
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT32_xor-test.js
@@ -0,0 +1,64 @@
+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/school/node_modules/cuint/test/UINT64-test.js b/school/node_modules/cuint/test/UINT64-test.js
new file mode 100644
index 0000000..7f0f44e
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT64-test.js
@@ -0,0 +1,284 @@
+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/school/node_modules/cuint/test/UINT64_add-test.js b/school/node_modules/cuint/test/UINT64_add-test.js
new file mode 100644
index 0000000..0559c5d
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT64_add-test.js
@@ -0,0 +1,120 @@
+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/school/node_modules/cuint/test/UINT64_and-test.js b/school/node_modules/cuint/test/UINT64_and-test.js
new file mode 100644
index 0000000..5e9cdf4
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT64_and-test.js
@@ -0,0 +1,64 @@
+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/school/node_modules/cuint/test/UINT64_div-test.js b/school/node_modules/cuint/test/UINT64_div-test.js
new file mode 100644
index 0000000..567f6c0
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT64_div-test.js
@@ -0,0 +1,105 @@
+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/school/node_modules/cuint/test/UINT64_equals-test.js b/school/node_modules/cuint/test/UINT64_equals-test.js
new file mode 100644
index 0000000..6672c4d
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT64_equals-test.js
@@ -0,0 +1,62 @@
+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/school/node_modules/cuint/test/UINT64_greaterThan-test.js b/school/node_modules/cuint/test/UINT64_greaterThan-test.js
new file mode 100644
index 0000000..988672e
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT64_greaterThan-test.js
@@ -0,0 +1,52 @@
+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/school/node_modules/cuint/test/UINT64_lessThan-test.js b/school/node_modules/cuint/test/UINT64_lessThan-test.js
new file mode 100644
index 0000000..262eb19
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT64_lessThan-test.js
@@ -0,0 +1,52 @@
+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/school/node_modules/cuint/test/UINT64_multiply-test.js b/school/node_modules/cuint/test/UINT64_multiply-test.js
new file mode 100644
index 0000000..14b5d15
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT64_multiply-test.js
@@ -0,0 +1,75 @@
+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/school/node_modules/cuint/test/UINT64_negate-test.js b/school/node_modules/cuint/test/UINT64_negate-test.js
new file mode 100644
index 0000000..0647ac5
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT64_negate-test.js
@@ -0,0 +1,51 @@
+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/school/node_modules/cuint/test/UINT64_not-test.js b/school/node_modules/cuint/test/UINT64_not-test.js
new file mode 100644
index 0000000..a606cdb
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT64_not-test.js
@@ -0,0 +1,45 @@
+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/school/node_modules/cuint/test/UINT64_or-test.js b/school/node_modules/cuint/test/UINT64_or-test.js
new file mode 100644
index 0000000..9f9f254
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT64_or-test.js
@@ -0,0 +1,52 @@
+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/school/node_modules/cuint/test/UINT64_rotateLeft-test.js b/school/node_modules/cuint/test/UINT64_rotateLeft-test.js
new file mode 100644
index 0000000..11643eb
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT64_rotateLeft-test.js
@@ -0,0 +1,51 @@
+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/school/node_modules/cuint/test/UINT64_rotateRight-test.js b/school/node_modules/cuint/test/UINT64_rotateRight-test.js
new file mode 100644
index 0000000..45505f4
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT64_rotateRight-test.js
@@ -0,0 +1,51 @@
+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/school/node_modules/cuint/test/UINT64_shiftLeft-test.js b/school/node_modules/cuint/test/UINT64_shiftLeft-test.js
new file mode 100644
index 0000000..d85e346
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT64_shiftLeft-test.js
@@ -0,0 +1,73 @@
+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/school/node_modules/cuint/test/UINT64_shiftRight-test.js b/school/node_modules/cuint/test/UINT64_shiftRight-test.js
new file mode 100644
index 0000000..261a37f
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT64_shiftRight-test.js
@@ -0,0 +1,95 @@
+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/school/node_modules/cuint/test/UINT64_subtract-test.js b/school/node_modules/cuint/test/UINT64_subtract-test.js
new file mode 100644
index 0000000..895a177
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT64_subtract-test.js
@@ -0,0 +1,75 @@
+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/school/node_modules/cuint/test/UINT64_toNumber-test.js b/school/node_modules/cuint/test/UINT64_toNumber-test.js
new file mode 100644
index 0000000..9f3f9c1
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT64_toNumber-test.js
@@ -0,0 +1,63 @@
+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/school/node_modules/cuint/test/UINT64_toString-test.js b/school/node_modules/cuint/test/UINT64_toString-test.js
new file mode 100644
index 0000000..cb1316a
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT64_toString-test.js
@@ -0,0 +1,74 @@
+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/school/node_modules/cuint/test/UINT64_xor-test.js b/school/node_modules/cuint/test/UINT64_xor-test.js
new file mode 100644
index 0000000..0a05fdb
--- /dev/null
+++ b/school/node_modules/cuint/test/UINT64_xor-test.js
@@ -0,0 +1,64 @@
+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()
+ })
+
+ })
+
+})