bigint-inc-32.js (489B)
1 const tests = [ 2 [-0x80000000n, -0x7fffffffn], 3 [-0x7fffffffn, -0x7ffffffen], 4 [-0x7ffffffen, -0x7ffffffdn], 5 [-2n, -1n], 6 [-1n, 0n], 7 [0n, 1n], 8 [1n, 2n], 9 [2n, 3n], 10 [0x7ffffffen, 0x7fffffffn], 11 ]; 12 13 function f(tests) { 14 for (let test of tests) { 15 let input = test[0], expected = test[1]; 16 assertEq(BigInt.asIntN(32, input), input); 17 assertEq(BigInt.asIntN(32, expected), expected); 18 19 assertEq(++input, expected); 20 } 21 } 22 23 for (let i = 0; i < 200; ++i) { 24 f(tests); 25 }