diff --git a/test/language/expressions/addition/bigint-and-number.js b/test/language/expressions/addition/bigint-and-number.js index 1d41b3985cb07b1b83b76e9dcb5130c644b08cfc..c4c47f3bc507f2881c35fb2b953d8a79259a9065 100644 --- a/test/language/expressions/addition/bigint-and-number.js +++ b/test/language/expressions/addition/bigint-and-number.js @@ -12,22 +12,74 @@ info: | Let rnum be ? ToNumeric(rprim) If Type(lnum) does not equal Type(rnum), throw a TypeError exception. ---*/ +assert.throws(TypeError, function() { + 1n + 1; +}, '1n + 1 throws TypeError'); -assert.throws(TypeError, function() { 1n + 1; }, "1n + 1 throws TypeError"); -assert.throws(TypeError, function() { 1 + 1n; }, "1 + 1n throws TypeError"); -assert.throws(TypeError, function() { Object(1n) + 1; }, "Object(1n) + 1 throws TypeError"); -assert.throws(TypeError, function() { 1 + Object(1n); }, "1 + Object(1n) throws TypeError"); -assert.throws(TypeError, function() { 1n + Object(1); }, "1n + Object(1) throws TypeError"); -assert.throws(TypeError, function() { Object(1) + 1n; }, "Object(1) + 1n throws TypeError"); -assert.throws(TypeError, function() { Object(1n) + Object(1); }, "Object(1n) + Object(1) throws TypeError"); -assert.throws(TypeError, function() { Object(1) + Object(1n); }, "Object(1) + Object(1n) throws TypeError"); -assert.throws(TypeError, function() { 1n + NaN; }, "1n + NaN throws TypeError"); -assert.throws(TypeError, function() { NaN + 1n; }, "NaN + 1n throws TypeError"); -assert.throws(TypeError, function() { 1n + Infinity; }, "1n + Infinity throws TypeError"); -assert.throws(TypeError, function() { Infinity + 1n; }, "Infinity + 1n throws TypeError"); -assert.throws(TypeError, function() { 1n + true; }, "1n + true throws TypeError"); -assert.throws(TypeError, function() { true + 1n; }, "true + 1n throws TypeError"); -assert.throws(TypeError, function() { 1n + null; }, "1n + null throws TypeError"); -assert.throws(TypeError, function() { null + 1n; }, "null + 1n throws TypeError"); -assert.throws(TypeError, function() { 1n + undefined; }, "1n + undefined throws TypeError"); -assert.throws(TypeError, function() { undefined + 1n; }, "undefined + 1n throws TypeError"); +assert.throws(TypeError, function() { + 1 + 1n; +}, '1 + 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) + 1; +}, 'Object(1n) + 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 + Object(1n); +}, '1 + Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n + Object(1); +}, '1n + Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) + 1n; +}, 'Object(1) + 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) + Object(1); +}, 'Object(1n) + Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) + Object(1n); +}, 'Object(1) + Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n + NaN; +}, '1n + NaN throws TypeError'); + +assert.throws(TypeError, function() { + NaN + 1n; +}, 'NaN + 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n + Infinity; +}, '1n + Infinity throws TypeError'); + +assert.throws(TypeError, function() { + Infinity + 1n; +}, 'Infinity + 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n + true; +}, '1n + true throws TypeError'); + +assert.throws(TypeError, function() { + true + 1n; +}, 'true + 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n + null; +}, '1n + null throws TypeError'); + +assert.throws(TypeError, function() { + null + 1n; +}, 'null + 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n + undefined; +}, '1n + undefined throws TypeError'); + +assert.throws(TypeError, function() { + undefined + 1n; +}, 'undefined + 1n throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/addition/bigint-arithmetic.js b/test/language/expressions/addition/bigint-arithmetic.js index 71a3434e7cbc31d8dbc11a4cd8c8f88c40310e1e..2d1b72d0b327d8293e7eeb8b299318f35267398a 100644 --- a/test/language/expressions/addition/bigint-arithmetic.js +++ b/test/language/expressions/addition/bigint-arithmetic.js @@ -1,167 +1,1401 @@ // Copyright (C) 2017 Robin Templeton. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- esid: sec-addition-operator-plus-runtime-semantics-evaluation description: BigInt addition arithmetic features: [BigInt] ---*/ +assert.sameValue( + 0xFEDCBA9876543210n + 0xFEDCBA9876543210n, + 0x1FDB97530ECA86420n, + 'The result of (0xFEDCBA9876543210n + 0xFEDCBA9876543210n) is 0x1FDB97530ECA86420n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0xFEDCBA9876543210n, + 0x1FDB97530ECA86420n, + 'The result of (0xFEDCBA9876543210n + 0xFEDCBA9876543210n) is 0x1FDB97530ECA86420n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0xFEDCBA987654320Fn, + 0x1FDB97530ECA8641Fn, + 'The result of (0xFEDCBA9876543210n + 0xFEDCBA987654320Fn) is 0x1FDB97530ECA8641Fn' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0xFEDCBA987654320Fn, + 0x1FDB97530ECA8641Fn, + 'The result of (0xFEDCBA9876543210n + 0xFEDCBA987654320Fn) is 0x1FDB97530ECA8641Fn' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0xFEDCBA98n, + 0xFEDCBA997530ECA8n, + 'The result of (0xFEDCBA9876543210n + 0xFEDCBA98n) is 0xFEDCBA997530ECA8n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0xFEDCBA98n, + 0xFEDCBA997530ECA8n, + 'The result of (0xFEDCBA9876543210n + 0xFEDCBA98n) is 0xFEDCBA997530ECA8n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0xFEDCBA97n, + 0xFEDCBA997530ECA7n, + 'The result of (0xFEDCBA9876543210n + 0xFEDCBA97n) is 0xFEDCBA997530ECA7n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0xFEDCBA97n, + 0xFEDCBA997530ECA7n, + 'The result of (0xFEDCBA9876543210n + 0xFEDCBA97n) is 0xFEDCBA997530ECA7n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0x1234n, + 0xFEDCBA9876544444n, + 'The result of (0xFEDCBA9876543210n + 0x1234n) is 0xFEDCBA9876544444n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0x1234n, + 0xFEDCBA9876544444n, + 'The result of (0xFEDCBA9876543210n + 0x1234n) is 0xFEDCBA9876544444n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0x3n, + 0xFEDCBA9876543213n, + 'The result of (0xFEDCBA9876543210n + 0x3n) is 0xFEDCBA9876543213n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0x3n, + 0xFEDCBA9876543213n, + 'The result of (0xFEDCBA9876543210n + 0x3n) is 0xFEDCBA9876543213n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0x2n, + 0xFEDCBA9876543212n, + 'The result of (0xFEDCBA9876543210n + 0x2n) is 0xFEDCBA9876543212n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0x2n, + 0xFEDCBA9876543212n, + 'The result of (0xFEDCBA9876543210n + 0x2n) is 0xFEDCBA9876543212n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0x1n, + 0xFEDCBA9876543211n, + 'The result of (0xFEDCBA9876543210n + 0x1n) is 0xFEDCBA9876543211n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0x1n, + 0xFEDCBA9876543211n, + 'The result of (0xFEDCBA9876543210n + 0x1n) is 0xFEDCBA9876543211n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0x0n, + 0xFEDCBA9876543210n, + 'The result of (0xFEDCBA9876543210n + 0x0n) is 0xFEDCBA9876543210n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0x0n, + 0xFEDCBA9876543210n, + 'The result of (0xFEDCBA9876543210n + 0x0n) is 0xFEDCBA9876543210n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0x1n, + 0xFEDCBA987654320Fn, + 'The result of (0xFEDCBA9876543210n + -0x1n) is 0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0x1n, + 0xFEDCBA987654320Fn, + 'The result of (0xFEDCBA9876543210n + -0x1n) is 0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0x2n, + 0xFEDCBA987654320En, + 'The result of (0xFEDCBA9876543210n + -0x2n) is 0xFEDCBA987654320En' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0x2n, + 0xFEDCBA987654320En, + 'The result of (0xFEDCBA9876543210n + -0x2n) is 0xFEDCBA987654320En' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0x3n, + 0xFEDCBA987654320Dn, + 'The result of (0xFEDCBA9876543210n + -0x3n) is 0xFEDCBA987654320Dn' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0x3n, + 0xFEDCBA987654320Dn, + 'The result of (0xFEDCBA9876543210n + -0x3n) is 0xFEDCBA987654320Dn' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0x1234n, + 0xFEDCBA9876541FDCn, + 'The result of (0xFEDCBA9876543210n + -0x1234n) is 0xFEDCBA9876541FDCn' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0x1234n, + 0xFEDCBA9876541FDCn, + 'The result of (0xFEDCBA9876543210n + -0x1234n) is 0xFEDCBA9876541FDCn' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0xFEDCBA97n, + 0xFEDCBA9777777779n, + 'The result of (0xFEDCBA9876543210n + -0xFEDCBA97n) is 0xFEDCBA9777777779n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0xFEDCBA97n, + 0xFEDCBA9777777779n, + 'The result of (0xFEDCBA9876543210n + -0xFEDCBA97n) is 0xFEDCBA9777777779n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0xFEDCBA98n, + 0xFEDCBA9777777778n, + 'The result of (0xFEDCBA9876543210n + -0xFEDCBA98n) is 0xFEDCBA9777777778n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0xFEDCBA98n, + 0xFEDCBA9777777778n, + 'The result of (0xFEDCBA9876543210n + -0xFEDCBA98n) is 0xFEDCBA9777777778n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0xFEDCBA987654320Fn, + 0x1n, + 'The result of (0xFEDCBA9876543210n + -0xFEDCBA987654320Fn) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0xFEDCBA987654320Fn, + 0x1n, + 'The result of (0xFEDCBA9876543210n + -0xFEDCBA987654320Fn) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0xFEDCBA9876543210n, + 0x0n, + 'The result of (0xFEDCBA9876543210n + -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0xFEDCBA9876543210n, + 0x0n, + 'The result of (0xFEDCBA9876543210n + -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0xFEDCBA987654320Fn, + 0x1FDB97530ECA8641En, + 'The result of (0xFEDCBA987654320Fn + 0xFEDCBA987654320Fn) is 0x1FDB97530ECA8641En' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0xFEDCBA987654320Fn, + 0x1FDB97530ECA8641En, + 'The result of (0xFEDCBA987654320Fn + 0xFEDCBA987654320Fn) is 0x1FDB97530ECA8641En' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0xFEDCBA98n, + 0xFEDCBA997530ECA7n, + 'The result of (0xFEDCBA987654320Fn + 0xFEDCBA98n) is 0xFEDCBA997530ECA7n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0xFEDCBA98n, + 0xFEDCBA997530ECA7n, + 'The result of (0xFEDCBA987654320Fn + 0xFEDCBA98n) is 0xFEDCBA997530ECA7n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0xFEDCBA97n, + 0xFEDCBA997530ECA6n, + 'The result of (0xFEDCBA987654320Fn + 0xFEDCBA97n) is 0xFEDCBA997530ECA6n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0xFEDCBA97n, + 0xFEDCBA997530ECA6n, + 'The result of (0xFEDCBA987654320Fn + 0xFEDCBA97n) is 0xFEDCBA997530ECA6n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0x1234n, + 0xFEDCBA9876544443n, + 'The result of (0xFEDCBA987654320Fn + 0x1234n) is 0xFEDCBA9876544443n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0x1234n, + 0xFEDCBA9876544443n, + 'The result of (0xFEDCBA987654320Fn + 0x1234n) is 0xFEDCBA9876544443n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0x3n, + 0xFEDCBA9876543212n, + 'The result of (0xFEDCBA987654320Fn + 0x3n) is 0xFEDCBA9876543212n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0x3n, + 0xFEDCBA9876543212n, + 'The result of (0xFEDCBA987654320Fn + 0x3n) is 0xFEDCBA9876543212n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0x2n, + 0xFEDCBA9876543211n, + 'The result of (0xFEDCBA987654320Fn + 0x2n) is 0xFEDCBA9876543211n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0x2n, + 0xFEDCBA9876543211n, + 'The result of (0xFEDCBA987654320Fn + 0x2n) is 0xFEDCBA9876543211n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0x1n, + 0xFEDCBA9876543210n, + 'The result of (0xFEDCBA987654320Fn + 0x1n) is 0xFEDCBA9876543210n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0x1n, + 0xFEDCBA9876543210n, + 'The result of (0xFEDCBA987654320Fn + 0x1n) is 0xFEDCBA9876543210n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0x0n, + 0xFEDCBA987654320Fn, + 'The result of (0xFEDCBA987654320Fn + 0x0n) is 0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0x0n, + 0xFEDCBA987654320Fn, + 'The result of (0xFEDCBA987654320Fn + 0x0n) is 0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0x1n, + 0xFEDCBA987654320En, + 'The result of (0xFEDCBA987654320Fn + -0x1n) is 0xFEDCBA987654320En' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0x1n, + 0xFEDCBA987654320En, + 'The result of (0xFEDCBA987654320Fn + -0x1n) is 0xFEDCBA987654320En' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0x2n, + 0xFEDCBA987654320Dn, + 'The result of (0xFEDCBA987654320Fn + -0x2n) is 0xFEDCBA987654320Dn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0x2n, + 0xFEDCBA987654320Dn, + 'The result of (0xFEDCBA987654320Fn + -0x2n) is 0xFEDCBA987654320Dn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0x3n, + 0xFEDCBA987654320Cn, + 'The result of (0xFEDCBA987654320Fn + -0x3n) is 0xFEDCBA987654320Cn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0x3n, + 0xFEDCBA987654320Cn, + 'The result of (0xFEDCBA987654320Fn + -0x3n) is 0xFEDCBA987654320Cn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0x1234n, + 0xFEDCBA9876541FDBn, + 'The result of (0xFEDCBA987654320Fn + -0x1234n) is 0xFEDCBA9876541FDBn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0x1234n, + 0xFEDCBA9876541FDBn, + 'The result of (0xFEDCBA987654320Fn + -0x1234n) is 0xFEDCBA9876541FDBn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0xFEDCBA97n, + 0xFEDCBA9777777778n, + 'The result of (0xFEDCBA987654320Fn + -0xFEDCBA97n) is 0xFEDCBA9777777778n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0xFEDCBA97n, + 0xFEDCBA9777777778n, + 'The result of (0xFEDCBA987654320Fn + -0xFEDCBA97n) is 0xFEDCBA9777777778n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0xFEDCBA98n, + 0xFEDCBA9777777777n, + 'The result of (0xFEDCBA987654320Fn + -0xFEDCBA98n) is 0xFEDCBA9777777777n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0xFEDCBA98n, + 0xFEDCBA9777777777n, + 'The result of (0xFEDCBA987654320Fn + -0xFEDCBA98n) is 0xFEDCBA9777777777n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0xFEDCBA987654320Fn + -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0xFEDCBA987654320Fn + -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0xFEDCBA9876543210n, + -0x1n, + 'The result of (0xFEDCBA987654320Fn + -0xFEDCBA9876543210n) is -0x1n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0xFEDCBA9876543210n, + -0x1n, + 'The result of (0xFEDCBA987654320Fn + -0xFEDCBA9876543210n) is -0x1n' +); + +assert.sameValue( + 0xFEDCBA98n + 0xFEDCBA98n, + 0x1FDB97530n, + 'The result of (0xFEDCBA98n + 0xFEDCBA98n) is 0x1FDB97530n' +); + +assert.sameValue( + 0xFEDCBA98n + 0xFEDCBA98n, + 0x1FDB97530n, + 'The result of (0xFEDCBA98n + 0xFEDCBA98n) is 0x1FDB97530n' +); + +assert.sameValue( + 0xFEDCBA98n + 0xFEDCBA97n, + 0x1FDB9752Fn, + 'The result of (0xFEDCBA98n + 0xFEDCBA97n) is 0x1FDB9752Fn' +); + +assert.sameValue( + 0xFEDCBA98n + 0xFEDCBA97n, + 0x1FDB9752Fn, + 'The result of (0xFEDCBA98n + 0xFEDCBA97n) is 0x1FDB9752Fn' +); + +assert.sameValue( + 0xFEDCBA98n + 0x1234n, + 0xFEDCCCCCn, + 'The result of (0xFEDCBA98n + 0x1234n) is 0xFEDCCCCCn' +); + +assert.sameValue( + 0xFEDCBA98n + 0x1234n, + 0xFEDCCCCCn, + 'The result of (0xFEDCBA98n + 0x1234n) is 0xFEDCCCCCn' +); + +assert.sameValue( + 0xFEDCBA98n + 0x3n, + 0xFEDCBA9Bn, + 'The result of (0xFEDCBA98n + 0x3n) is 0xFEDCBA9Bn' +); + +assert.sameValue( + 0xFEDCBA98n + 0x3n, + 0xFEDCBA9Bn, + 'The result of (0xFEDCBA98n + 0x3n) is 0xFEDCBA9Bn' +); + +assert.sameValue( + 0xFEDCBA98n + 0x2n, + 0xFEDCBA9An, + 'The result of (0xFEDCBA98n + 0x2n) is 0xFEDCBA9An' +); + +assert.sameValue( + 0xFEDCBA98n + 0x2n, + 0xFEDCBA9An, + 'The result of (0xFEDCBA98n + 0x2n) is 0xFEDCBA9An' +); + +assert.sameValue( + 0xFEDCBA98n + 0x1n, + 0xFEDCBA99n, + 'The result of (0xFEDCBA98n + 0x1n) is 0xFEDCBA99n' +); + +assert.sameValue( + 0xFEDCBA98n + 0x1n, + 0xFEDCBA99n, + 'The result of (0xFEDCBA98n + 0x1n) is 0xFEDCBA99n' +); + +assert.sameValue( + 0xFEDCBA98n + 0x0n, + 0xFEDCBA98n, + 'The result of (0xFEDCBA98n + 0x0n) is 0xFEDCBA98n' +); + +assert.sameValue( + 0xFEDCBA98n + 0x0n, + 0xFEDCBA98n, + 'The result of (0xFEDCBA98n + 0x0n) is 0xFEDCBA98n' +); + +assert.sameValue( + 0xFEDCBA98n + -0x1n, + 0xFEDCBA97n, + 'The result of (0xFEDCBA98n + -0x1n) is 0xFEDCBA97n' +); + +assert.sameValue( + 0xFEDCBA98n + -0x1n, + 0xFEDCBA97n, + 'The result of (0xFEDCBA98n + -0x1n) is 0xFEDCBA97n' +); + +assert.sameValue( + 0xFEDCBA98n + -0x2n, + 0xFEDCBA96n, + 'The result of (0xFEDCBA98n + -0x2n) is 0xFEDCBA96n' +); + +assert.sameValue( + 0xFEDCBA98n + -0x2n, + 0xFEDCBA96n, + 'The result of (0xFEDCBA98n + -0x2n) is 0xFEDCBA96n' +); + +assert.sameValue( + 0xFEDCBA98n + -0x3n, + 0xFEDCBA95n, + 'The result of (0xFEDCBA98n + -0x3n) is 0xFEDCBA95n' +); + +assert.sameValue( + 0xFEDCBA98n + -0x3n, + 0xFEDCBA95n, + 'The result of (0xFEDCBA98n + -0x3n) is 0xFEDCBA95n' +); + +assert.sameValue( + 0xFEDCBA98n + -0x1234n, + 0xFEDCA864n, + 'The result of (0xFEDCBA98n + -0x1234n) is 0xFEDCA864n' +); + +assert.sameValue( + 0xFEDCBA98n + -0x1234n, + 0xFEDCA864n, + 'The result of (0xFEDCBA98n + -0x1234n) is 0xFEDCA864n' +); + +assert.sameValue( + 0xFEDCBA98n + -0xFEDCBA97n, + 0x1n, + 'The result of (0xFEDCBA98n + -0xFEDCBA97n) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA98n + -0xFEDCBA97n, + 0x1n, + 'The result of (0xFEDCBA98n + -0xFEDCBA97n) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA98n + -0xFEDCBA98n, + 0x0n, + 'The result of (0xFEDCBA98n + -0xFEDCBA98n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA98n + -0xFEDCBA98n, + 0x0n, + 'The result of (0xFEDCBA98n + -0xFEDCBA98n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA98n + -0xFEDCBA987654320Fn, + -0xFEDCBA9777777777n, + 'The result of (0xFEDCBA98n + -0xFEDCBA987654320Fn) is -0xFEDCBA9777777777n' +); + +assert.sameValue( + 0xFEDCBA98n + -0xFEDCBA987654320Fn, + -0xFEDCBA9777777777n, + 'The result of (0xFEDCBA98n + -0xFEDCBA987654320Fn) is -0xFEDCBA9777777777n' +); + +assert.sameValue( + 0xFEDCBA98n + -0xFEDCBA9876543210n, + -0xFEDCBA9777777778n, + 'The result of (0xFEDCBA98n + -0xFEDCBA9876543210n) is -0xFEDCBA9777777778n' +); + +assert.sameValue( + 0xFEDCBA98n + -0xFEDCBA9876543210n, + -0xFEDCBA9777777778n, + 'The result of (0xFEDCBA98n + -0xFEDCBA9876543210n) is -0xFEDCBA9777777778n' +); + +assert.sameValue( + 0xFEDCBA97n + 0xFEDCBA97n, + 0x1FDB9752En, + 'The result of (0xFEDCBA97n + 0xFEDCBA97n) is 0x1FDB9752En' +); + +assert.sameValue( + 0xFEDCBA97n + 0xFEDCBA97n, + 0x1FDB9752En, + 'The result of (0xFEDCBA97n + 0xFEDCBA97n) is 0x1FDB9752En' +); + +assert.sameValue( + 0xFEDCBA97n + 0x1234n, + 0xFEDCCCCBn, + 'The result of (0xFEDCBA97n + 0x1234n) is 0xFEDCCCCBn' +); + +assert.sameValue( + 0xFEDCBA97n + 0x1234n, + 0xFEDCCCCBn, + 'The result of (0xFEDCBA97n + 0x1234n) is 0xFEDCCCCBn' +); + +assert.sameValue( + 0xFEDCBA97n + 0x3n, + 0xFEDCBA9An, + 'The result of (0xFEDCBA97n + 0x3n) is 0xFEDCBA9An' +); + +assert.sameValue( + 0xFEDCBA97n + 0x3n, + 0xFEDCBA9An, + 'The result of (0xFEDCBA97n + 0x3n) is 0xFEDCBA9An' +); + +assert.sameValue( + 0xFEDCBA97n + 0x2n, + 0xFEDCBA99n, + 'The result of (0xFEDCBA97n + 0x2n) is 0xFEDCBA99n' +); + +assert.sameValue( + 0xFEDCBA97n + 0x2n, + 0xFEDCBA99n, + 'The result of (0xFEDCBA97n + 0x2n) is 0xFEDCBA99n' +); + +assert.sameValue( + 0xFEDCBA97n + 0x1n, + 0xFEDCBA98n, + 'The result of (0xFEDCBA97n + 0x1n) is 0xFEDCBA98n' +); + +assert.sameValue( + 0xFEDCBA97n + 0x1n, + 0xFEDCBA98n, + 'The result of (0xFEDCBA97n + 0x1n) is 0xFEDCBA98n' +); + +assert.sameValue( + 0xFEDCBA97n + 0x0n, + 0xFEDCBA97n, + 'The result of (0xFEDCBA97n + 0x0n) is 0xFEDCBA97n' +); + +assert.sameValue( + 0xFEDCBA97n + 0x0n, + 0xFEDCBA97n, + 'The result of (0xFEDCBA97n + 0x0n) is 0xFEDCBA97n' +); + +assert.sameValue( + 0xFEDCBA97n + -0x1n, + 0xFEDCBA96n, + 'The result of (0xFEDCBA97n + -0x1n) is 0xFEDCBA96n' +); + +assert.sameValue( + 0xFEDCBA97n + -0x1n, + 0xFEDCBA96n, + 'The result of (0xFEDCBA97n + -0x1n) is 0xFEDCBA96n' +); + +assert.sameValue( + 0xFEDCBA97n + -0x2n, + 0xFEDCBA95n, + 'The result of (0xFEDCBA97n + -0x2n) is 0xFEDCBA95n' +); + +assert.sameValue( + 0xFEDCBA97n + -0x2n, + 0xFEDCBA95n, + 'The result of (0xFEDCBA97n + -0x2n) is 0xFEDCBA95n' +); + +assert.sameValue( + 0xFEDCBA97n + -0x3n, + 0xFEDCBA94n, + 'The result of (0xFEDCBA97n + -0x3n) is 0xFEDCBA94n' +); + +assert.sameValue( + 0xFEDCBA97n + -0x3n, + 0xFEDCBA94n, + 'The result of (0xFEDCBA97n + -0x3n) is 0xFEDCBA94n' +); + +assert.sameValue( + 0xFEDCBA97n + -0x1234n, + 0xFEDCA863n, + 'The result of (0xFEDCBA97n + -0x1234n) is 0xFEDCA863n' +); + +assert.sameValue( + 0xFEDCBA97n + -0x1234n, + 0xFEDCA863n, + 'The result of (0xFEDCBA97n + -0x1234n) is 0xFEDCA863n' +); + +assert.sameValue( + 0xFEDCBA97n + -0xFEDCBA97n, + 0x0n, + 'The result of (0xFEDCBA97n + -0xFEDCBA97n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA97n + -0xFEDCBA97n, + 0x0n, + 'The result of (0xFEDCBA97n + -0xFEDCBA97n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA97n + -0xFEDCBA98n, + -0x1n, + 'The result of (0xFEDCBA97n + -0xFEDCBA98n) is -0x1n' +); + +assert.sameValue( + 0xFEDCBA97n + -0xFEDCBA98n, + -0x1n, + 'The result of (0xFEDCBA97n + -0xFEDCBA98n) is -0x1n' +); + +assert.sameValue( + 0xFEDCBA97n + -0xFEDCBA987654320Fn, + -0xFEDCBA9777777778n, + 'The result of (0xFEDCBA97n + -0xFEDCBA987654320Fn) is -0xFEDCBA9777777778n' +); + +assert.sameValue( + 0xFEDCBA97n + -0xFEDCBA987654320Fn, + -0xFEDCBA9777777778n, + 'The result of (0xFEDCBA97n + -0xFEDCBA987654320Fn) is -0xFEDCBA9777777778n' +); + +assert.sameValue( + 0xFEDCBA97n + -0xFEDCBA9876543210n, + -0xFEDCBA9777777779n, + 'The result of (0xFEDCBA97n + -0xFEDCBA9876543210n) is -0xFEDCBA9777777779n' +); + +assert.sameValue( + 0xFEDCBA97n + -0xFEDCBA9876543210n, + -0xFEDCBA9777777779n, + 'The result of (0xFEDCBA97n + -0xFEDCBA9876543210n) is -0xFEDCBA9777777779n' +); + +assert.sameValue(0x1234n + 0x1234n, 0x2468n, 'The result of (0x1234n + 0x1234n) is 0x2468n'); +assert.sameValue(0x1234n + 0x1234n, 0x2468n, 'The result of (0x1234n + 0x1234n) is 0x2468n'); +assert.sameValue(0x1234n + 0x3n, 0x1237n, 'The result of (0x1234n + 0x3n) is 0x1237n'); +assert.sameValue(0x1234n + 0x3n, 0x1237n, 'The result of (0x1234n + 0x3n) is 0x1237n'); +assert.sameValue(0x1234n + 0x2n, 0x1236n, 'The result of (0x1234n + 0x2n) is 0x1236n'); +assert.sameValue(0x1234n + 0x2n, 0x1236n, 'The result of (0x1234n + 0x2n) is 0x1236n'); +assert.sameValue(0x1234n + 0x1n, 0x1235n, 'The result of (0x1234n + 0x1n) is 0x1235n'); +assert.sameValue(0x1234n + 0x1n, 0x1235n, 'The result of (0x1234n + 0x1n) is 0x1235n'); +assert.sameValue(0x1234n + 0x0n, 0x1234n, 'The result of (0x1234n + 0x0n) is 0x1234n'); +assert.sameValue(0x1234n + 0x0n, 0x1234n, 'The result of (0x1234n + 0x0n) is 0x1234n'); +assert.sameValue(0x1234n + -0x1n, 0x1233n, 'The result of (0x1234n + -0x1n) is 0x1233n'); +assert.sameValue(0x1234n + -0x1n, 0x1233n, 'The result of (0x1234n + -0x1n) is 0x1233n'); +assert.sameValue(0x1234n + -0x2n, 0x1232n, 'The result of (0x1234n + -0x2n) is 0x1232n'); +assert.sameValue(0x1234n + -0x2n, 0x1232n, 'The result of (0x1234n + -0x2n) is 0x1232n'); +assert.sameValue(0x1234n + -0x3n, 0x1231n, 'The result of (0x1234n + -0x3n) is 0x1231n'); +assert.sameValue(0x1234n + -0x3n, 0x1231n, 'The result of (0x1234n + -0x3n) is 0x1231n'); +assert.sameValue(0x1234n + -0x1234n, 0x0n, 'The result of (0x1234n + -0x1234n) is 0x0n'); +assert.sameValue(0x1234n + -0x1234n, 0x0n, 'The result of (0x1234n + -0x1234n) is 0x0n'); + +assert.sameValue( + 0x1234n + -0xFEDCBA97n, + -0xFEDCA863n, + 'The result of (0x1234n + -0xFEDCBA97n) is -0xFEDCA863n' +); + +assert.sameValue( + 0x1234n + -0xFEDCBA97n, + -0xFEDCA863n, + 'The result of (0x1234n + -0xFEDCBA97n) is -0xFEDCA863n' +); + +assert.sameValue( + 0x1234n + -0xFEDCBA98n, + -0xFEDCA864n, + 'The result of (0x1234n + -0xFEDCBA98n) is -0xFEDCA864n' +); + +assert.sameValue( + 0x1234n + -0xFEDCBA98n, + -0xFEDCA864n, + 'The result of (0x1234n + -0xFEDCBA98n) is -0xFEDCA864n' +); + +assert.sameValue( + 0x1234n + -0xFEDCBA987654320Fn, + -0xFEDCBA9876541FDBn, + 'The result of (0x1234n + -0xFEDCBA987654320Fn) is -0xFEDCBA9876541FDBn' +); + +assert.sameValue( + 0x1234n + -0xFEDCBA987654320Fn, + -0xFEDCBA9876541FDBn, + 'The result of (0x1234n + -0xFEDCBA987654320Fn) is -0xFEDCBA9876541FDBn' +); + +assert.sameValue( + 0x1234n + -0xFEDCBA9876543210n, + -0xFEDCBA9876541FDCn, + 'The result of (0x1234n + -0xFEDCBA9876543210n) is -0xFEDCBA9876541FDCn' +); + +assert.sameValue( + 0x1234n + -0xFEDCBA9876543210n, + -0xFEDCBA9876541FDCn, + 'The result of (0x1234n + -0xFEDCBA9876543210n) is -0xFEDCBA9876541FDCn' +); + +assert.sameValue(0x3n + 0x3n, 0x6n, 'The result of (0x3n + 0x3n) is 0x6n'); +assert.sameValue(0x3n + 0x3n, 0x6n, 'The result of (0x3n + 0x3n) is 0x6n'); +assert.sameValue(0x3n + 0x2n, 0x5n, 'The result of (0x3n + 0x2n) is 0x5n'); +assert.sameValue(0x3n + 0x2n, 0x5n, 'The result of (0x3n + 0x2n) is 0x5n'); +assert.sameValue(0x3n + 0x1n, 0x4n, 'The result of (0x3n + 0x1n) is 0x4n'); +assert.sameValue(0x3n + 0x1n, 0x4n, 'The result of (0x3n + 0x1n) is 0x4n'); +assert.sameValue(0x3n + 0x0n, 0x3n, 'The result of (0x3n + 0x0n) is 0x3n'); +assert.sameValue(0x3n + 0x0n, 0x3n, 'The result of (0x3n + 0x0n) is 0x3n'); +assert.sameValue(0x3n + -0x1n, 0x2n, 'The result of (0x3n + -0x1n) is 0x2n'); +assert.sameValue(0x3n + -0x1n, 0x2n, 'The result of (0x3n + -0x1n) is 0x2n'); +assert.sameValue(0x3n + -0x2n, 0x1n, 'The result of (0x3n + -0x2n) is 0x1n'); +assert.sameValue(0x3n + -0x2n, 0x1n, 'The result of (0x3n + -0x2n) is 0x1n'); +assert.sameValue(0x3n + -0x3n, 0x0n, 'The result of (0x3n + -0x3n) is 0x0n'); +assert.sameValue(0x3n + -0x3n, 0x0n, 'The result of (0x3n + -0x3n) is 0x0n'); +assert.sameValue(0x3n + -0x1234n, -0x1231n, 'The result of (0x3n + -0x1234n) is -0x1231n'); +assert.sameValue(0x3n + -0x1234n, -0x1231n, 'The result of (0x3n + -0x1234n) is -0x1231n'); + +assert.sameValue( + 0x3n + -0xFEDCBA97n, + -0xFEDCBA94n, + 'The result of (0x3n + -0xFEDCBA97n) is -0xFEDCBA94n' +); + +assert.sameValue( + 0x3n + -0xFEDCBA97n, + -0xFEDCBA94n, + 'The result of (0x3n + -0xFEDCBA97n) is -0xFEDCBA94n' +); + +assert.sameValue( + 0x3n + -0xFEDCBA98n, + -0xFEDCBA95n, + 'The result of (0x3n + -0xFEDCBA98n) is -0xFEDCBA95n' +); + +assert.sameValue( + 0x3n + -0xFEDCBA98n, + -0xFEDCBA95n, + 'The result of (0x3n + -0xFEDCBA98n) is -0xFEDCBA95n' +); + +assert.sameValue( + 0x3n + -0xFEDCBA987654320Fn, + -0xFEDCBA987654320Cn, + 'The result of (0x3n + -0xFEDCBA987654320Fn) is -0xFEDCBA987654320Cn' +); + +assert.sameValue( + 0x3n + -0xFEDCBA987654320Fn, + -0xFEDCBA987654320Cn, + 'The result of (0x3n + -0xFEDCBA987654320Fn) is -0xFEDCBA987654320Cn' +); + +assert.sameValue( + 0x3n + -0xFEDCBA9876543210n, + -0xFEDCBA987654320Dn, + 'The result of (0x3n + -0xFEDCBA9876543210n) is -0xFEDCBA987654320Dn' +); + +assert.sameValue( + 0x3n + -0xFEDCBA9876543210n, + -0xFEDCBA987654320Dn, + 'The result of (0x3n + -0xFEDCBA9876543210n) is -0xFEDCBA987654320Dn' +); + +assert.sameValue(0x2n + 0x2n, 0x4n, 'The result of (0x2n + 0x2n) is 0x4n'); +assert.sameValue(0x2n + 0x2n, 0x4n, 'The result of (0x2n + 0x2n) is 0x4n'); +assert.sameValue(0x2n + 0x1n, 0x3n, 'The result of (0x2n + 0x1n) is 0x3n'); +assert.sameValue(0x2n + 0x1n, 0x3n, 'The result of (0x2n + 0x1n) is 0x3n'); +assert.sameValue(0x2n + 0x0n, 0x2n, 'The result of (0x2n + 0x0n) is 0x2n'); +assert.sameValue(0x2n + 0x0n, 0x2n, 'The result of (0x2n + 0x0n) is 0x2n'); +assert.sameValue(0x2n + -0x1n, 0x1n, 'The result of (0x2n + -0x1n) is 0x1n'); +assert.sameValue(0x2n + -0x1n, 0x1n, 'The result of (0x2n + -0x1n) is 0x1n'); +assert.sameValue(0x2n + -0x2n, 0x0n, 'The result of (0x2n + -0x2n) is 0x0n'); +assert.sameValue(0x2n + -0x2n, 0x0n, 'The result of (0x2n + -0x2n) is 0x0n'); +assert.sameValue(0x2n + -0x3n, -0x1n, 'The result of (0x2n + -0x3n) is -0x1n'); +assert.sameValue(0x2n + -0x3n, -0x1n, 'The result of (0x2n + -0x3n) is -0x1n'); +assert.sameValue(0x2n + -0x1234n, -0x1232n, 'The result of (0x2n + -0x1234n) is -0x1232n'); +assert.sameValue(0x2n + -0x1234n, -0x1232n, 'The result of (0x2n + -0x1234n) is -0x1232n'); + +assert.sameValue( + 0x2n + -0xFEDCBA97n, + -0xFEDCBA95n, + 'The result of (0x2n + -0xFEDCBA97n) is -0xFEDCBA95n' +); + +assert.sameValue( + 0x2n + -0xFEDCBA97n, + -0xFEDCBA95n, + 'The result of (0x2n + -0xFEDCBA97n) is -0xFEDCBA95n' +); + +assert.sameValue( + 0x2n + -0xFEDCBA98n, + -0xFEDCBA96n, + 'The result of (0x2n + -0xFEDCBA98n) is -0xFEDCBA96n' +); + +assert.sameValue( + 0x2n + -0xFEDCBA98n, + -0xFEDCBA96n, + 'The result of (0x2n + -0xFEDCBA98n) is -0xFEDCBA96n' +); + +assert.sameValue( + 0x2n + -0xFEDCBA987654320Fn, + -0xFEDCBA987654320Dn, + 'The result of (0x2n + -0xFEDCBA987654320Fn) is -0xFEDCBA987654320Dn' +); + +assert.sameValue( + 0x2n + -0xFEDCBA987654320Fn, + -0xFEDCBA987654320Dn, + 'The result of (0x2n + -0xFEDCBA987654320Fn) is -0xFEDCBA987654320Dn' +); + +assert.sameValue( + 0x2n + -0xFEDCBA9876543210n, + -0xFEDCBA987654320En, + 'The result of (0x2n + -0xFEDCBA9876543210n) is -0xFEDCBA987654320En' +); + +assert.sameValue( + 0x2n + -0xFEDCBA9876543210n, + -0xFEDCBA987654320En, + 'The result of (0x2n + -0xFEDCBA9876543210n) is -0xFEDCBA987654320En' +); + +assert.sameValue(0x1n + 0x1n, 0x2n, 'The result of (0x1n + 0x1n) is 0x2n'); +assert.sameValue(0x1n + 0x1n, 0x2n, 'The result of (0x1n + 0x1n) is 0x2n'); +assert.sameValue(0x1n + 0x0n, 0x1n, 'The result of (0x1n + 0x0n) is 0x1n'); +assert.sameValue(0x1n + 0x0n, 0x1n, 'The result of (0x1n + 0x0n) is 0x1n'); +assert.sameValue(0x1n + -0x1n, 0x0n, 'The result of (0x1n + -0x1n) is 0x0n'); +assert.sameValue(0x1n + -0x1n, 0x0n, 'The result of (0x1n + -0x1n) is 0x0n'); +assert.sameValue(0x1n + -0x2n, -0x1n, 'The result of (0x1n + -0x2n) is -0x1n'); +assert.sameValue(0x1n + -0x2n, -0x1n, 'The result of (0x1n + -0x2n) is -0x1n'); +assert.sameValue(0x1n + -0x3n, -0x2n, 'The result of (0x1n + -0x3n) is -0x2n'); +assert.sameValue(0x1n + -0x3n, -0x2n, 'The result of (0x1n + -0x3n) is -0x2n'); +assert.sameValue(0x1n + -0x1234n, -0x1233n, 'The result of (0x1n + -0x1234n) is -0x1233n'); +assert.sameValue(0x1n + -0x1234n, -0x1233n, 'The result of (0x1n + -0x1234n) is -0x1233n'); + +assert.sameValue( + 0x1n + -0xFEDCBA97n, + -0xFEDCBA96n, + 'The result of (0x1n + -0xFEDCBA97n) is -0xFEDCBA96n' +); + +assert.sameValue( + 0x1n + -0xFEDCBA97n, + -0xFEDCBA96n, + 'The result of (0x1n + -0xFEDCBA97n) is -0xFEDCBA96n' +); + +assert.sameValue( + 0x1n + -0xFEDCBA98n, + -0xFEDCBA97n, + 'The result of (0x1n + -0xFEDCBA98n) is -0xFEDCBA97n' +); + +assert.sameValue( + 0x1n + -0xFEDCBA98n, + -0xFEDCBA97n, + 'The result of (0x1n + -0xFEDCBA98n) is -0xFEDCBA97n' +); + +assert.sameValue( + 0x1n + -0xFEDCBA987654320Fn, + -0xFEDCBA987654320En, + 'The result of (0x1n + -0xFEDCBA987654320Fn) is -0xFEDCBA987654320En' +); + +assert.sameValue( + 0x1n + -0xFEDCBA987654320Fn, + -0xFEDCBA987654320En, + 'The result of (0x1n + -0xFEDCBA987654320Fn) is -0xFEDCBA987654320En' +); + +assert.sameValue( + 0x1n + -0xFEDCBA9876543210n, + -0xFEDCBA987654320Fn, + 'The result of (0x1n + -0xFEDCBA9876543210n) is -0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0x1n + -0xFEDCBA9876543210n, + -0xFEDCBA987654320Fn, + 'The result of (0x1n + -0xFEDCBA9876543210n) is -0xFEDCBA987654320Fn' +); + +assert.sameValue(0x0n + 0x0n, 0x0n, 'The result of (0x0n + 0x0n) is 0x0n'); +assert.sameValue(0x0n + 0x0n, 0x0n, 'The result of (0x0n + 0x0n) is 0x0n'); +assert.sameValue(0x0n + -0x1n, -0x1n, 'The result of (0x0n + -0x1n) is -0x1n'); +assert.sameValue(0x0n + -0x1n, -0x1n, 'The result of (0x0n + -0x1n) is -0x1n'); +assert.sameValue(0x0n + -0x2n, -0x2n, 'The result of (0x0n + -0x2n) is -0x2n'); +assert.sameValue(0x0n + -0x2n, -0x2n, 'The result of (0x0n + -0x2n) is -0x2n'); +assert.sameValue(0x0n + -0x3n, -0x3n, 'The result of (0x0n + -0x3n) is -0x3n'); +assert.sameValue(0x0n + -0x3n, -0x3n, 'The result of (0x0n + -0x3n) is -0x3n'); +assert.sameValue(0x0n + -0x1234n, -0x1234n, 'The result of (0x0n + -0x1234n) is -0x1234n'); +assert.sameValue(0x0n + -0x1234n, -0x1234n, 'The result of (0x0n + -0x1234n) is -0x1234n'); + +assert.sameValue( + 0x0n + -0xFEDCBA97n, + -0xFEDCBA97n, + 'The result of (0x0n + -0xFEDCBA97n) is -0xFEDCBA97n' +); + +assert.sameValue( + 0x0n + -0xFEDCBA97n, + -0xFEDCBA97n, + 'The result of (0x0n + -0xFEDCBA97n) is -0xFEDCBA97n' +); + +assert.sameValue( + 0x0n + -0xFEDCBA98n, + -0xFEDCBA98n, + 'The result of (0x0n + -0xFEDCBA98n) is -0xFEDCBA98n' +); + +assert.sameValue( + 0x0n + -0xFEDCBA98n, + -0xFEDCBA98n, + 'The result of (0x0n + -0xFEDCBA98n) is -0xFEDCBA98n' +); + +assert.sameValue( + 0x0n + -0xFEDCBA987654320Fn, + -0xFEDCBA987654320Fn, + 'The result of (0x0n + -0xFEDCBA987654320Fn) is -0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0x0n + -0xFEDCBA987654320Fn, + -0xFEDCBA987654320Fn, + 'The result of (0x0n + -0xFEDCBA987654320Fn) is -0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0x0n + -0xFEDCBA9876543210n, + -0xFEDCBA9876543210n, + 'The result of (0x0n + -0xFEDCBA9876543210n) is -0xFEDCBA9876543210n' +); + +assert.sameValue( + 0x0n + -0xFEDCBA9876543210n, + -0xFEDCBA9876543210n, + 'The result of (0x0n + -0xFEDCBA9876543210n) is -0xFEDCBA9876543210n' +); + +assert.sameValue(-0x1n + -0x1n, -0x2n, 'The result of (-0x1n + -0x1n) is -0x2n'); +assert.sameValue(-0x1n + -0x1n, -0x2n, 'The result of (-0x1n + -0x1n) is -0x2n'); +assert.sameValue(-0x1n + -0x2n, -0x3n, 'The result of (-0x1n + -0x2n) is -0x3n'); +assert.sameValue(-0x1n + -0x2n, -0x3n, 'The result of (-0x1n + -0x2n) is -0x3n'); +assert.sameValue(-0x1n + -0x3n, -0x4n, 'The result of (-0x1n + -0x3n) is -0x4n'); +assert.sameValue(-0x1n + -0x3n, -0x4n, 'The result of (-0x1n + -0x3n) is -0x4n'); +assert.sameValue(-0x1n + -0x1234n, -0x1235n, 'The result of (-0x1n + -0x1234n) is -0x1235n'); +assert.sameValue(-0x1n + -0x1234n, -0x1235n, 'The result of (-0x1n + -0x1234n) is -0x1235n'); + +assert.sameValue( + -0x1n + -0xFEDCBA97n, + -0xFEDCBA98n, + 'The result of (-0x1n + -0xFEDCBA97n) is -0xFEDCBA98n' +); + +assert.sameValue( + -0x1n + -0xFEDCBA97n, + -0xFEDCBA98n, + 'The result of (-0x1n + -0xFEDCBA97n) is -0xFEDCBA98n' +); + +assert.sameValue( + -0x1n + -0xFEDCBA98n, + -0xFEDCBA99n, + 'The result of (-0x1n + -0xFEDCBA98n) is -0xFEDCBA99n' +); + +assert.sameValue( + -0x1n + -0xFEDCBA98n, + -0xFEDCBA99n, + 'The result of (-0x1n + -0xFEDCBA98n) is -0xFEDCBA99n' +); + +assert.sameValue( + -0x1n + -0xFEDCBA987654320Fn, + -0xFEDCBA9876543210n, + 'The result of (-0x1n + -0xFEDCBA987654320Fn) is -0xFEDCBA9876543210n' +); + +assert.sameValue( + -0x1n + -0xFEDCBA987654320Fn, + -0xFEDCBA9876543210n, + 'The result of (-0x1n + -0xFEDCBA987654320Fn) is -0xFEDCBA9876543210n' +); + +assert.sameValue( + -0x1n + -0xFEDCBA9876543210n, + -0xFEDCBA9876543211n, + 'The result of (-0x1n + -0xFEDCBA9876543210n) is -0xFEDCBA9876543211n' +); + +assert.sameValue( + -0x1n + -0xFEDCBA9876543210n, + -0xFEDCBA9876543211n, + 'The result of (-0x1n + -0xFEDCBA9876543210n) is -0xFEDCBA9876543211n' +); + +assert.sameValue(-0x2n + -0x2n, -0x4n, 'The result of (-0x2n + -0x2n) is -0x4n'); +assert.sameValue(-0x2n + -0x2n, -0x4n, 'The result of (-0x2n + -0x2n) is -0x4n'); +assert.sameValue(-0x2n + -0x3n, -0x5n, 'The result of (-0x2n + -0x3n) is -0x5n'); +assert.sameValue(-0x2n + -0x3n, -0x5n, 'The result of (-0x2n + -0x3n) is -0x5n'); +assert.sameValue(-0x2n + -0x1234n, -0x1236n, 'The result of (-0x2n + -0x1234n) is -0x1236n'); +assert.sameValue(-0x2n + -0x1234n, -0x1236n, 'The result of (-0x2n + -0x1234n) is -0x1236n'); + +assert.sameValue( + -0x2n + -0xFEDCBA97n, + -0xFEDCBA99n, + 'The result of (-0x2n + -0xFEDCBA97n) is -0xFEDCBA99n' +); + +assert.sameValue( + -0x2n + -0xFEDCBA97n, + -0xFEDCBA99n, + 'The result of (-0x2n + -0xFEDCBA97n) is -0xFEDCBA99n' +); + +assert.sameValue( + -0x2n + -0xFEDCBA98n, + -0xFEDCBA9An, + 'The result of (-0x2n + -0xFEDCBA98n) is -0xFEDCBA9An' +); + +assert.sameValue( + -0x2n + -0xFEDCBA98n, + -0xFEDCBA9An, + 'The result of (-0x2n + -0xFEDCBA98n) is -0xFEDCBA9An' +); + +assert.sameValue( + -0x2n + -0xFEDCBA987654320Fn, + -0xFEDCBA9876543211n, + 'The result of (-0x2n + -0xFEDCBA987654320Fn) is -0xFEDCBA9876543211n' +); + +assert.sameValue( + -0x2n + -0xFEDCBA987654320Fn, + -0xFEDCBA9876543211n, + 'The result of (-0x2n + -0xFEDCBA987654320Fn) is -0xFEDCBA9876543211n' +); + +assert.sameValue( + -0x2n + -0xFEDCBA9876543210n, + -0xFEDCBA9876543212n, + 'The result of (-0x2n + -0xFEDCBA9876543210n) is -0xFEDCBA9876543212n' +); + +assert.sameValue( + -0x2n + -0xFEDCBA9876543210n, + -0xFEDCBA9876543212n, + 'The result of (-0x2n + -0xFEDCBA9876543210n) is -0xFEDCBA9876543212n' +); + +assert.sameValue(-0x3n + -0x3n, -0x6n, 'The result of (-0x3n + -0x3n) is -0x6n'); +assert.sameValue(-0x3n + -0x3n, -0x6n, 'The result of (-0x3n + -0x3n) is -0x6n'); +assert.sameValue(-0x3n + -0x1234n, -0x1237n, 'The result of (-0x3n + -0x1234n) is -0x1237n'); +assert.sameValue(-0x3n + -0x1234n, -0x1237n, 'The result of (-0x3n + -0x1234n) is -0x1237n'); + +assert.sameValue( + -0x3n + -0xFEDCBA97n, + -0xFEDCBA9An, + 'The result of (-0x3n + -0xFEDCBA97n) is -0xFEDCBA9An' +); + +assert.sameValue( + -0x3n + -0xFEDCBA97n, + -0xFEDCBA9An, + 'The result of (-0x3n + -0xFEDCBA97n) is -0xFEDCBA9An' +); + +assert.sameValue( + -0x3n + -0xFEDCBA98n, + -0xFEDCBA9Bn, + 'The result of (-0x3n + -0xFEDCBA98n) is -0xFEDCBA9Bn' +); + +assert.sameValue( + -0x3n + -0xFEDCBA98n, + -0xFEDCBA9Bn, + 'The result of (-0x3n + -0xFEDCBA98n) is -0xFEDCBA9Bn' +); + +assert.sameValue( + -0x3n + -0xFEDCBA987654320Fn, + -0xFEDCBA9876543212n, + 'The result of (-0x3n + -0xFEDCBA987654320Fn) is -0xFEDCBA9876543212n' +); + +assert.sameValue( + -0x3n + -0xFEDCBA987654320Fn, + -0xFEDCBA9876543212n, + 'The result of (-0x3n + -0xFEDCBA987654320Fn) is -0xFEDCBA9876543212n' +); + +assert.sameValue( + -0x3n + -0xFEDCBA9876543210n, + -0xFEDCBA9876543213n, + 'The result of (-0x3n + -0xFEDCBA9876543210n) is -0xFEDCBA9876543213n' +); + +assert.sameValue( + -0x3n + -0xFEDCBA9876543210n, + -0xFEDCBA9876543213n, + 'The result of (-0x3n + -0xFEDCBA9876543210n) is -0xFEDCBA9876543213n' +); + +assert.sameValue(-0x1234n + -0x1234n, -0x2468n, 'The result of (-0x1234n + -0x1234n) is -0x2468n'); +assert.sameValue(-0x1234n + -0x1234n, -0x2468n, 'The result of (-0x1234n + -0x1234n) is -0x2468n'); + +assert.sameValue( + -0x1234n + -0xFEDCBA97n, + -0xFEDCCCCBn, + 'The result of (-0x1234n + -0xFEDCBA97n) is -0xFEDCCCCBn' +); + +assert.sameValue( + -0x1234n + -0xFEDCBA97n, + -0xFEDCCCCBn, + 'The result of (-0x1234n + -0xFEDCBA97n) is -0xFEDCCCCBn' +); + +assert.sameValue( + -0x1234n + -0xFEDCBA98n, + -0xFEDCCCCCn, + 'The result of (-0x1234n + -0xFEDCBA98n) is -0xFEDCCCCCn' +); + +assert.sameValue( + -0x1234n + -0xFEDCBA98n, + -0xFEDCCCCCn, + 'The result of (-0x1234n + -0xFEDCBA98n) is -0xFEDCCCCCn' +); + +assert.sameValue( + -0x1234n + -0xFEDCBA987654320Fn, + -0xFEDCBA9876544443n, + 'The result of (-0x1234n + -0xFEDCBA987654320Fn) is -0xFEDCBA9876544443n' +); + +assert.sameValue( + -0x1234n + -0xFEDCBA987654320Fn, + -0xFEDCBA9876544443n, + 'The result of (-0x1234n + -0xFEDCBA987654320Fn) is -0xFEDCBA9876544443n' +); + +assert.sameValue( + -0x1234n + -0xFEDCBA9876543210n, + -0xFEDCBA9876544444n, + 'The result of (-0x1234n + -0xFEDCBA9876543210n) is -0xFEDCBA9876544444n' +); + +assert.sameValue( + -0x1234n + -0xFEDCBA9876543210n, + -0xFEDCBA9876544444n, + 'The result of (-0x1234n + -0xFEDCBA9876543210n) is -0xFEDCBA9876544444n' +); + +assert.sameValue( + -0xFEDCBA97n + -0xFEDCBA97n, + -0x1FDB9752En, + 'The result of (-0xFEDCBA97n + -0xFEDCBA97n) is -0x1FDB9752En' +); + +assert.sameValue( + -0xFEDCBA97n + -0xFEDCBA97n, + -0x1FDB9752En, + 'The result of (-0xFEDCBA97n + -0xFEDCBA97n) is -0x1FDB9752En' +); + +assert.sameValue( + -0xFEDCBA97n + -0xFEDCBA98n, + -0x1FDB9752Fn, + 'The result of (-0xFEDCBA97n + -0xFEDCBA98n) is -0x1FDB9752Fn' +); + +assert.sameValue( + -0xFEDCBA97n + -0xFEDCBA98n, + -0x1FDB9752Fn, + 'The result of (-0xFEDCBA97n + -0xFEDCBA98n) is -0x1FDB9752Fn' +); + +assert.sameValue( + -0xFEDCBA97n + -0xFEDCBA987654320Fn, + -0xFEDCBA997530ECA6n, + 'The result of (-0xFEDCBA97n + -0xFEDCBA987654320Fn) is -0xFEDCBA997530ECA6n' +); + +assert.sameValue( + -0xFEDCBA97n + -0xFEDCBA987654320Fn, + -0xFEDCBA997530ECA6n, + 'The result of (-0xFEDCBA97n + -0xFEDCBA987654320Fn) is -0xFEDCBA997530ECA6n' +); + +assert.sameValue( + -0xFEDCBA97n + -0xFEDCBA9876543210n, + -0xFEDCBA997530ECA7n, + 'The result of (-0xFEDCBA97n + -0xFEDCBA9876543210n) is -0xFEDCBA997530ECA7n' +); + +assert.sameValue( + -0xFEDCBA97n + -0xFEDCBA9876543210n, + -0xFEDCBA997530ECA7n, + 'The result of (-0xFEDCBA97n + -0xFEDCBA9876543210n) is -0xFEDCBA997530ECA7n' +); + +assert.sameValue( + -0xFEDCBA98n + -0xFEDCBA98n, + -0x1FDB97530n, + 'The result of (-0xFEDCBA98n + -0xFEDCBA98n) is -0x1FDB97530n' +); + +assert.sameValue( + -0xFEDCBA98n + -0xFEDCBA98n, + -0x1FDB97530n, + 'The result of (-0xFEDCBA98n + -0xFEDCBA98n) is -0x1FDB97530n' +); + +assert.sameValue( + -0xFEDCBA98n + -0xFEDCBA987654320Fn, + -0xFEDCBA997530ECA7n, + 'The result of (-0xFEDCBA98n + -0xFEDCBA987654320Fn) is -0xFEDCBA997530ECA7n' +); + +assert.sameValue( + -0xFEDCBA98n + -0xFEDCBA987654320Fn, + -0xFEDCBA997530ECA7n, + 'The result of (-0xFEDCBA98n + -0xFEDCBA987654320Fn) is -0xFEDCBA997530ECA7n' +); + +assert.sameValue( + -0xFEDCBA98n + -0xFEDCBA9876543210n, + -0xFEDCBA997530ECA8n, + 'The result of (-0xFEDCBA98n + -0xFEDCBA9876543210n) is -0xFEDCBA997530ECA8n' +); + +assert.sameValue( + -0xFEDCBA98n + -0xFEDCBA9876543210n, + -0xFEDCBA997530ECA8n, + 'The result of (-0xFEDCBA98n + -0xFEDCBA9876543210n) is -0xFEDCBA997530ECA8n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn + -0xFEDCBA987654320Fn, + -0x1FDB97530ECA8641En, + 'The result of (-0xFEDCBA987654320Fn + -0xFEDCBA987654320Fn) is -0x1FDB97530ECA8641En' +); + +assert.sameValue( + -0xFEDCBA987654320Fn + -0xFEDCBA987654320Fn, + -0x1FDB97530ECA8641En, + 'The result of (-0xFEDCBA987654320Fn + -0xFEDCBA987654320Fn) is -0x1FDB97530ECA8641En' +); + +assert.sameValue( + -0xFEDCBA987654320Fn + -0xFEDCBA9876543210n, + -0x1FDB97530ECA8641Fn, + 'The result of (-0xFEDCBA987654320Fn + -0xFEDCBA9876543210n) is -0x1FDB97530ECA8641Fn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn + -0xFEDCBA9876543210n, + -0x1FDB97530ECA8641Fn, + 'The result of (-0xFEDCBA987654320Fn + -0xFEDCBA9876543210n) is -0x1FDB97530ECA8641Fn' +); + +assert.sameValue( + -0xFEDCBA9876543210n + -0xFEDCBA9876543210n, + -0x1FDB97530ECA86420n, + 'The result of (-0xFEDCBA9876543210n + -0xFEDCBA9876543210n) is -0x1FDB97530ECA86420n' +); -function testAdd(x, y, z) { - assert.sameValue(x + y, z, x + " + " + y + " = " + z); - assert.sameValue(y + x, z, y + " + " + x + " = " + z); -} - -testAdd(0xFEDCBA9876543210n, 0xFEDCBA9876543210n, 0x1FDB97530ECA86420n); -testAdd(0xFEDCBA9876543210n, 0xFEDCBA987654320Fn, 0x1FDB97530ECA8641Fn); -testAdd(0xFEDCBA9876543210n, 0xFEDCBA98n, 0xFEDCBA997530ECA8n); -testAdd(0xFEDCBA9876543210n, 0xFEDCBA97n, 0xFEDCBA997530ECA7n); -testAdd(0xFEDCBA9876543210n, 0x1234n, 0xFEDCBA9876544444n); -testAdd(0xFEDCBA9876543210n, 0x3n, 0xFEDCBA9876543213n); -testAdd(0xFEDCBA9876543210n, 0x2n, 0xFEDCBA9876543212n); -testAdd(0xFEDCBA9876543210n, 0x1n, 0xFEDCBA9876543211n); -testAdd(0xFEDCBA9876543210n, 0x0n, 0xFEDCBA9876543210n); -testAdd(0xFEDCBA9876543210n, -0x1n, 0xFEDCBA987654320Fn); -testAdd(0xFEDCBA9876543210n, -0x2n, 0xFEDCBA987654320En); -testAdd(0xFEDCBA9876543210n, -0x3n, 0xFEDCBA987654320Dn); -testAdd(0xFEDCBA9876543210n, -0x1234n, 0xFEDCBA9876541FDCn); -testAdd(0xFEDCBA9876543210n, -0xFEDCBA97n, 0xFEDCBA9777777779n); -testAdd(0xFEDCBA9876543210n, -0xFEDCBA98n, 0xFEDCBA9777777778n); -testAdd(0xFEDCBA9876543210n, -0xFEDCBA987654320Fn, 0x1n); -testAdd(0xFEDCBA9876543210n, -0xFEDCBA9876543210n, 0x0n); -testAdd(0xFEDCBA987654320Fn, 0xFEDCBA987654320Fn, 0x1FDB97530ECA8641En); -testAdd(0xFEDCBA987654320Fn, 0xFEDCBA98n, 0xFEDCBA997530ECA7n); -testAdd(0xFEDCBA987654320Fn, 0xFEDCBA97n, 0xFEDCBA997530ECA6n); -testAdd(0xFEDCBA987654320Fn, 0x1234n, 0xFEDCBA9876544443n); -testAdd(0xFEDCBA987654320Fn, 0x3n, 0xFEDCBA9876543212n); -testAdd(0xFEDCBA987654320Fn, 0x2n, 0xFEDCBA9876543211n); -testAdd(0xFEDCBA987654320Fn, 0x1n, 0xFEDCBA9876543210n); -testAdd(0xFEDCBA987654320Fn, 0x0n, 0xFEDCBA987654320Fn); -testAdd(0xFEDCBA987654320Fn, -0x1n, 0xFEDCBA987654320En); -testAdd(0xFEDCBA987654320Fn, -0x2n, 0xFEDCBA987654320Dn); -testAdd(0xFEDCBA987654320Fn, -0x3n, 0xFEDCBA987654320Cn); -testAdd(0xFEDCBA987654320Fn, -0x1234n, 0xFEDCBA9876541FDBn); -testAdd(0xFEDCBA987654320Fn, -0xFEDCBA97n, 0xFEDCBA9777777778n); -testAdd(0xFEDCBA987654320Fn, -0xFEDCBA98n, 0xFEDCBA9777777777n); -testAdd(0xFEDCBA987654320Fn, -0xFEDCBA987654320Fn, 0x0n); -testAdd(0xFEDCBA987654320Fn, -0xFEDCBA9876543210n, -0x1n); -testAdd(0xFEDCBA98n, 0xFEDCBA98n, 0x1FDB97530n); -testAdd(0xFEDCBA98n, 0xFEDCBA97n, 0x1FDB9752Fn); -testAdd(0xFEDCBA98n, 0x1234n, 0xFEDCCCCCn); -testAdd(0xFEDCBA98n, 0x3n, 0xFEDCBA9Bn); -testAdd(0xFEDCBA98n, 0x2n, 0xFEDCBA9An); -testAdd(0xFEDCBA98n, 0x1n, 0xFEDCBA99n); -testAdd(0xFEDCBA98n, 0x0n, 0xFEDCBA98n); -testAdd(0xFEDCBA98n, -0x1n, 0xFEDCBA97n); -testAdd(0xFEDCBA98n, -0x2n, 0xFEDCBA96n); -testAdd(0xFEDCBA98n, -0x3n, 0xFEDCBA95n); -testAdd(0xFEDCBA98n, -0x1234n, 0xFEDCA864n); -testAdd(0xFEDCBA98n, -0xFEDCBA97n, 0x1n); -testAdd(0xFEDCBA98n, -0xFEDCBA98n, 0x0n); -testAdd(0xFEDCBA98n, -0xFEDCBA987654320Fn, -0xFEDCBA9777777777n); -testAdd(0xFEDCBA98n, -0xFEDCBA9876543210n, -0xFEDCBA9777777778n); -testAdd(0xFEDCBA97n, 0xFEDCBA97n, 0x1FDB9752En); -testAdd(0xFEDCBA97n, 0x1234n, 0xFEDCCCCBn); -testAdd(0xFEDCBA97n, 0x3n, 0xFEDCBA9An); -testAdd(0xFEDCBA97n, 0x2n, 0xFEDCBA99n); -testAdd(0xFEDCBA97n, 0x1n, 0xFEDCBA98n); -testAdd(0xFEDCBA97n, 0x0n, 0xFEDCBA97n); -testAdd(0xFEDCBA97n, -0x1n, 0xFEDCBA96n); -testAdd(0xFEDCBA97n, -0x2n, 0xFEDCBA95n); -testAdd(0xFEDCBA97n, -0x3n, 0xFEDCBA94n); -testAdd(0xFEDCBA97n, -0x1234n, 0xFEDCA863n); -testAdd(0xFEDCBA97n, -0xFEDCBA97n, 0x0n); -testAdd(0xFEDCBA97n, -0xFEDCBA98n, -0x1n); -testAdd(0xFEDCBA97n, -0xFEDCBA987654320Fn, -0xFEDCBA9777777778n); -testAdd(0xFEDCBA97n, -0xFEDCBA9876543210n, -0xFEDCBA9777777779n); -testAdd(0x1234n, 0x1234n, 0x2468n); -testAdd(0x1234n, 0x3n, 0x1237n); -testAdd(0x1234n, 0x2n, 0x1236n); -testAdd(0x1234n, 0x1n, 0x1235n); -testAdd(0x1234n, 0x0n, 0x1234n); -testAdd(0x1234n, -0x1n, 0x1233n); -testAdd(0x1234n, -0x2n, 0x1232n); -testAdd(0x1234n, -0x3n, 0x1231n); -testAdd(0x1234n, -0x1234n, 0x0n); -testAdd(0x1234n, -0xFEDCBA97n, -0xFEDCA863n); -testAdd(0x1234n, -0xFEDCBA98n, -0xFEDCA864n); -testAdd(0x1234n, -0xFEDCBA987654320Fn, -0xFEDCBA9876541FDBn); -testAdd(0x1234n, -0xFEDCBA9876543210n, -0xFEDCBA9876541FDCn); -testAdd(0x3n, 0x3n, 0x6n); -testAdd(0x3n, 0x2n, 0x5n); -testAdd(0x3n, 0x1n, 0x4n); -testAdd(0x3n, 0x0n, 0x3n); -testAdd(0x3n, -0x1n, 0x2n); -testAdd(0x3n, -0x2n, 0x1n); -testAdd(0x3n, -0x3n, 0x0n); -testAdd(0x3n, -0x1234n, -0x1231n); -testAdd(0x3n, -0xFEDCBA97n, -0xFEDCBA94n); -testAdd(0x3n, -0xFEDCBA98n, -0xFEDCBA95n); -testAdd(0x3n, -0xFEDCBA987654320Fn, -0xFEDCBA987654320Cn); -testAdd(0x3n, -0xFEDCBA9876543210n, -0xFEDCBA987654320Dn); -testAdd(0x2n, 0x2n, 0x4n); -testAdd(0x2n, 0x1n, 0x3n); -testAdd(0x2n, 0x0n, 0x2n); -testAdd(0x2n, -0x1n, 0x1n); -testAdd(0x2n, -0x2n, 0x0n); -testAdd(0x2n, -0x3n, -0x1n); -testAdd(0x2n, -0x1234n, -0x1232n); -testAdd(0x2n, -0xFEDCBA97n, -0xFEDCBA95n); -testAdd(0x2n, -0xFEDCBA98n, -0xFEDCBA96n); -testAdd(0x2n, -0xFEDCBA987654320Fn, -0xFEDCBA987654320Dn); -testAdd(0x2n, -0xFEDCBA9876543210n, -0xFEDCBA987654320En); -testAdd(0x1n, 0x1n, 0x2n); -testAdd(0x1n, 0x0n, 0x1n); -testAdd(0x1n, -0x1n, 0x0n); -testAdd(0x1n, -0x2n, -0x1n); -testAdd(0x1n, -0x3n, -0x2n); -testAdd(0x1n, -0x1234n, -0x1233n); -testAdd(0x1n, -0xFEDCBA97n, -0xFEDCBA96n); -testAdd(0x1n, -0xFEDCBA98n, -0xFEDCBA97n); -testAdd(0x1n, -0xFEDCBA987654320Fn, -0xFEDCBA987654320En); -testAdd(0x1n, -0xFEDCBA9876543210n, -0xFEDCBA987654320Fn); -testAdd(0x0n, 0x0n, 0x0n); -testAdd(0x0n, -0x1n, -0x1n); -testAdd(0x0n, -0x2n, -0x2n); -testAdd(0x0n, -0x3n, -0x3n); -testAdd(0x0n, -0x1234n, -0x1234n); -testAdd(0x0n, -0xFEDCBA97n, -0xFEDCBA97n); -testAdd(0x0n, -0xFEDCBA98n, -0xFEDCBA98n); -testAdd(0x0n, -0xFEDCBA987654320Fn, -0xFEDCBA987654320Fn); -testAdd(0x0n, -0xFEDCBA9876543210n, -0xFEDCBA9876543210n); -testAdd(-0x1n, -0x1n, -0x2n); -testAdd(-0x1n, -0x2n, -0x3n); -testAdd(-0x1n, -0x3n, -0x4n); -testAdd(-0x1n, -0x1234n, -0x1235n); -testAdd(-0x1n, -0xFEDCBA97n, -0xFEDCBA98n); -testAdd(-0x1n, -0xFEDCBA98n, -0xFEDCBA99n); -testAdd(-0x1n, -0xFEDCBA987654320Fn, -0xFEDCBA9876543210n); -testAdd(-0x1n, -0xFEDCBA9876543210n, -0xFEDCBA9876543211n); -testAdd(-0x2n, -0x2n, -0x4n); -testAdd(-0x2n, -0x3n, -0x5n); -testAdd(-0x2n, -0x1234n, -0x1236n); -testAdd(-0x2n, -0xFEDCBA97n, -0xFEDCBA99n); -testAdd(-0x2n, -0xFEDCBA98n, -0xFEDCBA9An); -testAdd(-0x2n, -0xFEDCBA987654320Fn, -0xFEDCBA9876543211n); -testAdd(-0x2n, -0xFEDCBA9876543210n, -0xFEDCBA9876543212n); -testAdd(-0x3n, -0x3n, -0x6n); -testAdd(-0x3n, -0x1234n, -0x1237n); -testAdd(-0x3n, -0xFEDCBA97n, -0xFEDCBA9An); -testAdd(-0x3n, -0xFEDCBA98n, -0xFEDCBA9Bn); -testAdd(-0x3n, -0xFEDCBA987654320Fn, -0xFEDCBA9876543212n); -testAdd(-0x3n, -0xFEDCBA9876543210n, -0xFEDCBA9876543213n); -testAdd(-0x1234n, -0x1234n, -0x2468n); -testAdd(-0x1234n, -0xFEDCBA97n, -0xFEDCCCCBn); -testAdd(-0x1234n, -0xFEDCBA98n, -0xFEDCCCCCn); -testAdd(-0x1234n, -0xFEDCBA987654320Fn, -0xFEDCBA9876544443n); -testAdd(-0x1234n, -0xFEDCBA9876543210n, -0xFEDCBA9876544444n); -testAdd(-0xFEDCBA97n, -0xFEDCBA97n, -0x1FDB9752En); -testAdd(-0xFEDCBA97n, -0xFEDCBA98n, -0x1FDB9752Fn); -testAdd(-0xFEDCBA97n, -0xFEDCBA987654320Fn, -0xFEDCBA997530ECA6n); -testAdd(-0xFEDCBA97n, -0xFEDCBA9876543210n, -0xFEDCBA997530ECA7n); -testAdd(-0xFEDCBA98n, -0xFEDCBA98n, -0x1FDB97530n); -testAdd(-0xFEDCBA98n, -0xFEDCBA987654320Fn, -0xFEDCBA997530ECA7n); -testAdd(-0xFEDCBA98n, -0xFEDCBA9876543210n, -0xFEDCBA997530ECA8n); -testAdd(-0xFEDCBA987654320Fn, -0xFEDCBA987654320Fn, -0x1FDB97530ECA8641En); -testAdd(-0xFEDCBA987654320Fn, -0xFEDCBA9876543210n, -0x1FDB97530ECA8641Fn); -testAdd(-0xFEDCBA9876543210n, -0xFEDCBA9876543210n, -0x1FDB97530ECA86420n); +assert.sameValue( + -0xFEDCBA9876543210n + -0xFEDCBA9876543210n, + -0x1FDB97530ECA86420n, + 'The result of (-0xFEDCBA9876543210n + -0xFEDCBA9876543210n) is -0x1FDB97530ECA86420n' +); \ No newline at end of file diff --git a/test/language/expressions/addition/bigint-errors.js b/test/language/expressions/addition/bigint-errors.js index 7edc78a7bbba27de92664f86fabdef4910dbad7e..43a4edaa47dc8d5c8fcd9105a74c8c33ee854bfa 100644 --- a/test/language/expressions/addition/bigint-errors.js +++ b/test/language/expressions/addition/bigint-errors.js @@ -5,58 +5,66 @@ description: addition operator ToNumeric with BigInt operands esid: sec-addition-operator-plus-runtime-semantics-evaluation features: [BigInt, Symbol, Symbol.toPrimitive, computed-property-names] ---*/ - assert.throws(TypeError, function() { - Symbol("1") + 0n; -}, "ToBigInt: Symbol => TypeError"); + Symbol('1') + 0n; +}, 'Symbol("1") + 0n throws TypeError'); + assert.throws(TypeError, function() { - 0n + Symbol("1"); -}, "ToBigInt: Symbol => TypeError"); + 0n + Symbol('1'); +}, '0n + Symbol("1") throws TypeError'); + assert.throws(TypeError, function() { - Object(Symbol("1")) + 0n; -}, "ToBigInt: unbox object with internal slot => Symbol => TypeError"); + Object(Symbol('1')) + 0n; +}, 'Object(Symbol("1")) + 0n throws TypeError'); + assert.throws(TypeError, function() { - 0n + Object(Symbol("1")); -}, "ToBigInt: unbox object with internal slot => Symbol => TypeError"); + 0n + Object(Symbol('1')); +}, '0n + Object(Symbol("1")) throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { - return Symbol("1"); + return Symbol('1'); } }) + 0n; -}, "ToBigInt: @@toPrimitive => Symbol => TypeError"); +}, '({[Symbol.toPrimitive]: function() {return Symbol("1");}}) + 0n throws TypeError'); + assert.throws(TypeError, function() { 0n + { [Symbol.toPrimitive]: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: @@toPrimitive => Symbol => TypeError"); +}, '0n + {[Symbol.toPrimitive]: function() {return Symbol("1");}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { - return Symbol("1"); + return Symbol('1'); } }) + 0n; -}, "ToBigInt: valueOf => Symbol => TypeError"); +}, '({valueOf: function() {return Symbol("1");}}) + 0n throws TypeError'); + assert.throws(TypeError, function() { 0n + { valueOf: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: valueOf => Symbol => TypeError"); +}, '0n + {valueOf: function() {return Symbol("1");}} throws TypeError'); + assert.throws(TypeError, function() { ({ toString: function() { - return Symbol("1"); + return Symbol('1'); } }) + 0n; -}, "ToBigInt: toString => Symbol => TypeError"); +}, '({toString: function() {return Symbol("1");}}) + 0n throws TypeError'); + assert.throws(TypeError, function() { 0n + { toString: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: toString => Symbol => TypeError"); +}, '0n + {toString: function() {return Symbol("1");}} throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/addition/bigint-toprimitive.js b/test/language/expressions/addition/bigint-toprimitive.js index 771b50843bab2f8df4acfef7386026f160ab28dc..0162cf422b4f173c60b47765893a90694114665a 100644 --- a/test/language/expressions/addition/bigint-toprimitive.js +++ b/test/language/expressions/addition/bigint-toprimitive.js @@ -5,304 +5,368 @@ description: addition operator ToNumeric with BigInt operands esid: sec-addition-operator-plus-runtime-semantics-evaluation features: [BigInt, Symbol.toPrimitive, computed-property-names] ---*/ - function err() { throw new Test262Error(); } function MyError() {} -assert.sameValue(({ +assert.sameValue({ [Symbol.toPrimitive]: function() { return 2n; }, + valueOf: err, toString: err -}) + 1n, 3n, "ToPrimitive: @@toPrimitive takes precedence"); +} + 1n, 3n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) + 1n) is 3n'); + assert.sameValue(1n + { [Symbol.toPrimitive]: function() { return 2n; }, + valueOf: err, toString: err -}, 3n, "ToPrimitive: @@toPrimitive takes precedence"); -assert.sameValue(({ +}, 3n, 'The result of (1n + {[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) is 3n'); + +assert.sameValue({ valueOf: function() { return 2n; }, + toString: err -}) + 1n, 3n, "ToPrimitive: valueOf takes precedence over toString"); +} + 1n, 3n, 'The result of (({valueOf: function() {return 2n;}, toString: err}) + 1n) is 3n'); + assert.sameValue(1n + { valueOf: function() { return 2n; }, + toString: err -}, 3n, "ToPrimitive: valueOf takes precedence over toString"); -assert.sameValue(({ +}, 3n, 'The result of (1n + {valueOf: function() {return 2n;}, toString: err}) is 3n'); + +assert.sameValue({ toString: function() { return 2n; } -}) + 1n, 3n, "ToPrimitive: toString with no valueOf"); +} + 1n, 3n, 'The result of (({toString: function() {return 2n;}}) + 1n) is 3n'); + assert.sameValue(1n + { toString: function() { return 2n; } -}, 3n, "ToPrimitive: toString with no valueOf"); -assert.sameValue(({ +}, 3n, 'The result of (1n + {toString: function() {return 2n;}}) is 3n'); + +assert.sameValue({ [Symbol.toPrimitive]: undefined, + valueOf: function() { return 2n; } -}) + 1n, 3n, "ToPrimitive: skip @@toPrimitive when it's undefined"); +} + 1n, 3n, 'The result of (({[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) + 1n) is 3n'); + assert.sameValue(1n + { [Symbol.toPrimitive]: undefined, + valueOf: function() { return 2n; } -}, 3n, "ToPrimitive: skip @@toPrimitive when it's undefined"); -assert.sameValue(({ +}, 3n, 'The result of (1n + {[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) is 3n'); + +assert.sameValue({ [Symbol.toPrimitive]: null, + valueOf: function() { return 2n; } -}) + 1n, 3n, "ToPrimitive: skip @@toPrimitive when it's null"); +} + 1n, 3n, 'The result of (({[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) + 1n) is 3n'); + assert.sameValue(1n + { [Symbol.toPrimitive]: null, + valueOf: function() { return 2n; } -}, 3n, "ToPrimitive: skip @@toPrimitive when it's null"); -assert.sameValue(({ +}, 3n, 'The result of (1n + {[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) is 3n'); + +assert.sameValue({ valueOf: null, + toString: function() { return 2n; } -}) + 1n, 3n, "ToPrimitive: skip valueOf when it's not callable"); +} + 1n, 3n, 'The result of (({valueOf: null, toString: function() {return 2n;}}) + 1n) is 3n'); + assert.sameValue(1n + { valueOf: null, + toString: function() { return 2n; } -}, 3n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 3n, 'The result of (1n + {valueOf: null, toString: function() {return 2n;}}) is 3n'); + +assert.sameValue({ valueOf: 1, + toString: function() { return 2n; } -}) + 1n, 3n, "ToPrimitive: skip valueOf when it's not callable"); +} + 1n, 3n, 'The result of (({valueOf: 1, toString: function() {return 2n;}}) + 1n) is 3n'); + assert.sameValue(1n + { valueOf: 1, + toString: function() { return 2n; } -}, 3n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 3n, 'The result of (1n + {valueOf: 1, toString: function() {return 2n;}}) is 3n'); + +assert.sameValue({ valueOf: {}, + toString: function() { return 2n; } -}) + 1n, 3n, "ToPrimitive: skip valueOf when it's not callable"); +} + 1n, 3n, 'The result of (({valueOf: {}, toString: function() {return 2n;}}) + 1n) is 3n'); + assert.sameValue(1n + { valueOf: {}, + toString: function() { return 2n; } -}, 3n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 3n, 'The result of (1n + {valueOf: {}, toString: function() {return 2n;}}) is 3n'); + +assert.sameValue({ valueOf: function() { return {}; }, + toString: function() { return 2n; } -}) + 1n, 3n, "ToPrimitive: skip valueOf when it returns an object"); +} + 1n, 3n, 'The result of (({valueOf: function() {return {};}, toString: function() {return 2n;}}) + 1n) is 3n'); + assert.sameValue(1n + { valueOf: function() { return {}; }, + toString: function() { return 2n; } -}, 3n, "ToPrimitive: skip valueOf when it returns an object"); -assert.sameValue(({ +}, 3n, 'The result of (1n + {valueOf: function() {return {};}, toString: function() {return 2n;}}) is 3n'); + +assert.sameValue({ valueOf: function() { return Object(12345); }, + toString: function() { return 2n; } -}) + 1n, 3n, "ToPrimitive: skip valueOf when it returns an object"); +} + 1n, 3n, 'The result of (({valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) + 1n) is 3n'); + assert.sameValue(1n + { valueOf: function() { return Object(12345); }, + toString: function() { return 2n; } -}, 3n, "ToPrimitive: skip valueOf when it returns an object"); +}, 3n, 'The result of (1n + {valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) is 3n'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: 1 }) + 0n; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '({[Symbol.toPrimitive]: 1}) + 0n throws TypeError'); + assert.throws(TypeError, function() { 0n + { [Symbol.toPrimitive]: 1 }; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '0n + {[Symbol.toPrimitive]: 1} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: {} }) + 0n; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '({[Symbol.toPrimitive]: {}}) + 0n throws TypeError'); + assert.throws(TypeError, function() { 0n + { [Symbol.toPrimitive]: {} }; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '0n + {[Symbol.toPrimitive]: {}} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { return Object(1); } }) + 0n; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '({[Symbol.toPrimitive]: function() {return Object(1);}}) + 0n throws TypeError'); + assert.throws(TypeError, function() { 0n + { [Symbol.toPrimitive]: function() { return Object(1); } }; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '0n + {[Symbol.toPrimitive]: function() {return Object(1);}} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { return {}; } }) + 0n; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '({[Symbol.toPrimitive]: function() {return {};}}) + 0n throws TypeError'); + assert.throws(TypeError, function() { 0n + { [Symbol.toPrimitive]: function() { return {}; } }; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '0n + {[Symbol.toPrimitive]: function() {return {};}} throws TypeError'); + assert.throws(MyError, function() { ({ [Symbol.toPrimitive]: function() { throw new MyError(); } }) + 0n; -}, "ToPrimitive: propagate errors from @@toPrimitive"); +}, '({[Symbol.toPrimitive]: function() {throw new MyError();}}) + 0n throws MyError'); + assert.throws(MyError, function() { 0n + { [Symbol.toPrimitive]: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from @@toPrimitive"); +}, '0n + {[Symbol.toPrimitive]: function() {throw new MyError();}} throws MyError'); + assert.throws(MyError, function() { ({ valueOf: function() { throw new MyError(); } }) + 0n; -}, "ToPrimitive: propagate errors from valueOf"); +}, '({valueOf: function() {throw new MyError();}}) + 0n throws MyError'); + assert.throws(MyError, function() { 0n + { valueOf: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from valueOf"); +}, '0n + {valueOf: function() {throw new MyError();}} throws MyError'); + assert.throws(MyError, function() { ({ toString: function() { throw new MyError(); } }) + 0n; -}, "ToPrimitive: propagate errors from toString"); +}, '({toString: function() {throw new MyError();}}) + 0n throws MyError'); + assert.throws(MyError, function() { 0n + { toString: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from toString"); +}, '0n + {toString: function() {throw new MyError();}} throws MyError'); + assert.throws(TypeError, function() { ({ valueOf: null, toString: null }) + 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: null, toString: null}) + 0n throws TypeError'); + assert.throws(TypeError, function() { 0n + { valueOf: null, toString: null }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n + {valueOf: null, toString: null} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: 1, toString: 1 }) + 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: 1, toString: 1}) + 0n throws TypeError'); + assert.throws(TypeError, function() { 0n + { valueOf: 1, toString: 1 }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n + {valueOf: 1, toString: 1} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: {}, toString: {} }) + 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: {}, toString: {}}) + 0n throws TypeError'); + assert.throws(TypeError, function() { 0n + { valueOf: {}, toString: {} }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n + {valueOf: {}, toString: {}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { return Object(1); }, + toString: function() { return Object(1); } }) + 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: function() {return Object(1);}, toString: function() {return Object(1);}}) + 0n throws TypeError'); + assert.throws(TypeError, function() { 0n + { valueOf: function() { return Object(1); }, + toString: function() { return Object(1); } }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n + {valueOf: function() {return Object(1);}, toString: function() {return Object(1);}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { return {}; }, + toString: function() { return {}; } }) + 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: function() {return {};}, toString: function() {return {};}}) + 0n throws TypeError'); + assert.throws(TypeError, function() { 0n + { valueOf: function() { return {}; }, + toString: function() { return {}; } }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n + {valueOf: function() {return {};}, toString: function() {return {};}} throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/addition/bigint-wrapped-values.js b/test/language/expressions/addition/bigint-wrapped-values.js index a69e10b585d330a4ae16329545e2b15d80b81f76..ef9ac31fc2b4000743694652d083174e079cb900 100644 --- a/test/language/expressions/addition/bigint-wrapped-values.js +++ b/test/language/expressions/addition/bigint-wrapped-values.js @@ -5,36 +5,41 @@ description: addition operator ToNumeric with BigInt operands esid: sec-addition-operator-plus-runtime-semantics-evaluation features: [BigInt, Symbol.toPrimitive, computed-property-names] ---*/ +assert.sameValue(Object(2n) + 1n, 3n, 'The result of (Object(2n) + 1n) is 3n'); +assert.sameValue(1n + Object(2n), 3n, 'The result of (1n + Object(2n)) is 3n'); -assert.sameValue(Object(2n) + 1n, 3n, "ToPrimitive: unbox object with internal slot"); -assert.sameValue(1n + Object(2n), 3n, "ToPrimitive: unbox object with internal slot"); -assert.sameValue(({ +assert.sameValue({ [Symbol.toPrimitive]: function() { return 2n; } -}) + 1n, 3n, "ToPrimitive: @@toPrimitive"); +} + 1n, 3n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}}) + 1n) is 3n'); + assert.sameValue(1n + { [Symbol.toPrimitive]: function() { return 2n; } -}, 3n, "ToPrimitive: @@toPrimitive"); -assert.sameValue(({ +}, 3n, 'The result of (1n + {[Symbol.toPrimitive]: function() {return 2n;}}) is 3n'); + +assert.sameValue({ valueOf: function() { return 2n; } -}) + 1n, 3n, "ToPrimitive: valueOf"); +} + 1n, 3n, 'The result of (({valueOf: function() {return 2n;}}) + 1n) is 3n'); + assert.sameValue(1n + { valueOf: function() { return 2n; } -}, 3n, "ToPrimitive: valueOf"); -assert.sameValue(({ +}, 3n, 'The result of (1n + {valueOf: function() {return 2n;}}) is 3n'); + +assert.sameValue({ toString: function() { return 2n; } -}) + 1n, 3n, "ToPrimitive: toString"); +} + 1n, 3n, 'The result of (({toString: function() {return 2n;}}) + 1n) is 3n'); + assert.sameValue(1n + { toString: function() { return 2n; } -}, 3n, "ToPrimitive: toString"); +}, 3n, 'The result of (1n + {toString: function() {return 2n;}}) is 3n'); \ No newline at end of file diff --git a/test/language/expressions/bitwise-and/bigint-and-number.js b/test/language/expressions/bitwise-and/bigint-and-number.js index db1b23e8e188d4184f8a1c171cb6196e0fddb278..b347a2ec8dbc1659f77b867c2a579271568e6f98 100644 --- a/test/language/expressions/bitwise-and/bigint-and-number.js +++ b/test/language/expressions/bitwise-and/bigint-and-number.js @@ -9,24 +9,82 @@ info: | Let rnum be ? ToNumeric(rightValue). If Type(lnum) does not equal Type(rnum), throw a TypeError exception. ---*/ +assert.throws(TypeError, function() { + 1n & 1; +}, '1n & 1 throws TypeError'); -assert.throws(TypeError, function() { 1n & 1; }, "1n & 1 throws TypeError"); -assert.throws(TypeError, function() { 1 & 1n; }, "1 & 1n throws TypeError"); -assert.throws(TypeError, function() { Object(1n) & 1; }, "Object(1n) & 1 throws TypeError"); -assert.throws(TypeError, function() { 1 & Object(1n); }, "1 & Object(1n) throws TypeError"); -assert.throws(TypeError, function() { 1n & Object(1); }, "1n & Object(1) throws TypeError"); -assert.throws(TypeError, function() { Object(1) & 1n; }, "Object(1) & 1n throws TypeError"); -assert.throws(TypeError, function() { Object(1n) & Object(1); }, "Object(1n) & Object(1) throws TypeError"); -assert.throws(TypeError, function() { Object(1) & Object(1n); }, "Object(1) & Object(1n) throws TypeError"); -assert.throws(TypeError, function() { 1n & NaN; }, "1n & NaN throws TypeError"); -assert.throws(TypeError, function() { NaN & 1n; }, "NaN & 1n throws TypeError"); -assert.throws(TypeError, function() { 1n & Infinity; }, "1n & Infinity throws TypeError"); -assert.throws(TypeError, function() { Infinity & 1n; }, "Infinity & 1n throws TypeError"); -assert.throws(TypeError, function() { 1n & true; }, "1n & true throws TypeError"); -assert.throws(TypeError, function() { true & 1n; }, "true & 1n throws TypeError"); -assert.throws(TypeError, function() { 1n & "1"; }, '1n & "1" throws TypeError'); -assert.throws(TypeError, function() { "1" & 1n; }, '"1" & 1n throws TypeError'); -assert.throws(TypeError, function() { 1n & null; }, "1n & null throws TypeError"); -assert.throws(TypeError, function() { null & 1n; }, "null & 1n throws TypeError"); -assert.throws(TypeError, function() { 1n & undefined; }, "1n & undefined throws TypeError"); -assert.throws(TypeError, function() { undefined & 1n; }, "undefined & 1n throws TypeError"); +assert.throws(TypeError, function() { + 1 & 1n; +}, '1 & 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) & 1; +}, 'Object(1n) & 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 & Object(1n); +}, '1 & Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n & Object(1); +}, '1n & Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) & 1n; +}, 'Object(1) & 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) & Object(1); +}, 'Object(1n) & Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) & Object(1n); +}, 'Object(1) & Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n & NaN; +}, '1n & NaN throws TypeError'); + +assert.throws(TypeError, function() { + NaN & 1n; +}, 'NaN & 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n & Infinity; +}, '1n & Infinity throws TypeError'); + +assert.throws(TypeError, function() { + Infinity & 1n; +}, 'Infinity & 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n & true; +}, '1n & true throws TypeError'); + +assert.throws(TypeError, function() { + true & 1n; +}, 'true & 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n & '1'; +}, '1n & "1" throws TypeError'); + +assert.throws(TypeError, function() { + '1' & 1n; +}, '"1" & 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n & null; +}, '1n & null throws TypeError'); + +assert.throws(TypeError, function() { + null & 1n; +}, 'null & 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n & undefined; +}, '1n & undefined throws TypeError'); + +assert.throws(TypeError, function() { + undefined & 1n; +}, 'undefined & 1n throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/bitwise-and/bigint-errors.js b/test/language/expressions/bitwise-and/bigint-errors.js index 0f57b1431c75fa56fecacd7c6fb7cb7157134dbf..f4fe031516c02ea5273ed0998bc0308c964b253d 100644 --- a/test/language/expressions/bitwise-and/bigint-errors.js +++ b/test/language/expressions/bitwise-and/bigint-errors.js @@ -5,58 +5,66 @@ description: bitwise-and operator ToNumeric with BigInt operands esid: sec-binary-bitwise-operators-runtime-semantics-evaluation features: [BigInt, Symbol, Symbol.toPrimitive, computed-property-names] ---*/ - assert.throws(TypeError, function() { - Symbol("1") & 0n; -}, "ToBigInt: Symbol => TypeError"); + Symbol('1') & 0n; +}, 'Symbol("1") & 0n throws TypeError'); + assert.throws(TypeError, function() { - 0n & Symbol("1"); -}, "ToBigInt: Symbol => TypeError"); + 0n & Symbol('1'); +}, '0n & Symbol("1") throws TypeError'); + assert.throws(TypeError, function() { - Object(Symbol("1")) & 0n; -}, "ToBigInt: unbox object with internal slot => Symbol => TypeError"); + Object(Symbol('1')) & 0n; +}, 'Object(Symbol("1")) & 0n throws TypeError'); + assert.throws(TypeError, function() { - 0n & Object(Symbol("1")); -}, "ToBigInt: unbox object with internal slot => Symbol => TypeError"); + 0n & Object(Symbol('1')); +}, '0n & Object(Symbol("1")) throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { - return Symbol("1"); + return Symbol('1'); } }) & 0n; -}, "ToBigInt: @@toPrimitive => Symbol => TypeError"); +}, '({[Symbol.toPrimitive]: function() {return Symbol("1");}}) & 0n throws TypeError'); + assert.throws(TypeError, function() { 0n & { [Symbol.toPrimitive]: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: @@toPrimitive => Symbol => TypeError"); +}, '0n & {[Symbol.toPrimitive]: function() {return Symbol("1");}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { - return Symbol("1"); + return Symbol('1'); } }) & 0n; -}, "ToBigInt: valueOf => Symbol => TypeError"); +}, '({valueOf: function() {return Symbol("1");}}) & 0n throws TypeError'); + assert.throws(TypeError, function() { 0n & { valueOf: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: valueOf => Symbol => TypeError"); +}, '0n & {valueOf: function() {return Symbol("1");}} throws TypeError'); + assert.throws(TypeError, function() { ({ toString: function() { - return Symbol("1"); + return Symbol('1'); } }) & 0n; -}, "ToBigInt: toString => Symbol => TypeError"); +}, '({toString: function() {return Symbol("1");}}) & 0n throws TypeError'); + assert.throws(TypeError, function() { 0n & { toString: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: toString => Symbol => TypeError"); +}, '0n & {toString: function() {return Symbol("1");}} throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/bitwise-and/bigint-non-primitive.js b/test/language/expressions/bitwise-and/bigint-non-primitive.js index 2afe7e98d802d8ca5c8cd24e632a26fd8ef82452..393abed9fb4ff18f563c8da0af98c56180d391ae 100644 --- a/test/language/expressions/bitwise-and/bigint-non-primitive.js +++ b/test/language/expressions/bitwise-and/bigint-non-primitive.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Bitwise AND for BigInt non-primitive values esid: sec-binary-bitwise-operators-runtime-semantics-evaluation @@ -13,30 +12,70 @@ info: | features: [BigInt] ---*/ +assert.sameValue( + Object(0b101n) & 0b011n, + 0b001n, + 'The result of (Object(0b101n) & 0b011n) is 0b001n' +); -assert.sameValue(Object(0b101n) & 0b011n, 0b001n, "Object(0b101n) & 0b011n === 0b001n"); -assert.sameValue(0b011n & Object(0b101n), 0b001n, "0b011n & Object(0b101n) === 0b001n"); -assert.sameValue(Object(0b101n) & Object(0b011n), 0b001n, "Object(0b101n) & Object(0b011n) === 0b001n"); +assert.sameValue( + 0b011n & Object(0b101n), + 0b001n, + 'The result of (0b011n & Object(0b101n)) is 0b001n' +); + +assert.sameValue( + Object(0b101n) & Object(0b011n), + 0b001n, + 'The result of (Object(0b101n) & Object(0b011n)) is 0b001n' +); function err() { throw new Test262Error(); } -assert.sameValue( - {[Symbol.toPrimitive]: function() { return 0b101n; }, valueOf: err, toString: err} & 0b011n, 0b001n, - "primitive from @@toPrimitive"); -assert.sameValue( - 0b011n & {[Symbol.toPrimitive]: function() { return 0b101n; }, valueOf: err, toString: err}, 0b001n, - "primitive from @@toPrimitive"); -assert.sameValue( - {valueOf: function() { return 0b101n; }, toString: err} & 0b011n, 0b001n, - "primitive from {}.valueOf"); -assert.sameValue( - 0b011n & {valueOf: function() { return 0b101n; }, toString: err}, 0b001n, - "primitive from {}.valueOf"); -assert.sameValue( - {toString: function() { return 0b101n; }} & 0b011n, 0b001n, - "primitive from {}.toString"); -assert.sameValue( - 0b011n & {toString: function() { return 0b101n; }}, 0b001n, - "primitive from {}.toString"); +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 0b101n; + }, + + valueOf: err, + toString: err +} & 0b011n, 0b001n, 'The result of (({[Symbol.toPrimitive]: function() {return 0b101n;}, valueOf: err, toString: err}) & 0b011n) is 0b001n'); + +assert.sameValue(0b011n & { + [Symbol.toPrimitive]: function() { + return 0b101n; + }, + + valueOf: err, + toString: err +}, 0b001n, 'The result of (0b011n & {[Symbol.toPrimitive]: function() {return 0b101n;}, valueOf: err, toString: err}) is 0b001n'); + +assert.sameValue({ + valueOf: function() { + return 0b101n; + }, + + toString: err +} & 0b011n, 0b001n, 'The result of (({valueOf: function() {return 0b101n;}, toString: err}) & 0b011n) is 0b001n'); + +assert.sameValue(0b011n & { + valueOf: function() { + return 0b101n; + }, + + toString: err +}, 0b001n, 'The result of (0b011n & {valueOf: function() {return 0b101n;}, toString: err}) is 0b001n'); + +assert.sameValue({ + toString: function() { + return 0b101n; + } +} & 0b011n, 0b001n, 'The result of (({toString: function() {return 0b101n;}}) & 0b011n) is 0b001n'); + +assert.sameValue(0b011n & { + toString: function() { + return 0b101n; + } +}, 0b001n, 'The result of (0b011n & {toString: function() {return 0b101n;}}) is 0b001n'); \ No newline at end of file diff --git a/test/language/expressions/bitwise-and/bigint-toprimitive.js b/test/language/expressions/bitwise-and/bigint-toprimitive.js index 88ed17b6c18d1280358e13aacf8000373c835040..8b12907dee4da955b02b00b6c0fbc155c86e9127 100644 --- a/test/language/expressions/bitwise-and/bigint-toprimitive.js +++ b/test/language/expressions/bitwise-and/bigint-toprimitive.js @@ -5,304 +5,368 @@ description: bitwise-and operator ToNumeric with BigInt operands esid: sec-binary-bitwise-operators-runtime-semantics-evaluation features: [BigInt, Symbol.toPrimitive, computed-property-names] ---*/ - function err() { throw new Test262Error(); } function MyError() {} -assert.sameValue(({ +assert.sameValue({ [Symbol.toPrimitive]: function() { return 2n; }, + valueOf: err, toString: err -}) & 3n, 2n, "ToPrimitive: @@toPrimitive takes precedence"); +} & 3n, 2n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) & 3n) is 2n'); + assert.sameValue(3n & { [Symbol.toPrimitive]: function() { return 2n; }, + valueOf: err, toString: err -}, 2n, "ToPrimitive: @@toPrimitive takes precedence"); -assert.sameValue(({ +}, 2n, 'The result of (3n & {[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) is 2n'); + +assert.sameValue({ valueOf: function() { return 2n; }, + toString: err -}) & 3n, 2n, "ToPrimitive: valueOf takes precedence over toString"); +} & 3n, 2n, 'The result of (({valueOf: function() {return 2n;}, toString: err}) & 3n) is 2n'); + assert.sameValue(3n & { valueOf: function() { return 2n; }, + toString: err -}, 2n, "ToPrimitive: valueOf takes precedence over toString"); -assert.sameValue(({ +}, 2n, 'The result of (3n & {valueOf: function() {return 2n;}, toString: err}) is 2n'); + +assert.sameValue({ toString: function() { return 2n; } -}) & 3n, 2n, "ToPrimitive: toString with no valueOf"); +} & 3n, 2n, 'The result of (({toString: function() {return 2n;}}) & 3n) is 2n'); + assert.sameValue(3n & { toString: function() { return 2n; } -}, 2n, "ToPrimitive: toString with no valueOf"); -assert.sameValue(({ +}, 2n, 'The result of (3n & {toString: function() {return 2n;}}) is 2n'); + +assert.sameValue({ [Symbol.toPrimitive]: undefined, + valueOf: function() { return 2n; } -}) & 3n, 2n, "ToPrimitive: skip @@toPrimitive when it's undefined"); +} & 3n, 2n, 'The result of (({[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) & 3n) is 2n'); + assert.sameValue(3n & { [Symbol.toPrimitive]: undefined, + valueOf: function() { return 2n; } -}, 2n, "ToPrimitive: skip @@toPrimitive when it's undefined"); -assert.sameValue(({ +}, 2n, 'The result of (3n & {[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) is 2n'); + +assert.sameValue({ [Symbol.toPrimitive]: null, + valueOf: function() { return 2n; } -}) & 3n, 2n, "ToPrimitive: skip @@toPrimitive when it's null"); +} & 3n, 2n, 'The result of (({[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) & 3n) is 2n'); + assert.sameValue(3n & { [Symbol.toPrimitive]: null, + valueOf: function() { return 2n; } -}, 2n, "ToPrimitive: skip @@toPrimitive when it's null"); -assert.sameValue(({ +}, 2n, 'The result of (3n & {[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) is 2n'); + +assert.sameValue({ valueOf: null, + toString: function() { return 2n; } -}) & 3n, 2n, "ToPrimitive: skip valueOf when it's not callable"); +} & 3n, 2n, 'The result of (({valueOf: null, toString: function() {return 2n;}}) & 3n) is 2n'); + assert.sameValue(3n & { valueOf: null, + toString: function() { return 2n; } -}, 2n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 2n, 'The result of (3n & {valueOf: null, toString: function() {return 2n;}}) is 2n'); + +assert.sameValue({ valueOf: 1, + toString: function() { return 2n; } -}) & 3n, 2n, "ToPrimitive: skip valueOf when it's not callable"); +} & 3n, 2n, 'The result of (({valueOf: 1, toString: function() {return 2n;}}) & 3n) is 2n'); + assert.sameValue(3n & { valueOf: 1, + toString: function() { return 2n; } -}, 2n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 2n, 'The result of (3n & {valueOf: 1, toString: function() {return 2n;}}) is 2n'); + +assert.sameValue({ valueOf: {}, + toString: function() { return 2n; } -}) & 3n, 2n, "ToPrimitive: skip valueOf when it's not callable"); +} & 3n, 2n, 'The result of (({valueOf: {}, toString: function() {return 2n;}}) & 3n) is 2n'); + assert.sameValue(3n & { valueOf: {}, + toString: function() { return 2n; } -}, 2n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 2n, 'The result of (3n & {valueOf: {}, toString: function() {return 2n;}}) is 2n'); + +assert.sameValue({ valueOf: function() { return {}; }, + toString: function() { return 2n; } -}) & 3n, 2n, "ToPrimitive: skip valueOf when it returns an object"); +} & 3n, 2n, 'The result of (({valueOf: function() {return {};}, toString: function() {return 2n;}}) & 3n) is 2n'); + assert.sameValue(3n & { valueOf: function() { return {}; }, + toString: function() { return 2n; } -}, 2n, "ToPrimitive: skip valueOf when it returns an object"); -assert.sameValue(({ +}, 2n, 'The result of (3n & {valueOf: function() {return {};}, toString: function() {return 2n;}}) is 2n'); + +assert.sameValue({ valueOf: function() { return Object(12345); }, + toString: function() { return 2n; } -}) & 3n, 2n, "ToPrimitive: skip valueOf when it returns an object"); +} & 3n, 2n, 'The result of (({valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) & 3n) is 2n'); + assert.sameValue(3n & { valueOf: function() { return Object(12345); }, + toString: function() { return 2n; } -}, 2n, "ToPrimitive: skip valueOf when it returns an object"); +}, 2n, 'The result of (3n & {valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) is 2n'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: 1 }) & 0n; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '({[Symbol.toPrimitive]: 1}) & 0n throws TypeError'); + assert.throws(TypeError, function() { 0n & { [Symbol.toPrimitive]: 1 }; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '0n & {[Symbol.toPrimitive]: 1} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: {} }) & 0n; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '({[Symbol.toPrimitive]: {}}) & 0n throws TypeError'); + assert.throws(TypeError, function() { 0n & { [Symbol.toPrimitive]: {} }; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '0n & {[Symbol.toPrimitive]: {}} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { return Object(1); } }) & 0n; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '({[Symbol.toPrimitive]: function() {return Object(1);}}) & 0n throws TypeError'); + assert.throws(TypeError, function() { 0n & { [Symbol.toPrimitive]: function() { return Object(1); } }; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '0n & {[Symbol.toPrimitive]: function() {return Object(1);}} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { return {}; } }) & 0n; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '({[Symbol.toPrimitive]: function() {return {};}}) & 0n throws TypeError'); + assert.throws(TypeError, function() { 0n & { [Symbol.toPrimitive]: function() { return {}; } }; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '0n & {[Symbol.toPrimitive]: function() {return {};}} throws TypeError'); + assert.throws(MyError, function() { ({ [Symbol.toPrimitive]: function() { throw new MyError(); } }) & 0n; -}, "ToPrimitive: propagate errors from @@toPrimitive"); +}, '({[Symbol.toPrimitive]: function() {throw new MyError();}}) & 0n throws MyError'); + assert.throws(MyError, function() { 0n & { [Symbol.toPrimitive]: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from @@toPrimitive"); +}, '0n & {[Symbol.toPrimitive]: function() {throw new MyError();}} throws MyError'); + assert.throws(MyError, function() { ({ valueOf: function() { throw new MyError(); } }) & 0n; -}, "ToPrimitive: propagate errors from valueOf"); +}, '({valueOf: function() {throw new MyError();}}) & 0n throws MyError'); + assert.throws(MyError, function() { 0n & { valueOf: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from valueOf"); +}, '0n & {valueOf: function() {throw new MyError();}} throws MyError'); + assert.throws(MyError, function() { ({ toString: function() { throw new MyError(); } }) & 0n; -}, "ToPrimitive: propagate errors from toString"); +}, '({toString: function() {throw new MyError();}}) & 0n throws MyError'); + assert.throws(MyError, function() { 0n & { toString: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from toString"); +}, '0n & {toString: function() {throw new MyError();}} throws MyError'); + assert.throws(TypeError, function() { ({ valueOf: null, toString: null }) & 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: null, toString: null}) & 0n throws TypeError'); + assert.throws(TypeError, function() { 0n & { valueOf: null, toString: null }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n & {valueOf: null, toString: null} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: 1, toString: 1 }) & 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: 1, toString: 1}) & 0n throws TypeError'); + assert.throws(TypeError, function() { 0n & { valueOf: 1, toString: 1 }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n & {valueOf: 1, toString: 1} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: {}, toString: {} }) & 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: {}, toString: {}}) & 0n throws TypeError'); + assert.throws(TypeError, function() { 0n & { valueOf: {}, toString: {} }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n & {valueOf: {}, toString: {}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { return Object(1); }, + toString: function() { return Object(1); } }) & 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: function() {return Object(1);}, toString: function() {return Object(1);}}) & 0n throws TypeError'); + assert.throws(TypeError, function() { 0n & { valueOf: function() { return Object(1); }, + toString: function() { return Object(1); } }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n & {valueOf: function() {return Object(1);}, toString: function() {return Object(1);}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { return {}; }, + toString: function() { return {}; } }) & 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: function() {return {};}, toString: function() {return {};}}) & 0n throws TypeError'); + assert.throws(TypeError, function() { 0n & { valueOf: function() { return {}; }, + toString: function() { return {}; } }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n & {valueOf: function() {return {};}, toString: function() {return {};}} throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/bitwise-and/bigint-wrapped-values.js b/test/language/expressions/bitwise-and/bigint-wrapped-values.js index 381ca6158fdd1566c661aa54c7e2d64c1dea0e9c..9a0f6c211e93e3d44495bd64c092b67a48de12f1 100644 --- a/test/language/expressions/bitwise-and/bigint-wrapped-values.js +++ b/test/language/expressions/bitwise-and/bigint-wrapped-values.js @@ -5,36 +5,41 @@ description: bitwise-and operator ToNumeric with BigInt operands esid: sec-binary-bitwise-operators-runtime-semantics-evaluation features: [BigInt, Symbol.toPrimitive, computed-property-names] ---*/ +assert.sameValue(Object(2n) & 3n, 2n, 'The result of (Object(2n) & 3n) is 2n'); +assert.sameValue(3n & Object(2n), 2n, 'The result of (3n & Object(2n)) is 2n'); -assert.sameValue(Object(2n) & 3n, 2n, "ToPrimitive: unbox object with internal slot"); -assert.sameValue(3n & Object(2n), 2n, "ToPrimitive: unbox object with internal slot"); -assert.sameValue(({ +assert.sameValue({ [Symbol.toPrimitive]: function() { return 2n; } -}) & 3n, 2n, "ToPrimitive: @@toPrimitive"); +} & 3n, 2n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}}) & 3n) is 2n'); + assert.sameValue(3n & { [Symbol.toPrimitive]: function() { return 2n; } -}, 2n, "ToPrimitive: @@toPrimitive"); -assert.sameValue(({ +}, 2n, 'The result of (3n & {[Symbol.toPrimitive]: function() {return 2n;}}) is 2n'); + +assert.sameValue({ valueOf: function() { return 2n; } -}) & 3n, 2n, "ToPrimitive: valueOf"); +} & 3n, 2n, 'The result of (({valueOf: function() {return 2n;}}) & 3n) is 2n'); + assert.sameValue(3n & { valueOf: function() { return 2n; } -}, 2n, "ToPrimitive: valueOf"); -assert.sameValue(({ +}, 2n, 'The result of (3n & {valueOf: function() {return 2n;}}) is 2n'); + +assert.sameValue({ toString: function() { return 2n; } -}) & 3n, 2n, "ToPrimitive: toString"); +} & 3n, 2n, 'The result of (({toString: function() {return 2n;}}) & 3n) is 2n'); + assert.sameValue(3n & { toString: function() { return 2n; } -}, 2n, "ToPrimitive: toString"); +}, 2n, 'The result of (3n & {toString: function() {return 2n;}}) is 2n'); \ No newline at end of file diff --git a/test/language/expressions/bitwise-not/bigint-non-primitive.js b/test/language/expressions/bitwise-not/bigint-non-primitive.js index 862219a2bc170ba3b7eea2d4f774dda370351724..9a9c178bcb1026c60e5e0b764de4e3fa531aa1b9 100644 --- a/test/language/expressions/bitwise-not/bigint-non-primitive.js +++ b/test/language/expressions/bitwise-not/bigint-non-primitive.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Bitwise NOT for BigInt object wrappers esid: sec-bitwise-not-operator-runtime-semantics-evaluation @@ -15,19 +14,31 @@ info: | features: [BigInt, Symbol.toPrimitive] ---*/ - -assert.sameValue(~Object(1n), -2n, "~Object(1n) === -2n"); +assert.sameValue(~Object(1n), -2n, 'The value of ~Object(1n) is -2n'); function err() { throw new Test262Error(); } -assert.sameValue( - ~{[Symbol.toPrimitive]: function() { return 1n; }, valueOf: err, toString: err}, -2n, - "primitive from @@toPrimitive"); -assert.sameValue( - ~{valueOf: function() { return 1n; }, toString: err}, -2n, - "primitive from {}.valueOf"); -assert.sameValue( - ~{toString: function() { return 1n; }}, -2n, - "primitive from {}.toString"); +assert.sameValue(~{ + [Symbol.toPrimitive]: function() { + return 1n; + }, + + valueOf: err, + toString: err +}, -2n, 'The value of ~{[Symbol.toPrimitive]: function() {return 1n;}, valueOf: err, toString: err} is -2n'); + +assert.sameValue(~{ + valueOf: function() { + return 1n; + }, + + toString: err +}, -2n, 'The value of ~{valueOf: function() {return 1n;}, toString: err} is -2n'); + +assert.sameValue(~{ + toString: function() { + return 1n; + } +}, -2n, 'The value of ~{toString: function() {return 1n;}} is -2n'); \ No newline at end of file diff --git a/test/language/expressions/bitwise-or/bigint-and-number.js b/test/language/expressions/bitwise-or/bigint-and-number.js index dd9b809702b39e3943dd302dee281a3cd1fcb590..acf96ff247be9982b8b54c2c4204b17077b38c73 100644 --- a/test/language/expressions/bitwise-or/bigint-and-number.js +++ b/test/language/expressions/bitwise-or/bigint-and-number.js @@ -9,24 +9,82 @@ info: | Let rnum be ? ToNumeric(rightValue). If Type(lnum) does not equal Type(rnum), throw a TypeError exception. ---*/ +assert.throws(TypeError, function() { + 1n | 1; +}, '1n | 1 throws TypeError'); -assert.throws(TypeError, function() { 1n | 1; }, "1n | 1 throws TypeError"); -assert.throws(TypeError, function() { 1 | 1n; }, "1 | 1n throws TypeError"); -assert.throws(TypeError, function() { Object(1n) | 1; }, "Object(1n) | 1 throws TypeError"); -assert.throws(TypeError, function() { 1 | Object(1n); }, "1 | Object(1n) throws TypeError"); -assert.throws(TypeError, function() { 1n | Object(1); }, "1n | Object(1) throws TypeError"); -assert.throws(TypeError, function() { Object(1) | 1n; }, "Object(1) | 1n throws TypeError"); -assert.throws(TypeError, function() { Object(1n) | Object(1); }, "Object(1n) | Object(1) throws TypeError"); -assert.throws(TypeError, function() { Object(1) | Object(1n); }, "Object(1) | Object(1n) throws TypeError"); -assert.throws(TypeError, function() { 1n | NaN; }, "1n | NaN throws TypeError"); -assert.throws(TypeError, function() { NaN | 1n; }, "NaN | 1n throws TypeError"); -assert.throws(TypeError, function() { 1n | Infinity; }, "1n | Infinity throws TypeError"); -assert.throws(TypeError, function() { Infinity | 1n; }, "Infinity | 1n throws TypeError"); -assert.throws(TypeError, function() { 1n | true; }, "1n | true throws TypeError"); -assert.throws(TypeError, function() { true | 1n; }, "true | 1n throws TypeError"); -assert.throws(TypeError, function() { 1n | "1"; }, '1n | "1" throws TypeError'); -assert.throws(TypeError, function() { "1" | 1n; }, '"1" | 1n throws TypeError'); -assert.throws(TypeError, function() { 1n | null; }, "1n | null throws TypeError"); -assert.throws(TypeError, function() { null | 1n; }, "null | 1n throws TypeError"); -assert.throws(TypeError, function() { 1n | undefined; }, "1n | undefined throws TypeError"); -assert.throws(TypeError, function() { undefined | 1n; }, "undefined | 1n throws TypeError"); +assert.throws(TypeError, function() { + 1 | 1n; +}, '1 | 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) | 1; +}, 'Object(1n) | 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 | Object(1n); +}, '1 | Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n | Object(1); +}, '1n | Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) | 1n; +}, 'Object(1) | 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) | Object(1); +}, 'Object(1n) | Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) | Object(1n); +}, 'Object(1) | Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n | NaN; +}, '1n | NaN throws TypeError'); + +assert.throws(TypeError, function() { + NaN | 1n; +}, 'NaN | 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n | Infinity; +}, '1n | Infinity throws TypeError'); + +assert.throws(TypeError, function() { + Infinity | 1n; +}, 'Infinity | 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n | true; +}, '1n | true throws TypeError'); + +assert.throws(TypeError, function() { + true | 1n; +}, 'true | 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n | '1'; +}, '1n | "1" throws TypeError'); + +assert.throws(TypeError, function() { + '1' | 1n; +}, '"1" | 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n | null; +}, '1n | null throws TypeError'); + +assert.throws(TypeError, function() { + null | 1n; +}, 'null | 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n | undefined; +}, '1n | undefined throws TypeError'); + +assert.throws(TypeError, function() { + undefined | 1n; +}, 'undefined | 1n throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/bitwise-or/bigint-errors.js b/test/language/expressions/bitwise-or/bigint-errors.js index 339de3b06e32101f35742894af3444e6cf3c7dc7..f0ab953b126eb0c3fcdf6eddce9e3236d4bfa2a0 100644 --- a/test/language/expressions/bitwise-or/bigint-errors.js +++ b/test/language/expressions/bitwise-or/bigint-errors.js @@ -5,58 +5,66 @@ description: bitwise-or operator ToNumeric with BigInt operands esid: sec-binary-bitwise-operators-runtime-semantics-evaluation features: [BigInt, Symbol, Symbol.toPrimitive, computed-property-names] ---*/ - assert.throws(TypeError, function() { - Symbol("1") | 0n; -}, "ToBigInt: Symbol => TypeError"); + Symbol('1') | 0n; +}, 'Symbol("1") | 0n throws TypeError'); + assert.throws(TypeError, function() { - 0n | Symbol("1"); -}, "ToBigInt: Symbol => TypeError"); + 0n | Symbol('1'); +}, '0n | Symbol("1") throws TypeError'); + assert.throws(TypeError, function() { - Object(Symbol("1")) | 0n; -}, "ToBigInt: unbox object with internal slot => Symbol => TypeError"); + Object(Symbol('1')) | 0n; +}, 'Object(Symbol("1")) | 0n throws TypeError'); + assert.throws(TypeError, function() { - 0n | Object(Symbol("1")); -}, "ToBigInt: unbox object with internal slot => Symbol => TypeError"); + 0n | Object(Symbol('1')); +}, '0n | Object(Symbol("1")) throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { - return Symbol("1"); + return Symbol('1'); } }) | 0n; -}, "ToBigInt: @@toPrimitive => Symbol => TypeError"); +}, '({[Symbol.toPrimitive]: function() {return Symbol("1");}}) | 0n throws TypeError'); + assert.throws(TypeError, function() { 0n | { [Symbol.toPrimitive]: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: @@toPrimitive => Symbol => TypeError"); +}, '0n | {[Symbol.toPrimitive]: function() {return Symbol("1");}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { - return Symbol("1"); + return Symbol('1'); } }) | 0n; -}, "ToBigInt: valueOf => Symbol => TypeError"); +}, '({valueOf: function() {return Symbol("1");}}) | 0n throws TypeError'); + assert.throws(TypeError, function() { 0n | { valueOf: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: valueOf => Symbol => TypeError"); +}, '0n | {valueOf: function() {return Symbol("1");}} throws TypeError'); + assert.throws(TypeError, function() { ({ toString: function() { - return Symbol("1"); + return Symbol('1'); } }) | 0n; -}, "ToBigInt: toString => Symbol => TypeError"); +}, '({toString: function() {return Symbol("1");}}) | 0n throws TypeError'); + assert.throws(TypeError, function() { 0n | { toString: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: toString => Symbol => TypeError"); +}, '0n | {toString: function() {return Symbol("1");}} throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/bitwise-or/bigint-non-primitive.js b/test/language/expressions/bitwise-or/bigint-non-primitive.js index 85c59372eee501d48f9b52739cf43ce1c850caa9..1faec3e070abedd37bd4c7852107e302ec9568b8 100644 --- a/test/language/expressions/bitwise-or/bigint-non-primitive.js +++ b/test/language/expressions/bitwise-or/bigint-non-primitive.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Bitwise OR for BigInt non-primitive values esid: sec-binary-bitwise-operators-runtime-semantics-evaluation @@ -14,30 +13,70 @@ info: | features: [BigInt] ---*/ +assert.sameValue( + Object(0b101n) | 0b011n, + 0b111n, + 'The result of (Object(0b101n) | 0b011n) is 0b111n' +); -assert.sameValue(Object(0b101n) | 0b011n, 0b111n, "Object(0b101n) | 0b011n === 0b111n"); -assert.sameValue(0b011n | Object(0b101n), 0b111n, "0b011n | Object(0b101n) === 0b111n"); -assert.sameValue(Object(0b101n) | Object(0b011n), 0b111n, "Object(0b101n) | Object(0b011n) === 0b111n"); +assert.sameValue( + 0b011n | Object(0b101n), + 0b111n, + 'The result of (0b011n | Object(0b101n)) is 0b111n' +); + +assert.sameValue( + Object(0b101n) | Object(0b011n), + 0b111n, + 'The result of (Object(0b101n) | Object(0b011n)) is 0b111n' +); function err() { throw new Test262Error(); } -assert.sameValue( - {[Symbol.toPrimitive]: function() { return 0b101n; }, valueOf: err, toString: err} | 0b011n, 0b111n, - "primitive from @@toPrimitive"); -assert.sameValue( - 0b011n | {[Symbol.toPrimitive]: function() { return 0b101n; }, valueOf: err, toString: err}, 0b111n, - "primitive from @@toPrimitive"); -assert.sameValue( - {valueOf: function() { return 0b101n; }, toString: err} | 0b011n, 0b111n, - "primitive from {}.valueOf"); -assert.sameValue( - 0b011n | {valueOf: function() { return 0b101n; }, toString: err}, 0b111n, - "primitive from {}.valueOf"); -assert.sameValue( - {toString: function() { return 0b101n; }} | 0b011n, 0b111n, - "primitive from {}.toString"); -assert.sameValue( - 0b011n | {toString: function() { return 0b101n; }}, 0b111n, - "primitive from {}.toString"); +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 0b101n; + }, + + valueOf: err, + toString: err +} | 0b011n, 0b111n, 'The result of (({[Symbol.toPrimitive]: function() {return 0b101n;}, valueOf: err, toString: err}) | 0b011n) is 0b111n'); + +assert.sameValue(0b011n | { + [Symbol.toPrimitive]: function() { + return 0b101n; + }, + + valueOf: err, + toString: err +}, 0b111n, 'The result of (0b011n | {[Symbol.toPrimitive]: function() {return 0b101n;}, valueOf: err, toString: err}) is 0b111n'); + +assert.sameValue({ + valueOf: function() { + return 0b101n; + }, + + toString: err +} | 0b011n, 0b111n, 'The result of (({valueOf: function() {return 0b101n;}, toString: err}) | 0b011n) is 0b111n'); + +assert.sameValue(0b011n | { + valueOf: function() { + return 0b101n; + }, + + toString: err +}, 0b111n, 'The result of (0b011n | {valueOf: function() {return 0b101n;}, toString: err}) is 0b111n'); + +assert.sameValue({ + toString: function() { + return 0b101n; + } +} | 0b011n, 0b111n, 'The result of (({toString: function() {return 0b101n;}}) | 0b011n) is 0b111n'); + +assert.sameValue(0b011n | { + toString: function() { + return 0b101n; + } +}, 0b111n, 'The result of (0b011n | {toString: function() {return 0b101n;}}) is 0b111n'); \ No newline at end of file diff --git a/test/language/expressions/bitwise-or/bigint-toprimitive.js b/test/language/expressions/bitwise-or/bigint-toprimitive.js index 644395b8cabe00ab2c544e2a22185b9e2143cb76..c9151c5c80259784ff52e68988bf7990d4296be9 100644 --- a/test/language/expressions/bitwise-or/bigint-toprimitive.js +++ b/test/language/expressions/bitwise-or/bigint-toprimitive.js @@ -5,304 +5,368 @@ description: bitwise-or operator ToNumeric with BigInt operands esid: sec-binary-bitwise-operators-runtime-semantics-evaluation features: [BigInt, Symbol.toPrimitive, computed-property-names] ---*/ - function err() { throw new Test262Error(); } function MyError() {} -assert.sameValue(({ +assert.sameValue({ [Symbol.toPrimitive]: function() { return 2n; }, + valueOf: err, toString: err -}) | 1n, 3n, "ToPrimitive: @@toPrimitive takes precedence"); +} | 1n, 3n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) | 1n) is 3n'); + assert.sameValue(1n | { [Symbol.toPrimitive]: function() { return 2n; }, + valueOf: err, toString: err -}, 3n, "ToPrimitive: @@toPrimitive takes precedence"); -assert.sameValue(({ +}, 3n, 'The result of (1n | {[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) is 3n'); + +assert.sameValue({ valueOf: function() { return 2n; }, + toString: err -}) | 1n, 3n, "ToPrimitive: valueOf takes precedence over toString"); +} | 1n, 3n, 'The result of (({valueOf: function() {return 2n;}, toString: err}) | 1n) is 3n'); + assert.sameValue(1n | { valueOf: function() { return 2n; }, + toString: err -}, 3n, "ToPrimitive: valueOf takes precedence over toString"); -assert.sameValue(({ +}, 3n, 'The result of (1n | {valueOf: function() {return 2n;}, toString: err}) is 3n'); + +assert.sameValue({ toString: function() { return 2n; } -}) | 1n, 3n, "ToPrimitive: toString with no valueOf"); +} | 1n, 3n, 'The result of (({toString: function() {return 2n;}}) | 1n) is 3n'); + assert.sameValue(1n | { toString: function() { return 2n; } -}, 3n, "ToPrimitive: toString with no valueOf"); -assert.sameValue(({ +}, 3n, 'The result of (1n | {toString: function() {return 2n;}}) is 3n'); + +assert.sameValue({ [Symbol.toPrimitive]: undefined, + valueOf: function() { return 2n; } -}) | 1n, 3n, "ToPrimitive: skip @@toPrimitive when it's undefined"); +} | 1n, 3n, 'The result of (({[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) | 1n) is 3n'); + assert.sameValue(1n | { [Symbol.toPrimitive]: undefined, + valueOf: function() { return 2n; } -}, 3n, "ToPrimitive: skip @@toPrimitive when it's undefined"); -assert.sameValue(({ +}, 3n, 'The result of (1n | {[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) is 3n'); + +assert.sameValue({ [Symbol.toPrimitive]: null, + valueOf: function() { return 2n; } -}) | 1n, 3n, "ToPrimitive: skip @@toPrimitive when it's null"); +} | 1n, 3n, 'The result of (({[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) | 1n) is 3n'); + assert.sameValue(1n | { [Symbol.toPrimitive]: null, + valueOf: function() { return 2n; } -}, 3n, "ToPrimitive: skip @@toPrimitive when it's null"); -assert.sameValue(({ +}, 3n, 'The result of (1n | {[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) is 3n'); + +assert.sameValue({ valueOf: null, + toString: function() { return 2n; } -}) | 1n, 3n, "ToPrimitive: skip valueOf when it's not callable"); +} | 1n, 3n, 'The result of (({valueOf: null, toString: function() {return 2n;}}) | 1n) is 3n'); + assert.sameValue(1n | { valueOf: null, + toString: function() { return 2n; } -}, 3n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 3n, 'The result of (1n | {valueOf: null, toString: function() {return 2n;}}) is 3n'); + +assert.sameValue({ valueOf: 1, + toString: function() { return 2n; } -}) | 1n, 3n, "ToPrimitive: skip valueOf when it's not callable"); +} | 1n, 3n, 'The result of (({valueOf: 1, toString: function() {return 2n;}}) | 1n) is 3n'); + assert.sameValue(1n | { valueOf: 1, + toString: function() { return 2n; } -}, 3n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 3n, 'The result of (1n | {valueOf: 1, toString: function() {return 2n;}}) is 3n'); + +assert.sameValue({ valueOf: {}, + toString: function() { return 2n; } -}) | 1n, 3n, "ToPrimitive: skip valueOf when it's not callable"); +} | 1n, 3n, 'The result of (({valueOf: {}, toString: function() {return 2n;}}) | 1n) is 3n'); + assert.sameValue(1n | { valueOf: {}, + toString: function() { return 2n; } -}, 3n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 3n, 'The result of (1n | {valueOf: {}, toString: function() {return 2n;}}) is 3n'); + +assert.sameValue({ valueOf: function() { return {}; }, + toString: function() { return 2n; } -}) | 1n, 3n, "ToPrimitive: skip valueOf when it returns an object"); +} | 1n, 3n, 'The result of (({valueOf: function() {return {};}, toString: function() {return 2n;}}) | 1n) is 3n'); + assert.sameValue(1n | { valueOf: function() { return {}; }, + toString: function() { return 2n; } -}, 3n, "ToPrimitive: skip valueOf when it returns an object"); -assert.sameValue(({ +}, 3n, 'The result of (1n | {valueOf: function() {return {};}, toString: function() {return 2n;}}) is 3n'); + +assert.sameValue({ valueOf: function() { return Object(12345); }, + toString: function() { return 2n; } -}) | 1n, 3n, "ToPrimitive: skip valueOf when it returns an object"); +} | 1n, 3n, 'The result of (({valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) | 1n) is 3n'); + assert.sameValue(1n | { valueOf: function() { return Object(12345); }, + toString: function() { return 2n; } -}, 3n, "ToPrimitive: skip valueOf when it returns an object"); +}, 3n, 'The result of (1n | {valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) is 3n'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: 1 }) | 0n; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '({[Symbol.toPrimitive]: 1}) | 0n throws TypeError'); + assert.throws(TypeError, function() { 0n | { [Symbol.toPrimitive]: 1 }; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '0n | {[Symbol.toPrimitive]: 1} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: {} }) | 0n; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '({[Symbol.toPrimitive]: {}}) | 0n throws TypeError'); + assert.throws(TypeError, function() { 0n | { [Symbol.toPrimitive]: {} }; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '0n | {[Symbol.toPrimitive]: {}} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { return Object(1); } }) | 0n; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '({[Symbol.toPrimitive]: function() {return Object(1);}}) | 0n throws TypeError'); + assert.throws(TypeError, function() { 0n | { [Symbol.toPrimitive]: function() { return Object(1); } }; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '0n | {[Symbol.toPrimitive]: function() {return Object(1);}} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { return {}; } }) | 0n; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '({[Symbol.toPrimitive]: function() {return {};}}) | 0n throws TypeError'); + assert.throws(TypeError, function() { 0n | { [Symbol.toPrimitive]: function() { return {}; } }; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '0n | {[Symbol.toPrimitive]: function() {return {};}} throws TypeError'); + assert.throws(MyError, function() { ({ [Symbol.toPrimitive]: function() { throw new MyError(); } }) | 0n; -}, "ToPrimitive: propagate errors from @@toPrimitive"); +}, '({[Symbol.toPrimitive]: function() {throw new MyError();}}) | 0n throws MyError'); + assert.throws(MyError, function() { 0n | { [Symbol.toPrimitive]: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from @@toPrimitive"); +}, '0n | {[Symbol.toPrimitive]: function() {throw new MyError();}} throws MyError'); + assert.throws(MyError, function() { ({ valueOf: function() { throw new MyError(); } }) | 0n; -}, "ToPrimitive: propagate errors from valueOf"); +}, '({valueOf: function() {throw new MyError();}}) | 0n throws MyError'); + assert.throws(MyError, function() { 0n | { valueOf: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from valueOf"); +}, '0n | {valueOf: function() {throw new MyError();}} throws MyError'); + assert.throws(MyError, function() { ({ toString: function() { throw new MyError(); } }) | 0n; -}, "ToPrimitive: propagate errors from toString"); +}, '({toString: function() {throw new MyError();}}) | 0n throws MyError'); + assert.throws(MyError, function() { 0n | { toString: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from toString"); +}, '0n | {toString: function() {throw new MyError();}} throws MyError'); + assert.throws(TypeError, function() { ({ valueOf: null, toString: null }) | 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: null, toString: null}) | 0n throws TypeError'); + assert.throws(TypeError, function() { 0n | { valueOf: null, toString: null }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n | {valueOf: null, toString: null} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: 1, toString: 1 }) | 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: 1, toString: 1}) | 0n throws TypeError'); + assert.throws(TypeError, function() { 0n | { valueOf: 1, toString: 1 }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n | {valueOf: 1, toString: 1} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: {}, toString: {} }) | 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: {}, toString: {}}) | 0n throws TypeError'); + assert.throws(TypeError, function() { 0n | { valueOf: {}, toString: {} }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n | {valueOf: {}, toString: {}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { return Object(1); }, + toString: function() { return Object(1); } }) | 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: function() {return Object(1);}, toString: function() {return Object(1);}}) | 0n throws TypeError'); + assert.throws(TypeError, function() { 0n | { valueOf: function() { return Object(1); }, + toString: function() { return Object(1); } }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n | {valueOf: function() {return Object(1);}, toString: function() {return Object(1);}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { return {}; }, + toString: function() { return {}; } }) | 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: function() {return {};}, toString: function() {return {};}}) | 0n throws TypeError'); + assert.throws(TypeError, function() { 0n | { valueOf: function() { return {}; }, + toString: function() { return {}; } }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n | {valueOf: function() {return {};}, toString: function() {return {};}} throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/bitwise-or/bigint-wrapped-values.js b/test/language/expressions/bitwise-or/bigint-wrapped-values.js index 687e99f9d331fdb88292cb1398c61c78dfffc7e4..d51629dc6d09ccfd747e6a3b77a49a31eecab99a 100644 --- a/test/language/expressions/bitwise-or/bigint-wrapped-values.js +++ b/test/language/expressions/bitwise-or/bigint-wrapped-values.js @@ -5,36 +5,41 @@ description: bitwise-or operator ToNumeric with BigInt operands esid: sec-binary-bitwise-operators-runtime-semantics-evaluation features: [BigInt, Symbol.toPrimitive, computed-property-names] ---*/ +assert.sameValue(Object(2n) | 1n, 3n, 'The result of (Object(2n) | 1n) is 3n'); +assert.sameValue(1n | Object(2n), 3n, 'The result of (1n | Object(2n)) is 3n'); -assert.sameValue(Object(2n) | 1n, 3n, "ToPrimitive: unbox object with internal slot"); -assert.sameValue(1n | Object(2n), 3n, "ToPrimitive: unbox object with internal slot"); -assert.sameValue(({ +assert.sameValue({ [Symbol.toPrimitive]: function() { return 2n; } -}) | 1n, 3n, "ToPrimitive: @@toPrimitive"); +} | 1n, 3n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}}) | 1n) is 3n'); + assert.sameValue(1n | { [Symbol.toPrimitive]: function() { return 2n; } -}, 3n, "ToPrimitive: @@toPrimitive"); -assert.sameValue(({ +}, 3n, 'The result of (1n | {[Symbol.toPrimitive]: function() {return 2n;}}) is 3n'); + +assert.sameValue({ valueOf: function() { return 2n; } -}) | 1n, 3n, "ToPrimitive: valueOf"); +} | 1n, 3n, 'The result of (({valueOf: function() {return 2n;}}) | 1n) is 3n'); + assert.sameValue(1n | { valueOf: function() { return 2n; } -}, 3n, "ToPrimitive: valueOf"); -assert.sameValue(({ +}, 3n, 'The result of (1n | {valueOf: function() {return 2n;}}) is 3n'); + +assert.sameValue({ toString: function() { return 2n; } -}) | 1n, 3n, "ToPrimitive: toString"); +} | 1n, 3n, 'The result of (({toString: function() {return 2n;}}) | 1n) is 3n'); + assert.sameValue(1n | { toString: function() { return 2n; } -}, 3n, "ToPrimitive: toString"); +}, 3n, 'The result of (1n | {toString: function() {return 2n;}}) is 3n'); \ No newline at end of file diff --git a/test/language/expressions/bitwise-xor/bigint-and-number.js b/test/language/expressions/bitwise-xor/bigint-and-number.js index 4b5f2f696e401d75493849a9e91d7e42da746517..87da2a623fe427885ea1d7205143674924217a27 100644 --- a/test/language/expressions/bitwise-xor/bigint-and-number.js +++ b/test/language/expressions/bitwise-xor/bigint-and-number.js @@ -9,24 +9,82 @@ info: | Let rnum be ? ToNumeric(rightValue). If Type(lnum) does not equal Type(rnum), throw a TypeError exception. ---*/ +assert.throws(TypeError, function() { + 1n ^ 1; +}, '1n ^ 1 throws TypeError'); -assert.throws(TypeError, function() { 1n ^ 1; }, "1n ^ 1 throws TypeError"); -assert.throws(TypeError, function() { 1 ^ 1n; }, "1 ^ 1n throws TypeError"); -assert.throws(TypeError, function() { Object(1n) ^ 1; }, "Object(1n) ^ 1 throws TypeError"); -assert.throws(TypeError, function() { 1 ^ Object(1n); }, "1 ^ Object(1n) throws TypeError"); -assert.throws(TypeError, function() { 1n ^ Object(1); }, "1n ^ Object(1) throws TypeError"); -assert.throws(TypeError, function() { Object(1) ^ 1n; }, "Object(1) ^ 1n throws TypeError"); -assert.throws(TypeError, function() { Object(1n) ^ Object(1); }, "Object(1n) ^ Object(1) throws TypeError"); -assert.throws(TypeError, function() { Object(1) ^ Object(1n); }, "Object(1) ^ Object(1n) throws TypeError"); -assert.throws(TypeError, function() { 1n ^ NaN; }, "1n ^ NaN throws TypeError"); -assert.throws(TypeError, function() { NaN ^ 1n; }, "NaN ^ 1n throws TypeError"); -assert.throws(TypeError, function() { 1n ^ Infinity; }, "1n ^ Infinity throws TypeError"); -assert.throws(TypeError, function() { Infinity ^ 1n; }, "Infinity ^ 1n throws TypeError"); -assert.throws(TypeError, function() { 1n ^ true; }, "1n ^ true throws TypeError"); -assert.throws(TypeError, function() { true ^ 1n; }, "true ^ 1n throws TypeError"); -assert.throws(TypeError, function() { 1n ^ "1"; }, '1n ^ "1" throws TypeError'); -assert.throws(TypeError, function() { "1" ^ 1n; }, '"1" ^ 1n throws TypeError'); -assert.throws(TypeError, function() { 1n ^ null; }, "1n ^ null throws TypeError"); -assert.throws(TypeError, function() { null ^ 1n; }, "null ^ 1n throws TypeError"); -assert.throws(TypeError, function() { 1n ^ undefined; }, "1n ^ undefined throws TypeError"); -assert.throws(TypeError, function() { undefined ^ 1n; }, "undefined ^ 1n throws TypeError"); +assert.throws(TypeError, function() { + 1 ^ 1n; +}, '1 ^ 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) ^ 1; +}, 'Object(1n) ^ 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 ^ Object(1n); +}, '1 ^ Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n ^ Object(1); +}, '1n ^ Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) ^ 1n; +}, 'Object(1) ^ 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) ^ Object(1); +}, 'Object(1n) ^ Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) ^ Object(1n); +}, 'Object(1) ^ Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n ^ NaN; +}, '1n ^ NaN throws TypeError'); + +assert.throws(TypeError, function() { + NaN ^ 1n; +}, 'NaN ^ 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n ^ Infinity; +}, '1n ^ Infinity throws TypeError'); + +assert.throws(TypeError, function() { + Infinity ^ 1n; +}, 'Infinity ^ 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n ^ true; +}, '1n ^ true throws TypeError'); + +assert.throws(TypeError, function() { + true ^ 1n; +}, 'true ^ 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n ^ '1'; +}, '1n ^ "1" throws TypeError'); + +assert.throws(TypeError, function() { + '1' ^ 1n; +}, '"1" ^ 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n ^ null; +}, '1n ^ null throws TypeError'); + +assert.throws(TypeError, function() { + null ^ 1n; +}, 'null ^ 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n ^ undefined; +}, '1n ^ undefined throws TypeError'); + +assert.throws(TypeError, function() { + undefined ^ 1n; +}, 'undefined ^ 1n throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/bitwise-xor/bigint-errors.js b/test/language/expressions/bitwise-xor/bigint-errors.js index 6b3e43c458ecd722e8ab1bbb04d488f634b18bd8..b0994288e5fc527b37da5d9737b2ca7c2b158ce2 100644 --- a/test/language/expressions/bitwise-xor/bigint-errors.js +++ b/test/language/expressions/bitwise-xor/bigint-errors.js @@ -5,58 +5,66 @@ description: bitwise-xor operator ToNumeric with BigInt operands esid: sec-binary-bitwise-operators-runtime-semantics-evaluation features: [BigInt, Symbol, Symbol.toPrimitive, computed-property-names] ---*/ - assert.throws(TypeError, function() { - Symbol("1") ^ 0n; -}, "ToBigInt: Symbol => TypeError"); + Symbol('1') ^ 0n; +}, 'Symbol("1") ^ 0n throws TypeError'); + assert.throws(TypeError, function() { - 0n ^ Symbol("1"); -}, "ToBigInt: Symbol => TypeError"); + 0n ^ Symbol('1'); +}, '0n ^ Symbol("1") throws TypeError'); + assert.throws(TypeError, function() { - Object(Symbol("1")) ^ 0n; -}, "ToBigInt: unbox object with internal slot => Symbol => TypeError"); + Object(Symbol('1')) ^ 0n; +}, 'Object(Symbol("1")) ^ 0n throws TypeError'); + assert.throws(TypeError, function() { - 0n ^ Object(Symbol("1")); -}, "ToBigInt: unbox object with internal slot => Symbol => TypeError"); + 0n ^ Object(Symbol('1')); +}, '0n ^ Object(Symbol("1")) throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { - return Symbol("1"); + return Symbol('1'); } }) ^ 0n; -}, "ToBigInt: @@toPrimitive => Symbol => TypeError"); +}, '({[Symbol.toPrimitive]: function() {return Symbol("1");}}) ^ 0n throws TypeError'); + assert.throws(TypeError, function() { 0n ^ { [Symbol.toPrimitive]: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: @@toPrimitive => Symbol => TypeError"); +}, '0n ^ {[Symbol.toPrimitive]: function() {return Symbol("1");}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { - return Symbol("1"); + return Symbol('1'); } }) ^ 0n; -}, "ToBigInt: valueOf => Symbol => TypeError"); +}, '({valueOf: function() {return Symbol("1");}}) ^ 0n throws TypeError'); + assert.throws(TypeError, function() { 0n ^ { valueOf: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: valueOf => Symbol => TypeError"); +}, '0n ^ {valueOf: function() {return Symbol("1");}} throws TypeError'); + assert.throws(TypeError, function() { ({ toString: function() { - return Symbol("1"); + return Symbol('1'); } }) ^ 0n; -}, "ToBigInt: toString => Symbol => TypeError"); +}, '({toString: function() {return Symbol("1");}}) ^ 0n throws TypeError'); + assert.throws(TypeError, function() { 0n ^ { toString: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: toString => Symbol => TypeError"); +}, '0n ^ {toString: function() {return Symbol("1");}} throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/bitwise-xor/bigint-non-primitive.js b/test/language/expressions/bitwise-xor/bigint-non-primitive.js index 853ceec24d3673f0e4bc3063cbbb1a63ed31b73e..74cfd4372f9620983e97f8a59e8f41f3747e84ee 100644 --- a/test/language/expressions/bitwise-xor/bigint-non-primitive.js +++ b/test/language/expressions/bitwise-xor/bigint-non-primitive.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Bitwise XOR for BigInt non-primitive values esid: sec-binary-bitwise-operators-runtime-semantics-evaluation @@ -14,30 +13,70 @@ info: | features: [BigInt] ---*/ +assert.sameValue( + Object(0b101n) ^ 0b011n, + 0b110n, + 'The result of (Object(0b101n) ^ 0b011n) is 0b110n' +); -assert.sameValue(Object(0b101n) ^ 0b011n, 0b110n, "Object(0b101n) ^ 0b011n === 0b110n"); -assert.sameValue(0b011n ^ Object(0b101n), 0b110n, "0b011n ^ Object(0b101n) === 0b110n"); -assert.sameValue(Object(0b101n) ^ Object(0b011n), 0b110n, "Object(0b101n) ^ Object(0b011n) === 0b110n"); +assert.sameValue( + 0b011n ^ Object(0b101n), + 0b110n, + 'The result of (0b011n ^ Object(0b101n)) is 0b110n' +); + +assert.sameValue( + Object(0b101n) ^ Object(0b011n), + 0b110n, + 'The result of (Object(0b101n) ^ Object(0b011n)) is 0b110n' +); function err() { throw new Test262Error(); } -assert.sameValue( - {[Symbol.toPrimitive]: function() { return 0b101n; }, valueOf: err, toString: err} ^ 0b011n, 0b110n, - "primitive from @@toPrimitive"); -assert.sameValue( - 0b011n ^ {[Symbol.toPrimitive]: function() { return 0b101n; }, valueOf: err, toString: err}, 0b110n, - "primitive from @@toPrimitive"); -assert.sameValue( - {valueOf: function() { return 0b101n; }, toString: err} ^ 0b011n, 0b110n, - "primitive from {}.valueOf"); -assert.sameValue( - 0b011n ^ {valueOf: function() { return 0b101n; }, toString: err}, 0b110n, - "primitive from {}.valueOf"); -assert.sameValue( - {toString: function() { return 0b101n; }} ^ 0b011n, 0b110n, - "primitive from {}.toString"); -assert.sameValue( - 0b011n ^ {toString: function() { return 0b101n; }}, 0b110n, - "primitive from {}.toString"); +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 0b101n; + }, + + valueOf: err, + toString: err +} ^ 0b011n, 0b110n, 'The result of (({[Symbol.toPrimitive]: function() {return 0b101n;}, valueOf: err, toString: err}) ^ 0b011n) is 0b110n'); + +assert.sameValue(0b011n ^ { + [Symbol.toPrimitive]: function() { + return 0b101n; + }, + + valueOf: err, + toString: err +}, 0b110n, 'The result of (0b011n ^ {[Symbol.toPrimitive]: function() {return 0b101n;}, valueOf: err, toString: err}) is 0b110n'); + +assert.sameValue({ + valueOf: function() { + return 0b101n; + }, + + toString: err +} ^ 0b011n, 0b110n, 'The result of (({valueOf: function() {return 0b101n;}, toString: err}) ^ 0b011n) is 0b110n'); + +assert.sameValue(0b011n ^ { + valueOf: function() { + return 0b101n; + }, + + toString: err +}, 0b110n, 'The result of (0b011n ^ {valueOf: function() {return 0b101n;}, toString: err}) is 0b110n'); + +assert.sameValue({ + toString: function() { + return 0b101n; + } +} ^ 0b011n, 0b110n, 'The result of (({toString: function() {return 0b101n;}}) ^ 0b011n) is 0b110n'); + +assert.sameValue(0b011n ^ { + toString: function() { + return 0b101n; + } +}, 0b110n, 'The result of (0b011n ^ {toString: function() {return 0b101n;}}) is 0b110n'); \ No newline at end of file diff --git a/test/language/expressions/bitwise-xor/bigint-toprimitive.js b/test/language/expressions/bitwise-xor/bigint-toprimitive.js index 139c6990dae3eb7bd9a951c3413ccb135aac7743..e777196ff03ada45013c016c9a2f23db343ad1a9 100644 --- a/test/language/expressions/bitwise-xor/bigint-toprimitive.js +++ b/test/language/expressions/bitwise-xor/bigint-toprimitive.js @@ -5,304 +5,368 @@ description: bitwise-xor operator ToNumeric with BigInt operands esid: sec-binary-bitwise-operators-runtime-semantics-evaluation features: [BigInt, Symbol.toPrimitive, computed-property-names] ---*/ - function err() { throw new Test262Error(); } function MyError() {} -assert.sameValue(({ +assert.sameValue({ [Symbol.toPrimitive]: function() { return 2n; }, + valueOf: err, toString: err -}) ^ 3n, 1n, "ToPrimitive: @@toPrimitive takes precedence"); +} ^ 3n, 1n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) ^ 3n) is 1n'); + assert.sameValue(3n ^ { [Symbol.toPrimitive]: function() { return 2n; }, + valueOf: err, toString: err -}, 1n, "ToPrimitive: @@toPrimitive takes precedence"); -assert.sameValue(({ +}, 1n, 'The result of (3n ^ {[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) is 1n'); + +assert.sameValue({ valueOf: function() { return 2n; }, + toString: err -}) ^ 3n, 1n, "ToPrimitive: valueOf takes precedence over toString"); +} ^ 3n, 1n, 'The result of (({valueOf: function() {return 2n;}, toString: err}) ^ 3n) is 1n'); + assert.sameValue(3n ^ { valueOf: function() { return 2n; }, + toString: err -}, 1n, "ToPrimitive: valueOf takes precedence over toString"); -assert.sameValue(({ +}, 1n, 'The result of (3n ^ {valueOf: function() {return 2n;}, toString: err}) is 1n'); + +assert.sameValue({ toString: function() { return 2n; } -}) ^ 3n, 1n, "ToPrimitive: toString with no valueOf"); +} ^ 3n, 1n, 'The result of (({toString: function() {return 2n;}}) ^ 3n) is 1n'); + assert.sameValue(3n ^ { toString: function() { return 2n; } -}, 1n, "ToPrimitive: toString with no valueOf"); -assert.sameValue(({ +}, 1n, 'The result of (3n ^ {toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ [Symbol.toPrimitive]: undefined, + valueOf: function() { return 2n; } -}) ^ 3n, 1n, "ToPrimitive: skip @@toPrimitive when it's undefined"); +} ^ 3n, 1n, 'The result of (({[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) ^ 3n) is 1n'); + assert.sameValue(3n ^ { [Symbol.toPrimitive]: undefined, + valueOf: function() { return 2n; } -}, 1n, "ToPrimitive: skip @@toPrimitive when it's undefined"); -assert.sameValue(({ +}, 1n, 'The result of (3n ^ {[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ [Symbol.toPrimitive]: null, + valueOf: function() { return 2n; } -}) ^ 3n, 1n, "ToPrimitive: skip @@toPrimitive when it's null"); +} ^ 3n, 1n, 'The result of (({[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) ^ 3n) is 1n'); + assert.sameValue(3n ^ { [Symbol.toPrimitive]: null, + valueOf: function() { return 2n; } -}, 1n, "ToPrimitive: skip @@toPrimitive when it's null"); -assert.sameValue(({ +}, 1n, 'The result of (3n ^ {[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: null, + toString: function() { return 2n; } -}) ^ 3n, 1n, "ToPrimitive: skip valueOf when it's not callable"); +} ^ 3n, 1n, 'The result of (({valueOf: null, toString: function() {return 2n;}}) ^ 3n) is 1n'); + assert.sameValue(3n ^ { valueOf: null, + toString: function() { return 2n; } -}, 1n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 1n, 'The result of (3n ^ {valueOf: null, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: 1, + toString: function() { return 2n; } -}) ^ 3n, 1n, "ToPrimitive: skip valueOf when it's not callable"); +} ^ 3n, 1n, 'The result of (({valueOf: 1, toString: function() {return 2n;}}) ^ 3n) is 1n'); + assert.sameValue(3n ^ { valueOf: 1, + toString: function() { return 2n; } -}, 1n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 1n, 'The result of (3n ^ {valueOf: 1, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: {}, + toString: function() { return 2n; } -}) ^ 3n, 1n, "ToPrimitive: skip valueOf when it's not callable"); +} ^ 3n, 1n, 'The result of (({valueOf: {}, toString: function() {return 2n;}}) ^ 3n) is 1n'); + assert.sameValue(3n ^ { valueOf: {}, + toString: function() { return 2n; } -}, 1n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 1n, 'The result of (3n ^ {valueOf: {}, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: function() { return {}; }, + toString: function() { return 2n; } -}) ^ 3n, 1n, "ToPrimitive: skip valueOf when it returns an object"); +} ^ 3n, 1n, 'The result of (({valueOf: function() {return {};}, toString: function() {return 2n;}}) ^ 3n) is 1n'); + assert.sameValue(3n ^ { valueOf: function() { return {}; }, + toString: function() { return 2n; } -}, 1n, "ToPrimitive: skip valueOf when it returns an object"); -assert.sameValue(({ +}, 1n, 'The result of (3n ^ {valueOf: function() {return {};}, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: function() { return Object(12345); }, + toString: function() { return 2n; } -}) ^ 3n, 1n, "ToPrimitive: skip valueOf when it returns an object"); +} ^ 3n, 1n, 'The result of (({valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) ^ 3n) is 1n'); + assert.sameValue(3n ^ { valueOf: function() { return Object(12345); }, + toString: function() { return 2n; } -}, 1n, "ToPrimitive: skip valueOf when it returns an object"); +}, 1n, 'The result of (3n ^ {valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) is 1n'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: 1 }) ^ 0n; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '({[Symbol.toPrimitive]: 1}) ^ 0n throws TypeError'); + assert.throws(TypeError, function() { 0n ^ { [Symbol.toPrimitive]: 1 }; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '0n ^ {[Symbol.toPrimitive]: 1} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: {} }) ^ 0n; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '({[Symbol.toPrimitive]: {}}) ^ 0n throws TypeError'); + assert.throws(TypeError, function() { 0n ^ { [Symbol.toPrimitive]: {} }; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '0n ^ {[Symbol.toPrimitive]: {}} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { return Object(1); } }) ^ 0n; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '({[Symbol.toPrimitive]: function() {return Object(1);}}) ^ 0n throws TypeError'); + assert.throws(TypeError, function() { 0n ^ { [Symbol.toPrimitive]: function() { return Object(1); } }; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '0n ^ {[Symbol.toPrimitive]: function() {return Object(1);}} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { return {}; } }) ^ 0n; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '({[Symbol.toPrimitive]: function() {return {};}}) ^ 0n throws TypeError'); + assert.throws(TypeError, function() { 0n ^ { [Symbol.toPrimitive]: function() { return {}; } }; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '0n ^ {[Symbol.toPrimitive]: function() {return {};}} throws TypeError'); + assert.throws(MyError, function() { ({ [Symbol.toPrimitive]: function() { throw new MyError(); } }) ^ 0n; -}, "ToPrimitive: propagate errors from @@toPrimitive"); +}, '({[Symbol.toPrimitive]: function() {throw new MyError();}}) ^ 0n throws MyError'); + assert.throws(MyError, function() { 0n ^ { [Symbol.toPrimitive]: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from @@toPrimitive"); +}, '0n ^ {[Symbol.toPrimitive]: function() {throw new MyError();}} throws MyError'); + assert.throws(MyError, function() { ({ valueOf: function() { throw new MyError(); } }) ^ 0n; -}, "ToPrimitive: propagate errors from valueOf"); +}, '({valueOf: function() {throw new MyError();}}) ^ 0n throws MyError'); + assert.throws(MyError, function() { 0n ^ { valueOf: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from valueOf"); +}, '0n ^ {valueOf: function() {throw new MyError();}} throws MyError'); + assert.throws(MyError, function() { ({ toString: function() { throw new MyError(); } }) ^ 0n; -}, "ToPrimitive: propagate errors from toString"); +}, '({toString: function() {throw new MyError();}}) ^ 0n throws MyError'); + assert.throws(MyError, function() { 0n ^ { toString: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from toString"); +}, '0n ^ {toString: function() {throw new MyError();}} throws MyError'); + assert.throws(TypeError, function() { ({ valueOf: null, toString: null }) ^ 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: null, toString: null}) ^ 0n throws TypeError'); + assert.throws(TypeError, function() { 0n ^ { valueOf: null, toString: null }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n ^ {valueOf: null, toString: null} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: 1, toString: 1 }) ^ 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: 1, toString: 1}) ^ 0n throws TypeError'); + assert.throws(TypeError, function() { 0n ^ { valueOf: 1, toString: 1 }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n ^ {valueOf: 1, toString: 1} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: {}, toString: {} }) ^ 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: {}, toString: {}}) ^ 0n throws TypeError'); + assert.throws(TypeError, function() { 0n ^ { valueOf: {}, toString: {} }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n ^ {valueOf: {}, toString: {}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { return Object(1); }, + toString: function() { return Object(1); } }) ^ 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: function() {return Object(1);}, toString: function() {return Object(1);}}) ^ 0n throws TypeError'); + assert.throws(TypeError, function() { 0n ^ { valueOf: function() { return Object(1); }, + toString: function() { return Object(1); } }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n ^ {valueOf: function() {return Object(1);}, toString: function() {return Object(1);}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { return {}; }, + toString: function() { return {}; } }) ^ 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: function() {return {};}, toString: function() {return {};}}) ^ 0n throws TypeError'); + assert.throws(TypeError, function() { 0n ^ { valueOf: function() { return {}; }, + toString: function() { return {}; } }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n ^ {valueOf: function() {return {};}, toString: function() {return {};}} throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/bitwise-xor/bigint-wrapped-values.js b/test/language/expressions/bitwise-xor/bigint-wrapped-values.js index 4970575032661ce5b3d299a4081613a636068c84..36d61d6405715c2a53e3565df15f974beaa926f0 100644 --- a/test/language/expressions/bitwise-xor/bigint-wrapped-values.js +++ b/test/language/expressions/bitwise-xor/bigint-wrapped-values.js @@ -5,36 +5,41 @@ description: bitwise-xor operator ToNumeric with BigInt operands esid: sec-binary-bitwise-operators-runtime-semantics-evaluation features: [BigInt, Symbol.toPrimitive, computed-property-names] ---*/ +assert.sameValue(Object(2n) ^ 3n, 1n, 'The result of (Object(2n) ^ 3n) is 1n'); +assert.sameValue(3n ^ Object(2n), 1n, 'The result of (3n ^ Object(2n)) is 1n'); -assert.sameValue(Object(2n) ^ 3n, 1n, "ToPrimitive: unbox object with internal slot"); -assert.sameValue(3n ^ Object(2n), 1n, "ToPrimitive: unbox object with internal slot"); -assert.sameValue(({ +assert.sameValue({ [Symbol.toPrimitive]: function() { return 2n; } -}) ^ 3n, 1n, "ToPrimitive: @@toPrimitive"); +} ^ 3n, 1n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}}) ^ 3n) is 1n'); + assert.sameValue(3n ^ { [Symbol.toPrimitive]: function() { return 2n; } -}, 1n, "ToPrimitive: @@toPrimitive"); -assert.sameValue(({ +}, 1n, 'The result of (3n ^ {[Symbol.toPrimitive]: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: function() { return 2n; } -}) ^ 3n, 1n, "ToPrimitive: valueOf"); +} ^ 3n, 1n, 'The result of (({valueOf: function() {return 2n;}}) ^ 3n) is 1n'); + assert.sameValue(3n ^ { valueOf: function() { return 2n; } -}, 1n, "ToPrimitive: valueOf"); -assert.sameValue(({ +}, 1n, 'The result of (3n ^ {valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ toString: function() { return 2n; } -}) ^ 3n, 1n, "ToPrimitive: toString"); +} ^ 3n, 1n, 'The result of (({toString: function() {return 2n;}}) ^ 3n) is 1n'); + assert.sameValue(3n ^ { toString: function() { return 2n; } -}, 1n, "ToPrimitive: toString"); +}, 1n, 'The result of (3n ^ {toString: function() {return 2n;}}) is 1n'); \ No newline at end of file diff --git a/test/language/expressions/division/bigint-and-number.js b/test/language/expressions/division/bigint-and-number.js index fd7a6d0613a98b18909ece3f2c60d5a133d0261b..22d1ef4c247ce29c05473613681047a37c2c65e9 100644 --- a/test/language/expressions/division/bigint-and-number.js +++ b/test/language/expressions/division/bigint-and-number.js @@ -9,24 +9,82 @@ info: | Let rnum be ? ToNumeric(rightValue). If Type(lnum) does not equal Type(rnum), throw a TypeError exception. ---*/ +assert.throws(TypeError, function() { + 1n / 1; +}, '1n / 1 throws TypeError'); -assert.throws(TypeError, function() { 1n / 1; }, "1n / 1 throws TypeError"); -assert.throws(TypeError, function() { 1 / 1n; }, "1 / 1n throws TypeError"); -assert.throws(TypeError, function() { Object(1n) / 1; }, "Object(1n) / 1 throws TypeError"); -assert.throws(TypeError, function() { 1 / Object(1n); }, "1 / Object(1n) throws TypeError"); -assert.throws(TypeError, function() { 1n / Object(1); }, "1n / Object(1) throws TypeError"); -assert.throws(TypeError, function() { Object(1) / 1n; }, "Object(1) / 1n throws TypeError"); -assert.throws(TypeError, function() { Object(1n) / Object(1); }, "Object(1n) / Object(1) throws TypeError"); -assert.throws(TypeError, function() { Object(1) / Object(1n); }, "Object(1) / Object(1n) throws TypeError"); -assert.throws(TypeError, function() { 1n / NaN; }, "1n / NaN throws TypeError"); -assert.throws(TypeError, function() { NaN / 1n; }, "NaN / 1n throws TypeError"); -assert.throws(TypeError, function() { 1n / Infinity; }, "1n / Infinity throws TypeError"); -assert.throws(TypeError, function() { Infinity / 1n; }, "Infinity / 1n throws TypeError"); -assert.throws(TypeError, function() { 1n / true; }, "1n / true throws TypeError"); -assert.throws(TypeError, function() { true / 1n; }, "true / 1n throws TypeError"); -assert.throws(TypeError, function() { 1n / "1"; }, '1n / "1" throws TypeError'); -assert.throws(TypeError, function() { "1" / 1n; }, '"1" / 1n throws TypeError'); -assert.throws(TypeError, function() { 1n / null; }, "1n / null throws TypeError"); -assert.throws(TypeError, function() { null / 1n; }, "null / 1n throws TypeError"); -assert.throws(TypeError, function() { 1n / undefined; }, "1n / undefined throws TypeError"); -assert.throws(TypeError, function() { undefined / 1n; }, "undefined / 1n throws TypeError"); +assert.throws(TypeError, function() { + 1 / 1n; +}, '1 / 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) / 1; +}, 'Object(1n) / 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 / Object(1n); +}, '1 / Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n / Object(1); +}, '1n / Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) / 1n; +}, 'Object(1) / 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) / Object(1); +}, 'Object(1n) / Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) / Object(1n); +}, 'Object(1) / Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n / NaN; +}, '1n / NaN throws TypeError'); + +assert.throws(TypeError, function() { + NaN / 1n; +}, 'NaN / 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n / Infinity; +}, '1n / Infinity throws TypeError'); + +assert.throws(TypeError, function() { + Infinity / 1n; +}, 'Infinity / 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n / true; +}, '1n / true throws TypeError'); + +assert.throws(TypeError, function() { + true / 1n; +}, 'true / 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n / '1'; +}, '1n / "1" throws TypeError'); + +assert.throws(TypeError, function() { + '1' / 1n; +}, '"1" / 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n / null; +}, '1n / null throws TypeError'); + +assert.throws(TypeError, function() { + null / 1n; +}, 'null / 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n / undefined; +}, '1n / undefined throws TypeError'); + +assert.throws(TypeError, function() { + undefined / 1n; +}, 'undefined / 1n throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/division/bigint-arithmetic.js b/test/language/expressions/division/bigint-arithmetic.js index 9cfcd8cd83ce330d1ca60b0136e66edb08869823..2a44f892fd1f8ecaac00e189f6e6aff5995a1e7d 100644 --- a/test/language/expressions/division/bigint-arithmetic.js +++ b/test/language/expressions/division/bigint-arithmetic.js @@ -1,269 +1,1070 @@ // Copyright (C) 2017 Robin Templeton. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- esid: sec-multiplicative-operators-runtime-semantics-evaluation description: BigInt division arithmetic features: [BigInt] ---*/ +assert.sameValue( + 0xFEDCBA9876543210n / 0xFEDCBA9876543210n, + 0x1n, + 'The result of (0xFEDCBA9876543210n / 0xFEDCBA9876543210n) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA9876543210n / 0xFEDCBA987654320Fn, + 0x1n, + 'The result of (0xFEDCBA9876543210n / 0xFEDCBA987654320Fn) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA9876543210n / 0xFEDCBA98n, + 0x100000000n, + 'The result of (0xFEDCBA9876543210n / 0xFEDCBA98n) is 0x100000000n' +); + +assert.sameValue( + 0xFEDCBA9876543210n / 0xFEDCBA97n, + 0x100000001n, + 'The result of (0xFEDCBA9876543210n / 0xFEDCBA97n) is 0x100000001n' +); + +assert.sameValue( + 0xFEDCBA9876543210n / 0x1234n, + 0xE0042813BE5DCn, + 'The result of (0xFEDCBA9876543210n / 0x1234n) is 0xE0042813BE5DCn' +); + +assert.sameValue( + 0xFEDCBA9876543210n / 0x3n, + 0x54F43E32D21C10B0n, + 'The result of (0xFEDCBA9876543210n / 0x3n) is 0x54F43E32D21C10B0n' +); + +assert.sameValue( + 0xFEDCBA9876543210n / 0x2n, + 0x7F6E5D4C3B2A1908n, + 'The result of (0xFEDCBA9876543210n / 0x2n) is 0x7F6E5D4C3B2A1908n' +); + +assert.sameValue( + 0xFEDCBA9876543210n / 0x1n, + 0xFEDCBA9876543210n, + 'The result of (0xFEDCBA9876543210n / 0x1n) is 0xFEDCBA9876543210n' +); + +assert.sameValue( + 0xFEDCBA9876543210n / -0x1n, + -0xFEDCBA9876543210n, + 'The result of (0xFEDCBA9876543210n / -0x1n) is -0xFEDCBA9876543210n' +); + +assert.sameValue( + 0xFEDCBA9876543210n / -0x2n, + -0x7F6E5D4C3B2A1908n, + 'The result of (0xFEDCBA9876543210n / -0x2n) is -0x7F6E5D4C3B2A1908n' +); + +assert.sameValue( + 0xFEDCBA9876543210n / -0x3n, + -0x54F43E32D21C10B0n, + 'The result of (0xFEDCBA9876543210n / -0x3n) is -0x54F43E32D21C10B0n' +); + +assert.sameValue( + 0xFEDCBA9876543210n / -0x1234n, + -0xE0042813BE5DCn, + 'The result of (0xFEDCBA9876543210n / -0x1234n) is -0xE0042813BE5DCn' +); + +assert.sameValue( + 0xFEDCBA9876543210n / -0xFEDCBA97n, + -0x100000001n, + 'The result of (0xFEDCBA9876543210n / -0xFEDCBA97n) is -0x100000001n' +); + +assert.sameValue( + 0xFEDCBA9876543210n / -0xFEDCBA98n, + -0x100000000n, + 'The result of (0xFEDCBA9876543210n / -0xFEDCBA98n) is -0x100000000n' +); + +assert.sameValue( + 0xFEDCBA9876543210n / -0xFEDCBA987654320Fn, + -0x1n, + 'The result of (0xFEDCBA9876543210n / -0xFEDCBA987654320Fn) is -0x1n' +); + +assert.sameValue( + 0xFEDCBA9876543210n / -0xFEDCBA9876543210n, + -0x1n, + 'The result of (0xFEDCBA9876543210n / -0xFEDCBA9876543210n) is -0x1n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / 0xFEDCBA9876543210n, + 0x0n, + 'The result of (0xFEDCBA987654320Fn / 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / 0xFEDCBA987654320Fn, + 0x1n, + 'The result of (0xFEDCBA987654320Fn / 0xFEDCBA987654320Fn) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / 0xFEDCBA98n, + 0x100000000n, + 'The result of (0xFEDCBA987654320Fn / 0xFEDCBA98n) is 0x100000000n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / 0xFEDCBA97n, + 0x100000001n, + 'The result of (0xFEDCBA987654320Fn / 0xFEDCBA97n) is 0x100000001n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / 0x1234n, + 0xE0042813BE5DCn, + 'The result of (0xFEDCBA987654320Fn / 0x1234n) is 0xE0042813BE5DCn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / 0x3n, + 0x54F43E32D21C10AFn, + 'The result of (0xFEDCBA987654320Fn / 0x3n) is 0x54F43E32D21C10AFn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / 0x2n, + 0x7F6E5D4C3B2A1907n, + 'The result of (0xFEDCBA987654320Fn / 0x2n) is 0x7F6E5D4C3B2A1907n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / 0x1n, + 0xFEDCBA987654320Fn, + 'The result of (0xFEDCBA987654320Fn / 0x1n) is 0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / -0x1n, + -0xFEDCBA987654320Fn, + 'The result of (0xFEDCBA987654320Fn / -0x1n) is -0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / -0x2n, + -0x7F6E5D4C3B2A1907n, + 'The result of (0xFEDCBA987654320Fn / -0x2n) is -0x7F6E5D4C3B2A1907n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / -0x3n, + -0x54F43E32D21C10AFn, + 'The result of (0xFEDCBA987654320Fn / -0x3n) is -0x54F43E32D21C10AFn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / -0x1234n, + -0xE0042813BE5DCn, + 'The result of (0xFEDCBA987654320Fn / -0x1234n) is -0xE0042813BE5DCn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / -0xFEDCBA97n, + -0x100000001n, + 'The result of (0xFEDCBA987654320Fn / -0xFEDCBA97n) is -0x100000001n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / -0xFEDCBA98n, + -0x100000000n, + 'The result of (0xFEDCBA987654320Fn / -0xFEDCBA98n) is -0x100000000n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / -0xFEDCBA987654320Fn, + -0x1n, + 'The result of (0xFEDCBA987654320Fn / -0xFEDCBA987654320Fn) is -0x1n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / -0xFEDCBA9876543210n, + 0x0n, + 'The result of (0xFEDCBA987654320Fn / -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA98n / 0xFEDCBA9876543210n, + 0x0n, + 'The result of (0xFEDCBA98n / 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA98n / 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0xFEDCBA98n / 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA98n / 0xFEDCBA98n, + 0x1n, + 'The result of (0xFEDCBA98n / 0xFEDCBA98n) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA98n / 0xFEDCBA97n, + 0x1n, + 'The result of (0xFEDCBA98n / 0xFEDCBA97n) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA98n / 0x1234n, + 0xE0042n, + 'The result of (0xFEDCBA98n / 0x1234n) is 0xE0042n' +); + +assert.sameValue( + 0xFEDCBA98n / 0x3n, + 0x54F43E32n, + 'The result of (0xFEDCBA98n / 0x3n) is 0x54F43E32n' +); + +assert.sameValue( + 0xFEDCBA98n / 0x2n, + 0x7F6E5D4Cn, + 'The result of (0xFEDCBA98n / 0x2n) is 0x7F6E5D4Cn' +); + +assert.sameValue( + 0xFEDCBA98n / 0x1n, + 0xFEDCBA98n, + 'The result of (0xFEDCBA98n / 0x1n) is 0xFEDCBA98n' +); + +assert.sameValue( + 0xFEDCBA98n / -0x1n, + -0xFEDCBA98n, + 'The result of (0xFEDCBA98n / -0x1n) is -0xFEDCBA98n' +); + +assert.sameValue( + 0xFEDCBA98n / -0x2n, + -0x7F6E5D4Cn, + 'The result of (0xFEDCBA98n / -0x2n) is -0x7F6E5D4Cn' +); + +assert.sameValue( + 0xFEDCBA98n / -0x3n, + -0x54F43E32n, + 'The result of (0xFEDCBA98n / -0x3n) is -0x54F43E32n' +); + +assert.sameValue( + 0xFEDCBA98n / -0x1234n, + -0xE0042n, + 'The result of (0xFEDCBA98n / -0x1234n) is -0xE0042n' +); + +assert.sameValue( + 0xFEDCBA98n / -0xFEDCBA97n, + -0x1n, + 'The result of (0xFEDCBA98n / -0xFEDCBA97n) is -0x1n' +); + +assert.sameValue( + 0xFEDCBA98n / -0xFEDCBA98n, + -0x1n, + 'The result of (0xFEDCBA98n / -0xFEDCBA98n) is -0x1n' +); + +assert.sameValue( + 0xFEDCBA98n / -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0xFEDCBA98n / -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA98n / -0xFEDCBA9876543210n, + 0x0n, + 'The result of (0xFEDCBA98n / -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA97n / 0xFEDCBA9876543210n, + 0x0n, + 'The result of (0xFEDCBA97n / 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA97n / 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0xFEDCBA97n / 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA97n / 0xFEDCBA98n, + 0x0n, + 'The result of (0xFEDCBA97n / 0xFEDCBA98n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA97n / 0xFEDCBA97n, + 0x1n, + 'The result of (0xFEDCBA97n / 0xFEDCBA97n) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA97n / 0x1234n, + 0xE0042n, + 'The result of (0xFEDCBA97n / 0x1234n) is 0xE0042n' +); + +assert.sameValue( + 0xFEDCBA97n / 0x3n, + 0x54F43E32n, + 'The result of (0xFEDCBA97n / 0x3n) is 0x54F43E32n' +); + +assert.sameValue( + 0xFEDCBA97n / 0x2n, + 0x7F6E5D4Bn, + 'The result of (0xFEDCBA97n / 0x2n) is 0x7F6E5D4Bn' +); + +assert.sameValue( + 0xFEDCBA97n / 0x1n, + 0xFEDCBA97n, + 'The result of (0xFEDCBA97n / 0x1n) is 0xFEDCBA97n' +); + +assert.sameValue( + 0xFEDCBA97n / -0x1n, + -0xFEDCBA97n, + 'The result of (0xFEDCBA97n / -0x1n) is -0xFEDCBA97n' +); + +assert.sameValue( + 0xFEDCBA97n / -0x2n, + -0x7F6E5D4Bn, + 'The result of (0xFEDCBA97n / -0x2n) is -0x7F6E5D4Bn' +); + +assert.sameValue( + 0xFEDCBA97n / -0x3n, + -0x54F43E32n, + 'The result of (0xFEDCBA97n / -0x3n) is -0x54F43E32n' +); + +assert.sameValue( + 0xFEDCBA97n / -0x1234n, + -0xE0042n, + 'The result of (0xFEDCBA97n / -0x1234n) is -0xE0042n' +); + +assert.sameValue( + 0xFEDCBA97n / -0xFEDCBA97n, + -0x1n, + 'The result of (0xFEDCBA97n / -0xFEDCBA97n) is -0x1n' +); + +assert.sameValue( + 0xFEDCBA97n / -0xFEDCBA98n, + 0x0n, + 'The result of (0xFEDCBA97n / -0xFEDCBA98n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA97n / -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0xFEDCBA97n / -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA97n / -0xFEDCBA9876543210n, + 0x0n, + 'The result of (0xFEDCBA97n / -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0x1234n / 0xFEDCBA9876543210n, + 0x0n, + 'The result of (0x1234n / 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0x1234n / 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0x1234n / 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue(0x1234n / 0xFEDCBA98n, 0x0n, 'The result of (0x1234n / 0xFEDCBA98n) is 0x0n'); +assert.sameValue(0x1234n / 0xFEDCBA97n, 0x0n, 'The result of (0x1234n / 0xFEDCBA97n) is 0x0n'); +assert.sameValue(0x1234n / 0x1234n, 0x1n, 'The result of (0x1234n / 0x1234n) is 0x1n'); +assert.sameValue(0x1234n / 0x3n, 0x611n, 'The result of (0x1234n / 0x3n) is 0x611n'); +assert.sameValue(0x1234n / 0x2n, 0x91An, 'The result of (0x1234n / 0x2n) is 0x91An'); +assert.sameValue(0x1234n / 0x1n, 0x1234n, 'The result of (0x1234n / 0x1n) is 0x1234n'); +assert.sameValue(0x1234n / -0x1n, -0x1234n, 'The result of (0x1234n / -0x1n) is -0x1234n'); +assert.sameValue(0x1234n / -0x2n, -0x91An, 'The result of (0x1234n / -0x2n) is -0x91An'); +assert.sameValue(0x1234n / -0x3n, -0x611n, 'The result of (0x1234n / -0x3n) is -0x611n'); +assert.sameValue(0x1234n / -0x1234n, -0x1n, 'The result of (0x1234n / -0x1234n) is -0x1n'); +assert.sameValue(0x1234n / -0xFEDCBA97n, 0x0n, 'The result of (0x1234n / -0xFEDCBA97n) is 0x0n'); +assert.sameValue(0x1234n / -0xFEDCBA98n, 0x0n, 'The result of (0x1234n / -0xFEDCBA98n) is 0x0n'); + +assert.sameValue( + 0x1234n / -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0x1234n / -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + 0x1234n / -0xFEDCBA9876543210n, + 0x0n, + 'The result of (0x1234n / -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0x3n / 0xFEDCBA9876543210n, + 0x0n, + 'The result of (0x3n / 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0x3n / 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0x3n / 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue(0x3n / 0xFEDCBA98n, 0x0n, 'The result of (0x3n / 0xFEDCBA98n) is 0x0n'); +assert.sameValue(0x3n / 0xFEDCBA97n, 0x0n, 'The result of (0x3n / 0xFEDCBA97n) is 0x0n'); +assert.sameValue(0x3n / 0x1234n, 0x0n, 'The result of (0x3n / 0x1234n) is 0x0n'); +assert.sameValue(0x3n / 0x3n, 0x1n, 'The result of (0x3n / 0x3n) is 0x1n'); +assert.sameValue(0x3n / 0x2n, 0x1n, 'The result of (0x3n / 0x2n) is 0x1n'); +assert.sameValue(0x3n / 0x1n, 0x3n, 'The result of (0x3n / 0x1n) is 0x3n'); +assert.sameValue(0x3n / -0x1n, -0x3n, 'The result of (0x3n / -0x1n) is -0x3n'); +assert.sameValue(0x3n / -0x2n, -0x1n, 'The result of (0x3n / -0x2n) is -0x1n'); +assert.sameValue(0x3n / -0x3n, -0x1n, 'The result of (0x3n / -0x3n) is -0x1n'); +assert.sameValue(0x3n / -0x1234n, 0x0n, 'The result of (0x3n / -0x1234n) is 0x0n'); +assert.sameValue(0x3n / -0xFEDCBA97n, 0x0n, 'The result of (0x3n / -0xFEDCBA97n) is 0x0n'); +assert.sameValue(0x3n / -0xFEDCBA98n, 0x0n, 'The result of (0x3n / -0xFEDCBA98n) is 0x0n'); + +assert.sameValue( + 0x3n / -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0x3n / -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + 0x3n / -0xFEDCBA9876543210n, + 0x0n, + 'The result of (0x3n / -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0x2n / 0xFEDCBA9876543210n, + 0x0n, + 'The result of (0x2n / 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0x2n / 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0x2n / 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue(0x2n / 0xFEDCBA98n, 0x0n, 'The result of (0x2n / 0xFEDCBA98n) is 0x0n'); +assert.sameValue(0x2n / 0xFEDCBA97n, 0x0n, 'The result of (0x2n / 0xFEDCBA97n) is 0x0n'); +assert.sameValue(0x2n / 0x1234n, 0x0n, 'The result of (0x2n / 0x1234n) is 0x0n'); +assert.sameValue(0x2n / 0x3n, 0x0n, 'The result of (0x2n / 0x3n) is 0x0n'); +assert.sameValue(0x2n / 0x2n, 0x1n, 'The result of (0x2n / 0x2n) is 0x1n'); +assert.sameValue(0x2n / 0x1n, 0x2n, 'The result of (0x2n / 0x1n) is 0x2n'); +assert.sameValue(0x2n / -0x1n, -0x2n, 'The result of (0x2n / -0x1n) is -0x2n'); +assert.sameValue(0x2n / -0x2n, -0x1n, 'The result of (0x2n / -0x2n) is -0x1n'); +assert.sameValue(0x2n / -0x3n, 0x0n, 'The result of (0x2n / -0x3n) is 0x0n'); +assert.sameValue(0x2n / -0x1234n, 0x0n, 'The result of (0x2n / -0x1234n) is 0x0n'); +assert.sameValue(0x2n / -0xFEDCBA97n, 0x0n, 'The result of (0x2n / -0xFEDCBA97n) is 0x0n'); +assert.sameValue(0x2n / -0xFEDCBA98n, 0x0n, 'The result of (0x2n / -0xFEDCBA98n) is 0x0n'); + +assert.sameValue( + 0x2n / -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0x2n / -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + 0x2n / -0xFEDCBA9876543210n, + 0x0n, + 'The result of (0x2n / -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0x1n / 0xFEDCBA9876543210n, + 0x0n, + 'The result of (0x1n / 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0x1n / 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0x1n / 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue(0x1n / 0xFEDCBA98n, 0x0n, 'The result of (0x1n / 0xFEDCBA98n) is 0x0n'); +assert.sameValue(0x1n / 0xFEDCBA97n, 0x0n, 'The result of (0x1n / 0xFEDCBA97n) is 0x0n'); +assert.sameValue(0x1n / 0x1234n, 0x0n, 'The result of (0x1n / 0x1234n) is 0x0n'); +assert.sameValue(0x1n / 0x3n, 0x0n, 'The result of (0x1n / 0x3n) is 0x0n'); +assert.sameValue(0x1n / 0x2n, 0x0n, 'The result of (0x1n / 0x2n) is 0x0n'); +assert.sameValue(0x1n / 0x1n, 0x1n, 'The result of (0x1n / 0x1n) is 0x1n'); +assert.sameValue(0x1n / -0x1n, -0x1n, 'The result of (0x1n / -0x1n) is -0x1n'); +assert.sameValue(0x1n / -0x2n, 0x0n, 'The result of (0x1n / -0x2n) is 0x0n'); +assert.sameValue(0x1n / -0x3n, 0x0n, 'The result of (0x1n / -0x3n) is 0x0n'); +assert.sameValue(0x1n / -0x1234n, 0x0n, 'The result of (0x1n / -0x1234n) is 0x0n'); +assert.sameValue(0x1n / -0xFEDCBA97n, 0x0n, 'The result of (0x1n / -0xFEDCBA97n) is 0x0n'); +assert.sameValue(0x1n / -0xFEDCBA98n, 0x0n, 'The result of (0x1n / -0xFEDCBA98n) is 0x0n'); + +assert.sameValue( + 0x1n / -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0x1n / -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + 0x1n / -0xFEDCBA9876543210n, + 0x0n, + 'The result of (0x1n / -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0x1n / 0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0x1n / 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0x1n / 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0x1n / 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue(-0x1n / 0xFEDCBA98n, 0x0n, 'The result of (-0x1n / 0xFEDCBA98n) is 0x0n'); +assert.sameValue(-0x1n / 0xFEDCBA97n, 0x0n, 'The result of (-0x1n / 0xFEDCBA97n) is 0x0n'); +assert.sameValue(-0x1n / 0x1234n, 0x0n, 'The result of (-0x1n / 0x1234n) is 0x0n'); +assert.sameValue(-0x1n / 0x3n, 0x0n, 'The result of (-0x1n / 0x3n) is 0x0n'); +assert.sameValue(-0x1n / 0x2n, 0x0n, 'The result of (-0x1n / 0x2n) is 0x0n'); +assert.sameValue(-0x1n / 0x1n, -0x1n, 'The result of (-0x1n / 0x1n) is -0x1n'); +assert.sameValue(-0x1n / -0x1n, 0x1n, 'The result of (-0x1n / -0x1n) is 0x1n'); +assert.sameValue(-0x1n / -0x2n, 0x0n, 'The result of (-0x1n / -0x2n) is 0x0n'); +assert.sameValue(-0x1n / -0x3n, 0x0n, 'The result of (-0x1n / -0x3n) is 0x0n'); +assert.sameValue(-0x1n / -0x1234n, 0x0n, 'The result of (-0x1n / -0x1234n) is 0x0n'); +assert.sameValue(-0x1n / -0xFEDCBA97n, 0x0n, 'The result of (-0x1n / -0xFEDCBA97n) is 0x0n'); +assert.sameValue(-0x1n / -0xFEDCBA98n, 0x0n, 'The result of (-0x1n / -0xFEDCBA98n) is 0x0n'); + +assert.sameValue( + -0x1n / -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0x1n / -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + -0x1n / -0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0x1n / -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0x2n / 0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0x2n / 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0x2n / 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0x2n / 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue(-0x2n / 0xFEDCBA98n, 0x0n, 'The result of (-0x2n / 0xFEDCBA98n) is 0x0n'); +assert.sameValue(-0x2n / 0xFEDCBA97n, 0x0n, 'The result of (-0x2n / 0xFEDCBA97n) is 0x0n'); +assert.sameValue(-0x2n / 0x1234n, 0x0n, 'The result of (-0x2n / 0x1234n) is 0x0n'); +assert.sameValue(-0x2n / 0x3n, 0x0n, 'The result of (-0x2n / 0x3n) is 0x0n'); +assert.sameValue(-0x2n / 0x2n, -0x1n, 'The result of (-0x2n / 0x2n) is -0x1n'); +assert.sameValue(-0x2n / 0x1n, -0x2n, 'The result of (-0x2n / 0x1n) is -0x2n'); +assert.sameValue(-0x2n / -0x1n, 0x2n, 'The result of (-0x2n / -0x1n) is 0x2n'); +assert.sameValue(-0x2n / -0x2n, 0x1n, 'The result of (-0x2n / -0x2n) is 0x1n'); +assert.sameValue(-0x2n / -0x3n, 0x0n, 'The result of (-0x2n / -0x3n) is 0x0n'); +assert.sameValue(-0x2n / -0x1234n, 0x0n, 'The result of (-0x2n / -0x1234n) is 0x0n'); +assert.sameValue(-0x2n / -0xFEDCBA97n, 0x0n, 'The result of (-0x2n / -0xFEDCBA97n) is 0x0n'); +assert.sameValue(-0x2n / -0xFEDCBA98n, 0x0n, 'The result of (-0x2n / -0xFEDCBA98n) is 0x0n'); + +assert.sameValue( + -0x2n / -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0x2n / -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + -0x2n / -0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0x2n / -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0x3n / 0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0x3n / 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0x3n / 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0x3n / 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue(-0x3n / 0xFEDCBA98n, 0x0n, 'The result of (-0x3n / 0xFEDCBA98n) is 0x0n'); +assert.sameValue(-0x3n / 0xFEDCBA97n, 0x0n, 'The result of (-0x3n / 0xFEDCBA97n) is 0x0n'); +assert.sameValue(-0x3n / 0x1234n, 0x0n, 'The result of (-0x3n / 0x1234n) is 0x0n'); +assert.sameValue(-0x3n / 0x3n, -0x1n, 'The result of (-0x3n / 0x3n) is -0x1n'); +assert.sameValue(-0x3n / 0x2n, -0x1n, 'The result of (-0x3n / 0x2n) is -0x1n'); +assert.sameValue(-0x3n / 0x1n, -0x3n, 'The result of (-0x3n / 0x1n) is -0x3n'); +assert.sameValue(-0x3n / -0x1n, 0x3n, 'The result of (-0x3n / -0x1n) is 0x3n'); +assert.sameValue(-0x3n / -0x2n, 0x1n, 'The result of (-0x3n / -0x2n) is 0x1n'); +assert.sameValue(-0x3n / -0x3n, 0x1n, 'The result of (-0x3n / -0x3n) is 0x1n'); +assert.sameValue(-0x3n / -0x1234n, 0x0n, 'The result of (-0x3n / -0x1234n) is 0x0n'); +assert.sameValue(-0x3n / -0xFEDCBA97n, 0x0n, 'The result of (-0x3n / -0xFEDCBA97n) is 0x0n'); +assert.sameValue(-0x3n / -0xFEDCBA98n, 0x0n, 'The result of (-0x3n / -0xFEDCBA98n) is 0x0n'); + +assert.sameValue( + -0x3n / -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0x3n / -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + -0x3n / -0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0x3n / -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0x1234n / 0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0x1234n / 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0x1234n / 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0x1234n / 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue(-0x1234n / 0xFEDCBA98n, 0x0n, 'The result of (-0x1234n / 0xFEDCBA98n) is 0x0n'); +assert.sameValue(-0x1234n / 0xFEDCBA97n, 0x0n, 'The result of (-0x1234n / 0xFEDCBA97n) is 0x0n'); +assert.sameValue(-0x1234n / 0x1234n, -0x1n, 'The result of (-0x1234n / 0x1234n) is -0x1n'); +assert.sameValue(-0x1234n / 0x3n, -0x611n, 'The result of (-0x1234n / 0x3n) is -0x611n'); +assert.sameValue(-0x1234n / 0x2n, -0x91An, 'The result of (-0x1234n / 0x2n) is -0x91An'); +assert.sameValue(-0x1234n / 0x1n, -0x1234n, 'The result of (-0x1234n / 0x1n) is -0x1234n'); +assert.sameValue(-0x1234n / -0x1n, 0x1234n, 'The result of (-0x1234n / -0x1n) is 0x1234n'); +assert.sameValue(-0x1234n / -0x2n, 0x91An, 'The result of (-0x1234n / -0x2n) is 0x91An'); +assert.sameValue(-0x1234n / -0x3n, 0x611n, 'The result of (-0x1234n / -0x3n) is 0x611n'); +assert.sameValue(-0x1234n / -0x1234n, 0x1n, 'The result of (-0x1234n / -0x1234n) is 0x1n'); +assert.sameValue(-0x1234n / -0xFEDCBA97n, 0x0n, 'The result of (-0x1234n / -0xFEDCBA97n) is 0x0n'); +assert.sameValue(-0x1234n / -0xFEDCBA98n, 0x0n, 'The result of (-0x1234n / -0xFEDCBA98n) is 0x0n'); + +assert.sameValue( + -0x1234n / -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0x1234n / -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + -0x1234n / -0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0x1234n / -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA97n / 0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0xFEDCBA97n / 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA97n / 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0xFEDCBA97n / 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA97n / 0xFEDCBA98n, + 0x0n, + 'The result of (-0xFEDCBA97n / 0xFEDCBA98n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA97n / 0xFEDCBA97n, + -0x1n, + 'The result of (-0xFEDCBA97n / 0xFEDCBA97n) is -0x1n' +); + +assert.sameValue( + -0xFEDCBA97n / 0x1234n, + -0xE0042n, + 'The result of (-0xFEDCBA97n / 0x1234n) is -0xE0042n' +); + +assert.sameValue( + -0xFEDCBA97n / 0x3n, + -0x54F43E32n, + 'The result of (-0xFEDCBA97n / 0x3n) is -0x54F43E32n' +); + +assert.sameValue( + -0xFEDCBA97n / 0x2n, + -0x7F6E5D4Bn, + 'The result of (-0xFEDCBA97n / 0x2n) is -0x7F6E5D4Bn' +); + +assert.sameValue( + -0xFEDCBA97n / 0x1n, + -0xFEDCBA97n, + 'The result of (-0xFEDCBA97n / 0x1n) is -0xFEDCBA97n' +); + +assert.sameValue( + -0xFEDCBA97n / -0x1n, + 0xFEDCBA97n, + 'The result of (-0xFEDCBA97n / -0x1n) is 0xFEDCBA97n' +); + +assert.sameValue( + -0xFEDCBA97n / -0x2n, + 0x7F6E5D4Bn, + 'The result of (-0xFEDCBA97n / -0x2n) is 0x7F6E5D4Bn' +); + +assert.sameValue( + -0xFEDCBA97n / -0x3n, + 0x54F43E32n, + 'The result of (-0xFEDCBA97n / -0x3n) is 0x54F43E32n' +); + +assert.sameValue( + -0xFEDCBA97n / -0x1234n, + 0xE0042n, + 'The result of (-0xFEDCBA97n / -0x1234n) is 0xE0042n' +); + +assert.sameValue( + -0xFEDCBA97n / -0xFEDCBA97n, + 0x1n, + 'The result of (-0xFEDCBA97n / -0xFEDCBA97n) is 0x1n' +); + +assert.sameValue( + -0xFEDCBA97n / -0xFEDCBA98n, + 0x0n, + 'The result of (-0xFEDCBA97n / -0xFEDCBA98n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA97n / -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0xFEDCBA97n / -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA97n / -0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0xFEDCBA97n / -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA98n / 0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0xFEDCBA98n / 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA98n / 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0xFEDCBA98n / 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA98n / 0xFEDCBA98n, + -0x1n, + 'The result of (-0xFEDCBA98n / 0xFEDCBA98n) is -0x1n' +); + +assert.sameValue( + -0xFEDCBA98n / 0xFEDCBA97n, + -0x1n, + 'The result of (-0xFEDCBA98n / 0xFEDCBA97n) is -0x1n' +); + +assert.sameValue( + -0xFEDCBA98n / 0x1234n, + -0xE0042n, + 'The result of (-0xFEDCBA98n / 0x1234n) is -0xE0042n' +); + +assert.sameValue( + -0xFEDCBA98n / 0x3n, + -0x54F43E32n, + 'The result of (-0xFEDCBA98n / 0x3n) is -0x54F43E32n' +); + +assert.sameValue( + -0xFEDCBA98n / 0x2n, + -0x7F6E5D4Cn, + 'The result of (-0xFEDCBA98n / 0x2n) is -0x7F6E5D4Cn' +); + +assert.sameValue( + -0xFEDCBA98n / 0x1n, + -0xFEDCBA98n, + 'The result of (-0xFEDCBA98n / 0x1n) is -0xFEDCBA98n' +); + +assert.sameValue( + -0xFEDCBA98n / -0x1n, + 0xFEDCBA98n, + 'The result of (-0xFEDCBA98n / -0x1n) is 0xFEDCBA98n' +); + +assert.sameValue( + -0xFEDCBA98n / -0x2n, + 0x7F6E5D4Cn, + 'The result of (-0xFEDCBA98n / -0x2n) is 0x7F6E5D4Cn' +); + +assert.sameValue( + -0xFEDCBA98n / -0x3n, + 0x54F43E32n, + 'The result of (-0xFEDCBA98n / -0x3n) is 0x54F43E32n' +); + +assert.sameValue( + -0xFEDCBA98n / -0x1234n, + 0xE0042n, + 'The result of (-0xFEDCBA98n / -0x1234n) is 0xE0042n' +); + +assert.sameValue( + -0xFEDCBA98n / -0xFEDCBA97n, + 0x1n, + 'The result of (-0xFEDCBA98n / -0xFEDCBA97n) is 0x1n' +); + +assert.sameValue( + -0xFEDCBA98n / -0xFEDCBA98n, + 0x1n, + 'The result of (-0xFEDCBA98n / -0xFEDCBA98n) is 0x1n' +); + +assert.sameValue( + -0xFEDCBA98n / -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0xFEDCBA98n / -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA98n / -0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0xFEDCBA98n / -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / 0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0xFEDCBA987654320Fn / 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / 0xFEDCBA987654320Fn, + -0x1n, + 'The result of (-0xFEDCBA987654320Fn / 0xFEDCBA987654320Fn) is -0x1n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / 0xFEDCBA98n, + -0x100000000n, + 'The result of (-0xFEDCBA987654320Fn / 0xFEDCBA98n) is -0x100000000n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / 0xFEDCBA97n, + -0x100000001n, + 'The result of (-0xFEDCBA987654320Fn / 0xFEDCBA97n) is -0x100000001n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / 0x1234n, + -0xE0042813BE5DCn, + 'The result of (-0xFEDCBA987654320Fn / 0x1234n) is -0xE0042813BE5DCn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / 0x3n, + -0x54F43E32D21C10AFn, + 'The result of (-0xFEDCBA987654320Fn / 0x3n) is -0x54F43E32D21C10AFn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / 0x2n, + -0x7F6E5D4C3B2A1907n, + 'The result of (-0xFEDCBA987654320Fn / 0x2n) is -0x7F6E5D4C3B2A1907n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / 0x1n, + -0xFEDCBA987654320Fn, + 'The result of (-0xFEDCBA987654320Fn / 0x1n) is -0xFEDCBA987654320Fn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / -0x1n, + 0xFEDCBA987654320Fn, + 'The result of (-0xFEDCBA987654320Fn / -0x1n) is 0xFEDCBA987654320Fn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / -0x2n, + 0x7F6E5D4C3B2A1907n, + 'The result of (-0xFEDCBA987654320Fn / -0x2n) is 0x7F6E5D4C3B2A1907n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / -0x3n, + 0x54F43E32D21C10AFn, + 'The result of (-0xFEDCBA987654320Fn / -0x3n) is 0x54F43E32D21C10AFn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / -0x1234n, + 0xE0042813BE5DCn, + 'The result of (-0xFEDCBA987654320Fn / -0x1234n) is 0xE0042813BE5DCn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / -0xFEDCBA97n, + 0x100000001n, + 'The result of (-0xFEDCBA987654320Fn / -0xFEDCBA97n) is 0x100000001n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / -0xFEDCBA98n, + 0x100000000n, + 'The result of (-0xFEDCBA987654320Fn / -0xFEDCBA98n) is 0x100000000n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / -0xFEDCBA987654320Fn, + 0x1n, + 'The result of (-0xFEDCBA987654320Fn / -0xFEDCBA987654320Fn) is 0x1n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / -0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0xFEDCBA987654320Fn / -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA9876543210n / 0xFEDCBA9876543210n, + -0x1n, + 'The result of (-0xFEDCBA9876543210n / 0xFEDCBA9876543210n) is -0x1n' +); + +assert.sameValue( + -0xFEDCBA9876543210n / 0xFEDCBA987654320Fn, + -0x1n, + 'The result of (-0xFEDCBA9876543210n / 0xFEDCBA987654320Fn) is -0x1n' +); + +assert.sameValue( + -0xFEDCBA9876543210n / 0xFEDCBA98n, + -0x100000000n, + 'The result of (-0xFEDCBA9876543210n / 0xFEDCBA98n) is -0x100000000n' +); + +assert.sameValue( + -0xFEDCBA9876543210n / 0xFEDCBA97n, + -0x100000001n, + 'The result of (-0xFEDCBA9876543210n / 0xFEDCBA97n) is -0x100000001n' +); + +assert.sameValue( + -0xFEDCBA9876543210n / 0x1234n, + -0xE0042813BE5DCn, + 'The result of (-0xFEDCBA9876543210n / 0x1234n) is -0xE0042813BE5DCn' +); + +assert.sameValue( + -0xFEDCBA9876543210n / 0x3n, + -0x54F43E32D21C10B0n, + 'The result of (-0xFEDCBA9876543210n / 0x3n) is -0x54F43E32D21C10B0n' +); + +assert.sameValue( + -0xFEDCBA9876543210n / 0x2n, + -0x7F6E5D4C3B2A1908n, + 'The result of (-0xFEDCBA9876543210n / 0x2n) is -0x7F6E5D4C3B2A1908n' +); + +assert.sameValue( + -0xFEDCBA9876543210n / 0x1n, + -0xFEDCBA9876543210n, + 'The result of (-0xFEDCBA9876543210n / 0x1n) is -0xFEDCBA9876543210n' +); + +assert.sameValue( + -0xFEDCBA9876543210n / -0x1n, + 0xFEDCBA9876543210n, + 'The result of (-0xFEDCBA9876543210n / -0x1n) is 0xFEDCBA9876543210n' +); + +assert.sameValue( + -0xFEDCBA9876543210n / -0x2n, + 0x7F6E5D4C3B2A1908n, + 'The result of (-0xFEDCBA9876543210n / -0x2n) is 0x7F6E5D4C3B2A1908n' +); + +assert.sameValue( + -0xFEDCBA9876543210n / -0x3n, + 0x54F43E32D21C10B0n, + 'The result of (-0xFEDCBA9876543210n / -0x3n) is 0x54F43E32D21C10B0n' +); + +assert.sameValue( + -0xFEDCBA9876543210n / -0x1234n, + 0xE0042813BE5DCn, + 'The result of (-0xFEDCBA9876543210n / -0x1234n) is 0xE0042813BE5DCn' +); + +assert.sameValue( + -0xFEDCBA9876543210n / -0xFEDCBA97n, + 0x100000001n, + 'The result of (-0xFEDCBA9876543210n / -0xFEDCBA97n) is 0x100000001n' +); + +assert.sameValue( + -0xFEDCBA9876543210n / -0xFEDCBA98n, + 0x100000000n, + 'The result of (-0xFEDCBA9876543210n / -0xFEDCBA98n) is 0x100000000n' +); + +assert.sameValue( + -0xFEDCBA9876543210n / -0xFEDCBA987654320Fn, + 0x1n, + 'The result of (-0xFEDCBA9876543210n / -0xFEDCBA987654320Fn) is 0x1n' +); -function testDiv(x, y, z) { - assert.sameValue(x / y, z, x + " / " + y + " = " + z); -} - -testDiv(0xFEDCBA9876543210n, 0xFEDCBA9876543210n, 0x1n); -testDiv(0xFEDCBA9876543210n, 0xFEDCBA987654320Fn, 0x1n); -testDiv(0xFEDCBA9876543210n, 0xFEDCBA98n, 0x100000000n); -testDiv(0xFEDCBA9876543210n, 0xFEDCBA97n, 0x100000001n); -testDiv(0xFEDCBA9876543210n, 0x1234n, 0xE0042813BE5DCn); -testDiv(0xFEDCBA9876543210n, 0x3n, 0x54F43E32D21C10B0n); -testDiv(0xFEDCBA9876543210n, 0x2n, 0x7F6E5D4C3B2A1908n); -testDiv(0xFEDCBA9876543210n, 0x1n, 0xFEDCBA9876543210n); -testDiv(0xFEDCBA9876543210n, -0x1n, -0xFEDCBA9876543210n); -testDiv(0xFEDCBA9876543210n, -0x2n, -0x7F6E5D4C3B2A1908n); -testDiv(0xFEDCBA9876543210n, -0x3n, -0x54F43E32D21C10B0n); -testDiv(0xFEDCBA9876543210n, -0x1234n, -0xE0042813BE5DCn); -testDiv(0xFEDCBA9876543210n, -0xFEDCBA97n, -0x100000001n); -testDiv(0xFEDCBA9876543210n, -0xFEDCBA98n, -0x100000000n); -testDiv(0xFEDCBA9876543210n, -0xFEDCBA987654320Fn, -0x1n); -testDiv(0xFEDCBA9876543210n, -0xFEDCBA9876543210n, -0x1n); -testDiv(0xFEDCBA987654320Fn, 0xFEDCBA9876543210n, 0x0n); -testDiv(0xFEDCBA987654320Fn, 0xFEDCBA987654320Fn, 0x1n); -testDiv(0xFEDCBA987654320Fn, 0xFEDCBA98n, 0x100000000n); -testDiv(0xFEDCBA987654320Fn, 0xFEDCBA97n, 0x100000001n); -testDiv(0xFEDCBA987654320Fn, 0x1234n, 0xE0042813BE5DCn); -testDiv(0xFEDCBA987654320Fn, 0x3n, 0x54F43E32D21C10AFn); -testDiv(0xFEDCBA987654320Fn, 0x2n, 0x7F6E5D4C3B2A1907n); -testDiv(0xFEDCBA987654320Fn, 0x1n, 0xFEDCBA987654320Fn); -testDiv(0xFEDCBA987654320Fn, -0x1n, -0xFEDCBA987654320Fn); -testDiv(0xFEDCBA987654320Fn, -0x2n, -0x7F6E5D4C3B2A1907n); -testDiv(0xFEDCBA987654320Fn, -0x3n, -0x54F43E32D21C10AFn); -testDiv(0xFEDCBA987654320Fn, -0x1234n, -0xE0042813BE5DCn); -testDiv(0xFEDCBA987654320Fn, -0xFEDCBA97n, -0x100000001n); -testDiv(0xFEDCBA987654320Fn, -0xFEDCBA98n, -0x100000000n); -testDiv(0xFEDCBA987654320Fn, -0xFEDCBA987654320Fn, -0x1n); -testDiv(0xFEDCBA987654320Fn, -0xFEDCBA9876543210n, 0x0n); -testDiv(0xFEDCBA98n, 0xFEDCBA9876543210n, 0x0n); -testDiv(0xFEDCBA98n, 0xFEDCBA987654320Fn, 0x0n); -testDiv(0xFEDCBA98n, 0xFEDCBA98n, 0x1n); -testDiv(0xFEDCBA98n, 0xFEDCBA97n, 0x1n); -testDiv(0xFEDCBA98n, 0x1234n, 0xE0042n); -testDiv(0xFEDCBA98n, 0x3n, 0x54F43E32n); -testDiv(0xFEDCBA98n, 0x2n, 0x7F6E5D4Cn); -testDiv(0xFEDCBA98n, 0x1n, 0xFEDCBA98n); -testDiv(0xFEDCBA98n, -0x1n, -0xFEDCBA98n); -testDiv(0xFEDCBA98n, -0x2n, -0x7F6E5D4Cn); -testDiv(0xFEDCBA98n, -0x3n, -0x54F43E32n); -testDiv(0xFEDCBA98n, -0x1234n, -0xE0042n); -testDiv(0xFEDCBA98n, -0xFEDCBA97n, -0x1n); -testDiv(0xFEDCBA98n, -0xFEDCBA98n, -0x1n); -testDiv(0xFEDCBA98n, -0xFEDCBA987654320Fn, 0x0n); -testDiv(0xFEDCBA98n, -0xFEDCBA9876543210n, 0x0n); -testDiv(0xFEDCBA97n, 0xFEDCBA9876543210n, 0x0n); -testDiv(0xFEDCBA97n, 0xFEDCBA987654320Fn, 0x0n); -testDiv(0xFEDCBA97n, 0xFEDCBA98n, 0x0n); -testDiv(0xFEDCBA97n, 0xFEDCBA97n, 0x1n); -testDiv(0xFEDCBA97n, 0x1234n, 0xE0042n); -testDiv(0xFEDCBA97n, 0x3n, 0x54F43E32n); -testDiv(0xFEDCBA97n, 0x2n, 0x7F6E5D4Bn); -testDiv(0xFEDCBA97n, 0x1n, 0xFEDCBA97n); -testDiv(0xFEDCBA97n, -0x1n, -0xFEDCBA97n); -testDiv(0xFEDCBA97n, -0x2n, -0x7F6E5D4Bn); -testDiv(0xFEDCBA97n, -0x3n, -0x54F43E32n); -testDiv(0xFEDCBA97n, -0x1234n, -0xE0042n); -testDiv(0xFEDCBA97n, -0xFEDCBA97n, -0x1n); -testDiv(0xFEDCBA97n, -0xFEDCBA98n, 0x0n); -testDiv(0xFEDCBA97n, -0xFEDCBA987654320Fn, 0x0n); -testDiv(0xFEDCBA97n, -0xFEDCBA9876543210n, 0x0n); -testDiv(0x1234n, 0xFEDCBA9876543210n, 0x0n); -testDiv(0x1234n, 0xFEDCBA987654320Fn, 0x0n); -testDiv(0x1234n, 0xFEDCBA98n, 0x0n); -testDiv(0x1234n, 0xFEDCBA97n, 0x0n); -testDiv(0x1234n, 0x1234n, 0x1n); -testDiv(0x1234n, 0x3n, 0x611n); -testDiv(0x1234n, 0x2n, 0x91An); -testDiv(0x1234n, 0x1n, 0x1234n); -testDiv(0x1234n, -0x1n, -0x1234n); -testDiv(0x1234n, -0x2n, -0x91An); -testDiv(0x1234n, -0x3n, -0x611n); -testDiv(0x1234n, -0x1234n, -0x1n); -testDiv(0x1234n, -0xFEDCBA97n, 0x0n); -testDiv(0x1234n, -0xFEDCBA98n, 0x0n); -testDiv(0x1234n, -0xFEDCBA987654320Fn, 0x0n); -testDiv(0x1234n, -0xFEDCBA9876543210n, 0x0n); -testDiv(0x3n, 0xFEDCBA9876543210n, 0x0n); -testDiv(0x3n, 0xFEDCBA987654320Fn, 0x0n); -testDiv(0x3n, 0xFEDCBA98n, 0x0n); -testDiv(0x3n, 0xFEDCBA97n, 0x0n); -testDiv(0x3n, 0x1234n, 0x0n); -testDiv(0x3n, 0x3n, 0x1n); -testDiv(0x3n, 0x2n, 0x1n); -testDiv(0x3n, 0x1n, 0x3n); -testDiv(0x3n, -0x1n, -0x3n); -testDiv(0x3n, -0x2n, -0x1n); -testDiv(0x3n, -0x3n, -0x1n); -testDiv(0x3n, -0x1234n, 0x0n); -testDiv(0x3n, -0xFEDCBA97n, 0x0n); -testDiv(0x3n, -0xFEDCBA98n, 0x0n); -testDiv(0x3n, -0xFEDCBA987654320Fn, 0x0n); -testDiv(0x3n, -0xFEDCBA9876543210n, 0x0n); -testDiv(0x2n, 0xFEDCBA9876543210n, 0x0n); -testDiv(0x2n, 0xFEDCBA987654320Fn, 0x0n); -testDiv(0x2n, 0xFEDCBA98n, 0x0n); -testDiv(0x2n, 0xFEDCBA97n, 0x0n); -testDiv(0x2n, 0x1234n, 0x0n); -testDiv(0x2n, 0x3n, 0x0n); -testDiv(0x2n, 0x2n, 0x1n); -testDiv(0x2n, 0x1n, 0x2n); -testDiv(0x2n, -0x1n, -0x2n); -testDiv(0x2n, -0x2n, -0x1n); -testDiv(0x2n, -0x3n, 0x0n); -testDiv(0x2n, -0x1234n, 0x0n); -testDiv(0x2n, -0xFEDCBA97n, 0x0n); -testDiv(0x2n, -0xFEDCBA98n, 0x0n); -testDiv(0x2n, -0xFEDCBA987654320Fn, 0x0n); -testDiv(0x2n, -0xFEDCBA9876543210n, 0x0n); -testDiv(0x1n, 0xFEDCBA9876543210n, 0x0n); -testDiv(0x1n, 0xFEDCBA987654320Fn, 0x0n); -testDiv(0x1n, 0xFEDCBA98n, 0x0n); -testDiv(0x1n, 0xFEDCBA97n, 0x0n); -testDiv(0x1n, 0x1234n, 0x0n); -testDiv(0x1n, 0x3n, 0x0n); -testDiv(0x1n, 0x2n, 0x0n); -testDiv(0x1n, 0x1n, 0x1n); -testDiv(0x1n, -0x1n, -0x1n); -testDiv(0x1n, -0x2n, 0x0n); -testDiv(0x1n, -0x3n, 0x0n); -testDiv(0x1n, -0x1234n, 0x0n); -testDiv(0x1n, -0xFEDCBA97n, 0x0n); -testDiv(0x1n, -0xFEDCBA98n, 0x0n); -testDiv(0x1n, -0xFEDCBA987654320Fn, 0x0n); -testDiv(0x1n, -0xFEDCBA9876543210n, 0x0n); -testDiv(-0x1n, 0xFEDCBA9876543210n, 0x0n); -testDiv(-0x1n, 0xFEDCBA987654320Fn, 0x0n); -testDiv(-0x1n, 0xFEDCBA98n, 0x0n); -testDiv(-0x1n, 0xFEDCBA97n, 0x0n); -testDiv(-0x1n, 0x1234n, 0x0n); -testDiv(-0x1n, 0x3n, 0x0n); -testDiv(-0x1n, 0x2n, 0x0n); -testDiv(-0x1n, 0x1n, -0x1n); -testDiv(-0x1n, -0x1n, 0x1n); -testDiv(-0x1n, -0x2n, 0x0n); -testDiv(-0x1n, -0x3n, 0x0n); -testDiv(-0x1n, -0x1234n, 0x0n); -testDiv(-0x1n, -0xFEDCBA97n, 0x0n); -testDiv(-0x1n, -0xFEDCBA98n, 0x0n); -testDiv(-0x1n, -0xFEDCBA987654320Fn, 0x0n); -testDiv(-0x1n, -0xFEDCBA9876543210n, 0x0n); -testDiv(-0x2n, 0xFEDCBA9876543210n, 0x0n); -testDiv(-0x2n, 0xFEDCBA987654320Fn, 0x0n); -testDiv(-0x2n, 0xFEDCBA98n, 0x0n); -testDiv(-0x2n, 0xFEDCBA97n, 0x0n); -testDiv(-0x2n, 0x1234n, 0x0n); -testDiv(-0x2n, 0x3n, 0x0n); -testDiv(-0x2n, 0x2n, -0x1n); -testDiv(-0x2n, 0x1n, -0x2n); -testDiv(-0x2n, -0x1n, 0x2n); -testDiv(-0x2n, -0x2n, 0x1n); -testDiv(-0x2n, -0x3n, 0x0n); -testDiv(-0x2n, -0x1234n, 0x0n); -testDiv(-0x2n, -0xFEDCBA97n, 0x0n); -testDiv(-0x2n, -0xFEDCBA98n, 0x0n); -testDiv(-0x2n, -0xFEDCBA987654320Fn, 0x0n); -testDiv(-0x2n, -0xFEDCBA9876543210n, 0x0n); -testDiv(-0x3n, 0xFEDCBA9876543210n, 0x0n); -testDiv(-0x3n, 0xFEDCBA987654320Fn, 0x0n); -testDiv(-0x3n, 0xFEDCBA98n, 0x0n); -testDiv(-0x3n, 0xFEDCBA97n, 0x0n); -testDiv(-0x3n, 0x1234n, 0x0n); -testDiv(-0x3n, 0x3n, -0x1n); -testDiv(-0x3n, 0x2n, -0x1n); -testDiv(-0x3n, 0x1n, -0x3n); -testDiv(-0x3n, -0x1n, 0x3n); -testDiv(-0x3n, -0x2n, 0x1n); -testDiv(-0x3n, -0x3n, 0x1n); -testDiv(-0x3n, -0x1234n, 0x0n); -testDiv(-0x3n, -0xFEDCBA97n, 0x0n); -testDiv(-0x3n, -0xFEDCBA98n, 0x0n); -testDiv(-0x3n, -0xFEDCBA987654320Fn, 0x0n); -testDiv(-0x3n, -0xFEDCBA9876543210n, 0x0n); -testDiv(-0x1234n, 0xFEDCBA9876543210n, 0x0n); -testDiv(-0x1234n, 0xFEDCBA987654320Fn, 0x0n); -testDiv(-0x1234n, 0xFEDCBA98n, 0x0n); -testDiv(-0x1234n, 0xFEDCBA97n, 0x0n); -testDiv(-0x1234n, 0x1234n, -0x1n); -testDiv(-0x1234n, 0x3n, -0x611n); -testDiv(-0x1234n, 0x2n, -0x91An); -testDiv(-0x1234n, 0x1n, -0x1234n); -testDiv(-0x1234n, -0x1n, 0x1234n); -testDiv(-0x1234n, -0x2n, 0x91An); -testDiv(-0x1234n, -0x3n, 0x611n); -testDiv(-0x1234n, -0x1234n, 0x1n); -testDiv(-0x1234n, -0xFEDCBA97n, 0x0n); -testDiv(-0x1234n, -0xFEDCBA98n, 0x0n); -testDiv(-0x1234n, -0xFEDCBA987654320Fn, 0x0n); -testDiv(-0x1234n, -0xFEDCBA9876543210n, 0x0n); -testDiv(-0xFEDCBA97n, 0xFEDCBA9876543210n, 0x0n); -testDiv(-0xFEDCBA97n, 0xFEDCBA987654320Fn, 0x0n); -testDiv(-0xFEDCBA97n, 0xFEDCBA98n, 0x0n); -testDiv(-0xFEDCBA97n, 0xFEDCBA97n, -0x1n); -testDiv(-0xFEDCBA97n, 0x1234n, -0xE0042n); -testDiv(-0xFEDCBA97n, 0x3n, -0x54F43E32n); -testDiv(-0xFEDCBA97n, 0x2n, -0x7F6E5D4Bn); -testDiv(-0xFEDCBA97n, 0x1n, -0xFEDCBA97n); -testDiv(-0xFEDCBA97n, -0x1n, 0xFEDCBA97n); -testDiv(-0xFEDCBA97n, -0x2n, 0x7F6E5D4Bn); -testDiv(-0xFEDCBA97n, -0x3n, 0x54F43E32n); -testDiv(-0xFEDCBA97n, -0x1234n, 0xE0042n); -testDiv(-0xFEDCBA97n, -0xFEDCBA97n, 0x1n); -testDiv(-0xFEDCBA97n, -0xFEDCBA98n, 0x0n); -testDiv(-0xFEDCBA97n, -0xFEDCBA987654320Fn, 0x0n); -testDiv(-0xFEDCBA97n, -0xFEDCBA9876543210n, 0x0n); -testDiv(-0xFEDCBA98n, 0xFEDCBA9876543210n, 0x0n); -testDiv(-0xFEDCBA98n, 0xFEDCBA987654320Fn, 0x0n); -testDiv(-0xFEDCBA98n, 0xFEDCBA98n, -0x1n); -testDiv(-0xFEDCBA98n, 0xFEDCBA97n, -0x1n); -testDiv(-0xFEDCBA98n, 0x1234n, -0xE0042n); -testDiv(-0xFEDCBA98n, 0x3n, -0x54F43E32n); -testDiv(-0xFEDCBA98n, 0x2n, -0x7F6E5D4Cn); -testDiv(-0xFEDCBA98n, 0x1n, -0xFEDCBA98n); -testDiv(-0xFEDCBA98n, -0x1n, 0xFEDCBA98n); -testDiv(-0xFEDCBA98n, -0x2n, 0x7F6E5D4Cn); -testDiv(-0xFEDCBA98n, -0x3n, 0x54F43E32n); -testDiv(-0xFEDCBA98n, -0x1234n, 0xE0042n); -testDiv(-0xFEDCBA98n, -0xFEDCBA97n, 0x1n); -testDiv(-0xFEDCBA98n, -0xFEDCBA98n, 0x1n); -testDiv(-0xFEDCBA98n, -0xFEDCBA987654320Fn, 0x0n); -testDiv(-0xFEDCBA98n, -0xFEDCBA9876543210n, 0x0n); -testDiv(-0xFEDCBA987654320Fn, 0xFEDCBA9876543210n, 0x0n); -testDiv(-0xFEDCBA987654320Fn, 0xFEDCBA987654320Fn, -0x1n); -testDiv(-0xFEDCBA987654320Fn, 0xFEDCBA98n, -0x100000000n); -testDiv(-0xFEDCBA987654320Fn, 0xFEDCBA97n, -0x100000001n); -testDiv(-0xFEDCBA987654320Fn, 0x1234n, -0xE0042813BE5DCn); -testDiv(-0xFEDCBA987654320Fn, 0x3n, -0x54F43E32D21C10AFn); -testDiv(-0xFEDCBA987654320Fn, 0x2n, -0x7F6E5D4C3B2A1907n); -testDiv(-0xFEDCBA987654320Fn, 0x1n, -0xFEDCBA987654320Fn); -testDiv(-0xFEDCBA987654320Fn, -0x1n, 0xFEDCBA987654320Fn); -testDiv(-0xFEDCBA987654320Fn, -0x2n, 0x7F6E5D4C3B2A1907n); -testDiv(-0xFEDCBA987654320Fn, -0x3n, 0x54F43E32D21C10AFn); -testDiv(-0xFEDCBA987654320Fn, -0x1234n, 0xE0042813BE5DCn); -testDiv(-0xFEDCBA987654320Fn, -0xFEDCBA97n, 0x100000001n); -testDiv(-0xFEDCBA987654320Fn, -0xFEDCBA98n, 0x100000000n); -testDiv(-0xFEDCBA987654320Fn, -0xFEDCBA987654320Fn, 0x1n); -testDiv(-0xFEDCBA987654320Fn, -0xFEDCBA9876543210n, 0x0n); -testDiv(-0xFEDCBA9876543210n, 0xFEDCBA9876543210n, -0x1n); -testDiv(-0xFEDCBA9876543210n, 0xFEDCBA987654320Fn, -0x1n); -testDiv(-0xFEDCBA9876543210n, 0xFEDCBA98n, -0x100000000n); -testDiv(-0xFEDCBA9876543210n, 0xFEDCBA97n, -0x100000001n); -testDiv(-0xFEDCBA9876543210n, 0x1234n, -0xE0042813BE5DCn); -testDiv(-0xFEDCBA9876543210n, 0x3n, -0x54F43E32D21C10B0n); -testDiv(-0xFEDCBA9876543210n, 0x2n, -0x7F6E5D4C3B2A1908n); -testDiv(-0xFEDCBA9876543210n, 0x1n, -0xFEDCBA9876543210n); -testDiv(-0xFEDCBA9876543210n, -0x1n, 0xFEDCBA9876543210n); -testDiv(-0xFEDCBA9876543210n, -0x2n, 0x7F6E5D4C3B2A1908n); -testDiv(-0xFEDCBA9876543210n, -0x3n, 0x54F43E32D21C10B0n); -testDiv(-0xFEDCBA9876543210n, -0x1234n, 0xE0042813BE5DCn); -testDiv(-0xFEDCBA9876543210n, -0xFEDCBA97n, 0x100000001n); -testDiv(-0xFEDCBA9876543210n, -0xFEDCBA98n, 0x100000000n); -testDiv(-0xFEDCBA9876543210n, -0xFEDCBA987654320Fn, 0x1n); -testDiv(-0xFEDCBA9876543210n, -0xFEDCBA9876543210n, 0x1n); +assert.sameValue( + -0xFEDCBA9876543210n / -0xFEDCBA9876543210n, + 0x1n, + 'The result of (-0xFEDCBA9876543210n / -0xFEDCBA9876543210n) is 0x1n' +); \ No newline at end of file diff --git a/test/language/expressions/division/bigint-complex-infinity.js b/test/language/expressions/division/bigint-complex-infinity.js index 636b28b65baffff132eaa73c7ec24cd702c626b6..508a580e4094dd3d0e3997920fcd90896e6c557d 100644 --- a/test/language/expressions/division/bigint-complex-infinity.js +++ b/test/language/expressions/division/bigint-complex-infinity.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Robin Templeton. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: BigInt division of complex infinity (1/0) esid: sec-multiplicative-operators-runtime-semantics-evaluation @@ -19,19 +18,18 @@ info: | ... features: [BigInt] ---*/ - assert.throws(RangeError, function() { - 1n / 0n -}); + 1n / 0n; +}, '1n / 0n throws RangeError'); assert.throws(RangeError, function() { - 10n / 0n -}); + 10n / 0n; +}, '10n / 0n throws RangeError'); assert.throws(RangeError, function() { - 0n / 0n -}); + 0n / 0n; +}, '0n / 0n throws RangeError'); assert.throws(RangeError, function() { - 1000000000000000000n / 0n -}); + 1000000000000000000n / 0n; +}, '1000000000000000000n / 0n throws RangeError'); \ No newline at end of file diff --git a/test/language/expressions/division/bigint-errors.js b/test/language/expressions/division/bigint-errors.js index 78981b44e88d9560c226f2fe2207b381c11775a8..cfc554cd75ce5aa554d642fee9307bd63bc2aba0 100644 --- a/test/language/expressions/division/bigint-errors.js +++ b/test/language/expressions/division/bigint-errors.js @@ -5,58 +5,66 @@ description: division operator ToNumeric with BigInt operands esid: sec-multiplicative-operators-runtime-semantics-evaluation features: [BigInt, Symbol, Symbol.toPrimitive, computed-property-names] ---*/ - assert.throws(TypeError, function() { - Symbol("1") / 1n; -}, "ToBigInt: Symbol => TypeError"); + Symbol('1') / 1n; +}, 'Symbol("1") / 1n throws TypeError'); + assert.throws(TypeError, function() { - 0n / Symbol("1"); -}, "ToBigInt: Symbol => TypeError"); + 0n / Symbol('1'); +}, '0n / Symbol("1") throws TypeError'); + assert.throws(TypeError, function() { - Object(Symbol("1")) / 1n; -}, "ToBigInt: unbox object with internal slot => Symbol => TypeError"); + Object(Symbol('1')) / 1n; +}, 'Object(Symbol("1")) / 1n throws TypeError'); + assert.throws(TypeError, function() { - 0n / Object(Symbol("1")); -}, "ToBigInt: unbox object with internal slot => Symbol => TypeError"); + 0n / Object(Symbol('1')); +}, '0n / Object(Symbol("1")) throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { - return Symbol("1"); + return Symbol('1'); } }) / 1n; -}, "ToBigInt: @@toPrimitive => Symbol => TypeError"); +}, '({[Symbol.toPrimitive]: function() {return Symbol("1");}}) / 1n throws TypeError'); + assert.throws(TypeError, function() { 0n / { [Symbol.toPrimitive]: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: @@toPrimitive => Symbol => TypeError"); +}, '0n / {[Symbol.toPrimitive]: function() {return Symbol("1");}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { - return Symbol("1"); + return Symbol('1'); } }) / 1n; -}, "ToBigInt: valueOf => Symbol => TypeError"); +}, '({valueOf: function() {return Symbol("1");}}) / 1n throws TypeError'); + assert.throws(TypeError, function() { 0n / { valueOf: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: valueOf => Symbol => TypeError"); +}, '0n / {valueOf: function() {return Symbol("1");}} throws TypeError'); + assert.throws(TypeError, function() { ({ toString: function() { - return Symbol("1"); + return Symbol('1'); } }) / 1n; -}, "ToBigInt: toString => Symbol => TypeError"); +}, '({toString: function() {return Symbol("1");}}) / 1n throws TypeError'); + assert.throws(TypeError, function() { 0n / { toString: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: toString => Symbol => TypeError"); +}, '0n / {toString: function() {return Symbol("1");}} throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/division/bigint-toprimitive.js b/test/language/expressions/division/bigint-toprimitive.js index d50ec872f89cb3fec3a6cb20b00dd553deed3b0c..d525e1e7949179732b8f15c9910654eed03b7e92 100644 --- a/test/language/expressions/division/bigint-toprimitive.js +++ b/test/language/expressions/division/bigint-toprimitive.js @@ -5,304 +5,368 @@ description: division operator ToNumeric with BigInt operands esid: sec-multiplicative-operators-runtime-semantics-evaluation features: [BigInt, Symbol.toPrimitive, computed-property-names] ---*/ - function err() { throw new Test262Error(); } function MyError() {} -assert.sameValue(({ +assert.sameValue({ [Symbol.toPrimitive]: function() { return 2n; }, + valueOf: err, toString: err -}) / 2n, 1n, "ToPrimitive: @@toPrimitive takes precedence"); +} / 2n, 1n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) / 2n) is 1n'); + assert.sameValue(2n / { [Symbol.toPrimitive]: function() { return 2n; }, + valueOf: err, toString: err -}, 1n, "ToPrimitive: @@toPrimitive takes precedence"); -assert.sameValue(({ +}, 1n, 'The result of (2n / {[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) is 1n'); + +assert.sameValue({ valueOf: function() { return 2n; }, + toString: err -}) / 2n, 1n, "ToPrimitive: valueOf takes precedence over toString"); +} / 2n, 1n, 'The result of (({valueOf: function() {return 2n;}, toString: err}) / 2n) is 1n'); + assert.sameValue(2n / { valueOf: function() { return 2n; }, + toString: err -}, 1n, "ToPrimitive: valueOf takes precedence over toString"); -assert.sameValue(({ +}, 1n, 'The result of (2n / {valueOf: function() {return 2n;}, toString: err}) is 1n'); + +assert.sameValue({ toString: function() { return 2n; } -}) / 2n, 1n, "ToPrimitive: toString with no valueOf"); +} / 2n, 1n, 'The result of (({toString: function() {return 2n;}}) / 2n) is 1n'); + assert.sameValue(2n / { toString: function() { return 2n; } -}, 1n, "ToPrimitive: toString with no valueOf"); -assert.sameValue(({ +}, 1n, 'The result of (2n / {toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ [Symbol.toPrimitive]: undefined, + valueOf: function() { return 2n; } -}) / 2n, 1n, "ToPrimitive: skip @@toPrimitive when it's undefined"); +} / 2n, 1n, 'The result of (({[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) / 2n) is 1n'); + assert.sameValue(2n / { [Symbol.toPrimitive]: undefined, + valueOf: function() { return 2n; } -}, 1n, "ToPrimitive: skip @@toPrimitive when it's undefined"); -assert.sameValue(({ +}, 1n, 'The result of (2n / {[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ [Symbol.toPrimitive]: null, + valueOf: function() { return 2n; } -}) / 2n, 1n, "ToPrimitive: skip @@toPrimitive when it's null"); +} / 2n, 1n, 'The result of (({[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) / 2n) is 1n'); + assert.sameValue(2n / { [Symbol.toPrimitive]: null, + valueOf: function() { return 2n; } -}, 1n, "ToPrimitive: skip @@toPrimitive when it's null"); -assert.sameValue(({ +}, 1n, 'The result of (2n / {[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: null, + toString: function() { return 2n; } -}) / 2n, 1n, "ToPrimitive: skip valueOf when it's not callable"); +} / 2n, 1n, 'The result of (({valueOf: null, toString: function() {return 2n;}}) / 2n) is 1n'); + assert.sameValue(2n / { valueOf: null, + toString: function() { return 2n; } -}, 1n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 1n, 'The result of (2n / {valueOf: null, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: 1, + toString: function() { return 2n; } -}) / 2n, 1n, "ToPrimitive: skip valueOf when it's not callable"); +} / 2n, 1n, 'The result of (({valueOf: 1, toString: function() {return 2n;}}) / 2n) is 1n'); + assert.sameValue(2n / { valueOf: 1, + toString: function() { return 2n; } -}, 1n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 1n, 'The result of (2n / {valueOf: 1, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: {}, + toString: function() { return 2n; } -}) / 2n, 1n, "ToPrimitive: skip valueOf when it's not callable"); +} / 2n, 1n, 'The result of (({valueOf: {}, toString: function() {return 2n;}}) / 2n) is 1n'); + assert.sameValue(2n / { valueOf: {}, + toString: function() { return 2n; } -}, 1n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 1n, 'The result of (2n / {valueOf: {}, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: function() { return {}; }, + toString: function() { return 2n; } -}) / 2n, 1n, "ToPrimitive: skip valueOf when it returns an object"); +} / 2n, 1n, 'The result of (({valueOf: function() {return {};}, toString: function() {return 2n;}}) / 2n) is 1n'); + assert.sameValue(2n / { valueOf: function() { return {}; }, + toString: function() { return 2n; } -}, 1n, "ToPrimitive: skip valueOf when it returns an object"); -assert.sameValue(({ +}, 1n, 'The result of (2n / {valueOf: function() {return {};}, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: function() { return Object(12345); }, + toString: function() { return 2n; } -}) / 2n, 1n, "ToPrimitive: skip valueOf when it returns an object"); +} / 2n, 1n, 'The result of (({valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) / 2n) is 1n'); + assert.sameValue(2n / { valueOf: function() { return Object(12345); }, + toString: function() { return 2n; } -}, 1n, "ToPrimitive: skip valueOf when it returns an object"); +}, 1n, 'The result of (2n / {valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) is 1n'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: 1 }) / 1n; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '({[Symbol.toPrimitive]: 1}) / 1n throws TypeError'); + assert.throws(TypeError, function() { 0n / { [Symbol.toPrimitive]: 1 }; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '0n / {[Symbol.toPrimitive]: 1} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: {} }) / 1n; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '({[Symbol.toPrimitive]: {}}) / 1n throws TypeError'); + assert.throws(TypeError, function() { 0n / { [Symbol.toPrimitive]: {} }; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '0n / {[Symbol.toPrimitive]: {}} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { return Object(1); } }) / 1n; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '({[Symbol.toPrimitive]: function() {return Object(1);}}) / 1n throws TypeError'); + assert.throws(TypeError, function() { 0n / { [Symbol.toPrimitive]: function() { return Object(1); } }; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '0n / {[Symbol.toPrimitive]: function() {return Object(1);}} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { return {}; } }) / 1n; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '({[Symbol.toPrimitive]: function() {return {};}}) / 1n throws TypeError'); + assert.throws(TypeError, function() { 0n / { [Symbol.toPrimitive]: function() { return {}; } }; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '0n / {[Symbol.toPrimitive]: function() {return {};}} throws TypeError'); + assert.throws(MyError, function() { ({ [Symbol.toPrimitive]: function() { throw new MyError(); } }) / 1n; -}, "ToPrimitive: propagate errors from @@toPrimitive"); +}, '({[Symbol.toPrimitive]: function() {throw new MyError();}}) / 1n throws MyError'); + assert.throws(MyError, function() { 0n / { [Symbol.toPrimitive]: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from @@toPrimitive"); +}, '0n / {[Symbol.toPrimitive]: function() {throw new MyError();}} throws MyError'); + assert.throws(MyError, function() { ({ valueOf: function() { throw new MyError(); } }) / 1n; -}, "ToPrimitive: propagate errors from valueOf"); +}, '({valueOf: function() {throw new MyError();}}) / 1n throws MyError'); + assert.throws(MyError, function() { 0n / { valueOf: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from valueOf"); +}, '0n / {valueOf: function() {throw new MyError();}} throws MyError'); + assert.throws(MyError, function() { ({ toString: function() { throw new MyError(); } }) / 1n; -}, "ToPrimitive: propagate errors from toString"); +}, '({toString: function() {throw new MyError();}}) / 1n throws MyError'); + assert.throws(MyError, function() { 0n / { toString: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from toString"); +}, '0n / {toString: function() {throw new MyError();}} throws MyError'); + assert.throws(TypeError, function() { ({ valueOf: null, toString: null }) / 1n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: null, toString: null}) / 1n throws TypeError'); + assert.throws(TypeError, function() { 0n / { valueOf: null, toString: null }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n / {valueOf: null, toString: null} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: 1, toString: 1 }) / 1n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: 1, toString: 1}) / 1n throws TypeError'); + assert.throws(TypeError, function() { 0n / { valueOf: 1, toString: 1 }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n / {valueOf: 1, toString: 1} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: {}, toString: {} }) / 1n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: {}, toString: {}}) / 1n throws TypeError'); + assert.throws(TypeError, function() { 0n / { valueOf: {}, toString: {} }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n / {valueOf: {}, toString: {}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { return Object(1); }, + toString: function() { return Object(1); } }) / 1n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: function() {return Object(1);}, toString: function() {return Object(1);}}) / 1n throws TypeError'); + assert.throws(TypeError, function() { 0n / { valueOf: function() { return Object(1); }, + toString: function() { return Object(1); } }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n / {valueOf: function() {return Object(1);}, toString: function() {return Object(1);}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { return {}; }, + toString: function() { return {}; } }) / 1n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: function() {return {};}, toString: function() {return {};}}) / 1n throws TypeError'); + assert.throws(TypeError, function() { 0n / { valueOf: function() { return {}; }, + toString: function() { return {}; } }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n / {valueOf: function() {return {};}, toString: function() {return {};}} throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/division/bigint-wrapped-values.js b/test/language/expressions/division/bigint-wrapped-values.js index d25f79b57e71099268e4cc72ad1c10de70a9daa9..16fe89ae7a3bfd28bd69c25482433e454e0cef0a 100644 --- a/test/language/expressions/division/bigint-wrapped-values.js +++ b/test/language/expressions/division/bigint-wrapped-values.js @@ -5,36 +5,41 @@ description: division operator ToNumeric with BigInt operands esid: sec-multiplicative-operators-runtime-semantics-evaluation features: [BigInt, Symbol.toPrimitive, computed-property-names] ---*/ +assert.sameValue(Object(2n) / 2n, 1n, 'The result of (Object(2n) / 2n) is 1n'); +assert.sameValue(2n / Object(2n), 1n, 'The result of (2n / Object(2n)) is 1n'); -assert.sameValue(Object(2n) / 2n, 1n, "ToPrimitive: unbox object with internal slot"); -assert.sameValue(2n / Object(2n), 1n, "ToPrimitive: unbox object with internal slot"); -assert.sameValue(({ +assert.sameValue({ [Symbol.toPrimitive]: function() { return 2n; } -}) / 2n, 1n, "ToPrimitive: @@toPrimitive"); +} / 2n, 1n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}}) / 2n) is 1n'); + assert.sameValue(2n / { [Symbol.toPrimitive]: function() { return 2n; } -}, 1n, "ToPrimitive: @@toPrimitive"); -assert.sameValue(({ +}, 1n, 'The result of (2n / {[Symbol.toPrimitive]: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: function() { return 2n; } -}) / 2n, 1n, "ToPrimitive: valueOf"); +} / 2n, 1n, 'The result of (({valueOf: function() {return 2n;}}) / 2n) is 1n'); + assert.sameValue(2n / { valueOf: function() { return 2n; } -}, 1n, "ToPrimitive: valueOf"); -assert.sameValue(({ +}, 1n, 'The result of (2n / {valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ toString: function() { return 2n; } -}) / 2n, 1n, "ToPrimitive: toString"); +} / 2n, 1n, 'The result of (({toString: function() {return 2n;}}) / 2n) is 1n'); + assert.sameValue(2n / { toString: function() { return 2n; } -}, 1n, "ToPrimitive: toString"); +}, 1n, 'The result of (2n / {toString: function() {return 2n;}}) is 1n'); \ No newline at end of file diff --git a/test/language/expressions/does-not-equals/bigint-and-bigint.js b/test/language/expressions/does-not-equals/bigint-and-bigint.js index fbed259fb70183b3ec3731864df980d9213da961..ed49cad23eabcf0afd7d00f3c73fefee54827ad5 100644 --- a/test/language/expressions/does-not-equals/bigint-and-bigint.js +++ b/test/language/expressions/does-not-equals/bigint-and-bigint.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Non-strict inequality comparison of BigInt values esid: sec-abstract-equality-comparison @@ -15,39 +14,158 @@ info: | features: [BigInt] ---*/ +assert.sameValue(0n != 0n, false, 'The result of (0n != 0n) is false'); +assert.sameValue(1n != 1n, false, 'The result of (1n != 1n) is false'); +assert.sameValue(-1n != -1n, false, 'The result of (-1n != -1n) is false'); +assert.sameValue(0n != -0n, false, 'The result of (0n != -0n) is false'); +assert.sameValue(-0n != 0n, false, 'The result of (-0n != 0n) is false'); +assert.sameValue(0n != 1n, true, 'The result of (0n != 1n) is true'); +assert.sameValue(1n != 0n, true, 'The result of (1n != 0n) is true'); +assert.sameValue(0n != -1n, true, 'The result of (0n != -1n) is true'); +assert.sameValue(-1n != 0n, true, 'The result of (-1n != 0n) is true'); +assert.sameValue(1n != -1n, true, 'The result of (1n != -1n) is true'); +assert.sameValue(-1n != 1n, true, 'The result of (-1n != 1n) is true'); + +assert.sameValue( + 0x1fffffffffffff01n != 0x1fffffffffffff01n, + false, + 'The result of (0x1fffffffffffff01n != 0x1fffffffffffff01n) is false' +); + +assert.sameValue( + 0x1fffffffffffff01n != 0x1fffffffffffff02n, + true, + 'The result of (0x1fffffffffffff01n != 0x1fffffffffffff02n) is true' +); + +assert.sameValue( + 0x1fffffffffffff02n != 0x1fffffffffffff01n, + true, + 'The result of (0x1fffffffffffff02n != 0x1fffffffffffff01n) is true' +); + +assert.sameValue( + -0x1fffffffffffff01n != -0x1fffffffffffff01n, + false, + 'The result of (-0x1fffffffffffff01n != -0x1fffffffffffff01n) is false' +); + +assert.sameValue( + -0x1fffffffffffff01n != -0x1fffffffffffff02n, + true, + 'The result of (-0x1fffffffffffff01n != -0x1fffffffffffff02n) is true' +); + +assert.sameValue( + -0x1fffffffffffff02n != -0x1fffffffffffff01n, + true, + 'The result of (-0x1fffffffffffff02n != -0x1fffffffffffff01n) is true' +); + +assert.sameValue( + 0x10000000000000000n != 0n, + true, + 'The result of (0x10000000000000000n != 0n) is true' +); + +assert.sameValue( + 0n != 0x10000000000000000n, + true, + 'The result of (0n != 0x10000000000000000n) is true' +); + +assert.sameValue( + 0x10000000000000000n != 1n, + true, + 'The result of (0x10000000000000000n != 1n) is true' +); + +assert.sameValue( + 1n != 0x10000000000000000n, + true, + 'The result of (1n != 0x10000000000000000n) is true' +); + +assert.sameValue( + 0x10000000000000000n != -1n, + true, + 'The result of (0x10000000000000000n != -1n) is true' +); + +assert.sameValue( + -1n != 0x10000000000000000n, + true, + 'The result of (-1n != 0x10000000000000000n) is true' +); + +assert.sameValue( + 0x10000000000000001n != 0n, + true, + 'The result of (0x10000000000000001n != 0n) is true' +); + +assert.sameValue( + 0n != 0x10000000000000001n, + true, + 'The result of (0n != 0x10000000000000001n) is true' +); + +assert.sameValue( + -0x10000000000000000n != 0n, + true, + 'The result of (-0x10000000000000000n != 0n) is true' +); + +assert.sameValue( + 0n != -0x10000000000000000n, + true, + 'The result of (0n != -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000000n != 1n, + true, + 'The result of (-0x10000000000000000n != 1n) is true' +); + +assert.sameValue( + 1n != -0x10000000000000000n, + true, + 'The result of (1n != -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000000n != -1n, + true, + 'The result of (-0x10000000000000000n != -1n) is true' +); + +assert.sameValue( + -1n != -0x10000000000000000n, + true, + 'The result of (-1n != -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000001n != 0n, + true, + 'The result of (-0x10000000000000001n != 0n) is true' +); + +assert.sameValue( + 0n != -0x10000000000000001n, + true, + 'The result of (0n != -0x10000000000000001n) is true' +); + +assert.sameValue( + 0x10000000000000000n != 0x100000000n, + true, + 'The result of (0x10000000000000000n != 0x100000000n) is true' +); -assert.sameValue(0n != 0n, false, "0n != 0n"); -assert.sameValue(1n != 1n, false, "1n != 1n"); -assert.sameValue(-1n != -1n, false, "-1n != -1n"); -assert.sameValue(0n != -0n, false, "0n != -0n"); -assert.sameValue(-0n != 0n, false, "-0n != 0n"); -assert.sameValue(0n != 1n, true, "0n != 1n"); -assert.sameValue(1n != 0n, true, "1n != 0n"); -assert.sameValue(0n != -1n, true, "0n != -1n"); -assert.sameValue(-1n != 0n, true, "-1n != 0n"); -assert.sameValue(1n != -1n, true, "1n != -1n"); -assert.sameValue(-1n != 1n, true, "-1n != 1n"); -assert.sameValue(0x1fffffffffffff01n != 0x1fffffffffffff01n, false, "0x1fffffffffffff01n != 0x1fffffffffffff01n"); -assert.sameValue(0x1fffffffffffff01n != 0x1fffffffffffff02n, true, "0x1fffffffffffff01n != 0x1fffffffffffff02n"); -assert.sameValue(0x1fffffffffffff02n != 0x1fffffffffffff01n, true, "0x1fffffffffffff02n != 0x1fffffffffffff01n"); -assert.sameValue(-0x1fffffffffffff01n != -0x1fffffffffffff01n, false, "-0x1fffffffffffff01n != -0x1fffffffffffff01n"); -assert.sameValue(-0x1fffffffffffff01n != -0x1fffffffffffff02n, true, "-0x1fffffffffffff01n != -0x1fffffffffffff02n"); -assert.sameValue(-0x1fffffffffffff02n != -0x1fffffffffffff01n, true, "-0x1fffffffffffff02n != -0x1fffffffffffff01n"); -assert.sameValue(0x10000000000000000n != 0n, true, "0x10000000000000000n != 0n"); -assert.sameValue(0n != 0x10000000000000000n, true, "0n != 0x10000000000000000n"); -assert.sameValue(0x10000000000000000n != 1n, true, "0x10000000000000000n != 1n"); -assert.sameValue(1n != 0x10000000000000000n, true, "1n != 0x10000000000000000n"); -assert.sameValue(0x10000000000000000n != -1n, true, "0x10000000000000000n != -1n"); -assert.sameValue(-1n != 0x10000000000000000n, true, "-1n != 0x10000000000000000n"); -assert.sameValue(0x10000000000000001n != 0n, true, "0x10000000000000001n != 0n"); -assert.sameValue(0n != 0x10000000000000001n, true, "0n != 0x10000000000000001n"); -assert.sameValue(-0x10000000000000000n != 0n, true, "-0x10000000000000000n != 0n"); -assert.sameValue(0n != -0x10000000000000000n, true, "0n != -0x10000000000000000n"); -assert.sameValue(-0x10000000000000000n != 1n, true, "-0x10000000000000000n != 1n"); -assert.sameValue(1n != -0x10000000000000000n, true, "1n != -0x10000000000000000n"); -assert.sameValue(-0x10000000000000000n != -1n, true, "-0x10000000000000000n != -1n"); -assert.sameValue(-1n != -0x10000000000000000n, true, "-1n != -0x10000000000000000n"); -assert.sameValue(-0x10000000000000001n != 0n, true, "-0x10000000000000001n != 0n"); -assert.sameValue(0n != -0x10000000000000001n, true, "0n != -0x10000000000000001n"); -assert.sameValue(0x10000000000000000n != 0x100000000n, true, "0x10000000000000000n != 0x100000000n"); -assert.sameValue(0x100000000n != 0x10000000000000000n, true, "0x100000000n != 0x10000000000000000n"); +assert.sameValue( + 0x100000000n != 0x10000000000000000n, + true, + 'The result of (0x100000000n != 0x10000000000000000n) is true' +); \ No newline at end of file diff --git a/test/language/expressions/does-not-equals/bigint-and-boolean.js b/test/language/expressions/does-not-equals/bigint-and-boolean.js index 498dd1b77cfc1158b3fb3ec2de90383984d04abd..c8c6bf3d9bc2f37391d597b81f23ff528f016e08 100644 --- a/test/language/expressions/does-not-equals/bigint-and-boolean.js +++ b/test/language/expressions/does-not-equals/bigint-and-boolean.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Non-strict inequality comparison of BigInt and Boolean values esid: sec-abstract-equality-comparison @@ -14,20 +13,19 @@ info: | features: [BigInt] ---*/ - -assert.sameValue(-1n != false, true, "-1n != false"); -assert.sameValue(false != -1n, true, "false != -1n"); -assert.sameValue(-1n != true, true, "-1n != true"); -assert.sameValue(true != -1n, true, "true != -1n"); -assert.sameValue(0n != false, false, "0n != false"); -assert.sameValue(false != 0n, false, "false != 0n"); -assert.sameValue(0n != true, true, "0n != true"); -assert.sameValue(true != 0n, true, "true != 0n"); -assert.sameValue(1n != false, true, "1n != false"); -assert.sameValue(false != 1n, true, "false != 1n"); -assert.sameValue(1n != true, false, "1n != true"); -assert.sameValue(true != 1n, false, "true != 1n"); -assert.sameValue(2n != false, true, "2n != false"); -assert.sameValue(false != 2n, true, "false != 2n"); -assert.sameValue(2n != true, true, "2n != true"); -assert.sameValue(true != 2n, true, "true != 2n"); +assert.sameValue(-1n != false, true, 'The result of (-1n != false) is true'); +assert.sameValue(false != -1n, true, 'The result of (false != -1n) is true'); +assert.sameValue(-1n != true, true, 'The result of (-1n != true) is true'); +assert.sameValue(true != -1n, true, 'The result of (true != -1n) is true'); +assert.sameValue(0n != false, false, 'The result of (0n != false) is false'); +assert.sameValue(false != 0n, false, 'The result of (false != 0n) is false'); +assert.sameValue(0n != true, true, 'The result of (0n != true) is true'); +assert.sameValue(true != 0n, true, 'The result of (true != 0n) is true'); +assert.sameValue(1n != false, true, 'The result of (1n != false) is true'); +assert.sameValue(false != 1n, true, 'The result of (false != 1n) is true'); +assert.sameValue(1n != true, false, 'The result of (1n != true) is false'); +assert.sameValue(true != 1n, false, 'The result of (true != 1n) is false'); +assert.sameValue(2n != false, true, 'The result of (2n != false) is true'); +assert.sameValue(false != 2n, true, 'The result of (false != 2n) is true'); +assert.sameValue(2n != true, true, 'The result of (2n != true) is true'); +assert.sameValue(true != 2n, true, 'The result of (true != 2n) is true'); \ No newline at end of file diff --git a/test/language/expressions/does-not-equals/bigint-and-incomparable-primitive.js b/test/language/expressions/does-not-equals/bigint-and-incomparable-primitive.js index 6366dc3730c217fa1e6883f33c6fa992b2040b25..07bd83bdaeae91026c40afbf69823e39668600e3 100644 --- a/test/language/expressions/does-not-equals/bigint-and-incomparable-primitive.js +++ b/test/language/expressions/does-not-equals/bigint-and-incomparable-primitive.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Non-strict inequality comparison of BigInt and miscellaneous primitive values esid: sec-equality-operators-runtime-semantics-evaluation @@ -12,16 +11,15 @@ info: | features: [BigInt, Symbol] ---*/ - -assert.sameValue(0n != undefined, true, "0n != undefined"); -assert.sameValue(undefined != 0n, true, "undefined != 0n"); -assert.sameValue(1n != undefined, true, "1n != undefined"); -assert.sameValue(undefined != 1n, true, "undefined != 1n"); -assert.sameValue(0n != null, true, "0n != null"); -assert.sameValue(null != 0n, true, "null != 0n"); -assert.sameValue(1n != null, true, "1n != null"); -assert.sameValue(null != 1n, true, "null != 1n"); -assert.sameValue(0n != Symbol("1"), true, '0n != Symbol("1")'); -assert.sameValue(Symbol("1") != 0n, true, 'Symbol("1") != 0n'); -assert.sameValue(1n != Symbol("1"), true, '1n != Symbol("1")'); -assert.sameValue(Symbol("1") != 1n, true, 'Symbol("1") != 1n'); +assert.sameValue(0n != undefined, true, 'The result of (0n != undefined) is true'); +assert.sameValue(undefined != 0n, true, 'The result of (undefined != 0n) is true'); +assert.sameValue(1n != undefined, true, 'The result of (1n != undefined) is true'); +assert.sameValue(undefined != 1n, true, 'The result of (undefined != 1n) is true'); +assert.sameValue(0n != null, true, 'The result of (0n != null) is true'); +assert.sameValue(null != 0n, true, 'The result of (null != 0n) is true'); +assert.sameValue(1n != null, true, 'The result of (1n != null) is true'); +assert.sameValue(null != 1n, true, 'The result of (null != 1n) is true'); +assert.sameValue(0n != Symbol('1'), true, 'The result of (0n != Symbol("1")) is true'); +assert.sameValue(Symbol('1') != 0n, true, 'The result of (Symbol("1") != 0n) is true'); +assert.sameValue(1n != Symbol('1'), true, 'The result of (1n != Symbol("1")) is true'); +assert.sameValue(Symbol('1') != 1n, true, 'The result of (Symbol("1") != 1n) is true'); \ No newline at end of file diff --git a/test/language/expressions/does-not-equals/bigint-and-non-finite.js b/test/language/expressions/does-not-equals/bigint-and-non-finite.js index 2118e014f6b4049642007828fb57a708ca6c55c2..0093074ae8765dd8ab4d64c4c046464140cf23dc 100644 --- a/test/language/expressions/does-not-equals/bigint-and-non-finite.js +++ b/test/language/expressions/does-not-equals/bigint-and-non-finite.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Non-strict inequality comparison of BigInt and non-finite Number values esid: sec-abstract-equality-comparison @@ -10,22 +9,21 @@ info: | features: [BigInt] ---*/ - -assert.sameValue(0n != Infinity, true, "0n != Infinity"); -assert.sameValue(Infinity != 0n, true, "Infinity != 0n"); -assert.sameValue(1n != Infinity, true, "1n != Infinity"); -assert.sameValue(Infinity != 1n, true, "Infinity != 1n"); -assert.sameValue(-1n != Infinity, true, "-1n != Infinity"); -assert.sameValue(Infinity != -1n, true, "Infinity != -1n"); -assert.sameValue(0n != -Infinity, true, "0n != -Infinity"); -assert.sameValue(-Infinity != 0n, true, "-Infinity != 0n"); -assert.sameValue(1n != -Infinity, true, "1n != -Infinity"); -assert.sameValue(-Infinity != 1n, true, "-Infinity != 1n"); -assert.sameValue(-1n != -Infinity, true, "-1n != -Infinity"); -assert.sameValue(-Infinity != -1n, true, "-Infinity != -1n"); -assert.sameValue(0n != NaN, true, "0n != NaN"); -assert.sameValue(NaN != 0n, true, "NaN != 0n"); -assert.sameValue(1n != NaN, true, "1n != NaN"); -assert.sameValue(NaN != 1n, true, "NaN != 1n"); -assert.sameValue(-1n != NaN, true, "-1n != NaN"); -assert.sameValue(NaN != -1n, true, "NaN != -1n"); +assert.sameValue(0n != Infinity, true, 'The result of (0n != Infinity) is true'); +assert.sameValue(Infinity != 0n, true, 'The result of (Infinity != 0n) is true'); +assert.sameValue(1n != Infinity, true, 'The result of (1n != Infinity) is true'); +assert.sameValue(Infinity != 1n, true, 'The result of (Infinity != 1n) is true'); +assert.sameValue(-1n != Infinity, true, 'The result of (-1n != Infinity) is true'); +assert.sameValue(Infinity != -1n, true, 'The result of (Infinity != -1n) is true'); +assert.sameValue(0n != -Infinity, true, 'The result of (0n != -Infinity) is true'); +assert.sameValue(-Infinity != 0n, true, 'The result of (-Infinity != 0n) is true'); +assert.sameValue(1n != -Infinity, true, 'The result of (1n != -Infinity) is true'); +assert.sameValue(-Infinity != 1n, true, 'The result of (-Infinity != 1n) is true'); +assert.sameValue(-1n != -Infinity, true, 'The result of (-1n != -Infinity) is true'); +assert.sameValue(-Infinity != -1n, true, 'The result of (-Infinity != -1n) is true'); +assert.sameValue(0n != NaN, true, 'The result of (0n != NaN) is true'); +assert.sameValue(NaN != 0n, true, 'The result of (NaN != 0n) is true'); +assert.sameValue(1n != NaN, true, 'The result of (1n != NaN) is true'); +assert.sameValue(NaN != 1n, true, 'The result of (NaN != 1n) is true'); +assert.sameValue(-1n != NaN, true, 'The result of (-1n != NaN) is true'); +assert.sameValue(NaN != -1n, true, 'The result of (NaN != -1n) is true'); \ No newline at end of file diff --git a/test/language/expressions/does-not-equals/bigint-and-number-extremes.js b/test/language/expressions/does-not-equals/bigint-and-number-extremes.js index dfb2c7ea2cc80430e18ec426ebfc219803f955b6..63eee522421af3209872eb4209146ca1ece34520 100644 --- a/test/language/expressions/does-not-equals/bigint-and-number-extremes.js +++ b/test/language/expressions/does-not-equals/bigint-and-number-extremes.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Non-strict inequality comparison of BigInt and large Number values esid: sec-abstract-equality-comparison @@ -10,32 +9,43 @@ info: | features: [BigInt] ---*/ +assert.sameValue(1n != Number.MAX_VALUE, true, 'The result of (1n != Number.MAX_VALUE) is true'); +assert.sameValue(Number.MAX_VALUE != 1n, true, 'The result of (Number.MAX_VALUE != 1n) is true'); +assert.sameValue(1n != -Number.MAX_VALUE, true, 'The result of (1n != -Number.MAX_VALUE) is true'); +assert.sameValue(-Number.MAX_VALUE != 1n, true, 'The result of (-Number.MAX_VALUE != 1n) is true'); -assert.sameValue(1n != Number.MAX_VALUE, true, "1n != Number.MAX_VALUE"); -assert.sameValue(Number.MAX_VALUE != 1n, true, "Number.MAX_VALUE != 1n"); -assert.sameValue(1n != -Number.MAX_VALUE, true, "1n != -Number.MAX_VALUE"); -assert.sameValue(-Number.MAX_VALUE != 1n, true, "-Number.MAX_VALUE != 1n"); assert.sameValue( 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn != Number.MAX_VALUE, true, - "0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn != Number.MAX_VALUE"); + 'The result of (0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn != Number.MAX_VALUE) is true' +); + assert.sameValue( Number.MAX_VALUE != 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn, true, - "Number.MAX_VALUE != 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn"); + 'The result of (Number.MAX_VALUE != 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn) is true' +); + assert.sameValue( 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n != Number.MAX_VALUE, false, - "0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n != Number.MAX_VALUE"); + 'The result of (0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n != Number.MAX_VALUE) is false' +); + assert.sameValue( Number.MAX_VALUE != 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, false, - "Number.MAX_VALUE != 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n"); + 'The result of (Number.MAX_VALUE != 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n) is false' +); + assert.sameValue( 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n != Number.MAX_VALUE, true, - "0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n != Number.MAX_VALUE"); + 'The result of (0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n != Number.MAX_VALUE) is true' +); + assert.sameValue( Number.MAX_VALUE != 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n, true, - "Number.MAX_VALUE != 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n"); + 'The result of (Number.MAX_VALUE != 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n) is true' +); \ No newline at end of file diff --git a/test/language/expressions/does-not-equals/bigint-and-number.js b/test/language/expressions/does-not-equals/bigint-and-number.js index d0d76c6c2f044884ec718448b237a229e8118253..a5ddbc9dd3793a3b8dd0f032caded936c0c1c957 100644 --- a/test/language/expressions/does-not-equals/bigint-and-number.js +++ b/test/language/expressions/does-not-equals/bigint-and-number.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Non-strict inequality comparison of BigInt and Number values esid: sec-abstract-equality-comparison @@ -10,24 +9,33 @@ info: | features: [BigInt] ---*/ +assert.sameValue(0n != 0, false, 'The result of (0n != 0) is false'); +assert.sameValue(0 != 0n, false, 'The result of (0 != 0n) is false'); +assert.sameValue(0n != -0, false, 'The result of (0n != -0) is false'); +assert.sameValue(-0 != 0n, false, 'The result of (-0 != 0n) is false'); +assert.sameValue(0n != 0.000000000001, true, 'The result of (0n != 0.000000000001) is true'); +assert.sameValue(0.000000000001 != 0n, true, 'The result of (0.000000000001 != 0n) is true'); +assert.sameValue(0n != 1, true, 'The result of (0n != 1) is true'); +assert.sameValue(1 != 0n, true, 'The result of (1 != 0n) is true'); +assert.sameValue(1n != 0, true, 'The result of (1n != 0) is true'); +assert.sameValue(0 != 1n, true, 'The result of (0 != 1n) is true'); +assert.sameValue(1n != 0.999999999999, true, 'The result of (1n != 0.999999999999) is true'); +assert.sameValue(0.999999999999 != 1n, true, 'The result of (0.999999999999 != 1n) is true'); +assert.sameValue(1n != 1, false, 'The result of (1n != 1) is false'); +assert.sameValue(1 != 1n, false, 'The result of (1 != 1n) is false'); +assert.sameValue(0n != Number.MIN_VALUE, true, 'The result of (0n != Number.MIN_VALUE) is true'); +assert.sameValue(Number.MIN_VALUE != 0n, true, 'The result of (Number.MIN_VALUE != 0n) is true'); +assert.sameValue(0n != -Number.MIN_VALUE, true, 'The result of (0n != -Number.MIN_VALUE) is true'); +assert.sameValue(-Number.MIN_VALUE != 0n, true, 'The result of (-Number.MIN_VALUE != 0n) is true'); + +assert.sameValue( + -10n != Number.MIN_VALUE, + true, + 'The result of (-10n != Number.MIN_VALUE) is true' +); -assert.sameValue(0n != 0, false, "0n != 0"); -assert.sameValue(0 != 0n, false, "0 != 0n"); -assert.sameValue(0n != -0, false, "0n != -0"); -assert.sameValue(-0 != 0n, false, "-0 != 0n"); -assert.sameValue(0n != 0.000000000001, true, "0n != 0.000000000001"); -assert.sameValue(0.000000000001 != 0n, true, "0.000000000001 != 0n"); -assert.sameValue(0n != 1, true, "0n != 1"); -assert.sameValue(1 != 0n, true, "1 != 0n"); -assert.sameValue(1n != 0, true, "1n != 0"); -assert.sameValue(0 != 1n, true, "0 != 1n"); -assert.sameValue(1n != 0.999999999999, true, "1n != 0.999999999999"); -assert.sameValue(0.999999999999 != 1n, true, "0.999999999999 != 1n"); -assert.sameValue(1n != 1, false, "1n != 1"); -assert.sameValue(1 != 1n, false, "1 != 1n"); -assert.sameValue(0n != Number.MIN_VALUE, true, "0n != Number.MIN_VALUE"); -assert.sameValue(Number.MIN_VALUE != 0n, true, "Number.MIN_VALUE != 0n"); -assert.sameValue(0n != -Number.MIN_VALUE, true, "0n != -Number.MIN_VALUE"); -assert.sameValue(-Number.MIN_VALUE != 0n, true, "-Number.MIN_VALUE != 0n"); -assert.sameValue(-10n != Number.MIN_VALUE, true, "-10n != Number.MIN_VALUE"); -assert.sameValue(Number.MIN_VALUE != -10n, true, "Number.MIN_VALUE != -10n"); +assert.sameValue( + Number.MIN_VALUE != -10n, + true, + 'The result of (Number.MIN_VALUE != -10n) is true' +); \ No newline at end of file diff --git a/test/language/expressions/does-not-equals/bigint-and-object.js b/test/language/expressions/does-not-equals/bigint-and-object.js index 33d67b03483b9933926c1c856e65c4985beb6e63..a53cddf5ad21be4fc17ec0849dc016507a45e32e 100644 --- a/test/language/expressions/does-not-equals/bigint-and-object.js +++ b/test/language/expressions/does-not-equals/bigint-and-object.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Non-strict inequality comparison of BigInt values and non-primitive objects esid: sec-abstract-equality-comparison @@ -21,36 +20,115 @@ info: | features: [BigInt] ---*/ +assert.sameValue(0n != Object(0n), false, 'The result of (0n != Object(0n)) is false'); +assert.sameValue(Object(0n) != 0n, false, 'The result of (Object(0n) != 0n) is false'); +assert.sameValue(0n != Object(1n), true, 'The result of (0n != Object(1n)) is true'); +assert.sameValue(Object(1n) != 0n, true, 'The result of (Object(1n) != 0n) is true'); +assert.sameValue(1n != Object(0n), true, 'The result of (1n != Object(0n)) is true'); +assert.sameValue(Object(0n) != 1n, true, 'The result of (Object(0n) != 1n) is true'); +assert.sameValue(1n != Object(1n), false, 'The result of (1n != Object(1n)) is false'); +assert.sameValue(Object(1n) != 1n, false, 'The result of (Object(1n) != 1n) is false'); +assert.sameValue(2n != Object(0n), true, 'The result of (2n != Object(0n)) is true'); +assert.sameValue(Object(0n) != 2n, true, 'The result of (Object(0n) != 2n) is true'); +assert.sameValue(2n != Object(1n), true, 'The result of (2n != Object(1n)) is true'); +assert.sameValue(Object(1n) != 2n, true, 'The result of (Object(1n) != 2n) is true'); +assert.sameValue(2n != Object(2n), false, 'The result of (2n != Object(2n)) is false'); +assert.sameValue(Object(2n) != 2n, false, 'The result of (Object(2n) != 2n) is false'); +assert.sameValue(0n != {}, true, 'The result of (0n != {}) is true'); +assert.sameValue({} != 0n, true, 'The result of (({}) != 0n) is true'); + +assert.sameValue(0n != { + valueOf: function() { + return 0n; + } +}, false, 'The result of (0n != {valueOf: function() {return 0n;}}) is false'); + +assert.sameValue({ + valueOf: function() { + return 0n; + } +} != 0n, false, 'The result of (({valueOf: function() {return 0n;}}) != 0n) is false'); + +assert.sameValue(0n != { + valueOf: function() { + return 1n; + } +}, true, 'The result of (0n != {valueOf: function() {return 1n;}}) is true'); + +assert.sameValue({ + valueOf: function() { + return 1n; + } +} != 0n, true, 'The result of (({valueOf: function() {return 1n;}}) != 0n) is true'); + +assert.sameValue(0n != { + toString: function() { + return '0'; + } +}, false, 'The result of (0n != {toString: function() {return "0";}}) is false'); + +assert.sameValue({ + toString: function() { + return '0'; + } +} != 0n, false, 'The result of (({toString: function() {return "0";}}) != 0n) is false'); + +assert.sameValue(0n != { + toString: function() { + return '1'; + } +}, true, 'The result of (0n != {toString: function() {return "1";}}) is true'); + +assert.sameValue({ + toString: function() { + return '1'; + } +} != 0n, true, 'The result of (({toString: function() {return "1";}}) != 0n) is true'); + +assert.sameValue(900719925474099101n != { + valueOf: function() { + return 900719925474099101n; + } +}, false, 'The result of (900719925474099101n != {valueOf: function() {return 900719925474099101n;}}) is false'); + +assert.sameValue({ + valueOf: function() { + return 900719925474099101n; + } +} != 900719925474099101n, false, 'The result of (({valueOf: function() {return 900719925474099101n;}}) != 900719925474099101n) is false'); + +assert.sameValue(900719925474099101n != { + valueOf: function() { + return 900719925474099102n; + } +}, true, 'The result of (900719925474099101n != {valueOf: function() {return 900719925474099102n;}}) is true'); + +assert.sameValue({ + valueOf: function() { + return 900719925474099102n; + } +} != 900719925474099101n, true, 'The result of (({valueOf: function() {return 900719925474099102n;}}) != 900719925474099101n) is true'); + +assert.sameValue(900719925474099101n != { + toString: function() { + return '900719925474099101'; + } +}, false, 'The result of (900719925474099101n != {toString: function() {return "900719925474099101";}}) is false'); + +assert.sameValue({ + toString: function() { + return '900719925474099101'; + } +} != 900719925474099101n, false, 'The result of (({toString: function() {return "900719925474099101";}}) != 900719925474099101n) is false'); + +assert.sameValue(900719925474099101n != { + toString: function() { + return '900719925474099102'; + } +}, true, 'The result of (900719925474099101n != {toString: function() {return "900719925474099102";}}) is true'); -assert.sameValue(0n != Object(0n), false, "0n != Object(0n)"); -assert.sameValue(Object(0n) != 0n, false, "Object(0n) != 0n"); -assert.sameValue(0n != Object(1n), true, "0n != Object(1n)"); -assert.sameValue(Object(1n) != 0n, true, "Object(1n) != 0n"); -assert.sameValue(1n != Object(0n), true, "1n != Object(0n)"); -assert.sameValue(Object(0n) != 1n, true, "Object(0n) != 1n"); -assert.sameValue(1n != Object(1n), false, "1n != Object(1n)"); -assert.sameValue(Object(1n) != 1n, false, "Object(1n) != 1n"); -assert.sameValue(2n != Object(0n), true, "2n != Object(0n)"); -assert.sameValue(Object(0n) != 2n, true, "Object(0n) != 2n"); -assert.sameValue(2n != Object(1n), true, "2n != Object(1n)"); -assert.sameValue(Object(1n) != 2n, true, "Object(1n) != 2n"); -assert.sameValue(2n != Object(2n), false, "2n != Object(2n)"); -assert.sameValue(Object(2n) != 2n, false, "Object(2n) != 2n"); -assert.sameValue(0n != {}, true, "0n != {}"); -assert.sameValue({} != 0n, true, "{} != 0n"); -assert.sameValue(0n != {valueOf: function() { return 0n; }}, false, "0n != {valueOf: function() { return 0n; }}"); -assert.sameValue({valueOf: function() { return 0n; }} != 0n, false, "{valueOf: function() { return 0n; }} != 0n"); -assert.sameValue(0n != {valueOf: function() { return 1n; }}, true, "0n != {valueOf: function() { return 1n; }}"); -assert.sameValue({valueOf: function() { return 1n; }} != 0n, true, "{valueOf: function() { return 1n; }} != 0n"); -assert.sameValue(0n != {toString: function() { return "0"; }}, false, '0n != {toString: function() { return "0"; }}'); -assert.sameValue({toString: function() { return "0"; }} != 0n, false, '{toString: function() { return "0"; }} != 0n'); -assert.sameValue(0n != {toString: function() { return "1"; }}, true, '0n != {toString: function() { return "1"; }}'); -assert.sameValue({toString: function() { return "1"; }} != 0n, true, '{toString: function() { return "1"; }} != 0n'); -assert.sameValue(900719925474099101n != {valueOf: function() { return 900719925474099101n; }}, false, "900719925474099101n != {valueOf: function() { return 900719925474099101n; }}"); -assert.sameValue({valueOf: function() { return 900719925474099101n; }} != 900719925474099101n, false, "{valueOf: function() { return 900719925474099101n; }} != 900719925474099101n"); -assert.sameValue(900719925474099101n != {valueOf: function() { return 900719925474099102n; }}, true, "900719925474099101n != {valueOf: function() { return 900719925474099102n; }}"); -assert.sameValue({valueOf: function() { return 900719925474099102n; }} != 900719925474099101n, true, "{valueOf: function() { return 900719925474099102n; }} != 900719925474099101n"); -assert.sameValue(900719925474099101n != {toString: function() { return "900719925474099101"; }}, false, '900719925474099101n != {toString: function() { return "900719925474099101"; }}'); -assert.sameValue({toString: function() { return "900719925474099101"; }} != 900719925474099101n, false, '{toString: function() { return "900719925474099101"; }} != 900719925474099101n'); -assert.sameValue(900719925474099101n != {toString: function() { return "900719925474099102"; }}, true, '900719925474099101n != {toString: function() { return "900719925474099102"; }}'); -assert.sameValue({toString: function() { return "900719925474099102"; }} != 900719925474099101n, true, '{toString: function() { return "900719925474099102"; }} != 900719925474099101n'); +assert.sameValue({ + toString: function() { + return '900719925474099102'; + } +} != 900719925474099101n, true, 'The result of (({toString: function() {return "900719925474099102";}}) != 900719925474099101n) is true'); \ No newline at end of file diff --git a/test/language/expressions/does-not-equals/bigint-and-string.js b/test/language/expressions/does-not-equals/bigint-and-string.js index 4bea156a74e60fb026914ad8450bf22cb7a16dfc..56e1bec5ee48288ffb561974c071b94860514f88 100644 --- a/test/language/expressions/does-not-equals/bigint-and-string.js +++ b/test/language/expressions/does-not-equals/bigint-and-string.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Non-strict inequality comparison of BigInt and String values esid: sec-abstract-equality-comparison @@ -9,40 +8,59 @@ info: | features: [BigInt] ---*/ +assert.sameValue(0n != '', false, 'The result of (0n != "") is false'); +assert.sameValue('' != 0n, false, 'The result of ("" != 0n) is false'); +assert.sameValue(0n != '-0', false, 'The result of (0n != "-0") is false'); +assert.sameValue('-0' != 0n, false, 'The result of ("-0" != 0n) is false'); +assert.sameValue(0n != '0', false, 'The result of (0n != "0") is false'); +assert.sameValue('0' != 0n, false, 'The result of ("0" != 0n) is false'); +assert.sameValue(0n != '-1', true, 'The result of (0n != "-1") is true'); +assert.sameValue('-1' != 0n, true, 'The result of ("-1" != 0n) is true'); +assert.sameValue(0n != '1', true, 'The result of (0n != "1") is true'); +assert.sameValue('1' != 0n, true, 'The result of ("1" != 0n) is true'); +assert.sameValue(0n != 'foo', true, 'The result of (0n != "foo") is true'); +assert.sameValue('foo' != 0n, true, 'The result of ("foo" != 0n) is true'); +assert.sameValue(1n != '', true, 'The result of (1n != "") is true'); +assert.sameValue('' != 1n, true, 'The result of ("" != 1n) is true'); +assert.sameValue(1n != '-0', true, 'The result of (1n != "-0") is true'); +assert.sameValue('-0' != 1n, true, 'The result of ("-0" != 1n) is true'); +assert.sameValue(1n != '0', true, 'The result of (1n != "0") is true'); +assert.sameValue('0' != 1n, true, 'The result of ("0" != 1n) is true'); +assert.sameValue(1n != '-1', true, 'The result of (1n != "-1") is true'); +assert.sameValue('-1' != 1n, true, 'The result of ("-1" != 1n) is true'); +assert.sameValue(1n != '1', false, 'The result of (1n != "1") is false'); +assert.sameValue('1' != 1n, false, 'The result of ("1" != 1n) is false'); +assert.sameValue(1n != 'foo', true, 'The result of (1n != "foo") is true'); +assert.sameValue('foo' != 1n, true, 'The result of ("foo" != 1n) is true'); +assert.sameValue(-1n != '-', true, 'The result of (-1n != "-") is true'); +assert.sameValue('-' != -1n, true, 'The result of ("-" != -1n) is true'); +assert.sameValue(-1n != '-0', true, 'The result of (-1n != "-0") is true'); +assert.sameValue('-0' != -1n, true, 'The result of ("-0" != -1n) is true'); +assert.sameValue(-1n != '-1', false, 'The result of (-1n != "-1") is false'); +assert.sameValue('-1' != -1n, false, 'The result of ("-1" != -1n) is false'); +assert.sameValue(-1n != '-foo', true, 'The result of (-1n != "-foo") is true'); +assert.sameValue('-foo' != -1n, true, 'The result of ("-foo" != -1n) is true'); + +assert.sameValue( + 900719925474099101n != '900719925474099101', + false, + 'The result of (900719925474099101n != "900719925474099101") is false' +); + +assert.sameValue( + '900719925474099101' != 900719925474099101n, + false, + 'The result of ("900719925474099101" != 900719925474099101n) is false' +); + +assert.sameValue( + 900719925474099102n != '900719925474099101', + true, + 'The result of (900719925474099102n != "900719925474099101") is true' +); -assert.sameValue(0n != "", false, '0n != ""'); -assert.sameValue("" != 0n, false, '"" != 0n'); -assert.sameValue(0n != "-0", false, '0n != "-0"'); -assert.sameValue("-0" != 0n, false, '"-0" != 0n'); -assert.sameValue(0n != "0", false, '0n != "0"'); -assert.sameValue("0" != 0n, false, '"0" != 0n'); -assert.sameValue(0n != "-1", true, '0n != "-1"'); -assert.sameValue("-1" != 0n, true, '"-1" != 0n'); -assert.sameValue(0n != "1", true, '0n != "1"'); -assert.sameValue("1" != 0n, true, '"1" != 0n'); -assert.sameValue(0n != "foo", true, '0n != "foo"'); -assert.sameValue("foo" != 0n, true, '"foo" != 0n'); -assert.sameValue(1n != "", true, '1n != ""'); -assert.sameValue("" != 1n, true, '"" != 1n'); -assert.sameValue(1n != "-0", true, '1n != "-0"'); -assert.sameValue("-0" != 1n, true, '"-0" != 1n'); -assert.sameValue(1n != "0", true, '1n != "0"'); -assert.sameValue("0" != 1n, true, '"0" != 1n'); -assert.sameValue(1n != "-1", true, '1n != "-1"'); -assert.sameValue("-1" != 1n, true, '"-1" != 1n'); -assert.sameValue(1n != "1", false, '1n != "1"'); -assert.sameValue("1" != 1n, false, '"1" != 1n'); -assert.sameValue(1n != "foo", true, '1n != "foo"'); -assert.sameValue("foo" != 1n, true, '"foo" != 1n'); -assert.sameValue(-1n != "-", true, '-1n != "-"'); -assert.sameValue("-" != -1n, true, '"-" != -1n'); -assert.sameValue(-1n != "-0", true, '-1n != "-0"'); -assert.sameValue("-0" != -1n, true, '"-0" != -1n'); -assert.sameValue(-1n != "-1", false, '-1n != "-1"'); -assert.sameValue("-1" != -1n, false, '"-1" != -1n'); -assert.sameValue(-1n != "-foo", true, '-1n != "-foo"'); -assert.sameValue("-foo" != -1n, true, '"-foo" != -1n'); -assert.sameValue(900719925474099101n != "900719925474099101", false, '900719925474099101n != "900719925474099101"'); -assert.sameValue("900719925474099101" != 900719925474099101n, false, '"900719925474099101" != 900719925474099101n'); -assert.sameValue(900719925474099102n != "900719925474099101", true, '900719925474099102n != "900719925474099101"'); -assert.sameValue("900719925474099101" != 900719925474099102n, true, '"900719925474099101" != 900719925474099102n'); +assert.sameValue( + '900719925474099101' != 900719925474099102n, + true, + 'The result of ("900719925474099101" != 900719925474099102n) is true' +); \ No newline at end of file diff --git a/test/language/expressions/equals/bigint-and-bigint.js b/test/language/expressions/equals/bigint-and-bigint.js index 7241abd531eddd87d751c66b04061e03c879f127..e7c888abf5e2b8c34cf56dd4aba6c29522501ffa 100644 --- a/test/language/expressions/equals/bigint-and-bigint.js +++ b/test/language/expressions/equals/bigint-and-bigint.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Non-strict equality comparison of BigInt values esid: sec-abstract-equality-comparison @@ -15,39 +14,158 @@ info: | features: [BigInt] ---*/ +assert.sameValue(0n == 0n, true, 'The result of (0n == 0n) is true'); +assert.sameValue(1n == 1n, true, 'The result of (1n == 1n) is true'); +assert.sameValue(-1n == -1n, true, 'The result of (-1n == -1n) is true'); +assert.sameValue(0n == -0n, true, 'The result of (0n == -0n) is true'); +assert.sameValue(-0n == 0n, true, 'The result of (-0n == 0n) is true'); +assert.sameValue(0n == 1n, false, 'The result of (0n == 1n) is false'); +assert.sameValue(1n == 0n, false, 'The result of (1n == 0n) is false'); +assert.sameValue(0n == -1n, false, 'The result of (0n == -1n) is false'); +assert.sameValue(-1n == 0n, false, 'The result of (-1n == 0n) is false'); +assert.sameValue(1n == -1n, false, 'The result of (1n == -1n) is false'); +assert.sameValue(-1n == 1n, false, 'The result of (-1n == 1n) is false'); + +assert.sameValue( + 0x1fffffffffffff01n == 0x1fffffffffffff01n, + true, + 'The result of (0x1fffffffffffff01n == 0x1fffffffffffff01n) is true' +); + +assert.sameValue( + 0x1fffffffffffff01n == 0x1fffffffffffff02n, + false, + 'The result of (0x1fffffffffffff01n == 0x1fffffffffffff02n) is false' +); + +assert.sameValue( + 0x1fffffffffffff02n == 0x1fffffffffffff01n, + false, + 'The result of (0x1fffffffffffff02n == 0x1fffffffffffff01n) is false' +); + +assert.sameValue( + -0x1fffffffffffff01n == -0x1fffffffffffff01n, + true, + 'The result of (-0x1fffffffffffff01n == -0x1fffffffffffff01n) is true' +); + +assert.sameValue( + -0x1fffffffffffff01n == -0x1fffffffffffff02n, + false, + 'The result of (-0x1fffffffffffff01n == -0x1fffffffffffff02n) is false' +); + +assert.sameValue( + -0x1fffffffffffff02n == -0x1fffffffffffff01n, + false, + 'The result of (-0x1fffffffffffff02n == -0x1fffffffffffff01n) is false' +); + +assert.sameValue( + 0x10000000000000000n == 0n, + false, + 'The result of (0x10000000000000000n == 0n) is false' +); + +assert.sameValue( + 0n == 0x10000000000000000n, + false, + 'The result of (0n == 0x10000000000000000n) is false' +); + +assert.sameValue( + 0x10000000000000000n == 1n, + false, + 'The result of (0x10000000000000000n == 1n) is false' +); + +assert.sameValue( + 1n == 0x10000000000000000n, + false, + 'The result of (1n == 0x10000000000000000n) is false' +); + +assert.sameValue( + 0x10000000000000000n == -1n, + false, + 'The result of (0x10000000000000000n == -1n) is false' +); + +assert.sameValue( + -1n == 0x10000000000000000n, + false, + 'The result of (-1n == 0x10000000000000000n) is false' +); + +assert.sameValue( + 0x10000000000000001n == 0n, + false, + 'The result of (0x10000000000000001n == 0n) is false' +); + +assert.sameValue( + 0n == 0x10000000000000001n, + false, + 'The result of (0n == 0x10000000000000001n) is false' +); + +assert.sameValue( + -0x10000000000000000n == 0n, + false, + 'The result of (-0x10000000000000000n == 0n) is false' +); + +assert.sameValue( + 0n == -0x10000000000000000n, + false, + 'The result of (0n == -0x10000000000000000n) is false' +); + +assert.sameValue( + -0x10000000000000000n == 1n, + false, + 'The result of (-0x10000000000000000n == 1n) is false' +); + +assert.sameValue( + 1n == -0x10000000000000000n, + false, + 'The result of (1n == -0x10000000000000000n) is false' +); + +assert.sameValue( + -0x10000000000000000n == -1n, + false, + 'The result of (-0x10000000000000000n == -1n) is false' +); + +assert.sameValue( + -1n == -0x10000000000000000n, + false, + 'The result of (-1n == -0x10000000000000000n) is false' +); + +assert.sameValue( + -0x10000000000000001n == 0n, + false, + 'The result of (-0x10000000000000001n == 0n) is false' +); + +assert.sameValue( + 0n == -0x10000000000000001n, + false, + 'The result of (0n == -0x10000000000000001n) is false' +); + +assert.sameValue( + 0x10000000000000000n == 0x100000000n, + false, + 'The result of (0x10000000000000000n == 0x100000000n) is false' +); -assert.sameValue(0n == 0n, true, "0n == 0n"); -assert.sameValue(1n == 1n, true, "1n == 1n"); -assert.sameValue(-1n == -1n, true, "-1n == -1n"); -assert.sameValue(0n == -0n, true, "0n == -0n"); -assert.sameValue(-0n == 0n, true, "-0n == 0n"); -assert.sameValue(0n == 1n, false, "0n == 1n"); -assert.sameValue(1n == 0n, false, "1n == 0n"); -assert.sameValue(0n == -1n, false, "0n == -1n"); -assert.sameValue(-1n == 0n, false, "-1n == 0n"); -assert.sameValue(1n == -1n, false, "1n == -1n"); -assert.sameValue(-1n == 1n, false, "-1n == 1n"); -assert.sameValue(0x1fffffffffffff01n == 0x1fffffffffffff01n, true, "0x1fffffffffffff01n == 0x1fffffffffffff01n"); -assert.sameValue(0x1fffffffffffff01n == 0x1fffffffffffff02n, false, "0x1fffffffffffff01n == 0x1fffffffffffff02n"); -assert.sameValue(0x1fffffffffffff02n == 0x1fffffffffffff01n, false, "0x1fffffffffffff02n == 0x1fffffffffffff01n"); -assert.sameValue(-0x1fffffffffffff01n == -0x1fffffffffffff01n, true, "-0x1fffffffffffff01n == -0x1fffffffffffff01n"); -assert.sameValue(-0x1fffffffffffff01n == -0x1fffffffffffff02n, false, "-0x1fffffffffffff01n == -0x1fffffffffffff02n"); -assert.sameValue(-0x1fffffffffffff02n == -0x1fffffffffffff01n, false, "-0x1fffffffffffff02n == -0x1fffffffffffff01n"); -assert.sameValue(0x10000000000000000n == 0n, false, "0x10000000000000000n == 0n"); -assert.sameValue(0n == 0x10000000000000000n, false, "0n == 0x10000000000000000n"); -assert.sameValue(0x10000000000000000n == 1n, false, "0x10000000000000000n == 1n"); -assert.sameValue(1n == 0x10000000000000000n, false, "1n == 0x10000000000000000n"); -assert.sameValue(0x10000000000000000n == -1n, false, "0x10000000000000000n == -1n"); -assert.sameValue(-1n == 0x10000000000000000n, false, "-1n == 0x10000000000000000n"); -assert.sameValue(0x10000000000000001n == 0n, false, "0x10000000000000001n == 0n"); -assert.sameValue(0n == 0x10000000000000001n, false, "0n == 0x10000000000000001n"); -assert.sameValue(-0x10000000000000000n == 0n, false, "-0x10000000000000000n == 0n"); -assert.sameValue(0n == -0x10000000000000000n, false, "0n == -0x10000000000000000n"); -assert.sameValue(-0x10000000000000000n == 1n, false, "-0x10000000000000000n == 1n"); -assert.sameValue(1n == -0x10000000000000000n, false, "1n == -0x10000000000000000n"); -assert.sameValue(-0x10000000000000000n == -1n, false, "-0x10000000000000000n == -1n"); -assert.sameValue(-1n == -0x10000000000000000n, false, "-1n == -0x10000000000000000n"); -assert.sameValue(-0x10000000000000001n == 0n, false, "-0x10000000000000001n == 0n"); -assert.sameValue(0n == -0x10000000000000001n, false, "0n == -0x10000000000000001n"); -assert.sameValue(0x10000000000000000n == 0x100000000n, false, "0x10000000000000000n == 0x100000000n"); -assert.sameValue(0x100000000n == 0x10000000000000000n, false, "0x100000000n == 0x10000000000000000n"); +assert.sameValue( + 0x100000000n == 0x10000000000000000n, + false, + 'The result of (0x100000000n == 0x10000000000000000n) is false' +); \ No newline at end of file diff --git a/test/language/expressions/equals/bigint-and-boolean.js b/test/language/expressions/equals/bigint-and-boolean.js index c40ab3adfb0164d74e275448bcc40c42239c71fa..74cec0f374327152c03542e0532a2484856eb793 100644 --- a/test/language/expressions/equals/bigint-and-boolean.js +++ b/test/language/expressions/equals/bigint-and-boolean.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Non-strict equality comparison of BigInt and Boolean values esid: sec-abstract-equality-comparison @@ -14,20 +13,19 @@ info: | features: [BigInt] ---*/ - -assert.sameValue(-1n == false, false, "-1n == false"); -assert.sameValue(false == -1n, false, "false == -1n"); -assert.sameValue(-1n == true, false, "-1n == true"); -assert.sameValue(true == -1n, false, "true == -1n"); -assert.sameValue(0n == false, true, "0n == false"); -assert.sameValue(false == 0n, true, "false == 0n"); -assert.sameValue(0n == true, false, "0n == true"); -assert.sameValue(true == 0n, false, "true == 0n"); -assert.sameValue(1n == false, false, "1n == false"); -assert.sameValue(false == 1n, false, "false == 1n"); -assert.sameValue(1n == true, true, "1n == true"); -assert.sameValue(true == 1n, true, "true == 1n"); -assert.sameValue(2n == false, false, "2n == false"); -assert.sameValue(false == 2n, false, "false == 2n"); -assert.sameValue(2n == true, false, "2n == true"); -assert.sameValue(true == 2n, false, "true == 2n"); +assert.sameValue(-1n == false, false, 'The result of (-1n == false) is false'); +assert.sameValue(false == -1n, false, 'The result of (false == -1n) is false'); +assert.sameValue(-1n == true, false, 'The result of (-1n == true) is false'); +assert.sameValue(true == -1n, false, 'The result of (true == -1n) is false'); +assert.sameValue(0n == false, true, 'The result of (0n == false) is true'); +assert.sameValue(false == 0n, true, 'The result of (false == 0n) is true'); +assert.sameValue(0n == true, false, 'The result of (0n == true) is false'); +assert.sameValue(true == 0n, false, 'The result of (true == 0n) is false'); +assert.sameValue(1n == false, false, 'The result of (1n == false) is false'); +assert.sameValue(false == 1n, false, 'The result of (false == 1n) is false'); +assert.sameValue(1n == true, true, 'The result of (1n == true) is true'); +assert.sameValue(true == 1n, true, 'The result of (true == 1n) is true'); +assert.sameValue(2n == false, false, 'The result of (2n == false) is false'); +assert.sameValue(false == 2n, false, 'The result of (false == 2n) is false'); +assert.sameValue(2n == true, false, 'The result of (2n == true) is false'); +assert.sameValue(true == 2n, false, 'The result of (true == 2n) is false'); \ No newline at end of file diff --git a/test/language/expressions/equals/bigint-and-incomparable-primitive.js b/test/language/expressions/equals/bigint-and-incomparable-primitive.js index 06df0c7329fbbf5986fe2f8155c4680d9eee558d..231232190f6a0a5c3acd51c2becb9f28d25e64f4 100644 --- a/test/language/expressions/equals/bigint-and-incomparable-primitive.js +++ b/test/language/expressions/equals/bigint-and-incomparable-primitive.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Non-strict equality comparison of BigInt and miscellaneous primitive values esid: sec-equality-operators-runtime-semantics-evaluation @@ -11,16 +10,15 @@ info: | features: [BigInt, Symbol] ---*/ - -assert.sameValue(0n == undefined, false, "0n == undefined"); -assert.sameValue(undefined == 0n, false, "undefined == 0n"); -assert.sameValue(1n == undefined, false, "1n == undefined"); -assert.sameValue(undefined == 1n, false, "undefined == 1n"); -assert.sameValue(0n == null, false, "0n == null"); -assert.sameValue(null == 0n, false, "null == 0n"); -assert.sameValue(1n == null, false, "1n == null"); -assert.sameValue(null == 1n, false, "null == 1n"); -assert.sameValue(0n == Symbol("1"), false, '0n == Symbol("1")'); -assert.sameValue(Symbol("1") == 0n, false, 'Symbol("1") == 0n'); -assert.sameValue(1n == Symbol("1"), false, '1n == Symbol("1")'); -assert.sameValue(Symbol("1") == 1n, false, 'Symbol("1") == 1n'); +assert.sameValue(0n == undefined, false, 'The result of (0n == undefined) is false'); +assert.sameValue(undefined == 0n, false, 'The result of (undefined == 0n) is false'); +assert.sameValue(1n == undefined, false, 'The result of (1n == undefined) is false'); +assert.sameValue(undefined == 1n, false, 'The result of (undefined == 1n) is false'); +assert.sameValue(0n == null, false, 'The result of (0n == null) is false'); +assert.sameValue(null == 0n, false, 'The result of (null == 0n) is false'); +assert.sameValue(1n == null, false, 'The result of (1n == null) is false'); +assert.sameValue(null == 1n, false, 'The result of (null == 1n) is false'); +assert.sameValue(0n == Symbol('1'), false, 'The result of (0n == Symbol("1")) is false'); +assert.sameValue(Symbol('1') == 0n, false, 'The result of (Symbol("1") == 0n) is false'); +assert.sameValue(1n == Symbol('1'), false, 'The result of (1n == Symbol("1")) is false'); +assert.sameValue(Symbol('1') == 1n, false, 'The result of (Symbol("1") == 1n) is false'); \ No newline at end of file diff --git a/test/language/expressions/equals/bigint-and-non-finite.js b/test/language/expressions/equals/bigint-and-non-finite.js index 763233f87f1f441f655693c2bb673cf1b905cf7b..51827da711a905a6af41f41050c595b56da9420d 100644 --- a/test/language/expressions/equals/bigint-and-non-finite.js +++ b/test/language/expressions/equals/bigint-and-non-finite.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Non-strict equality comparison of BigInt and non-finite Number values esid: sec-abstract-equality-comparison @@ -10,22 +9,21 @@ info: | features: [BigInt] ---*/ - -assert.sameValue(0n == Infinity, false, "0n == Infinity"); -assert.sameValue(Infinity == 0n, false, "Infinity == 0n"); -assert.sameValue(1n == Infinity, false, "1n == Infinity"); -assert.sameValue(Infinity == 1n, false, "Infinity == 1n"); -assert.sameValue(-1n == Infinity, false, "-1n == Infinity"); -assert.sameValue(Infinity == -1n, false, "Infinity == -1n"); -assert.sameValue(0n == -Infinity, false, "0n == -Infinity"); -assert.sameValue(-Infinity == 0n, false, "-Infinity == 0n"); -assert.sameValue(1n == -Infinity, false, "1n == -Infinity"); -assert.sameValue(-Infinity == 1n, false, "-Infinity == 1n"); -assert.sameValue(-1n == -Infinity, false, "-1n == -Infinity"); -assert.sameValue(-Infinity == -1n, false, "-Infinity == -1n"); -assert.sameValue(0n == NaN, false, "0n == NaN"); -assert.sameValue(NaN == 0n, false, "NaN == 0n"); -assert.sameValue(1n == NaN, false, "1n == NaN"); -assert.sameValue(NaN == 1n, false, "NaN == 1n"); -assert.sameValue(-1n == NaN, false, "-1n == NaN"); -assert.sameValue(NaN == -1n, false, "NaN == -1n"); +assert.sameValue(0n == Infinity, false, 'The result of (0n == Infinity) is false'); +assert.sameValue(Infinity == 0n, false, 'The result of (Infinity == 0n) is false'); +assert.sameValue(1n == Infinity, false, 'The result of (1n == Infinity) is false'); +assert.sameValue(Infinity == 1n, false, 'The result of (Infinity == 1n) is false'); +assert.sameValue(-1n == Infinity, false, 'The result of (-1n == Infinity) is false'); +assert.sameValue(Infinity == -1n, false, 'The result of (Infinity == -1n) is false'); +assert.sameValue(0n == -Infinity, false, 'The result of (0n == -Infinity) is false'); +assert.sameValue(-Infinity == 0n, false, 'The result of (-Infinity == 0n) is false'); +assert.sameValue(1n == -Infinity, false, 'The result of (1n == -Infinity) is false'); +assert.sameValue(-Infinity == 1n, false, 'The result of (-Infinity == 1n) is false'); +assert.sameValue(-1n == -Infinity, false, 'The result of (-1n == -Infinity) is false'); +assert.sameValue(-Infinity == -1n, false, 'The result of (-Infinity == -1n) is false'); +assert.sameValue(0n == NaN, false, 'The result of (0n == NaN) is false'); +assert.sameValue(NaN == 0n, false, 'The result of (NaN == 0n) is false'); +assert.sameValue(1n == NaN, false, 'The result of (1n == NaN) is false'); +assert.sameValue(NaN == 1n, false, 'The result of (NaN == 1n) is false'); +assert.sameValue(-1n == NaN, false, 'The result of (-1n == NaN) is false'); +assert.sameValue(NaN == -1n, false, 'The result of (NaN == -1n) is false'); \ No newline at end of file diff --git a/test/language/expressions/equals/bigint-and-number-extremes.js b/test/language/expressions/equals/bigint-and-number-extremes.js index bd49a2b54a788c9fc61ec08b55aba8ad816692db..62265413dda6d370d0ab8f858f3d9602594723c8 100644 --- a/test/language/expressions/equals/bigint-and-number-extremes.js +++ b/test/language/expressions/equals/bigint-and-number-extremes.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Non-strict equality comparison of BigInt and large Number values esid: sec-abstract-equality-comparison @@ -10,32 +9,53 @@ info: | features: [BigInt] ---*/ +assert.sameValue(1n == Number.MAX_VALUE, false, 'The result of (1n == Number.MAX_VALUE) is false'); +assert.sameValue(Number.MAX_VALUE == 1n, false, 'The result of (Number.MAX_VALUE == 1n) is false'); + +assert.sameValue( + 1n == -Number.MAX_VALUE, + false, + 'The result of (1n == -Number.MAX_VALUE) is false' +); + +assert.sameValue( + -Number.MAX_VALUE == 1n, + false, + 'The result of (-Number.MAX_VALUE == 1n) is false' +); -assert.sameValue(1n == Number.MAX_VALUE, false, "1n == Number.MAX_VALUE"); -assert.sameValue(Number.MAX_VALUE == 1n, false, "Number.MAX_VALUE == 1n"); -assert.sameValue(1n == -Number.MAX_VALUE, false, "1n == -Number.MAX_VALUE"); -assert.sameValue(-Number.MAX_VALUE == 1n, false, "-Number.MAX_VALUE == 1n"); assert.sameValue( 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn == Number.MAX_VALUE, false, - "0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn == Number.MAX_VALUE"); + 'The result of (0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn == Number.MAX_VALUE) is false' +); + assert.sameValue( Number.MAX_VALUE == 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn, false, - "Number.MAX_VALUE == 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn"); + 'The result of (Number.MAX_VALUE == 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn) is false' +); + assert.sameValue( 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n == Number.MAX_VALUE, true, - "0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n == Number.MAX_VALUE"); + 'The result of (0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n == Number.MAX_VALUE) is true' +); + assert.sameValue( Number.MAX_VALUE == 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, true, - "Number.MAX_VALUE == 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n"); + 'The result of (Number.MAX_VALUE == 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n) is true' +); + assert.sameValue( 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n == Number.MAX_VALUE, false, - "0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n == Number.MAX_VALUE"); + 'The result of (0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n == Number.MAX_VALUE) is false' +); + assert.sameValue( Number.MAX_VALUE == 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n, false, - "Number.MAX_VALUE == 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n"); + 'The result of (Number.MAX_VALUE == 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n) is false' +); \ No newline at end of file diff --git a/test/language/expressions/equals/bigint-and-number.js b/test/language/expressions/equals/bigint-and-number.js index 1b7bceaa1dc71b59a3cf5d85db98d573ec72731e..a771d2101a82908f617172a824af64ee58c38fbb 100644 --- a/test/language/expressions/equals/bigint-and-number.js +++ b/test/language/expressions/equals/bigint-and-number.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Non-strict equality comparison of BigInt and Number values esid: sec-abstract-equality-comparison @@ -10,24 +9,43 @@ info: | features: [BigInt] ---*/ +assert.sameValue(0n == 0, true, 'The result of (0n == 0) is true'); +assert.sameValue(0 == 0n, true, 'The result of (0 == 0n) is true'); +assert.sameValue(0n == -0, true, 'The result of (0n == -0) is true'); +assert.sameValue(-0 == 0n, true, 'The result of (-0 == 0n) is true'); +assert.sameValue(0n == 0.000000000001, false, 'The result of (0n == 0.000000000001) is false'); +assert.sameValue(0.000000000001 == 0n, false, 'The result of (0.000000000001 == 0n) is false'); +assert.sameValue(0n == 1, false, 'The result of (0n == 1) is false'); +assert.sameValue(1 == 0n, false, 'The result of (1 == 0n) is false'); +assert.sameValue(1n == 0, false, 'The result of (1n == 0) is false'); +assert.sameValue(0 == 1n, false, 'The result of (0 == 1n) is false'); +assert.sameValue(1n == 0.999999999999, false, 'The result of (1n == 0.999999999999) is false'); +assert.sameValue(0.999999999999 == 1n, false, 'The result of (0.999999999999 == 1n) is false'); +assert.sameValue(1n == 1, true, 'The result of (1n == 1) is true'); +assert.sameValue(1 == 1n, true, 'The result of (1 == 1n) is true'); +assert.sameValue(0n == Number.MIN_VALUE, false, 'The result of (0n == Number.MIN_VALUE) is false'); +assert.sameValue(Number.MIN_VALUE == 0n, false, 'The result of (Number.MIN_VALUE == 0n) is false'); + +assert.sameValue( + 0n == -Number.MIN_VALUE, + false, + 'The result of (0n == -Number.MIN_VALUE) is false' +); + +assert.sameValue( + -Number.MIN_VALUE == 0n, + false, + 'The result of (-Number.MIN_VALUE == 0n) is false' +); + +assert.sameValue( + -10n == Number.MIN_VALUE, + false, + 'The result of (-10n == Number.MIN_VALUE) is false' +); -assert.sameValue(0n == 0, true, "0n == 0"); -assert.sameValue(0 == 0n, true, "0 == 0n"); -assert.sameValue(0n == -0, true, "0n == -0"); -assert.sameValue(-0 == 0n, true, "-0 == 0n"); -assert.sameValue(0n == 0.000000000001, false, "0n == 0.000000000001"); -assert.sameValue(0.000000000001 == 0n, false, "0.000000000001 == 0n"); -assert.sameValue(0n == 1, false, "0n == 1"); -assert.sameValue(1 == 0n, false, "1 == 0n"); -assert.sameValue(1n == 0, false, "1n == 0"); -assert.sameValue(0 == 1n, false, "0 == 1n"); -assert.sameValue(1n == 0.999999999999, false, "1n == 0.999999999999"); -assert.sameValue(0.999999999999 == 1n, false, "0.999999999999 == 1n"); -assert.sameValue(1n == 1, true, "1n == 1"); -assert.sameValue(1 == 1n, true, "1 == 1n"); -assert.sameValue(0n == Number.MIN_VALUE, false, "0n == Number.MIN_VALUE"); -assert.sameValue(Number.MIN_VALUE == 0n, false, "Number.MIN_VALUE == 0n"); -assert.sameValue(0n == -Number.MIN_VALUE, false, "0n == -Number.MIN_VALUE"); -assert.sameValue(-Number.MIN_VALUE == 0n, false, "-Number.MIN_VALUE == 0n"); -assert.sameValue(-10n == Number.MIN_VALUE, false, "-10n == Number.MIN_VALUE"); -assert.sameValue(Number.MIN_VALUE == -10n, false, "Number.MIN_VALUE == -10n"); +assert.sameValue( + Number.MIN_VALUE == -10n, + false, + 'The result of (Number.MIN_VALUE == -10n) is false' +); \ No newline at end of file diff --git a/test/language/expressions/equals/bigint-and-object.js b/test/language/expressions/equals/bigint-and-object.js index fe3438bb5356dde8b9c71d8d889afa64b55b1dc6..6f5dd056ca0de6c6472e8fec6dd8f62272f3ae41 100644 --- a/test/language/expressions/equals/bigint-and-object.js +++ b/test/language/expressions/equals/bigint-and-object.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Non-strict equality comparison of BigInt values and non-primitive objects esid: sec-abstract-equality-comparison @@ -21,36 +20,115 @@ info: | features: [BigInt] ---*/ +assert.sameValue(0n == Object(0n), true, 'The result of (0n == Object(0n)) is true'); +assert.sameValue(Object(0n) == 0n, true, 'The result of (Object(0n) == 0n) is true'); +assert.sameValue(0n == Object(1n), false, 'The result of (0n == Object(1n)) is false'); +assert.sameValue(Object(1n) == 0n, false, 'The result of (Object(1n) == 0n) is false'); +assert.sameValue(1n == Object(0n), false, 'The result of (1n == Object(0n)) is false'); +assert.sameValue(Object(0n) == 1n, false, 'The result of (Object(0n) == 1n) is false'); +assert.sameValue(1n == Object(1n), true, 'The result of (1n == Object(1n)) is true'); +assert.sameValue(Object(1n) == 1n, true, 'The result of (Object(1n) == 1n) is true'); +assert.sameValue(2n == Object(0n), false, 'The result of (2n == Object(0n)) is false'); +assert.sameValue(Object(0n) == 2n, false, 'The result of (Object(0n) == 2n) is false'); +assert.sameValue(2n == Object(1n), false, 'The result of (2n == Object(1n)) is false'); +assert.sameValue(Object(1n) == 2n, false, 'The result of (Object(1n) == 2n) is false'); +assert.sameValue(2n == Object(2n), true, 'The result of (2n == Object(2n)) is true'); +assert.sameValue(Object(2n) == 2n, true, 'The result of (Object(2n) == 2n) is true'); +assert.sameValue(0n == {}, false, 'The result of (0n == {}) is false'); +assert.sameValue({} == 0n, false, 'The result of (({}) == 0n) is false'); + +assert.sameValue(0n == { + valueOf: function() { + return 0n; + } +}, true, 'The result of (0n == {valueOf: function() {return 0n;}}) is true'); + +assert.sameValue({ + valueOf: function() { + return 0n; + } +} == 0n, true, 'The result of (({valueOf: function() {return 0n;}}) == 0n) is true'); + +assert.sameValue(0n == { + valueOf: function() { + return 1n; + } +}, false, 'The result of (0n == {valueOf: function() {return 1n;}}) is false'); + +assert.sameValue({ + valueOf: function() { + return 1n; + } +} == 0n, false, 'The result of (({valueOf: function() {return 1n;}}) == 0n) is false'); + +assert.sameValue(0n == { + toString: function() { + return '0'; + } +}, true, 'The result of (0n == {toString: function() {return "0";}}) is true'); + +assert.sameValue({ + toString: function() { + return '0'; + } +} == 0n, true, 'The result of (({toString: function() {return "0";}}) == 0n) is true'); + +assert.sameValue(0n == { + toString: function() { + return '1'; + } +}, false, 'The result of (0n == {toString: function() {return "1";}}) is false'); + +assert.sameValue({ + toString: function() { + return '1'; + } +} == 0n, false, 'The result of (({toString: function() {return "1";}}) == 0n) is false'); + +assert.sameValue(900719925474099101n == { + valueOf: function() { + return 900719925474099101n; + } +}, true, 'The result of (900719925474099101n == {valueOf: function() {return 900719925474099101n;}}) is true'); + +assert.sameValue({ + valueOf: function() { + return 900719925474099101n; + } +} == 900719925474099101n, true, 'The result of (({valueOf: function() {return 900719925474099101n;}}) == 900719925474099101n) is true'); + +assert.sameValue(900719925474099101n == { + valueOf: function() { + return 900719925474099102n; + } +}, false, 'The result of (900719925474099101n == {valueOf: function() {return 900719925474099102n;}}) is false'); + +assert.sameValue({ + valueOf: function() { + return 900719925474099102n; + } +} == 900719925474099101n, false, 'The result of (({valueOf: function() {return 900719925474099102n;}}) == 900719925474099101n) is false'); + +assert.sameValue(900719925474099101n == { + toString: function() { + return '900719925474099101'; + } +}, true, 'The result of (900719925474099101n == {toString: function() {return "900719925474099101";}}) is true'); + +assert.sameValue({ + toString: function() { + return '900719925474099101'; + } +} == 900719925474099101n, true, 'The result of (({toString: function() {return "900719925474099101";}}) == 900719925474099101n) is true'); + +assert.sameValue(900719925474099101n == { + toString: function() { + return '900719925474099102'; + } +}, false, 'The result of (900719925474099101n == {toString: function() {return "900719925474099102";}}) is false'); -assert.sameValue(0n == Object(0n), true, "0n == Object(0n)"); -assert.sameValue(Object(0n) == 0n, true, "Object(0n) == 0n"); -assert.sameValue(0n == Object(1n), false, "0n == Object(1n)"); -assert.sameValue(Object(1n) == 0n, false, "Object(1n) == 0n"); -assert.sameValue(1n == Object(0n), false, "1n == Object(0n)"); -assert.sameValue(Object(0n) == 1n, false, "Object(0n) == 1n"); -assert.sameValue(1n == Object(1n), true, "1n == Object(1n)"); -assert.sameValue(Object(1n) == 1n, true, "Object(1n) == 1n"); -assert.sameValue(2n == Object(0n), false, "2n == Object(0n)"); -assert.sameValue(Object(0n) == 2n, false, "Object(0n) == 2n"); -assert.sameValue(2n == Object(1n), false, "2n == Object(1n)"); -assert.sameValue(Object(1n) == 2n, false, "Object(1n) == 2n"); -assert.sameValue(2n == Object(2n), true, "2n == Object(2n)"); -assert.sameValue(Object(2n) == 2n, true, "Object(2n) == 2n"); -assert.sameValue(0n == {}, false, "0n == {}"); -assert.sameValue({} == 0n, false, "{} == 0n"); -assert.sameValue(0n == {valueOf: function() { return 0n; }}, true, "0n == {valueOf: function() { return 0n; }}"); -assert.sameValue({valueOf: function() { return 0n; }} == 0n, true, "{valueOf: function() { return 0n; }} == 0n"); -assert.sameValue(0n == {valueOf: function() { return 1n; }}, false, "0n == {valueOf: function() { return 1n; }}"); -assert.sameValue({valueOf: function() { return 1n; }} == 0n, false, "{valueOf: function() { return 1n; }} == 0n"); -assert.sameValue(0n == {toString: function() { return "0"; }}, true, '0n == {toString: function() { return "0"; }}'); -assert.sameValue({toString: function() { return "0"; }} == 0n, true, '{toString: function() { return "0"; }} == 0n'); -assert.sameValue(0n == {toString: function() { return "1"; }}, false, '0n == {toString: function() { return "1"; }}'); -assert.sameValue({toString: function() { return "1"; }} == 0n, false, '{toString: function() { return "1"; }} == 0n'); -assert.sameValue(900719925474099101n == {valueOf: function() { return 900719925474099101n; }}, true, "900719925474099101n == {valueOf: function() { return 900719925474099101n; }}"); -assert.sameValue({valueOf: function() { return 900719925474099101n; }} == 900719925474099101n, true, "{valueOf: function() { return 900719925474099101n; }} == 900719925474099101n"); -assert.sameValue(900719925474099101n == {valueOf: function() { return 900719925474099102n; }}, false, "900719925474099101n == {valueOf: function() { return 900719925474099102n; }}"); -assert.sameValue({valueOf: function() { return 900719925474099102n; }} == 900719925474099101n, false, "{valueOf: function() { return 900719925474099102n; }} == 900719925474099101n"); -assert.sameValue(900719925474099101n == {toString: function() { return "900719925474099101"; }}, true, '900719925474099101n == {toString: function() { return "900719925474099101"; }}'); -assert.sameValue({toString: function() { return "900719925474099101"; }} == 900719925474099101n, true, '{toString: function() { return "900719925474099101"; }} == 900719925474099101n'); -assert.sameValue(900719925474099101n == {toString: function() { return "900719925474099102"; }}, false, '900719925474099101n == {toString: function() { return "900719925474099102"; }}'); -assert.sameValue({toString: function() { return "900719925474099102"; }} == 900719925474099101n, false, '{toString: function() { return "900719925474099102"; }} == 900719925474099101n'); +assert.sameValue({ + toString: function() { + return '900719925474099102'; + } +} == 900719925474099101n, false, 'The result of (({toString: function() {return "900719925474099102";}}) == 900719925474099101n) is false'); \ No newline at end of file diff --git a/test/language/expressions/equals/bigint-and-string.js b/test/language/expressions/equals/bigint-and-string.js index e72d615d2cfa54591e1ab7097cf23efbcd3a8c77..92c3fa8990a76c21760b71fad9c28a250c4c9d8f 100644 --- a/test/language/expressions/equals/bigint-and-string.js +++ b/test/language/expressions/equals/bigint-and-string.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Non-strict equality comparison of BigInt and String values esid: sec-abstract-equality-comparison @@ -9,40 +8,59 @@ info: | features: [BigInt] ---*/ +assert.sameValue(0n == '', true, 'The result of (0n == "") is true'); +assert.sameValue('' == 0n, true, 'The result of ("" == 0n) is true'); +assert.sameValue(0n == '-0', true, 'The result of (0n == "-0") is true'); +assert.sameValue('-0' == 0n, true, 'The result of ("-0" == 0n) is true'); +assert.sameValue(0n == '0', true, 'The result of (0n == "0") is true'); +assert.sameValue('0' == 0n, true, 'The result of ("0" == 0n) is true'); +assert.sameValue(0n == '-1', false, 'The result of (0n == "-1") is false'); +assert.sameValue('-1' == 0n, false, 'The result of ("-1" == 0n) is false'); +assert.sameValue(0n == '1', false, 'The result of (0n == "1") is false'); +assert.sameValue('1' == 0n, false, 'The result of ("1" == 0n) is false'); +assert.sameValue(0n == 'foo', false, 'The result of (0n == "foo") is false'); +assert.sameValue('foo' == 0n, false, 'The result of ("foo" == 0n) is false'); +assert.sameValue(1n == '', false, 'The result of (1n == "") is false'); +assert.sameValue('' == 1n, false, 'The result of ("" == 1n) is false'); +assert.sameValue(1n == '-0', false, 'The result of (1n == "-0") is false'); +assert.sameValue('-0' == 1n, false, 'The result of ("-0" == 1n) is false'); +assert.sameValue(1n == '0', false, 'The result of (1n == "0") is false'); +assert.sameValue('0' == 1n, false, 'The result of ("0" == 1n) is false'); +assert.sameValue(1n == '-1', false, 'The result of (1n == "-1") is false'); +assert.sameValue('-1' == 1n, false, 'The result of ("-1" == 1n) is false'); +assert.sameValue(1n == '1', true, 'The result of (1n == "1") is true'); +assert.sameValue('1' == 1n, true, 'The result of ("1" == 1n) is true'); +assert.sameValue(1n == 'foo', false, 'The result of (1n == "foo") is false'); +assert.sameValue('foo' == 1n, false, 'The result of ("foo" == 1n) is false'); +assert.sameValue(-1n == '-', false, 'The result of (-1n == "-") is false'); +assert.sameValue('-' == -1n, false, 'The result of ("-" == -1n) is false'); +assert.sameValue(-1n == '-0', false, 'The result of (-1n == "-0") is false'); +assert.sameValue('-0' == -1n, false, 'The result of ("-0" == -1n) is false'); +assert.sameValue(-1n == '-1', true, 'The result of (-1n == "-1") is true'); +assert.sameValue('-1' == -1n, true, 'The result of ("-1" == -1n) is true'); +assert.sameValue(-1n == '-foo', false, 'The result of (-1n == "-foo") is false'); +assert.sameValue('-foo' == -1n, false, 'The result of ("-foo" == -1n) is false'); + +assert.sameValue( + 900719925474099101n == '900719925474099101', + true, + 'The result of (900719925474099101n == "900719925474099101") is true' +); + +assert.sameValue( + '900719925474099101' == 900719925474099101n, + true, + 'The result of ("900719925474099101" == 900719925474099101n) is true' +); + +assert.sameValue( + 900719925474099102n == '900719925474099101', + false, + 'The result of (900719925474099102n == "900719925474099101") is false' +); -assert.sameValue(0n == "", true, '0n == ""'); -assert.sameValue("" == 0n, true, '"" == 0n'); -assert.sameValue(0n == "-0", true, '0n == "-0"'); -assert.sameValue("-0" == 0n, true, '"-0" == 0n'); -assert.sameValue(0n == "0", true, '0n == "0"'); -assert.sameValue("0" == 0n, true, '"0" == 0n'); -assert.sameValue(0n == "-1", false, '0n == "-1"'); -assert.sameValue("-1" == 0n, false, '"-1" == 0n'); -assert.sameValue(0n == "1", false, '0n == "1"'); -assert.sameValue("1" == 0n, false, '"1" == 0n'); -assert.sameValue(0n == "foo", false, '0n == "foo"'); -assert.sameValue("foo" == 0n, false, '"foo" == 0n'); -assert.sameValue(1n == "", false, '1n == ""'); -assert.sameValue("" == 1n, false, '"" == 1n'); -assert.sameValue(1n == "-0", false, '1n == "-0"'); -assert.sameValue("-0" == 1n, false, '"-0" == 1n'); -assert.sameValue(1n == "0", false, '1n == "0"'); -assert.sameValue("0" == 1n, false, '"0" == 1n'); -assert.sameValue(1n == "-1", false, '1n == "-1"'); -assert.sameValue("-1" == 1n, false, '"-1" == 1n'); -assert.sameValue(1n == "1", true, '1n == "1"'); -assert.sameValue("1" == 1n, true, '"1" == 1n'); -assert.sameValue(1n == "foo", false, '1n == "foo"'); -assert.sameValue("foo" == 1n, false, '"foo" == 1n'); -assert.sameValue(-1n == "-", false, '-1n == "-"'); -assert.sameValue("-" == -1n, false, '"-" == -1n'); -assert.sameValue(-1n == "-0", false, '-1n == "-0"'); -assert.sameValue("-0" == -1n, false, '"-0" == -1n'); -assert.sameValue(-1n == "-1", true, '-1n == "-1"'); -assert.sameValue("-1" == -1n, true, '"-1" == -1n'); -assert.sameValue(-1n == "-foo", false, '-1n == "-foo"'); -assert.sameValue("-foo" == -1n, false, '"-foo" == -1n'); -assert.sameValue(900719925474099101n == "900719925474099101", true, '900719925474099101n == "900719925474099101"'); -assert.sameValue("900719925474099101" == 900719925474099101n, true, '"900719925474099101" == 900719925474099101n'); -assert.sameValue(900719925474099102n == "900719925474099101", false, '900719925474099102n == "900719925474099101"'); -assert.sameValue("900719925474099101" == 900719925474099102n, false, '"900719925474099101" == 900719925474099102n'); +assert.sameValue( + '900719925474099101' == 900719925474099102n, + false, + 'The result of ("900719925474099101" == 900719925474099102n) is false' +); \ No newline at end of file diff --git a/test/language/expressions/exponentiation/bigint-and-number.js b/test/language/expressions/exponentiation/bigint-and-number.js index f8b96cac6a22420f2adc075eae17bcaae91c75b2..8a0416622a5095fb50464d729a71caf7ed540b10 100644 --- a/test/language/expressions/exponentiation/bigint-and-number.js +++ b/test/language/expressions/exponentiation/bigint-and-number.js @@ -9,24 +9,82 @@ info: | Let exponent be ? ToNumeric(rightValue). If Type(base) does not equal Type(exponent), throw a TypeError exception. ---*/ +assert.throws(TypeError, function() { + 1n ** 1; +}, '1n ** 1 throws TypeError'); -assert.throws(TypeError, function() { 1n ** 1; }, "1n ** 1 throws TypeError"); -assert.throws(TypeError, function() { 1 ** 1n; }, "1 ** 1n throws TypeError"); -assert.throws(TypeError, function() { Object(1n) ** 1; }, "Object(1n) ** 1 throws TypeError"); -assert.throws(TypeError, function() { 1 ** Object(1n); }, "1 ** Object(1n) throws TypeError"); -assert.throws(TypeError, function() { 1n ** Object(1); }, "1n ** Object(1) throws TypeError"); -assert.throws(TypeError, function() { Object(1) ** 1n; }, "Object(1) ** 1n throws TypeError"); -assert.throws(TypeError, function() { Object(1n) ** Object(1); }, "Object(1n) ** Object(1) throws TypeError"); -assert.throws(TypeError, function() { Object(1) ** Object(1n); }, "Object(1) ** Object(1n) throws TypeError"); -assert.throws(TypeError, function() { 1n ** NaN; }, "1n ** NaN throws TypeError"); -assert.throws(TypeError, function() { NaN ** 1n; }, "NaN ** 1n throws TypeError"); -assert.throws(TypeError, function() { 1n ** Infinity; }, "1n ** Infinity throws TypeError"); -assert.throws(TypeError, function() { Infinity ** 1n; }, "Infinity ** 1n throws TypeError"); -assert.throws(TypeError, function() { 1n ** true; }, "1n ** true throws TypeError"); -assert.throws(TypeError, function() { true ** 1n; }, "true ** 1n throws TypeError"); -assert.throws(TypeError, function() { 1n ** "1"; }, '1n ** "1" throws TypeError'); -assert.throws(TypeError, function() { "1" ** 1n; }, '"1" ** 1n throws TypeError'); -assert.throws(TypeError, function() { 1n ** null; }, "1n ** null throws TypeError"); -assert.throws(TypeError, function() { null ** 1n; }, "null ** 1n throws TypeError"); -assert.throws(TypeError, function() { 1n ** undefined; }, "1n ** undefined throws TypeError"); -assert.throws(TypeError, function() { undefined ** 1n; }, "undefined ** 1n throws TypeError"); +assert.throws(TypeError, function() { + 1 ** 1n; +}, '1 ** 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) ** 1; +}, 'Object(1n) ** 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 ** Object(1n); +}, '1 ** Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n ** Object(1); +}, '1n ** Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) ** 1n; +}, 'Object(1) ** 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) ** Object(1); +}, 'Object(1n) ** Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) ** Object(1n); +}, 'Object(1) ** Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n ** NaN; +}, '1n ** NaN throws TypeError'); + +assert.throws(TypeError, function() { + NaN ** 1n; +}, 'NaN ** 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n ** Infinity; +}, '1n ** Infinity throws TypeError'); + +assert.throws(TypeError, function() { + Infinity ** 1n; +}, 'Infinity ** 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n ** true; +}, '1n ** true throws TypeError'); + +assert.throws(TypeError, function() { + true ** 1n; +}, 'true ** 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n ** '1'; +}, '1n ** "1" throws TypeError'); + +assert.throws(TypeError, function() { + '1' ** 1n; +}, '"1" ** 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n ** null; +}, '1n ** null throws TypeError'); + +assert.throws(TypeError, function() { + null ** 1n; +}, 'null ** 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n ** undefined; +}, '1n ** undefined throws TypeError'); + +assert.throws(TypeError, function() { + undefined ** 1n; +}, 'undefined ** 1n throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/exponentiation/bigint-arithmetic.js b/test/language/expressions/exponentiation/bigint-arithmetic.js index 0ff0e0c01943c19632cf3508311f82e6b7a4fa7a..cd7267ffe38ad0b9859714487d28779bfd8b10bb 100644 --- a/test/language/expressions/exponentiation/bigint-arithmetic.js +++ b/test/language/expressions/exponentiation/bigint-arithmetic.js @@ -1,38 +1,75 @@ // Copyright (C) 2017 Robin Templeton. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- esid: sec-exp-operator-runtime-semantics-evaluation description: BigInt exponentiation arithmetic features: [BigInt] ---*/ +assert.sameValue( + 0x123n ** 0x123n, + 0x37AA7FAA38F2F6026AABEFE979EA730BA9EA4CB99E2E3F645D515D3BBE2D84BCD89F8A034BADF3E3DC0CF417258371B31F4555DC0883DA96760AB157DB7DFFF5E3E97A3EAAB8328B2B178060B5A5E4C4DD8BC8D66B7F4D9F0E0B1AC3A566FDE0A15EBF8DBDBD0565C5FBDB7C123CF250E271DF5C38BC6746A1327F09C7FB4B96E0EDA45C429799CA80B1DB039692C70DFFE4E66F1D9CAB4270863B09A7918F774D686F685F560FEDC6B7B85CB45DE5EEEF6A5FE2FC8B5037FB421204641909347C91F2DC252F49B8F310E867E56D1CA2E81EE9A3AA568682C7B8B41D709A2E7F8D9A8D8C56D6BE78B6CA8365E362B81A64974C315FB8FA50CED4F7944F28FA3ECA77B8BCB56DC69814328F891E6065D108EEE7B8E695038090CCA10C0E68DD7A36CFAA1C26CDFEC369FBn, + 'The result of (0x123n ** 0x123n) is 0x37AA7FAA38F2F6026AABEFE979EA730BA9EA4CB99E2E3F645D515D3BBE2D84BCD89F8A034BADF3E3DC0CF417258371B31F4555DC0883DA96760AB157DB7DFFF5E3E97A3EAAB8328B2B178060B5A5E4C4DD8BC8D66B7F4D9F0E0B1AC3A566FDE0A15EBF8DBDBD0565C5FBDB7C123CF250E271DF5C38BC6746A1327F09C7FB4B96E0EDA45C429799CA80B1DB039692C70DFFE4E66F1D9CAB4270863B09A7918F774D686F685F560FEDC6B7B85CB45DE5EEEF6A5FE2FC8B5037FB421204641909347C91F2DC252F49B8F310E867E56D1CA2E81EE9A3AA568682C7B8B41D709A2E7F8D9A8D8C56D6BE78B6CA8365E362B81A64974C315FB8FA50CED4F7944F28FA3ECA77B8BCB56DC69814328F891E6065D108EEE7B8E695038090CCA10C0E68DD7A36CFAA1C26CDFEC369FBn' +); + +assert.sameValue( + 0x123n ** 0xFFn, + 0x8D5BB75861377EC967BF78FDF39CE51696FBD34722999943F8865938772B517167CD5ED775A78987F5106831F4978E0709032B26ED8F13F814699DB8AB3ACD5CF631F2D8B8B706FCF5EF441AAEE745A795EC5CB86A5E8D87D09F648EFC557B98F73E750FEC9AED061D47806F269CCCDFB6D513912A82AE79B171D76AF6D926BC4F4C4DA43A6EFB4D9D1672E356CC1F74A29AF80D53A8F27592F6191AB9B3D57FA2C435CB2CE8F18A3B3448F88F4BAD3606A9878DA9528B569BADAC0C1EC0B1A2B06CD4C64DEEC940807DFD05C56E3E17ADB1A88EDAF0D67C87C1F871BFB5C47CAE8365FE33538317EE2DF4EE52636CE1BDA9E41C7DA72826E4C097A53BD73D8D697E10D28Bn, + 'The result of (0x123n ** 0xFFn) is 0x8D5BB75861377EC967BF78FDF39CE51696FBD34722999943F8865938772B517167CD5ED775A78987F5106831F4978E0709032B26ED8F13F814699DB8AB3ACD5CF631F2D8B8B706FCF5EF441AAEE745A795EC5CB86A5E8D87D09F648EFC557B98F73E750FEC9AED061D47806F269CCCDFB6D513912A82AE79B171D76AF6D926BC4F4C4DA43A6EFB4D9D1672E356CC1F74A29AF80D53A8F27592F6191AB9B3D57FA2C435CB2CE8F18A3B3448F88F4BAD3606A9878DA9528B569BADAC0C1EC0B1A2B06CD4C64DEEC940807DFD05C56E3E17ADB1A88EDAF0D67C87C1F871BFB5C47CAE8365FE33538317EE2DF4EE52636CE1BDA9E41C7DA72826E4C097A53BD73D8D697E10D28Bn' +); + +assert.sameValue(0x123n ** 0x3n, 0x178027Bn, 'The result of (0x123n ** 0x3n) is 0x178027Bn'); +assert.sameValue(0x123n ** 0x2n, 0x14AC9n, 'The result of (0x123n ** 0x2n) is 0x14AC9n'); +assert.sameValue(0x123n ** 0x1n, 0x123n, 'The result of (0x123n ** 0x1n) is 0x123n'); + +assert.sameValue( + 0xFFn ** 0x123n, + 0x51F5CA2E1A36F5FF1ED3D393D76FBC3612B38EB64E00EDAC5E95ADE0D16D0B044C8E9F2B77B3F31AF9159F482205541E9D3BE9D248FF39CE6524874EBCA60E06302E8B505D11EEEEE869C7F801A82B9739C197E6D63A1EB2D29B5AD5EED4773C762106E9F66BFCB6C11450218973C69DED3FE51FF881AD0430675BF54320513EA766117C50C554E86E22A5ACFD8047D5470B4FCBCB9EFC86196CA77C58F1BEB09F76160D641B82E2481BEDAE089207D49FE0FB7DE14B6C4BC82E9C58140746AC8E74C3353AAF5F9CF47ED1F87C52F463C053DB63CD08CC9866EBA274D39B6B357ADADAD4D210167EF7363453D42BC225D90070336861F2D259489D78B7F04B05FE65E29151ADD2B8F4D318011988550CE590DBA4C868AC65AA325051DF613D6C2E22FFn, + 'The result of (0xFFn ** 0x123n) is 0x51F5CA2E1A36F5FF1ED3D393D76FBC3612B38EB64E00EDAC5E95ADE0D16D0B044C8E9F2B77B3F31AF9159F482205541E9D3BE9D248FF39CE6524874EBCA60E06302E8B505D11EEEEE869C7F801A82B9739C197E6D63A1EB2D29B5AD5EED4773C762106E9F66BFCB6C11450218973C69DED3FE51FF881AD0430675BF54320513EA766117C50C554E86E22A5ACFD8047D5470B4FCBCB9EFC86196CA77C58F1BEB09F76160D641B82E2481BEDAE089207D49FE0FB7DE14B6C4BC82E9C58140746AC8E74C3353AAF5F9CF47ED1F87C52F463C053DB63CD08CC9866EBA274D39B6B357ADADAD4D210167EF7363453D42BC225D90070336861F2D259489D78B7F04B05FE65E29151ADD2B8F4D318011988550CE590DBA4C868AC65AA325051DF613D6C2E22FFn' +); + +assert.sameValue( + 0xFFn ** 0xFFn, + 0x5E5C8B0EB95AB08F9D37EF127FC01BD0E33DE52647528396D78D5F8DA31989E67814F6BBA1FB0F0207010FF5F2347B19D5F6598FC91BF5A88F77DAA3D7B382FEC484F3D205C06A34445384C0E7AB0D883788C68C012CB433055EDDA746A48409444EA91147273B79FC3EABB70ECA552AF650C234BB01ED404427F17CDDDD71D08E39EF9C3982E3CE44E670456AA8154C1FDBD9C35947F494636A425C69BF89E9C75AD3B7A0A559AF0F5DA9947C8DEBA64417310713B23E7EF4DE50BB2A3E90BC2AC3DA5201CCA8D6E5DFEA887C4F7A4E92175D9F88BD2779B57F9EB35BE7528F965A06DA0AC41DCB3A34F1D8AB7D8FEE620A94FAA42C395997756B007FFEFFn, + 'The result of (0xFFn ** 0xFFn) is 0x5E5C8B0EB95AB08F9D37EF127FC01BD0E33DE52647528396D78D5F8DA31989E67814F6BBA1FB0F0207010FF5F2347B19D5F6598FC91BF5A88F77DAA3D7B382FEC484F3D205C06A34445384C0E7AB0D883788C68C012CB433055EDDA746A48409444EA91147273B79FC3EABB70ECA552AF650C234BB01ED404427F17CDDDD71D08E39EF9C3982E3CE44E670456AA8154C1FDBD9C35947F494636A425C69BF89E9C75AD3B7A0A559AF0F5DA9947C8DEBA64417310713B23E7EF4DE50BB2A3E90BC2AC3DA5201CCA8D6E5DFEA887C4F7A4E92175D9F88BD2779B57F9EB35BE7528F965A06DA0AC41DCB3A34F1D8AB7D8FEE620A94FAA42C395997756B007FFEFFn' +); + +assert.sameValue(0xFFn ** 0x3n, 0xFD02FFn, 'The result of (0xFFn ** 0x3n) is 0xFD02FFn'); +assert.sameValue(0xFFn ** 0x2n, 0xFE01n, 'The result of (0xFFn ** 0x2n) is 0xFE01n'); +assert.sameValue(0xFFn ** 0x1n, 0xFFn, 'The result of (0xFFn ** 0x1n) is 0xFFn'); + +assert.sameValue( + 0x3n ** 0x123n, + 0x25609213623D7D6219085CF49D306450BF6519835586C19D3A4F3A2C5F35B44A300C8A76E11708B5495B9C3EE756BBF19E3FD15CE625D3C0539Bn, + 'The result of (0x3n ** 0x123n) is 0x25609213623D7D6219085CF49D306450BF6519835586C19D3A4F3A2C5F35B44A300C8A76E11708B5495B9C3EE756BBF19E3FD15CE625D3C0539Bn' +); + +assert.sameValue( + 0x3n ** 0xFFn, + 0x11F1B08E87EC42C5D83C3218FC83C41DCFD9F4428F4F92AF1AAA80AA46162B1F71E981273601F4AD1DD4709B5ACA650265A6ABn, + 'The result of (0x3n ** 0xFFn) is 0x11F1B08E87EC42C5D83C3218FC83C41DCFD9F4428F4F92AF1AAA80AA46162B1F71E981273601F4AD1DD4709B5ACA650265A6ABn' +); + +assert.sameValue(0x3n ** 0x3n, 0x1Bn, 'The result of (0x3n ** 0x3n) is 0x1Bn'); +assert.sameValue(0x3n ** 0x2n, 0x9n, 'The result of (0x3n ** 0x2n) is 0x9n'); +assert.sameValue(0x3n ** 0x1n, 0x3n, 'The result of (0x3n ** 0x1n) is 0x3n'); + +assert.sameValue( + 0x2n ** 0x123n, + 0x8000000000000000000000000000000000000000000000000000000000000000000000000n, + 'The result of (0x2n ** 0x123n) is 0x8000000000000000000000000000000000000000000000000000000000000000000000000n' +); + +assert.sameValue( + 0x2n ** 0xFFn, + 0x8000000000000000000000000000000000000000000000000000000000000000n, + 'The result of (0x2n ** 0xFFn) is 0x8000000000000000000000000000000000000000000000000000000000000000n' +); -function testExpt(x, y, z) { - assert.sameValue(x ** y, z, x + " ** " + y + " = " + z); -} - -testExpt(0x123n, 0x123n, 0x37AA7FAA38F2F6026AABEFE979EA730BA9EA4CB99E2E3F645D515D3BBE2D84BCD89F8A034BADF3E3DC0CF417258371B31F4555DC0883DA96760AB157DB7DFFF5E3E97A3EAAB8328B2B178060B5A5E4C4DD8BC8D66B7F4D9F0E0B1AC3A566FDE0A15EBF8DBDBD0565C5FBDB7C123CF250E271DF5C38BC6746A1327F09C7FB4B96E0EDA45C429799CA80B1DB039692C70DFFE4E66F1D9CAB4270863B09A7918F774D686F685F560FEDC6B7B85CB45DE5EEEF6A5FE2FC8B5037FB421204641909347C91F2DC252F49B8F310E867E56D1CA2E81EE9A3AA568682C7B8B41D709A2E7F8D9A8D8C56D6BE78B6CA8365E362B81A64974C315FB8FA50CED4F7944F28FA3ECA77B8BCB56DC69814328F891E6065D108EEE7B8E695038090CCA10C0E68DD7A36CFAA1C26CDFEC369FBn); -testExpt(0x123n, 0xFFn, 0x8D5BB75861377EC967BF78FDF39CE51696FBD34722999943F8865938772B517167CD5ED775A78987F5106831F4978E0709032B26ED8F13F814699DB8AB3ACD5CF631F2D8B8B706FCF5EF441AAEE745A795EC5CB86A5E8D87D09F648EFC557B98F73E750FEC9AED061D47806F269CCCDFB6D513912A82AE79B171D76AF6D926BC4F4C4DA43A6EFB4D9D1672E356CC1F74A29AF80D53A8F27592F6191AB9B3D57FA2C435CB2CE8F18A3B3448F88F4BAD3606A9878DA9528B569BADAC0C1EC0B1A2B06CD4C64DEEC940807DFD05C56E3E17ADB1A88EDAF0D67C87C1F871BFB5C47CAE8365FE33538317EE2DF4EE52636CE1BDA9E41C7DA72826E4C097A53BD73D8D697E10D28Bn); -testExpt(0x123n, 0x3n, 0x178027Bn); -testExpt(0x123n, 0x2n, 0x14AC9n); -testExpt(0x123n, 0x1n, 0x123n); -testExpt(0xFFn, 0x123n, 0x51F5CA2E1A36F5FF1ED3D393D76FBC3612B38EB64E00EDAC5E95ADE0D16D0B044C8E9F2B77B3F31AF9159F482205541E9D3BE9D248FF39CE6524874EBCA60E06302E8B505D11EEEEE869C7F801A82B9739C197E6D63A1EB2D29B5AD5EED4773C762106E9F66BFCB6C11450218973C69DED3FE51FF881AD0430675BF54320513EA766117C50C554E86E22A5ACFD8047D5470B4FCBCB9EFC86196CA77C58F1BEB09F76160D641B82E2481BEDAE089207D49FE0FB7DE14B6C4BC82E9C58140746AC8E74C3353AAF5F9CF47ED1F87C52F463C053DB63CD08CC9866EBA274D39B6B357ADADAD4D210167EF7363453D42BC225D90070336861F2D259489D78B7F04B05FE65E29151ADD2B8F4D318011988550CE590DBA4C868AC65AA325051DF613D6C2E22FFn); -testExpt(0xFFn, 0xFFn, 0x5E5C8B0EB95AB08F9D37EF127FC01BD0E33DE52647528396D78D5F8DA31989E67814F6BBA1FB0F0207010FF5F2347B19D5F6598FC91BF5A88F77DAA3D7B382FEC484F3D205C06A34445384C0E7AB0D883788C68C012CB433055EDDA746A48409444EA91147273B79FC3EABB70ECA552AF650C234BB01ED404427F17CDDDD71D08E39EF9C3982E3CE44E670456AA8154C1FDBD9C35947F494636A425C69BF89E9C75AD3B7A0A559AF0F5DA9947C8DEBA64417310713B23E7EF4DE50BB2A3E90BC2AC3DA5201CCA8D6E5DFEA887C4F7A4E92175D9F88BD2779B57F9EB35BE7528F965A06DA0AC41DCB3A34F1D8AB7D8FEE620A94FAA42C395997756B007FFEFFn); -testExpt(0xFFn, 0x3n, 0xFD02FFn); -testExpt(0xFFn, 0x2n, 0xFE01n); -testExpt(0xFFn, 0x1n, 0xFFn); -testExpt(0x3n, 0x123n, 0x25609213623D7D6219085CF49D306450BF6519835586C19D3A4F3A2C5F35B44A300C8A76E11708B5495B9C3EE756BBF19E3FD15CE625D3C0539Bn); -testExpt(0x3n, 0xFFn, 0x11F1B08E87EC42C5D83C3218FC83C41DCFD9F4428F4F92AF1AAA80AA46162B1F71E981273601F4AD1DD4709B5ACA650265A6ABn); -testExpt(0x3n, 0x3n, 0x1Bn); -testExpt(0x3n, 0x2n, 0x9n); -testExpt(0x3n, 0x1n, 0x3n); -testExpt(0x2n, 0x123n, 0x8000000000000000000000000000000000000000000000000000000000000000000000000n); -testExpt(0x2n, 0xFFn, 0x8000000000000000000000000000000000000000000000000000000000000000n); -testExpt(0x2n, 0x3n, 0x8n); -testExpt(0x2n, 0x2n, 0x4n); -testExpt(0x2n, 0x1n, 0x2n); -testExpt(0x1n, 0x123n, 0x1n); -testExpt(0x1n, 0xFFn, 0x1n); -testExpt(0x1n, 0x3n, 0x1n); -testExpt(0x1n, 0x2n, 0x1n); -testExpt(0x1n, 0x1n, 0x1n); +assert.sameValue(0x2n ** 0x3n, 0x8n, 'The result of (0x2n ** 0x3n) is 0x8n'); +assert.sameValue(0x2n ** 0x2n, 0x4n, 'The result of (0x2n ** 0x2n) is 0x4n'); +assert.sameValue(0x2n ** 0x1n, 0x2n, 'The result of (0x2n ** 0x1n) is 0x2n'); +assert.sameValue(0x1n ** 0x123n, 0x1n, 'The result of (0x1n ** 0x123n) is 0x1n'); +assert.sameValue(0x1n ** 0xFFn, 0x1n, 'The result of (0x1n ** 0xFFn) is 0x1n'); +assert.sameValue(0x1n ** 0x3n, 0x1n, 'The result of (0x1n ** 0x3n) is 0x1n'); +assert.sameValue(0x1n ** 0x2n, 0x1n, 'The result of (0x1n ** 0x2n) is 0x1n'); +assert.sameValue(0x1n ** 0x1n, 0x1n, 'The result of (0x1n ** 0x1n) is 0x1n'); \ No newline at end of file diff --git a/test/language/expressions/exponentiation/bigint-errors.js b/test/language/expressions/exponentiation/bigint-errors.js index 61b2a8192279c280ac50155c204ff8cb096a677c..72a2cc65e3126e3d6e70a173db378c338cfb9180 100644 --- a/test/language/expressions/exponentiation/bigint-errors.js +++ b/test/language/expressions/exponentiation/bigint-errors.js @@ -5,58 +5,66 @@ description: exponentiation operator ToNumeric with BigInt operands esid: sec-exp-operator-runtime-semantics-evaluation features: [BigInt, Symbol, Symbol.toPrimitive, computed-property-names] ---*/ - assert.throws(TypeError, function() { - Symbol("1") ** 0n; -}, "ToBigInt: Symbol => TypeError"); + Symbol('1') ** 0n; +}, 'Symbol("1") ** 0n throws TypeError'); + assert.throws(TypeError, function() { - 0n ** Symbol("1"); -}, "ToBigInt: Symbol => TypeError"); + 0n ** Symbol('1'); +}, '0n ** Symbol("1") throws TypeError'); + assert.throws(TypeError, function() { - Object(Symbol("1")) ** 0n; -}, "ToBigInt: unbox object with internal slot => Symbol => TypeError"); + Object(Symbol('1')) ** 0n; +}, 'Object(Symbol("1")) ** 0n throws TypeError'); + assert.throws(TypeError, function() { - 0n ** Object(Symbol("1")); -}, "ToBigInt: unbox object with internal slot => Symbol => TypeError"); + 0n ** Object(Symbol('1')); +}, '0n ** Object(Symbol("1")) throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { - return Symbol("1"); + return Symbol('1'); } }) ** 0n; -}, "ToBigInt: @@toPrimitive => Symbol => TypeError"); +}, '({[Symbol.toPrimitive]: function() {return Symbol("1");}}) ** 0n throws TypeError'); + assert.throws(TypeError, function() { 0n ** { [Symbol.toPrimitive]: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: @@toPrimitive => Symbol => TypeError"); +}, '0n ** {[Symbol.toPrimitive]: function() {return Symbol("1");}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { - return Symbol("1"); + return Symbol('1'); } }) ** 0n; -}, "ToBigInt: valueOf => Symbol => TypeError"); +}, '({valueOf: function() {return Symbol("1");}}) ** 0n throws TypeError'); + assert.throws(TypeError, function() { 0n ** { valueOf: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: valueOf => Symbol => TypeError"); +}, '0n ** {valueOf: function() {return Symbol("1");}} throws TypeError'); + assert.throws(TypeError, function() { ({ toString: function() { - return Symbol("1"); + return Symbol('1'); } }) ** 0n; -}, "ToBigInt: toString => Symbol => TypeError"); +}, '({toString: function() {return Symbol("1");}}) ** 0n throws TypeError'); + assert.throws(TypeError, function() { 0n ** { toString: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: toString => Symbol => TypeError"); +}, '0n ** {toString: function() {return Symbol("1");}} throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/exponentiation/bigint-exp-operator-negative-throws.js b/test/language/expressions/exponentiation/bigint-negative-exponent-throws.js similarity index 74% rename from test/language/expressions/exponentiation/bigint-exp-operator-negative-throws.js rename to test/language/expressions/exponentiation/bigint-negative-exponent-throws.js index f46a9beac57d0f2137d64123cbc48b28e15bf0df..d3dffb701d33e4d216057a0730cbf2ab21704054 100644 --- a/test/language/expressions/exponentiation/bigint-exp-operator-negative-throws.js +++ b/test/language/expressions/exponentiation/bigint-negative-exponent-throws.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Robin Templeton. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: If the BigInt exponent is < 0, throw a RangeError exception esid: sec-exp-operator-runtime-semantics-evaluation @@ -13,24 +12,21 @@ info: | BigInt::exponentiate (base, exponent) 1. If exponent < 0, throw a RangeError exception. - 2. If base is 0n and exponent is 0n, return 1n. - 3. Return a BigInt representing the mathematical value of base raised to the power exponent. ... features: [BigInt] ---*/ - assert.throws(RangeError, function() { - 1n ** -1n -}); + 1n ** -1n; +}, '1n ** -1n throws RangeError'); assert.throws(RangeError, function() { - 0n ** -1n -}); + 0n ** -1n; +}, '0n ** -1n throws RangeError'); assert.throws(RangeError, function() { - (-1n) ** -1n -}); + (-1n) ** -1n; +}, '(-1n) ** -1n throws RangeError'); assert.throws(RangeError, function() { - 1n ** -100000000000000000n -}); + 1n ** -100000000000000000n; +}, '1n ** -100000000000000000n throws RangeError'); \ No newline at end of file diff --git a/test/language/expressions/exponentiation/bigint-toprimitive.js b/test/language/expressions/exponentiation/bigint-toprimitive.js index 8e8277df366d7e4d9a206fe5808a0d90848d6b18..b63120ac333dc90d8fd06b2329f7fe3dba369323 100644 --- a/test/language/expressions/exponentiation/bigint-toprimitive.js +++ b/test/language/expressions/exponentiation/bigint-toprimitive.js @@ -5,304 +5,368 @@ description: exponentiation operator ToNumeric with BigInt operands esid: sec-exp-operator-runtime-semantics-evaluation features: [BigInt, Symbol.toPrimitive, computed-property-names] ---*/ - function err() { throw new Test262Error(); } function MyError() {} -assert.sameValue(({ +assert.sameValue({ [Symbol.toPrimitive]: function() { return 2n; }, + valueOf: err, toString: err -}) ** 1n, 2n, "ToPrimitive: @@toPrimitive takes precedence"); +} ** 1n, 2n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) ** 1n) is 2n'); + assert.sameValue(1n ** { [Symbol.toPrimitive]: function() { return 2n; }, + valueOf: err, toString: err -}, 1n, "ToPrimitive: @@toPrimitive takes precedence"); -assert.sameValue(({ +}, 1n, 'The result of (1n ** {[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) is 1n'); + +assert.sameValue({ valueOf: function() { return 2n; }, + toString: err -}) ** 1n, 2n, "ToPrimitive: valueOf takes precedence over toString"); +} ** 1n, 2n, 'The result of (({valueOf: function() {return 2n;}, toString: err}) ** 1n) is 2n'); + assert.sameValue(1n ** { valueOf: function() { return 2n; }, + toString: err -}, 1n, "ToPrimitive: valueOf takes precedence over toString"); -assert.sameValue(({ +}, 1n, 'The result of (1n ** {valueOf: function() {return 2n;}, toString: err}) is 1n'); + +assert.sameValue({ toString: function() { return 2n; } -}) ** 1n, 2n, "ToPrimitive: toString with no valueOf"); +} ** 1n, 2n, 'The result of (({toString: function() {return 2n;}}) ** 1n) is 2n'); + assert.sameValue(1n ** { toString: function() { return 2n; } -}, 1n, "ToPrimitive: toString with no valueOf"); -assert.sameValue(({ +}, 1n, 'The result of (1n ** {toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ [Symbol.toPrimitive]: undefined, + valueOf: function() { return 2n; } -}) ** 1n, 2n, "ToPrimitive: skip @@toPrimitive when it's undefined"); +} ** 1n, 2n, 'The result of (({[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) ** 1n) is 2n'); + assert.sameValue(1n ** { [Symbol.toPrimitive]: undefined, + valueOf: function() { return 2n; } -}, 1n, "ToPrimitive: skip @@toPrimitive when it's undefined"); -assert.sameValue(({ +}, 1n, 'The result of (1n ** {[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ [Symbol.toPrimitive]: null, + valueOf: function() { return 2n; } -}) ** 1n, 2n, "ToPrimitive: skip @@toPrimitive when it's null"); +} ** 1n, 2n, 'The result of (({[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) ** 1n) is 2n'); + assert.sameValue(1n ** { [Symbol.toPrimitive]: null, + valueOf: function() { return 2n; } -}, 1n, "ToPrimitive: skip @@toPrimitive when it's null"); -assert.sameValue(({ +}, 1n, 'The result of (1n ** {[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: null, + toString: function() { return 2n; } -}) ** 1n, 2n, "ToPrimitive: skip valueOf when it's not callable"); +} ** 1n, 2n, 'The result of (({valueOf: null, toString: function() {return 2n;}}) ** 1n) is 2n'); + assert.sameValue(1n ** { valueOf: null, + toString: function() { return 2n; } -}, 1n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 1n, 'The result of (1n ** {valueOf: null, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: 1, + toString: function() { return 2n; } -}) ** 1n, 2n, "ToPrimitive: skip valueOf when it's not callable"); +} ** 1n, 2n, 'The result of (({valueOf: 1, toString: function() {return 2n;}}) ** 1n) is 2n'); + assert.sameValue(1n ** { valueOf: 1, + toString: function() { return 2n; } -}, 1n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 1n, 'The result of (1n ** {valueOf: 1, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: {}, + toString: function() { return 2n; } -}) ** 1n, 2n, "ToPrimitive: skip valueOf when it's not callable"); +} ** 1n, 2n, 'The result of (({valueOf: {}, toString: function() {return 2n;}}) ** 1n) is 2n'); + assert.sameValue(1n ** { valueOf: {}, + toString: function() { return 2n; } -}, 1n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 1n, 'The result of (1n ** {valueOf: {}, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: function() { return {}; }, + toString: function() { return 2n; } -}) ** 1n, 2n, "ToPrimitive: skip valueOf when it returns an object"); +} ** 1n, 2n, 'The result of (({valueOf: function() {return {};}, toString: function() {return 2n;}}) ** 1n) is 2n'); + assert.sameValue(1n ** { valueOf: function() { return {}; }, + toString: function() { return 2n; } -}, 1n, "ToPrimitive: skip valueOf when it returns an object"); -assert.sameValue(({ +}, 1n, 'The result of (1n ** {valueOf: function() {return {};}, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: function() { return Object(12345); }, + toString: function() { return 2n; } -}) ** 1n, 2n, "ToPrimitive: skip valueOf when it returns an object"); +} ** 1n, 2n, 'The result of (({valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) ** 1n) is 2n'); + assert.sameValue(1n ** { valueOf: function() { return Object(12345); }, + toString: function() { return 2n; } -}, 1n, "ToPrimitive: skip valueOf when it returns an object"); +}, 1n, 'The result of (1n ** {valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) is 1n'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: 1 }) ** 0n; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '({[Symbol.toPrimitive]: 1}) ** 0n throws TypeError'); + assert.throws(TypeError, function() { 0n ** { [Symbol.toPrimitive]: 1 }; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '0n ** {[Symbol.toPrimitive]: 1} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: {} }) ** 0n; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '({[Symbol.toPrimitive]: {}}) ** 0n throws TypeError'); + assert.throws(TypeError, function() { 0n ** { [Symbol.toPrimitive]: {} }; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '0n ** {[Symbol.toPrimitive]: {}} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { return Object(1); } }) ** 0n; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '({[Symbol.toPrimitive]: function() {return Object(1);}}) ** 0n throws TypeError'); + assert.throws(TypeError, function() { 0n ** { [Symbol.toPrimitive]: function() { return Object(1); } }; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '0n ** {[Symbol.toPrimitive]: function() {return Object(1);}} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { return {}; } }) ** 0n; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '({[Symbol.toPrimitive]: function() {return {};}}) ** 0n throws TypeError'); + assert.throws(TypeError, function() { 0n ** { [Symbol.toPrimitive]: function() { return {}; } }; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '0n ** {[Symbol.toPrimitive]: function() {return {};}} throws TypeError'); + assert.throws(MyError, function() { ({ [Symbol.toPrimitive]: function() { throw new MyError(); } }) ** 0n; -}, "ToPrimitive: propagate errors from @@toPrimitive"); +}, '({[Symbol.toPrimitive]: function() {throw new MyError();}}) ** 0n throws MyError'); + assert.throws(MyError, function() { 0n ** { [Symbol.toPrimitive]: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from @@toPrimitive"); +}, '0n ** {[Symbol.toPrimitive]: function() {throw new MyError();}} throws MyError'); + assert.throws(MyError, function() { ({ valueOf: function() { throw new MyError(); } }) ** 0n; -}, "ToPrimitive: propagate errors from valueOf"); +}, '({valueOf: function() {throw new MyError();}}) ** 0n throws MyError'); + assert.throws(MyError, function() { 0n ** { valueOf: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from valueOf"); +}, '0n ** {valueOf: function() {throw new MyError();}} throws MyError'); + assert.throws(MyError, function() { ({ toString: function() { throw new MyError(); } }) ** 0n; -}, "ToPrimitive: propagate errors from toString"); +}, '({toString: function() {throw new MyError();}}) ** 0n throws MyError'); + assert.throws(MyError, function() { 0n ** { toString: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from toString"); +}, '0n ** {toString: function() {throw new MyError();}} throws MyError'); + assert.throws(TypeError, function() { ({ valueOf: null, toString: null }) ** 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: null, toString: null}) ** 0n throws TypeError'); + assert.throws(TypeError, function() { 0n ** { valueOf: null, toString: null }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n ** {valueOf: null, toString: null} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: 1, toString: 1 }) ** 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: 1, toString: 1}) ** 0n throws TypeError'); + assert.throws(TypeError, function() { 0n ** { valueOf: 1, toString: 1 }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n ** {valueOf: 1, toString: 1} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: {}, toString: {} }) ** 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: {}, toString: {}}) ** 0n throws TypeError'); + assert.throws(TypeError, function() { 0n ** { valueOf: {}, toString: {} }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n ** {valueOf: {}, toString: {}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { return Object(1); }, + toString: function() { return Object(1); } }) ** 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: function() {return Object(1);}, toString: function() {return Object(1);}}) ** 0n throws TypeError'); + assert.throws(TypeError, function() { 0n ** { valueOf: function() { return Object(1); }, + toString: function() { return Object(1); } }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n ** {valueOf: function() {return Object(1);}, toString: function() {return Object(1);}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { return {}; }, + toString: function() { return {}; } }) ** 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: function() {return {};}, toString: function() {return {};}}) ** 0n throws TypeError'); + assert.throws(TypeError, function() { 0n ** { valueOf: function() { return {}; }, + toString: function() { return {}; } }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n ** {valueOf: function() {return {};}, toString: function() {return {};}} throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/exponentiation/bigint-wrapped-values.js b/test/language/expressions/exponentiation/bigint-wrapped-values.js index bc93102f4f2e8a76f3870cd6bb078ba243e52f36..fa0906102e081258dc79145d6524a51456d6567d 100644 --- a/test/language/expressions/exponentiation/bigint-wrapped-values.js +++ b/test/language/expressions/exponentiation/bigint-wrapped-values.js @@ -5,36 +5,41 @@ description: exponentiation operator ToNumeric with BigInt operands esid: sec-exp-operator-runtime-semantics-evaluation features: [BigInt, Symbol.toPrimitive, computed-property-names] ---*/ +assert.sameValue(Object(2n) ** 1n, 2n, 'The result of (Object(2n) ** 1n) is 2n'); +assert.sameValue(1n ** Object(2n), 1n, 'The result of (1n ** Object(2n)) is 1n'); -assert.sameValue(Object(2n) ** 1n, 2n, "ToPrimitive: unbox object with internal slot"); -assert.sameValue(1n ** Object(2n), 1n, "ToPrimitive: unbox object with internal slot"); -assert.sameValue(({ +assert.sameValue({ [Symbol.toPrimitive]: function() { return 2n; } -}) ** 1n, 2n, "ToPrimitive: @@toPrimitive"); +} ** 1n, 2n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}}) ** 1n) is 2n'); + assert.sameValue(1n ** { [Symbol.toPrimitive]: function() { return 2n; } -}, 1n, "ToPrimitive: @@toPrimitive"); -assert.sameValue(({ +}, 1n, 'The result of (1n ** {[Symbol.toPrimitive]: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: function() { return 2n; } -}) ** 1n, 2n, "ToPrimitive: valueOf"); +} ** 1n, 2n, 'The result of (({valueOf: function() {return 2n;}}) ** 1n) is 2n'); + assert.sameValue(1n ** { valueOf: function() { return 2n; } -}, 1n, "ToPrimitive: valueOf"); -assert.sameValue(({ +}, 1n, 'The result of (1n ** {valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ toString: function() { return 2n; } -}) ** 1n, 2n, "ToPrimitive: toString"); +} ** 1n, 2n, 'The result of (({toString: function() {return 2n;}}) ** 1n) is 2n'); + assert.sameValue(1n ** { toString: function() { return 2n; } -}, 1n, "ToPrimitive: toString"); +}, 1n, 'The result of (1n ** {toString: function() {return 2n;}}) is 1n'); \ No newline at end of file diff --git a/test/language/expressions/exponentiation/bigint-zero-base-zero-exponent.js b/test/language/expressions/exponentiation/bigint-zero-base-zero-exponent.js index a1080f465b1aee478fb86c393df54dab85fdc504..55ffbf231a6091636580e2799dd91628c8ec39d8 100644 --- a/test/language/expressions/exponentiation/bigint-zero-base-zero-exponent.js +++ b/test/language/expressions/exponentiation/bigint-zero-base-zero-exponent.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Robin Templeton. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: If the BigInt base and exponent are both 0n, return 1n esid: sec-exp-operator-runtime-semantics-evaluation @@ -18,5 +17,4 @@ info: | ... features: [BigInt] ---*/ - -assert.sameValue(0n ** 0n, 1n); +assert.sameValue(0n ** 0n, 1n, 'The result of (0n ** 0n) is 1n'); \ No newline at end of file diff --git a/test/language/expressions/greater-than-or-equal/bigint-and-bigint.js b/test/language/expressions/greater-than-or-equal/bigint-and-bigint.js index 6ce429669a1906d8017a817e165642751ffdc246..4c1c7670a26e4f206f88a2da9b7119db478bc13c 100644 --- a/test/language/expressions/greater-than-or-equal/bigint-and-bigint.js +++ b/test/language/expressions/greater-than-or-equal/bigint-and-bigint.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Comparisons of BigInt and BigInt values esid: sec-abstract-relational-comparison @@ -20,37 +19,146 @@ info: | features: [BigInt] ---*/ +assert.sameValue(0n >= 0n, true, 'The result of (0n >= 0n) is true'); +assert.sameValue(1n >= 1n, true, 'The result of (1n >= 1n) is true'); +assert.sameValue(-1n >= -1n, true, 'The result of (-1n >= -1n) is true'); +assert.sameValue(0n >= -0n, true, 'The result of (0n >= -0n) is true'); +assert.sameValue(-0n >= 0n, true, 'The result of (-0n >= 0n) is true'); +assert.sameValue(0n >= 1n, false, 'The result of (0n >= 1n) is false'); +assert.sameValue(1n >= 0n, true, 'The result of (1n >= 0n) is true'); +assert.sameValue(0n >= -1n, true, 'The result of (0n >= -1n) is true'); +assert.sameValue(-1n >= 0n, false, 'The result of (-1n >= 0n) is false'); +assert.sameValue(1n >= -1n, true, 'The result of (1n >= -1n) is true'); +assert.sameValue(-1n >= 1n, false, 'The result of (-1n >= 1n) is false'); + +assert.sameValue( + 0x1fffffffffffff01n >= 0x1fffffffffffff02n, + false, + 'The result of (0x1fffffffffffff01n >= 0x1fffffffffffff02n) is false' +); + +assert.sameValue( + 0x1fffffffffffff02n >= 0x1fffffffffffff01n, + true, + 'The result of (0x1fffffffffffff02n >= 0x1fffffffffffff01n) is true' +); + +assert.sameValue( + -0x1fffffffffffff01n >= -0x1fffffffffffff02n, + true, + 'The result of (-0x1fffffffffffff01n >= -0x1fffffffffffff02n) is true' +); + +assert.sameValue( + -0x1fffffffffffff02n >= -0x1fffffffffffff01n, + false, + 'The result of (-0x1fffffffffffff02n >= -0x1fffffffffffff01n) is false' +); + +assert.sameValue( + 0x10000000000000000n >= 0n, + true, + 'The result of (0x10000000000000000n >= 0n) is true' +); + +assert.sameValue( + 0n >= 0x10000000000000000n, + false, + 'The result of (0n >= 0x10000000000000000n) is false' +); + +assert.sameValue( + 0x10000000000000000n >= 1n, + true, + 'The result of (0x10000000000000000n >= 1n) is true' +); + +assert.sameValue( + 1n >= 0x10000000000000000n, + false, + 'The result of (1n >= 0x10000000000000000n) is false' +); + +assert.sameValue( + 0x10000000000000000n >= -1n, + true, + 'The result of (0x10000000000000000n >= -1n) is true' +); + +assert.sameValue( + -1n >= 0x10000000000000000n, + false, + 'The result of (-1n >= 0x10000000000000000n) is false' +); + +assert.sameValue( + 0x10000000000000001n >= 0n, + true, + 'The result of (0x10000000000000001n >= 0n) is true' +); + +assert.sameValue( + 0n >= 0x10000000000000001n, + false, + 'The result of (0n >= 0x10000000000000001n) is false' +); + +assert.sameValue( + -0x10000000000000000n >= 0n, + false, + 'The result of (-0x10000000000000000n >= 0n) is false' +); + +assert.sameValue( + 0n >= -0x10000000000000000n, + true, + 'The result of (0n >= -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000000n >= 1n, + false, + 'The result of (-0x10000000000000000n >= 1n) is false' +); + +assert.sameValue( + 1n >= -0x10000000000000000n, + true, + 'The result of (1n >= -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000000n >= -1n, + false, + 'The result of (-0x10000000000000000n >= -1n) is false' +); + +assert.sameValue( + -1n >= -0x10000000000000000n, + true, + 'The result of (-1n >= -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000001n >= 0n, + false, + 'The result of (-0x10000000000000001n >= 0n) is false' +); + +assert.sameValue( + 0n >= -0x10000000000000001n, + true, + 'The result of (0n >= -0x10000000000000001n) is true' +); + +assert.sameValue( + 0x10000000000000000n >= 0x100000000n, + true, + 'The result of (0x10000000000000000n >= 0x100000000n) is true' +); -assert.sameValue(0n >= 0n, true, "0n >= 0n"); -assert.sameValue(1n >= 1n, true, "1n >= 1n"); -assert.sameValue(-1n >= -1n, true, "-1n >= -1n"); -assert.sameValue(0n >= -0n, true, "0n >= -0n"); -assert.sameValue(-0n >= 0n, true, "-0n >= 0n"); -assert.sameValue(0n >= 1n, false, "0n >= 1n"); -assert.sameValue(1n >= 0n, true, "1n >= 0n"); -assert.sameValue(0n >= -1n, true, "0n >= -1n"); -assert.sameValue(-1n >= 0n, false, "-1n >= 0n"); -assert.sameValue(1n >= -1n, true, "1n >= -1n"); -assert.sameValue(-1n >= 1n, false, "-1n >= 1n"); -assert.sameValue(0x1fffffffffffff01n >= 0x1fffffffffffff02n, false, "0x1fffffffffffff01n >= 0x1fffffffffffff02n"); -assert.sameValue(0x1fffffffffffff02n >= 0x1fffffffffffff01n, true, "0x1fffffffffffff02n >= 0x1fffffffffffff01n"); -assert.sameValue(-0x1fffffffffffff01n >= -0x1fffffffffffff02n, true, "-0x1fffffffffffff01n >= -0x1fffffffffffff02n"); -assert.sameValue(-0x1fffffffffffff02n >= -0x1fffffffffffff01n, false, "-0x1fffffffffffff02n >= -0x1fffffffffffff01n"); -assert.sameValue(0x10000000000000000n >= 0n, true, "0x10000000000000000n >= 0n"); -assert.sameValue(0n >= 0x10000000000000000n, false, "0n >= 0x10000000000000000n"); -assert.sameValue(0x10000000000000000n >= 1n, true, "0x10000000000000000n >= 1n"); -assert.sameValue(1n >= 0x10000000000000000n, false, "1n >= 0x10000000000000000n"); -assert.sameValue(0x10000000000000000n >= -1n, true, "0x10000000000000000n >= -1n"); -assert.sameValue(-1n >= 0x10000000000000000n, false, "-1n >= 0x10000000000000000n"); -assert.sameValue(0x10000000000000001n >= 0n, true, "0x10000000000000001n >= 0n"); -assert.sameValue(0n >= 0x10000000000000001n, false, "0n >= 0x10000000000000001n"); -assert.sameValue(-0x10000000000000000n >= 0n, false, "-0x10000000000000000n >= 0n"); -assert.sameValue(0n >= -0x10000000000000000n, true, "0n >= -0x10000000000000000n"); -assert.sameValue(-0x10000000000000000n >= 1n, false, "-0x10000000000000000n >= 1n"); -assert.sameValue(1n >= -0x10000000000000000n, true, "1n >= -0x10000000000000000n"); -assert.sameValue(-0x10000000000000000n >= -1n, false, "-0x10000000000000000n >= -1n"); -assert.sameValue(-1n >= -0x10000000000000000n, true, "-1n >= -0x10000000000000000n"); -assert.sameValue(-0x10000000000000001n >= 0n, false, "-0x10000000000000001n >= 0n"); -assert.sameValue(0n >= -0x10000000000000001n, true, "0n >= -0x10000000000000001n"); -assert.sameValue(0x10000000000000000n >= 0x100000000n, true, "0x10000000000000000n >= 0x100000000n"); -assert.sameValue(0x100000000n >= 0x10000000000000000n, false, "0x100000000n >= 0x10000000000000000n"); +assert.sameValue( + 0x100000000n >= 0x10000000000000000n, + false, + 'The result of (0x100000000n >= 0x10000000000000000n) is false' +); \ No newline at end of file diff --git a/test/language/expressions/greater-than-or-equal/bigint-and-incomparable-string.js b/test/language/expressions/greater-than-or-equal/bigint-and-incomparable-string.js index 0a0303814f1b7c6a9cb068aadb03d8194914ef45..abd0bdf453cb6b70b3fb05f6e51e4e4eb55ca450 100644 --- a/test/language/expressions/greater-than-or-equal/bigint-and-incomparable-string.js +++ b/test/language/expressions/greater-than-or-equal/bigint-and-incomparable-string.js @@ -1,30 +1,27 @@ // Copyright (C) 2018 Igalia, S.L. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Relational comparison of BigInt and string values esid: sec-abstract-relational-comparison features: [BigInt] ---*/ - -assert.sameValue(1n >= "0n", false, "1n >= '0n'"); -assert.sameValue(1n >= "0.", false, "1n >= '0.'"); -assert.sameValue(1n >= ".0", false, "1n >= '.0'"); -assert.sameValue(1n >= "0/1", false, "1n >= '0/1'"); -assert.sameValue(1n >= "z0", false, "1n >= 'z0'"); -assert.sameValue(1n >= "0z", false, "1n >= '0z'"); -assert.sameValue(1n >= "++0", false, "1n >= '++0'"); -assert.sameValue(1n >= "--0", false, "1n >= '--0'"); -assert.sameValue(1n >= "0e0", false, "1n >= '0e0'"); -assert.sameValue(1n >= "Infinity", false, "1n >= 'Infinity'"); - -assert.sameValue("1n" >= 0n, false, "'1n' >= 0n"); -assert.sameValue("1." >= 0n, false, "'1.' >= 0n"); -assert.sameValue(".1" >= 0n, false, "'.1' >= 0n"); -assert.sameValue("1/1" >= 0n, false, "'1/1' >= 0n"); -assert.sameValue("z1" >= 0n, false, "'z1' >= 0n"); -assert.sameValue("1z" >= 0n, false, "'1z' >= 0n"); -assert.sameValue("++1" >= 0n, false, "'++1' >= 0n"); -assert.sameValue("--1" >= 0n, false, "'--1' >= 0n"); -assert.sameValue("1e0" >= 0n, false, "'1e0' >= 0n"); -assert.sameValue("Infinity" >= 0n, false, "'Infinity' >= 0n"); +assert.sameValue(1n >= '0n', false, 'The result of (1n >= "0n") is false'); +assert.sameValue(1n >= '0.', false, 'The result of (1n >= "0.") is false'); +assert.sameValue(1n >= '.0', false, 'The result of (1n >= ".0") is false'); +assert.sameValue(1n >= '0/1', false, 'The result of (1n >= "0/1") is false'); +assert.sameValue(1n >= 'z0', false, 'The result of (1n >= "z0") is false'); +assert.sameValue(1n >= '0z', false, 'The result of (1n >= "0z") is false'); +assert.sameValue(1n >= '++0', false, 'The result of (1n >= "++0") is false'); +assert.sameValue(1n >= '--0', false, 'The result of (1n >= "--0") is false'); +assert.sameValue(1n >= '0e0', false, 'The result of (1n >= "0e0") is false'); +assert.sameValue(1n >= 'Infinity', false, 'The result of (1n >= "Infinity") is false'); +assert.sameValue('1n' >= 0n, false, 'The result of ("1n" >= 0n) is false'); +assert.sameValue('1.' >= 0n, false, 'The result of ("1." >= 0n) is false'); +assert.sameValue('.1' >= 0n, false, 'The result of (".1" >= 0n) is false'); +assert.sameValue('1/1' >= 0n, false, 'The result of ("1/1" >= 0n) is false'); +assert.sameValue('z1' >= 0n, false, 'The result of ("z1" >= 0n) is false'); +assert.sameValue('1z' >= 0n, false, 'The result of ("1z" >= 0n) is false'); +assert.sameValue('++1' >= 0n, false, 'The result of ("++1" >= 0n) is false'); +assert.sameValue('--1' >= 0n, false, 'The result of ("--1" >= 0n) is false'); +assert.sameValue('1e0' >= 0n, false, 'The result of ("1e0" >= 0n) is false'); +assert.sameValue('Infinity' >= 0n, false, 'The result of ("Infinity" >= 0n) is false'); \ No newline at end of file diff --git a/test/language/expressions/greater-than-or-equal/bigint-and-non-finite.js b/test/language/expressions/greater-than-or-equal/bigint-and-non-finite.js index f3af1b04ecbd6d6bf39cbdd00da436f40016c834..8c2b4d0bf7cb20ef6427799d215c6c9863787cf0 100644 --- a/test/language/expressions/greater-than-or-equal/bigint-and-non-finite.js +++ b/test/language/expressions/greater-than-or-equal/bigint-and-non-finite.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Comparisons of BigInt and non-finite Number values esid: sec-abstract-relational-comparison @@ -18,14 +17,13 @@ info: | g. If x is +∞, or y is -∞, return false. features: [BigInt] ---*/ - -assert.sameValue(1n >= Infinity, false, "1n >= Infinity"); -assert.sameValue(Infinity >= 1n, true, "Infinity >= 1n"); -assert.sameValue(-1n >= Infinity, false, "-1n >= Infinity"); -assert.sameValue(Infinity >= -1n, true, "Infinity >= -1n"); -assert.sameValue(1n >= -Infinity, true, "1n >= -Infinity"); -assert.sameValue(-Infinity >= 1n, false, "-Infinity >= 1n"); -assert.sameValue(-1n >= -Infinity, true, "-1n >= -Infinity"); -assert.sameValue(-Infinity >= -1n, false, "-Infinity >= -1n"); -assert.sameValue(0n >= NaN, false, "0n >= NaN"); -assert.sameValue(NaN >= 0n, false, "NaN >= 0n"); +assert.sameValue(1n >= Infinity, false, 'The result of (1n >= Infinity) is false'); +assert.sameValue(Infinity >= 1n, true, 'The result of (Infinity >= 1n) is true'); +assert.sameValue(-1n >= Infinity, false, 'The result of (-1n >= Infinity) is false'); +assert.sameValue(Infinity >= -1n, true, 'The result of (Infinity >= -1n) is true'); +assert.sameValue(1n >= -Infinity, true, 'The result of (1n >= -Infinity) is true'); +assert.sameValue(-Infinity >= 1n, false, 'The result of (-Infinity >= 1n) is false'); +assert.sameValue(-1n >= -Infinity, true, 'The result of (-1n >= -Infinity) is true'); +assert.sameValue(-Infinity >= -1n, false, 'The result of (-Infinity >= -1n) is false'); +assert.sameValue(0n >= NaN, false, 'The result of (0n >= NaN) is false'); +assert.sameValue(NaN >= 0n, false, 'The result of (NaN >= 0n) is false'); \ No newline at end of file diff --git a/test/language/expressions/greater-than-or-equal/bigint-and-number-extremes.js b/test/language/expressions/greater-than-or-equal/bigint-and-number-extremes.js index 64657ac9e036ea51fd0593c0ef75f0282c2418ce..7c2b2be5cf8b2b744a4f79c5166fb0a055ca6de2 100644 --- a/test/language/expressions/greater-than-or-equal/bigint-and-number-extremes.js +++ b/test/language/expressions/greater-than-or-equal/bigint-and-number-extremes.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Comparisons of large BigInt and Number values esid: sec-abstract-relational-comparison @@ -19,24 +18,36 @@ info: | h. If the mathematical value of nx is less than the mathematical value of ny, return true, otherwise return false. features: [BigInt] ---*/ +assert.sameValue(1n >= Number.MAX_VALUE, false, 'The result of (1n >= Number.MAX_VALUE) is false'); +assert.sameValue(Number.MAX_VALUE >= 1n, true, 'The result of (Number.MAX_VALUE >= 1n) is true'); +assert.sameValue(1n >= -Number.MAX_VALUE, true, 'The result of (1n >= -Number.MAX_VALUE) is true'); + +assert.sameValue( + -Number.MAX_VALUE >= 1n, + false, + 'The result of (-Number.MAX_VALUE >= 1n) is false' +); -assert.sameValue(1n >= Number.MAX_VALUE, false, "1n >= Number.MAX_VALUE"); -assert.sameValue(Number.MAX_VALUE >= 1n, true, "Number.MAX_VALUE >= 1n"); -assert.sameValue(1n >= -Number.MAX_VALUE, true, "1n >= -Number.MAX_VALUE"); -assert.sameValue(-Number.MAX_VALUE >= 1n, false, "-Number.MAX_VALUE >= 1n"); assert.sameValue( 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn >= Number.MAX_VALUE, false, - "0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn >= Number.MAX_VALUE"); + 'The result of (0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn >= Number.MAX_VALUE) is false' +); + assert.sameValue( Number.MAX_VALUE >= 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn, true, - "Number.MAX_VALUE >= 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn"); + 'The result of (Number.MAX_VALUE >= 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn) is true' +); + assert.sameValue( 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n >= Number.MAX_VALUE, true, - "0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n >= Number.MAX_VALUE"); + 'The result of (0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n >= Number.MAX_VALUE) is true' +); + assert.sameValue( Number.MAX_VALUE >= 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n, false, - "Number.MAX_VALUE >= 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n"); + 'The result of (Number.MAX_VALUE >= 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n) is false' +); \ No newline at end of file diff --git a/test/language/expressions/greater-than-or-equal/bigint-and-number.js b/test/language/expressions/greater-than-or-equal/bigint-and-number.js index c2cd2949a6beeb8a325e646b52c7c23ccc3e6ce7..55120ea3fc64ca49c853ea53460e4c4a9552c7fd 100644 --- a/test/language/expressions/greater-than-or-equal/bigint-and-number.js +++ b/test/language/expressions/greater-than-or-equal/bigint-and-number.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Robin Templeton. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Comparisons of BigInt and Number values esid: sec-abstract-relational-comparison @@ -19,24 +18,38 @@ info: | h. If the mathematical value of nx is less than the mathematical value of ny, return true, otherwise return false. features: [BigInt] ---*/ +assert.sameValue(0n >= 0, true, 'The result of (0n >= 0) is true'); +assert.sameValue(0 >= 0n, true, 'The result of (0 >= 0n) is true'); +assert.sameValue(0n >= -0, true, 'The result of (0n >= -0) is true'); +assert.sameValue(-0 >= 0n, true, 'The result of (-0 >= 0n) is true'); +assert.sameValue(0n >= 0.000000000001, false, 'The result of (0n >= 0.000000000001) is false'); +assert.sameValue(0.000000000001 >= 0n, true, 'The result of (0.000000000001 >= 0n) is true'); +assert.sameValue(0n >= 1, false, 'The result of (0n >= 1) is false'); +assert.sameValue(1 >= 0n, true, 'The result of (1 >= 0n) is true'); +assert.sameValue(1n >= 0, true, 'The result of (1n >= 0) is true'); +assert.sameValue(0 >= 1n, false, 'The result of (0 >= 1n) is false'); +assert.sameValue(1n >= 0.999999999999, true, 'The result of (1n >= 0.999999999999) is true'); +assert.sameValue(0.999999999999 >= 1n, false, 'The result of (0.999999999999 >= 1n) is false'); +assert.sameValue(1n >= 1, true, 'The result of (1n >= 1) is true'); +assert.sameValue(1 >= 1n, true, 'The result of (1 >= 1n) is true'); +assert.sameValue(0n >= Number.MIN_VALUE, false, 'The result of (0n >= Number.MIN_VALUE) is false'); +assert.sameValue(Number.MIN_VALUE >= 0n, true, 'The result of (Number.MIN_VALUE >= 0n) is true'); +assert.sameValue(0n >= -Number.MIN_VALUE, true, 'The result of (0n >= -Number.MIN_VALUE) is true'); + +assert.sameValue( + -Number.MIN_VALUE >= 0n, + false, + 'The result of (-Number.MIN_VALUE >= 0n) is false' +); + +assert.sameValue( + -10n >= Number.MIN_VALUE, + false, + 'The result of (-10n >= Number.MIN_VALUE) is false' +); -assert.sameValue(0n >= 0, true, "0n >= 0"); -assert.sameValue(0 >= 0n, true, "0 >= 0n"); -assert.sameValue(0n >= -0, true, "0n >= -0"); -assert.sameValue(-0 >= 0n, true, "-0 >= 0n"); -assert.sameValue(0n >= 0.000000000001, false, "0n >= 0.000000000001"); -assert.sameValue(0.000000000001 >= 0n, true, "0.000000000001 >= 0n"); -assert.sameValue(0n >= 1, false, "0n >= 1"); -assert.sameValue(1 >= 0n, true, "1 >= 0n"); -assert.sameValue(1n >= 0, true, "1n >= 0"); -assert.sameValue(0 >= 1n, false, "0 >= 1n"); -assert.sameValue(1n >= 0.999999999999, true, "1n >= 0.999999999999"); -assert.sameValue(0.999999999999 >= 1n, false, "0.999999999999 >= 1n"); -assert.sameValue(1n >= 1, true, "1n >= 1"); -assert.sameValue(1 >= 1n, true, "1 >= 1n"); -assert.sameValue(0n >= Number.MIN_VALUE, false, "0n >= Number.MIN_VALUE"); -assert.sameValue(Number.MIN_VALUE >= 0n, true, "Number.MIN_VALUE >= 0n"); -assert.sameValue(0n >= -Number.MIN_VALUE, true, "0n >= -Number.MIN_VALUE"); -assert.sameValue(-Number.MIN_VALUE >= 0n, false, "-Number.MIN_VALUE >= 0n"); -assert.sameValue(-10n >= Number.MIN_VALUE, false, "-10n >= Number.MIN_VALUE"); -assert.sameValue(Number.MIN_VALUE >= -10n, true, "Number.MIN_VALUE >= -10n"); +assert.sameValue( + Number.MIN_VALUE >= -10n, + true, + 'The result of (Number.MIN_VALUE >= -10n) is true' +); \ No newline at end of file diff --git a/test/language/expressions/greater-than-or-equal/bigint-and-string.js b/test/language/expressions/greater-than-or-equal/bigint-and-string.js index 37aecb3ef949cba308c356d69e6a62ede7d851c2..15abbaaa6f6c12baf2531dbd1891dfdaa98b45c8 100644 --- a/test/language/expressions/greater-than-or-equal/bigint-and-string.js +++ b/test/language/expressions/greater-than-or-equal/bigint-and-string.js @@ -1,48 +1,51 @@ // Copyright (C) 2018 Igalia, S.L. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Relational comparison of BigInt and string values esid: sec-abstract-relational-comparison features: [BigInt] ---*/ - -assert.sameValue(0n >= "0", true, "0n >= '0'"); -assert.sameValue("0" >= 0n, true, "'0' >= 0n"); - -assert.sameValue(0n >= "1", false, "0n >= '1'"); -assert.sameValue("0" >= 1n, false, "'0' >= 1n"); - -assert.sameValue(1n >= "0", true, "1n >= '0'"); -assert.sameValue("1" >= 0n, true, "'1' >= 0n"); - -assert.sameValue(0n >= "", true, "0n >= ''"); -assert.sameValue("" >= 0n, true, "'' >= 0n"); - -assert.sameValue(0n >= "1", false, "0n >= '1'"); -assert.sameValue("" >= 1n, false, "'' >= 1n"); - -assert.sameValue(1n >= "", true, "1n >= ''"); -assert.sameValue("1" >= 0n, true, "'1' >= 0n"); - -assert.sameValue(1n >= "1", true, "1n >= '1'"); -assert.sameValue("1" >= 1n, true, "'1' >= 1n"); - -assert.sameValue(1n >= "-1", true, "1n >= '-1'"); -assert.sameValue("1" >= -1n, true, "'1' >= -1n"); - -assert.sameValue(-1n >= "1", false, "-1n >= '1'"); -assert.sameValue("-1" >= 1n, false, "'-1' >= 1n"); - -assert.sameValue(-1n >= "-1", true, "-1n >= '-1'"); -assert.sameValue("-1" >= -1n, true, "'-1' >= -1n"); - -assert.sameValue(9007199254740993n >= "9007199254740992", true, - "9007199254740993n >= '9007199254740992'"); -assert.sameValue("9007199254740993" >= 9007199254740992n, true, - "'9007199254740993' >= 9007199254740992n"); - -assert.sameValue(-9007199254740992n >= "-9007199254740993", true, - "-9007199254740992n >= '-9007199254740993'"); -assert.sameValue("-9007199254740992" >= -9007199254740993n, true, - "'-9007199254740992' >= -9007199254740993n"); +assert.sameValue(0n >= '0', true, 'The result of (0n >= "0") is true'); +assert.sameValue('0' >= 0n, true, 'The result of ("0" >= 0n) is true'); +assert.sameValue(0n >= '1', false, 'The result of (0n >= "1") is false'); +assert.sameValue('0' >= 1n, false, 'The result of ("0" >= 1n) is false'); +assert.sameValue(1n >= '0', true, 'The result of (1n >= "0") is true'); +assert.sameValue('1' >= 0n, true, 'The result of ("1" >= 0n) is true'); +assert.sameValue(0n >= '', true, 'The result of (0n >= "") is true'); +assert.sameValue('' >= 0n, true, 'The result of ("" >= 0n) is true'); +assert.sameValue(0n >= '1', false, 'The result of (0n >= "1") is false'); +assert.sameValue('' >= 1n, false, 'The result of ("" >= 1n) is false'); +assert.sameValue(1n >= '', true, 'The result of (1n >= "") is true'); +assert.sameValue('1' >= 0n, true, 'The result of ("1" >= 0n) is true'); +assert.sameValue(1n >= '1', true, 'The result of (1n >= "1") is true'); +assert.sameValue('1' >= 1n, true, 'The result of ("1" >= 1n) is true'); +assert.sameValue(1n >= '-1', true, 'The result of (1n >= "-1") is true'); +assert.sameValue('1' >= -1n, true, 'The result of ("1" >= -1n) is true'); +assert.sameValue(-1n >= '1', false, 'The result of (-1n >= "1") is false'); +assert.sameValue('-1' >= 1n, false, 'The result of ("-1" >= 1n) is false'); +assert.sameValue(-1n >= '-1', true, 'The result of (-1n >= "-1") is true'); +assert.sameValue('-1' >= -1n, true, 'The result of ("-1" >= -1n) is true'); + +assert.sameValue( + 9007199254740993n >= '9007199254740992', + true, + 'The result of (9007199254740993n >= "9007199254740992") is true' +); + +assert.sameValue( + '9007199254740993' >= 9007199254740992n, + true, + 'The result of ("9007199254740993" >= 9007199254740992n) is true' +); + +assert.sameValue( + -9007199254740992n >= '-9007199254740993', + true, + 'The result of (-9007199254740992n >= "-9007199254740993") is true' +); + +assert.sameValue( + '-9007199254740992' >= -9007199254740993n, + true, + 'The result of ("-9007199254740992" >= -9007199254740993n) is true' +); \ No newline at end of file diff --git a/test/language/expressions/greater-than/11.8.2-1.js b/test/language/expressions/greater-than/11.8.2-1.js index a8699ab00c61208c835f391688d9bf029b7ce70a..0337ce6ca353bd465fc17c905a38885b7ddf4edd 100644 --- a/test/language/expressions/greater-than/11.8.2-1.js +++ b/test/language/expressions/greater-than/11.8.2-1.js @@ -4,25 +4,22 @@ /*--- es5id: 11.8.2-1 description: > - 11.8.2 Greater-than Operator - Partial left to right order - enforced when using Greater-than operator: valueOf > valueOf + 11.8.2 Greater-than Operator - Partial left to right order + enforced when using Greater-than operator: valueOf > valueOf ---*/ - var accessed = false; - var obj1 = { - valueOf: function () { - accessed = true; - return 3; - } - }; - var obj2 = { - valueOf: function () { - if (accessed === true) { - return 4; - } else { - return 2; - } - } - }; +var accessed = false; +var obj1 = { + valueOf: function () { + accessed = true; + return 3; + } +}; +var obj2 = { + valueOf: function () { + return 4; + } +}; -assert(!(obj1 > obj2), '!(obj1 > obj2) !== true'); +assert.sameValue(obj1 > obj2, false, 'The result of (obj1 > obj2) is false'); +assert.sameValue(accessed, true, 'The value of accessed is true'); diff --git a/test/language/expressions/greater-than/11.8.2-2.js b/test/language/expressions/greater-than/11.8.2-2.js index 3597625bb45af87bdab067c5df47483b356c4de6..fe0565c91dc6ba123f3275ffe3b17d429fbe1444 100644 --- a/test/language/expressions/greater-than/11.8.2-2.js +++ b/test/language/expressions/greater-than/11.8.2-2.js @@ -4,25 +4,22 @@ /*--- es5id: 11.8.2-2 description: > - 11.8.2 Greater-than Operator - Partial left to right order - enforced when using Greater-than operator: valueOf > toString + 11.8.2 Greater-than Operator - Partial left to right order + enforced when using Greater-than operator: valueOf > toString ---*/ - var accessed = false; - var obj1 = { - valueOf: function () { - accessed = true; - return 3; - } - }; - var obj2 = { - toString: function () { - if (accessed === true) { - return 4; - } else { - return 2; - } - } - }; +var accessed = false; +var obj1 = { + valueOf: function () { + accessed = true; + return 3; + } +}; +var obj2 = { + toString: function () { + return 4; + } +}; -assert(!(obj1 > obj2), '!(obj1 > obj2) !== true'); +assert.sameValue(obj1 > obj2, false, 'The result of (obj1 > obj2) is false'); +assert.sameValue(accessed, true, 'The value of accessed is true'); diff --git a/test/language/expressions/greater-than/11.8.2-3.js b/test/language/expressions/greater-than/11.8.2-3.js index 672dbc6a27a9efa28a00044b12bd648759724cb8..cf287f5b9ddbd9648818aee4d08fe8998a8d5a77 100644 --- a/test/language/expressions/greater-than/11.8.2-3.js +++ b/test/language/expressions/greater-than/11.8.2-3.js @@ -8,21 +8,18 @@ description: > enforced when using Greater-than operator: toString > valueOf ---*/ - var accessed = false; - var obj1 = { - toString: function () { - accessed = true; - return 3; - } - }; - var obj2 = { - valueOf: function () { - if (accessed === true) { - return 4; - } else { - return 2; - } - } - }; +var accessed = false; +var obj1 = { + toString: function () { + accessed = true; + return 3; + } +}; +var obj2 = { + valueOf: function () { + return 4; + } +}; -assert(!(obj1 > obj2), '!(obj1 > obj2) !== true'); +assert.sameValue(obj1 > obj2, false, 'The result of (obj1 > obj2) is false'); +assert.sameValue(accessed, true, 'The value of accessed is true'); diff --git a/test/language/expressions/greater-than/11.8.2-4.js b/test/language/expressions/greater-than/11.8.2-4.js index c11836e52299840e0a3a94043f0e99ea97aa2919..66b02a888e40176ec30d4d2a47fc40c3a2d8084b 100644 --- a/test/language/expressions/greater-than/11.8.2-4.js +++ b/test/language/expressions/greater-than/11.8.2-4.js @@ -8,21 +8,18 @@ description: > enforced when using Greater-than operator: toString > toString ---*/ - var accessed = false; - var obj1 = { - toString: function () { - accessed = true; - return 3; - } - }; - var obj2 = { - toString: function () { - if (accessed === true) { - return 4; - } else { - return 2; - } - } - }; +var accessed = false; +var obj1 = { + toString: function () { + accessed = true; + return 3; + } +}; +var obj2 = { + toString: function () { + return 4; + } +}; -assert(!(obj1 > obj2), '!(obj1 > obj2) !== true'); +assert.sameValue(obj1 > obj2, false, 'The result of (obj1 > obj2) is false'); +assert.sameValue(accessed, true, 'The value of accessed is true'); diff --git a/test/language/expressions/greater-than/bigint-and-bigint.js b/test/language/expressions/greater-than/bigint-and-bigint.js index c9f06fb44d784dc7beb0677a1acf8163a63525a0..71f57fd8e0af9b11fc95cc8ac0d751919f7c1104 100644 --- a/test/language/expressions/greater-than/bigint-and-bigint.js +++ b/test/language/expressions/greater-than/bigint-and-bigint.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Comparisons of BigInt and BigInt values esid: sec-abstract-relational-comparison @@ -20,37 +19,146 @@ info: | features: [BigInt] ---*/ +assert.sameValue(0n > 0n, false, 'The result of (0n > 0n) is false'); +assert.sameValue(1n > 1n, false, 'The result of (1n > 1n) is false'); +assert.sameValue(-1n > -1n, false, 'The result of (-1n > -1n) is false'); +assert.sameValue(0n > -0n, false, 'The result of (0n > -0n) is false'); +assert.sameValue(-0n > 0n, false, 'The result of (-0n > 0n) is false'); +assert.sameValue(0n > 1n, false, 'The result of (0n > 1n) is false'); +assert.sameValue(1n > 0n, true, 'The result of (1n > 0n) is true'); +assert.sameValue(0n > -1n, true, 'The result of (0n > -1n) is true'); +assert.sameValue(-1n > 0n, false, 'The result of (-1n > 0n) is false'); +assert.sameValue(1n > -1n, true, 'The result of (1n > -1n) is true'); +assert.sameValue(-1n > 1n, false, 'The result of (-1n > 1n) is false'); + +assert.sameValue( + 0x1fffffffffffff01n > 0x1fffffffffffff02n, + false, + 'The result of (0x1fffffffffffff01n > 0x1fffffffffffff02n) is false' +); + +assert.sameValue( + 0x1fffffffffffff02n > 0x1fffffffffffff01n, + true, + 'The result of (0x1fffffffffffff02n > 0x1fffffffffffff01n) is true' +); + +assert.sameValue( + -0x1fffffffffffff01n > -0x1fffffffffffff02n, + true, + 'The result of (-0x1fffffffffffff01n > -0x1fffffffffffff02n) is true' +); + +assert.sameValue( + -0x1fffffffffffff02n > -0x1fffffffffffff01n, + false, + 'The result of (-0x1fffffffffffff02n > -0x1fffffffffffff01n) is false' +); + +assert.sameValue( + 0x10000000000000000n > 0n, + true, + 'The result of (0x10000000000000000n > 0n) is true' +); + +assert.sameValue( + 0n > 0x10000000000000000n, + false, + 'The result of (0n > 0x10000000000000000n) is false' +); + +assert.sameValue( + 0x10000000000000000n > 1n, + true, + 'The result of (0x10000000000000000n > 1n) is true' +); + +assert.sameValue( + 1n > 0x10000000000000000n, + false, + 'The result of (1n > 0x10000000000000000n) is false' +); + +assert.sameValue( + 0x10000000000000000n > -1n, + true, + 'The result of (0x10000000000000000n > -1n) is true' +); + +assert.sameValue( + -1n > 0x10000000000000000n, + false, + 'The result of (-1n > 0x10000000000000000n) is false' +); + +assert.sameValue( + 0x10000000000000001n > 0n, + true, + 'The result of (0x10000000000000001n > 0n) is true' +); + +assert.sameValue( + 0n > 0x10000000000000001n, + false, + 'The result of (0n > 0x10000000000000001n) is false' +); + +assert.sameValue( + -0x10000000000000000n > 0n, + false, + 'The result of (-0x10000000000000000n > 0n) is false' +); + +assert.sameValue( + 0n > -0x10000000000000000n, + true, + 'The result of (0n > -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000000n > 1n, + false, + 'The result of (-0x10000000000000000n > 1n) is false' +); + +assert.sameValue( + 1n > -0x10000000000000000n, + true, + 'The result of (1n > -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000000n > -1n, + false, + 'The result of (-0x10000000000000000n > -1n) is false' +); + +assert.sameValue( + -1n > -0x10000000000000000n, + true, + 'The result of (-1n > -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000001n > 0n, + false, + 'The result of (-0x10000000000000001n > 0n) is false' +); + +assert.sameValue( + 0n > -0x10000000000000001n, + true, + 'The result of (0n > -0x10000000000000001n) is true' +); + +assert.sameValue( + 0x10000000000000000n > 0x100000000n, + true, + 'The result of (0x10000000000000000n > 0x100000000n) is true' +); -assert.sameValue(0n > 0n, false, "0n > 0n"); -assert.sameValue(1n > 1n, false, "1n > 1n"); -assert.sameValue(-1n > -1n, false, "-1n > -1n"); -assert.sameValue(0n > -0n, false, "0n > -0n"); -assert.sameValue(-0n > 0n, false, "-0n > 0n"); -assert.sameValue(0n > 1n, false, "0n > 1n"); -assert.sameValue(1n > 0n, true, "1n > 0n"); -assert.sameValue(0n > -1n, true, "0n > -1n"); -assert.sameValue(-1n > 0n, false, "-1n > 0n"); -assert.sameValue(1n > -1n, true, "1n > -1n"); -assert.sameValue(-1n > 1n, false, "-1n > 1n"); -assert.sameValue(0x1fffffffffffff01n > 0x1fffffffffffff02n, false, "0x1fffffffffffff01n > 0x1fffffffffffff02n"); -assert.sameValue(0x1fffffffffffff02n > 0x1fffffffffffff01n, true, "0x1fffffffffffff02n > 0x1fffffffffffff01n"); -assert.sameValue(-0x1fffffffffffff01n > -0x1fffffffffffff02n, true, "-0x1fffffffffffff01n > -0x1fffffffffffff02n"); -assert.sameValue(-0x1fffffffffffff02n > -0x1fffffffffffff01n, false, "-0x1fffffffffffff02n > -0x1fffffffffffff01n"); -assert.sameValue(0x10000000000000000n > 0n, true, "0x10000000000000000n > 0n"); -assert.sameValue(0n > 0x10000000000000000n, false, "0n > 0x10000000000000000n"); -assert.sameValue(0x10000000000000000n > 1n, true, "0x10000000000000000n > 1n"); -assert.sameValue(1n > 0x10000000000000000n, false, "1n > 0x10000000000000000n"); -assert.sameValue(0x10000000000000000n > -1n, true, "0x10000000000000000n > -1n"); -assert.sameValue(-1n > 0x10000000000000000n, false, "-1n > 0x10000000000000000n"); -assert.sameValue(0x10000000000000001n > 0n, true, "0x10000000000000001n > 0n"); -assert.sameValue(0n > 0x10000000000000001n, false, "0n > 0x10000000000000001n"); -assert.sameValue(-0x10000000000000000n > 0n, false, "-0x10000000000000000n > 0n"); -assert.sameValue(0n > -0x10000000000000000n, true, "0n > -0x10000000000000000n"); -assert.sameValue(-0x10000000000000000n > 1n, false, "-0x10000000000000000n > 1n"); -assert.sameValue(1n > -0x10000000000000000n, true, "1n > -0x10000000000000000n"); -assert.sameValue(-0x10000000000000000n > -1n, false, "-0x10000000000000000n > -1n"); -assert.sameValue(-1n > -0x10000000000000000n, true, "-1n > -0x10000000000000000n"); -assert.sameValue(-0x10000000000000001n > 0n, false, "-0x10000000000000001n > 0n"); -assert.sameValue(0n > -0x10000000000000001n, true, "0n > -0x10000000000000001n"); -assert.sameValue(0x10000000000000000n > 0x100000000n, true, "0x10000000000000000n > 0x100000000n"); -assert.sameValue(0x100000000n > 0x10000000000000000n, false, "0x100000000n > 0x10000000000000000n"); +assert.sameValue( + 0x100000000n > 0x10000000000000000n, + false, + 'The result of (0x100000000n > 0x10000000000000000n) is false' +); \ No newline at end of file diff --git a/test/language/expressions/greater-than/bigint-and-boolean.js b/test/language/expressions/greater-than/bigint-and-boolean.js index e7131154b0695049bd83e71cc53d61b2e8ec1ea7..da43b44adc69f73671805e3b6a2f2030114356fc 100644 --- a/test/language/expressions/greater-than/bigint-and-boolean.js +++ b/test/language/expressions/greater-than/bigint-and-boolean.js @@ -1,30 +1,21 @@ // Copyright (C) 2018 Caio Lima. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Relational comparison of BigInt and boolean values esid: sec-abstract-relational-comparison features: [BigInt] ---*/ - -assert.sameValue(0n > false, false, "0n > false"); -assert.sameValue(false > 0n, false, "false > 0n"); - -assert.sameValue(0n > true, false, "0n > true"); -assert.sameValue(true > 0n, true, "true > 0n"); - -assert.sameValue(1n > false, true, "1n > false"); -assert.sameValue(false > 1n, false, "false > 1n"); - -assert.sameValue(1n > true, false, "1n > true"); -assert.sameValue(true > 1n, false, "true > 1n"); - -assert.sameValue(31n > true, true, "31n > true"); -assert.sameValue(true > 31n, false, "true > 31n"); - -assert.sameValue(-3n > true, false, "-3n > true"); -assert.sameValue(true > -3n, true, "true > -3n"); - -assert.sameValue(-3n > false, false, "-3n > false"); -assert.sameValue(false > -3n, true, "false > -3n"); - +assert.sameValue(0n > false, false, 'The result of (0n > false) is false'); +assert.sameValue(false > 0n, false, 'The result of (false > 0n) is false'); +assert.sameValue(0n > true, false, 'The result of (0n > true) is false'); +assert.sameValue(true > 0n, true, 'The result of (true > 0n) is true'); +assert.sameValue(1n > false, true, 'The result of (1n > false) is true'); +assert.sameValue(false > 1n, false, 'The result of (false > 1n) is false'); +assert.sameValue(1n > true, false, 'The result of (1n > true) is false'); +assert.sameValue(true > 1n, false, 'The result of (true > 1n) is false'); +assert.sameValue(31n > true, true, 'The result of (31n > true) is true'); +assert.sameValue(true > 31n, false, 'The result of (true > 31n) is false'); +assert.sameValue(-3n > true, false, 'The result of (-3n > true) is false'); +assert.sameValue(true > -3n, true, 'The result of (true > -3n) is true'); +assert.sameValue(-3n > false, false, 'The result of (-3n > false) is false'); +assert.sameValue(false > -3n, true, 'The result of (false > -3n) is true'); \ No newline at end of file diff --git a/test/language/expressions/greater-than/bigint-and-incomparable-string.js b/test/language/expressions/greater-than/bigint-and-incomparable-string.js index 57b0334c945a47e3f5b942e5f6f5789817e9296b..68453be59a5dfb8bcbb1b46cc0aa2a4dde615707 100644 --- a/test/language/expressions/greater-than/bigint-and-incomparable-string.js +++ b/test/language/expressions/greater-than/bigint-and-incomparable-string.js @@ -1,30 +1,27 @@ // Copyright (C) 2018 Igalia, S.L. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Relational comparison of BigInt and string values esid: sec-abstract-relational-comparison features: [BigInt] ---*/ - -assert.sameValue(1n > "0n", false, "1n > '0n'"); -assert.sameValue(1n > "0.", false, "1n > '0.'"); -assert.sameValue(1n > ".0", false, "1n > '.0'"); -assert.sameValue(1n > "0/1", false, "1n > '0/1'"); -assert.sameValue(1n > "z0", false, "1n > 'z0'"); -assert.sameValue(1n > "0z", false, "1n > '0z'"); -assert.sameValue(1n > "++0", false, "1n > '++0'"); -assert.sameValue(1n > "--0", false, "1n > '--0'"); -assert.sameValue(1n > "0e0", false, "1n > '0e0'"); -assert.sameValue(1n > "Infinity", false, "1n > 'Infinity'"); - -assert.sameValue("1n" > 0n, false, "'1n' > 0n"); -assert.sameValue("1." > 0n, false, "'1.' > 0n"); -assert.sameValue(".1" > 0n, false, "'.1' > 0n"); -assert.sameValue("1/1" > 0n, false, "'1/1' > 0n"); -assert.sameValue("z1" > 0n, false, "'z1' > 0n"); -assert.sameValue("1z" > 0n, false, "'1z' > 0n"); -assert.sameValue("++1" > 0n, false, "'++1' > 0n"); -assert.sameValue("--1" > 0n, false, "'--1' > 0n"); -assert.sameValue("1e0" > 0n, false, "'1e0' > 0n"); -assert.sameValue("Infinity" > 0n, false, "'Infinity' > 0n"); +assert.sameValue(1n > '0n', false, 'The result of (1n > "0n") is false'); +assert.sameValue(1n > '0.', false, 'The result of (1n > "0.") is false'); +assert.sameValue(1n > '.0', false, 'The result of (1n > ".0") is false'); +assert.sameValue(1n > '0/1', false, 'The result of (1n > "0/1") is false'); +assert.sameValue(1n > 'z0', false, 'The result of (1n > "z0") is false'); +assert.sameValue(1n > '0z', false, 'The result of (1n > "0z") is false'); +assert.sameValue(1n > '++0', false, 'The result of (1n > "++0") is false'); +assert.sameValue(1n > '--0', false, 'The result of (1n > "--0") is false'); +assert.sameValue(1n > '0e0', false, 'The result of (1n > "0e0") is false'); +assert.sameValue(1n > 'Infinity', false, 'The result of (1n > "Infinity") is false'); +assert.sameValue('1n' > 0n, false, 'The result of ("1n" > 0n) is false'); +assert.sameValue('1.' > 0n, false, 'The result of ("1." > 0n) is false'); +assert.sameValue('.1' > 0n, false, 'The result of (".1" > 0n) is false'); +assert.sameValue('1/1' > 0n, false, 'The result of ("1/1" > 0n) is false'); +assert.sameValue('z1' > 0n, false, 'The result of ("z1" > 0n) is false'); +assert.sameValue('1z' > 0n, false, 'The result of ("1z" > 0n) is false'); +assert.sameValue('++1' > 0n, false, 'The result of ("++1" > 0n) is false'); +assert.sameValue('--1' > 0n, false, 'The result of ("--1" > 0n) is false'); +assert.sameValue('1e0' > 0n, false, 'The result of ("1e0" > 0n) is false'); +assert.sameValue('Infinity' > 0n, false, 'The result of ("Infinity" > 0n) is false'); \ No newline at end of file diff --git a/test/language/expressions/greater-than/bigint-and-non-finite.js b/test/language/expressions/greater-than/bigint-and-non-finite.js index 71b88c6647ac91e583e637b64a1ff3ee0c5578e1..3457ee2c2f084d274d1093f88faeff2749ae8d00 100644 --- a/test/language/expressions/greater-than/bigint-and-non-finite.js +++ b/test/language/expressions/greater-than/bigint-and-non-finite.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Comparisons of BigInt and non-finite Number values esid: sec-abstract-relational-comparison @@ -18,14 +17,13 @@ info: | g. If x is +∞, or y is -∞, return false. features: [BigInt] ---*/ - -assert.sameValue(1n > Infinity, false, "1n > Infinity"); -assert.sameValue(Infinity > 1n, true, "Infinity > 1n"); -assert.sameValue(-1n > Infinity, false, "-1n > Infinity"); -assert.sameValue(Infinity > -1n, true, "Infinity > -1n"); -assert.sameValue(1n > -Infinity, true, "1n > -Infinity"); -assert.sameValue(-Infinity > 1n, false, "-Infinity > 1n"); -assert.sameValue(-1n > -Infinity, true, "-1n > -Infinity"); -assert.sameValue(-Infinity > -1n, false, "-Infinity > -1n"); -assert.sameValue(0n > NaN, false, "0n > NaN"); -assert.sameValue(NaN > 0n, false, "NaN > 0n"); +assert.sameValue(1n > Infinity, false, 'The result of (1n > Infinity) is false'); +assert.sameValue(Infinity > 1n, true, 'The result of (Infinity > 1n) is true'); +assert.sameValue(-1n > Infinity, false, 'The result of (-1n > Infinity) is false'); +assert.sameValue(Infinity > -1n, true, 'The result of (Infinity > -1n) is true'); +assert.sameValue(1n > -Infinity, true, 'The result of (1n > -Infinity) is true'); +assert.sameValue(-Infinity > 1n, false, 'The result of (-Infinity > 1n) is false'); +assert.sameValue(-1n > -Infinity, true, 'The result of (-1n > -Infinity) is true'); +assert.sameValue(-Infinity > -1n, false, 'The result of (-Infinity > -1n) is false'); +assert.sameValue(0n > NaN, false, 'The result of (0n > NaN) is false'); +assert.sameValue(NaN > 0n, false, 'The result of (NaN > 0n) is false'); \ No newline at end of file diff --git a/test/language/expressions/greater-than/bigint-and-number-extremes.js b/test/language/expressions/greater-than/bigint-and-number-extremes.js index 1d1107d3324dc6ba4cf5b236b8e339b70f8a2857..6fde9fe0e462f95736bb01a9cee4693cad8d5ce0 100644 --- a/test/language/expressions/greater-than/bigint-and-number-extremes.js +++ b/test/language/expressions/greater-than/bigint-and-number-extremes.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Comparisons of BigInt and Number values esid: sec-abstract-relational-comparison @@ -19,24 +18,31 @@ info: | h. If the mathematical value of nx is less than the mathematical value of ny, return true, otherwise return false. features: [BigInt] ---*/ +assert.sameValue(1n > Number.MAX_VALUE, false, 'The result of (1n > Number.MAX_VALUE) is false'); +assert.sameValue(Number.MAX_VALUE > 1n, true, 'The result of (Number.MAX_VALUE > 1n) is true'); +assert.sameValue(1n > -Number.MAX_VALUE, true, 'The result of (1n > -Number.MAX_VALUE) is true'); +assert.sameValue(-Number.MAX_VALUE > 1n, false, 'The result of (-Number.MAX_VALUE > 1n) is false'); -assert.sameValue(1n > Number.MAX_VALUE, false, "1n > Number.MAX_VALUE"); -assert.sameValue(Number.MAX_VALUE > 1n, true, "Number.MAX_VALUE > 1n"); -assert.sameValue(1n > -Number.MAX_VALUE, true, "1n > -Number.MAX_VALUE"); -assert.sameValue(-Number.MAX_VALUE > 1n, false, "-Number.MAX_VALUE > 1n"); assert.sameValue( 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn > Number.MAX_VALUE, false, - "0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn > Number.MAX_VALUE"); + 'The result of (0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn > Number.MAX_VALUE) is false' +); + assert.sameValue( Number.MAX_VALUE > 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn, true, - "Number.MAX_VALUE > 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn"); + 'The result of (Number.MAX_VALUE > 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn) is true' +); + assert.sameValue( 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n > Number.MAX_VALUE, true, - "0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n > Number.MAX_VALUE"); + 'The result of (0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n > Number.MAX_VALUE) is true' +); + assert.sameValue( Number.MAX_VALUE > 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n, false, - "Number.MAX_VALUE > 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n"); + 'The result of (Number.MAX_VALUE > 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n) is false' +); \ No newline at end of file diff --git a/test/language/expressions/greater-than/bigint-and-number.js b/test/language/expressions/greater-than/bigint-and-number.js index 0d02c4923247bb45972c7e77001e9c19732931b8..670edd1a43d17dae3d3a1fb8011038a0ec43dcc7 100644 --- a/test/language/expressions/greater-than/bigint-and-number.js +++ b/test/language/expressions/greater-than/bigint-and-number.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Robin Templeton. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Comparisons of BigInt and Number values esid: sec-abstract-relational-comparison @@ -19,24 +18,29 @@ info: | h. If the mathematical value of nx is less than the mathematical value of ny, return true, otherwise return false. features: [BigInt] ---*/ +assert.sameValue(0n > 0, false, 'The result of (0n > 0) is false'); +assert.sameValue(0 > 0n, false, 'The result of (0 > 0n) is false'); +assert.sameValue(0n > -0, false, 'The result of (0n > -0) is false'); +assert.sameValue(-0 > 0n, false, 'The result of (-0 > 0n) is false'); +assert.sameValue(0n > 0.000000000001, false, 'The result of (0n > 0.000000000001) is false'); +assert.sameValue(0.000000000001 > 0n, true, 'The result of (0.000000000001 > 0n) is true'); +assert.sameValue(0n > 1, false, 'The result of (0n > 1) is false'); +assert.sameValue(1 > 0n, true, 'The result of (1 > 0n) is true'); +assert.sameValue(1n > 0, true, 'The result of (1n > 0) is true'); +assert.sameValue(0 > 1n, false, 'The result of (0 > 1n) is false'); +assert.sameValue(1n > 0.999999999999, true, 'The result of (1n > 0.999999999999) is true'); +assert.sameValue(0.999999999999 > 1n, false, 'The result of (0.999999999999 > 1n) is false'); +assert.sameValue(1n > 1, false, 'The result of (1n > 1) is false'); +assert.sameValue(1 > 1n, false, 'The result of (1 > 1n) is false'); +assert.sameValue(0n > Number.MIN_VALUE, false, 'The result of (0n > Number.MIN_VALUE) is false'); +assert.sameValue(Number.MIN_VALUE > 0n, true, 'The result of (Number.MIN_VALUE > 0n) is true'); +assert.sameValue(0n > -Number.MIN_VALUE, true, 'The result of (0n > -Number.MIN_VALUE) is true'); +assert.sameValue(-Number.MIN_VALUE > 0n, false, 'The result of (-Number.MIN_VALUE > 0n) is false'); + +assert.sameValue( + -10n > Number.MIN_VALUE, + false, + 'The result of (-10n > Number.MIN_VALUE) is false' +); -assert.sameValue(0n > 0, false, "0n > 0"); -assert.sameValue(0 > 0n, false, "0 > 0n"); -assert.sameValue(0n > -0, false, "0n > -0"); -assert.sameValue(-0 > 0n, false, "-0 > 0n"); -assert.sameValue(0n > 0.000000000001, false, "0n > 0.000000000001"); -assert.sameValue(0.000000000001 > 0n, true, "0.000000000001 > 0n"); -assert.sameValue(0n > 1, false, "0n > 1"); -assert.sameValue(1 > 0n, true, "1 > 0n"); -assert.sameValue(1n > 0, true, "1n > 0"); -assert.sameValue(0 > 1n, false, "0 > 1n"); -assert.sameValue(1n > 0.999999999999, true, "1n > 0.999999999999"); -assert.sameValue(0.999999999999 > 1n, false, "0.999999999999 > 1n"); -assert.sameValue(1n > 1, false, "1n > 1"); -assert.sameValue(1 > 1n, false, "1 > 1n"); -assert.sameValue(0n > Number.MIN_VALUE, false, "0n > Number.MIN_VALUE"); -assert.sameValue(Number.MIN_VALUE > 0n, true, "Number.MIN_VALUE > 0n"); -assert.sameValue(0n > -Number.MIN_VALUE, true, "0n > -Number.MIN_VALUE"); -assert.sameValue(-Number.MIN_VALUE > 0n, false, "-Number.MIN_VALUE > 0n"); -assert.sameValue(-10n > Number.MIN_VALUE, false, "-10n > Number.MIN_VALUE"); -assert.sameValue(Number.MIN_VALUE > -10n, true, "Number.MIN_VALUE > -10n"); +assert.sameValue(Number.MIN_VALUE > -10n, true, 'The result of (Number.MIN_VALUE > -10n) is true'); \ No newline at end of file diff --git a/test/language/expressions/greater-than/bigint-and-string.js b/test/language/expressions/greater-than/bigint-and-string.js index 36649fdac9cc7f5f13fc1fbdff1740d21fcaf23c..68b5f7b4cacdae47dd6ae1999b32d3fda04fa386 100644 --- a/test/language/expressions/greater-than/bigint-and-string.js +++ b/test/language/expressions/greater-than/bigint-and-string.js @@ -1,48 +1,51 @@ // Copyright (C) 2018 Igalia, S.L. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Relational comparison of BigInt and string values esid: sec-abstract-relational-comparison features: [BigInt] ---*/ - -assert.sameValue(0n > "0", false, "0n > '0'"); -assert.sameValue("0" > 0n, false, "'0' > 0n"); - -assert.sameValue(0n > "1", false, "0n > '1'"); -assert.sameValue("0" > 1n, false, "'0' > 1n"); - -assert.sameValue(1n > "0", true, "1n > '0'"); -assert.sameValue("1" > 0n, true, "'1' > 0n"); - -assert.sameValue(0n > "", false, "0n > ''"); -assert.sameValue("" > 0n, false, "'' > 0n"); - -assert.sameValue(0n > "1", false, "0n > '1'"); -assert.sameValue("" > 1n, false, "'' > 1n"); - -assert.sameValue(1n > "", true, "1n > ''"); -assert.sameValue("1" > 0n, true, "'1' > 0n"); - -assert.sameValue(1n > "1", false, "1n > '1'"); -assert.sameValue("1" > 1n, false, "'1' > 1n"); - -assert.sameValue(1n > "-1", true, "1n > '-1'"); -assert.sameValue("1" > -1n, true, "'1' > -1n"); - -assert.sameValue(-1n > "1", false, "-1n > '1'"); -assert.sameValue("-1" > 1n, false, "'-1' > 1n"); - -assert.sameValue(-1n > "-1", false, "-1n > '-1'"); -assert.sameValue("-1" > -1n, false, "'-1' > -1n"); - -assert.sameValue(9007199254740993n > "9007199254740992", true, - "9007199254740993n > '9007199254740992'"); -assert.sameValue("9007199254740993" > 9007199254740992n, true, - "'9007199254740993' > 9007199254740992n"); - -assert.sameValue(-9007199254740992n > "-9007199254740993", true, - "-9007199254740992n > '-9007199254740993'"); -assert.sameValue("-9007199254740992" > -9007199254740993n, true, - "'-9007199254740992' > -9007199254740993n"); +assert.sameValue(0n > '0', false, 'The result of (0n > "0") is false'); +assert.sameValue('0' > 0n, false, 'The result of ("0" > 0n) is false'); +assert.sameValue(0n > '1', false, 'The result of (0n > "1") is false'); +assert.sameValue('0' > 1n, false, 'The result of ("0" > 1n) is false'); +assert.sameValue(1n > '0', true, 'The result of (1n > "0") is true'); +assert.sameValue('1' > 0n, true, 'The result of ("1" > 0n) is true'); +assert.sameValue(0n > '', false, 'The result of (0n > "") is false'); +assert.sameValue('' > 0n, false, 'The result of ("" > 0n) is false'); +assert.sameValue(0n > '1', false, 'The result of (0n > "1") is false'); +assert.sameValue('' > 1n, false, 'The result of ("" > 1n) is false'); +assert.sameValue(1n > '', true, 'The result of (1n > "") is true'); +assert.sameValue('1' > 0n, true, 'The result of ("1" > 0n) is true'); +assert.sameValue(1n > '1', false, 'The result of (1n > "1") is false'); +assert.sameValue('1' > 1n, false, 'The result of ("1" > 1n) is false'); +assert.sameValue(1n > '-1', true, 'The result of (1n > "-1") is true'); +assert.sameValue('1' > -1n, true, 'The result of ("1" > -1n) is true'); +assert.sameValue(-1n > '1', false, 'The result of (-1n > "1") is false'); +assert.sameValue('-1' > 1n, false, 'The result of ("-1" > 1n) is false'); +assert.sameValue(-1n > '-1', false, 'The result of (-1n > "-1") is false'); +assert.sameValue('-1' > -1n, false, 'The result of ("-1" > -1n) is false'); + +assert.sameValue( + 9007199254740993n > '9007199254740992', + true, + 'The result of (9007199254740993n > "9007199254740992") is true' +); + +assert.sameValue( + '9007199254740993' > 9007199254740992n, + true, + 'The result of ("9007199254740993" > 9007199254740992n) is true' +); + +assert.sameValue( + -9007199254740992n > '-9007199254740993', + true, + 'The result of (-9007199254740992n > "-9007199254740993") is true' +); + +assert.sameValue( + '-9007199254740992' > -9007199254740993n, + true, + 'The result of ("-9007199254740992" > -9007199254740993n) is true' +); \ No newline at end of file diff --git a/test/language/expressions/greater-than/bigint-and-symbol.js b/test/language/expressions/greater-than/bigint-and-symbol.js index beb35e1c9376653dff7130bef4e1ad9d5c92fd27..2cc873f66405f42dfcfac4ca485f80fb98d2aaea 100644 --- a/test/language/expressions/greater-than/bigint-and-symbol.js +++ b/test/language/expressions/greater-than/bigint-and-symbol.js @@ -1,17 +1,14 @@ // Copyright (C) 2018 Caio Lima. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Relational comparison of BigInt and Symbol values esid: sec-abstract-relational-comparison features: [BigInt, Symbol] ---*/ - assert.throws(TypeError, function() { - 3n > Symbol("2"); -}, "ToNumeric(Symbol) on RHS throws."); + 3n > Symbol('2'); +}, '3n > Symbol("2") throws TypeError'); assert.throws(TypeError, function() { - Symbol("2") > 3n; -}, "ToNumeric(Symbol) on LHS throws."); - + Symbol('2') > 3n; +}, 'Symbol("2") > 3n throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/left-shift/bigint-and-number.js b/test/language/expressions/left-shift/bigint-and-number.js index 585fc56418d5dc1aeff5503a7558cf7226ddbfb0..65e3afbbf6c49e539ecb0699c9e3f6d7cc7aaa4f 100644 --- a/test/language/expressions/left-shift/bigint-and-number.js +++ b/test/language/expressions/left-shift/bigint-and-number.js @@ -9,24 +9,82 @@ info: | Let rnum be ? ToNumeric(rightValue). If Type(lnum) does not equal Type(rnum), throw a TypeError exception. ---*/ +assert.throws(TypeError, function() { + 1n << 1; +}, '1n << 1 throws TypeError'); -assert.throws(TypeError, function() { 1n << 1; }, "1n << 1 throws TypeError"); -assert.throws(TypeError, function() { 1 << 1n; }, "1 << 1n throws TypeError"); -assert.throws(TypeError, function() { Object(1n) << 1; }, "Object(1n) << 1 throws TypeError"); -assert.throws(TypeError, function() { 1 << Object(1n); }, "1 << Object(1n) throws TypeError"); -assert.throws(TypeError, function() { 1n << Object(1); }, "1n << Object(1) throws TypeError"); -assert.throws(TypeError, function() { Object(1) << 1n; }, "Object(1) << 1n throws TypeError"); -assert.throws(TypeError, function() { Object(1n) << Object(1); }, "Object(1n) << Object(1) throws TypeError"); -assert.throws(TypeError, function() { Object(1) << Object(1n); }, "Object(1) << Object(1n) throws TypeError"); -assert.throws(TypeError, function() { 1n << NaN; }, "1n << NaN throws TypeError"); -assert.throws(TypeError, function() { NaN << 1n; }, "NaN << 1n throws TypeError"); -assert.throws(TypeError, function() { 1n << Infinity; }, "1n << Infinity throws TypeError"); -assert.throws(TypeError, function() { Infinity << 1n; }, "Infinity << 1n throws TypeError"); -assert.throws(TypeError, function() { 1n << true; }, "1n << true throws TypeError"); -assert.throws(TypeError, function() { true << 1n; }, "true << 1n throws TypeError"); -assert.throws(TypeError, function() { 1n << "1"; }, '1n << "1" throws TypeError'); -assert.throws(TypeError, function() { "1" << 1n; }, '"1" << 1n throws TypeError'); -assert.throws(TypeError, function() { 1n << null; }, "1n << null throws TypeError"); -assert.throws(TypeError, function() { null << 1n; }, "null << 1n throws TypeError"); -assert.throws(TypeError, function() { 1n << undefined; }, "1n << undefined throws TypeError"); -assert.throws(TypeError, function() { undefined << 1n; }, "undefined << 1n throws TypeError"); +assert.throws(TypeError, function() { + 1 << 1n; +}, '1 << 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) << 1; +}, 'Object(1n) << 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 << Object(1n); +}, '1 << Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n << Object(1); +}, '1n << Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) << 1n; +}, 'Object(1) << 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) << Object(1); +}, 'Object(1n) << Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) << Object(1n); +}, 'Object(1) << Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n << NaN; +}, '1n << NaN throws TypeError'); + +assert.throws(TypeError, function() { + NaN << 1n; +}, 'NaN << 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n << Infinity; +}, '1n << Infinity throws TypeError'); + +assert.throws(TypeError, function() { + Infinity << 1n; +}, 'Infinity << 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n << true; +}, '1n << true throws TypeError'); + +assert.throws(TypeError, function() { + true << 1n; +}, 'true << 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n << '1'; +}, '1n << "1" throws TypeError'); + +assert.throws(TypeError, function() { + '1' << 1n; +}, '"1" << 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n << null; +}, '1n << null throws TypeError'); + +assert.throws(TypeError, function() { + null << 1n; +}, 'null << 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n << undefined; +}, '1n << undefined throws TypeError'); + +assert.throws(TypeError, function() { + undefined << 1n; +}, 'undefined << 1n throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/left-shift/bigint-errors.js b/test/language/expressions/left-shift/bigint-errors.js index 5e076e22f6f9d40f5550f359e36071c280b4a7bc..716d38ce32600ce8ed7cf26046a0785d4e4a063a 100644 --- a/test/language/expressions/left-shift/bigint-errors.js +++ b/test/language/expressions/left-shift/bigint-errors.js @@ -5,58 +5,66 @@ description: left-shift operator ToNumeric with BigInt operands esid: sec-left-shift-operator-runtime-semantics-evaluation features: [BigInt, Symbol, Symbol.toPrimitive, computed-property-names] ---*/ - assert.throws(TypeError, function() { - Symbol("1") << 0n; -}, "ToBigInt: Symbol => TypeError"); + Symbol('1') << 0n; +}, 'Symbol("1") << 0n throws TypeError'); + assert.throws(TypeError, function() { - 0n << Symbol("1"); -}, "ToBigInt: Symbol => TypeError"); + 0n << Symbol('1'); +}, '0n << Symbol("1") throws TypeError'); + assert.throws(TypeError, function() { - Object(Symbol("1")) << 0n; -}, "ToBigInt: unbox object with internal slot => Symbol => TypeError"); + Object(Symbol('1')) << 0n; +}, 'Object(Symbol("1")) << 0n throws TypeError'); + assert.throws(TypeError, function() { - 0n << Object(Symbol("1")); -}, "ToBigInt: unbox object with internal slot => Symbol => TypeError"); + 0n << Object(Symbol('1')); +}, '0n << Object(Symbol("1")) throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { - return Symbol("1"); + return Symbol('1'); } }) << 0n; -}, "ToBigInt: @@toPrimitive => Symbol => TypeError"); +}, '({[Symbol.toPrimitive]: function() {return Symbol("1");}}) << 0n throws TypeError'); + assert.throws(TypeError, function() { 0n << { [Symbol.toPrimitive]: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: @@toPrimitive => Symbol => TypeError"); +}, '0n << {[Symbol.toPrimitive]: function() {return Symbol("1");}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { - return Symbol("1"); + return Symbol('1'); } }) << 0n; -}, "ToBigInt: valueOf => Symbol => TypeError"); +}, '({valueOf: function() {return Symbol("1");}}) << 0n throws TypeError'); + assert.throws(TypeError, function() { 0n << { valueOf: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: valueOf => Symbol => TypeError"); +}, '0n << {valueOf: function() {return Symbol("1");}} throws TypeError'); + assert.throws(TypeError, function() { ({ toString: function() { - return Symbol("1"); + return Symbol('1'); } }) << 0n; -}, "ToBigInt: toString => Symbol => TypeError"); +}, '({toString: function() {return Symbol("1");}}) << 0n throws TypeError'); + assert.throws(TypeError, function() { 0n << { toString: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: toString => Symbol => TypeError"); +}, '0n << {toString: function() {return Symbol("1");}} throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/left-shift/bigint-non-primitive.js b/test/language/expressions/left-shift/bigint-non-primitive.js index ffa3405a964e43a5e5b3cb999ff84e0c3410af16..b2001b99ae468035d60076bd817d223d70f293f3 100644 --- a/test/language/expressions/left-shift/bigint-non-primitive.js +++ b/test/language/expressions/left-shift/bigint-non-primitive.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Left shift for non-primitive BigInt values esid: sec-left-shift-operator-runtime-semantics-evaluation @@ -19,32 +18,70 @@ info: | features: [BigInt, Symbol.toPrimitive] ---*/ +assert.sameValue(Object(0b101n) << 1n, 0b1010n, 'The result of (Object(0b101n) << 1n) is 0b1010n'); -assert.sameValue(Object(0b101n) << 1n, 0b1010n, "Object(0b101n) << 1n === 0b1010n"); -assert.sameValue(Object(0b101n) << Object(1n), 0b1010n, "Object(0b101n) << Object(1n) === 0b1010n"); +assert.sameValue( + Object(0b101n) << Object(1n), + 0b1010n, + 'The result of (Object(0b101n) << Object(1n)) is 0b1010n' +); function err() { throw new Test262Error(); } -assert.sameValue( - {[Symbol.toPrimitive]: function() { return 0b101n; }, valueOf: err, toString: err} << 1n, 0b1010n, - "primitive from @@toPrimitive"); -assert.sameValue( - {valueOf: function() { return 0b101n; }, toString: err} << 1n, 0b1010n, - "primitive from {}.valueOf"); -assert.sameValue( - {toString: function() { return 0b101n; }} << 1n, 0b1010n, - "primitive from {}.toString"); -assert.sameValue( - 0b101n << {[Symbol.toPrimitive]: function() { return 1n; }, valueOf: err, toString: err}, 0b1010n, - "primitive from @@toPrimitive"); -assert.sameValue( - 0b101n << {valueOf: function() { return 1n; }, toString: err}, 0b1010n, - "primitive from {}.valueOf"); -assert.sameValue( - 0b101n << {toString: function() { return 1n; }}, 0b1010n, - "primitive from {}.toString"); -assert.sameValue( - {valueOf: function() { return 0b101n; }} << {valueOf: function() { return 1n; }}, 0b1010n, - "primitive from {}.valueOf"); +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 0b101n; + }, + + valueOf: err, + toString: err +} << 1n, 0b1010n, 'The result of (({[Symbol.toPrimitive]: function() {return 0b101n;}, valueOf: err, toString: err}) << 1n) is 0b1010n'); + +assert.sameValue({ + valueOf: function() { + return 0b101n; + }, + + toString: err +} << 1n, 0b1010n, 'The result of (({valueOf: function() {return 0b101n;}, toString: err}) << 1n) is 0b1010n'); + +assert.sameValue({ + toString: function() { + return 0b101n; + } +} << 1n, 0b1010n, 'The result of (({toString: function() {return 0b101n;}}) << 1n) is 0b1010n'); + +assert.sameValue(0b101n << { + [Symbol.toPrimitive]: function() { + return 1n; + }, + + valueOf: err, + toString: err +}, 0b1010n, 'The result of (0b101n << {[Symbol.toPrimitive]: function() {return 1n;}, valueOf: err, toString: err}) is 0b1010n'); + +assert.sameValue(0b101n << { + valueOf: function() { + return 1n; + }, + + toString: err +}, 0b1010n, 'The result of (0b101n << {valueOf: function() {return 1n;}, toString: err}) is 0b1010n'); + +assert.sameValue(0b101n << { + toString: function() { + return 1n; + } +}, 0b1010n, 'The result of (0b101n << {toString: function() {return 1n;}}) is 0b1010n'); + +assert.sameValue({ + valueOf: function() { + return 0b101n; + } +} << { + valueOf: function() { + return 1n; + } +}, 0b1010n, 'The result of (({valueOf: function() {return 0b101n;}}) << {valueOf: function() {return 1n;}}) is 0b1010n'); \ No newline at end of file diff --git a/test/language/expressions/left-shift/bigint-toprimitive.js b/test/language/expressions/left-shift/bigint-toprimitive.js index 752d0e8ad51e687cfb274bc7ff72f1174342ba6a..1788d8b62e548bdd1b57bb52ba5dc6849634d1a3 100644 --- a/test/language/expressions/left-shift/bigint-toprimitive.js +++ b/test/language/expressions/left-shift/bigint-toprimitive.js @@ -5,304 +5,368 @@ description: left-shift operator ToNumeric with BigInt operands esid: sec-left-shift-operator-runtime-semantics-evaluation features: [BigInt, Symbol.toPrimitive, computed-property-names] ---*/ - function err() { throw new Test262Error(); } function MyError() {} -assert.sameValue(({ +assert.sameValue({ [Symbol.toPrimitive]: function() { return 2n; }, + valueOf: err, toString: err -}) << 1n, 4n, "ToPrimitive: @@toPrimitive takes precedence"); +} << 1n, 4n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) << 1n) is 4n'); + assert.sameValue(1n << { [Symbol.toPrimitive]: function() { return 2n; }, + valueOf: err, toString: err -}, 4n, "ToPrimitive: @@toPrimitive takes precedence"); -assert.sameValue(({ +}, 4n, 'The result of (1n << {[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) is 4n'); + +assert.sameValue({ valueOf: function() { return 2n; }, + toString: err -}) << 1n, 4n, "ToPrimitive: valueOf takes precedence over toString"); +} << 1n, 4n, 'The result of (({valueOf: function() {return 2n;}, toString: err}) << 1n) is 4n'); + assert.sameValue(1n << { valueOf: function() { return 2n; }, + toString: err -}, 4n, "ToPrimitive: valueOf takes precedence over toString"); -assert.sameValue(({ +}, 4n, 'The result of (1n << {valueOf: function() {return 2n;}, toString: err}) is 4n'); + +assert.sameValue({ toString: function() { return 2n; } -}) << 1n, 4n, "ToPrimitive: toString with no valueOf"); +} << 1n, 4n, 'The result of (({toString: function() {return 2n;}}) << 1n) is 4n'); + assert.sameValue(1n << { toString: function() { return 2n; } -}, 4n, "ToPrimitive: toString with no valueOf"); -assert.sameValue(({ +}, 4n, 'The result of (1n << {toString: function() {return 2n;}}) is 4n'); + +assert.sameValue({ [Symbol.toPrimitive]: undefined, + valueOf: function() { return 2n; } -}) << 1n, 4n, "ToPrimitive: skip @@toPrimitive when it's undefined"); +} << 1n, 4n, 'The result of (({[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) << 1n) is 4n'); + assert.sameValue(1n << { [Symbol.toPrimitive]: undefined, + valueOf: function() { return 2n; } -}, 4n, "ToPrimitive: skip @@toPrimitive when it's undefined"); -assert.sameValue(({ +}, 4n, 'The result of (1n << {[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) is 4n'); + +assert.sameValue({ [Symbol.toPrimitive]: null, + valueOf: function() { return 2n; } -}) << 1n, 4n, "ToPrimitive: skip @@toPrimitive when it's null"); +} << 1n, 4n, 'The result of (({[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) << 1n) is 4n'); + assert.sameValue(1n << { [Symbol.toPrimitive]: null, + valueOf: function() { return 2n; } -}, 4n, "ToPrimitive: skip @@toPrimitive when it's null"); -assert.sameValue(({ +}, 4n, 'The result of (1n << {[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) is 4n'); + +assert.sameValue({ valueOf: null, + toString: function() { return 2n; } -}) << 1n, 4n, "ToPrimitive: skip valueOf when it's not callable"); +} << 1n, 4n, 'The result of (({valueOf: null, toString: function() {return 2n;}}) << 1n) is 4n'); + assert.sameValue(1n << { valueOf: null, + toString: function() { return 2n; } -}, 4n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 4n, 'The result of (1n << {valueOf: null, toString: function() {return 2n;}}) is 4n'); + +assert.sameValue({ valueOf: 1, + toString: function() { return 2n; } -}) << 1n, 4n, "ToPrimitive: skip valueOf when it's not callable"); +} << 1n, 4n, 'The result of (({valueOf: 1, toString: function() {return 2n;}}) << 1n) is 4n'); + assert.sameValue(1n << { valueOf: 1, + toString: function() { return 2n; } -}, 4n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 4n, 'The result of (1n << {valueOf: 1, toString: function() {return 2n;}}) is 4n'); + +assert.sameValue({ valueOf: {}, + toString: function() { return 2n; } -}) << 1n, 4n, "ToPrimitive: skip valueOf when it's not callable"); +} << 1n, 4n, 'The result of (({valueOf: {}, toString: function() {return 2n;}}) << 1n) is 4n'); + assert.sameValue(1n << { valueOf: {}, + toString: function() { return 2n; } -}, 4n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 4n, 'The result of (1n << {valueOf: {}, toString: function() {return 2n;}}) is 4n'); + +assert.sameValue({ valueOf: function() { return {}; }, + toString: function() { return 2n; } -}) << 1n, 4n, "ToPrimitive: skip valueOf when it returns an object"); +} << 1n, 4n, 'The result of (({valueOf: function() {return {};}, toString: function() {return 2n;}}) << 1n) is 4n'); + assert.sameValue(1n << { valueOf: function() { return {}; }, + toString: function() { return 2n; } -}, 4n, "ToPrimitive: skip valueOf when it returns an object"); -assert.sameValue(({ +}, 4n, 'The result of (1n << {valueOf: function() {return {};}, toString: function() {return 2n;}}) is 4n'); + +assert.sameValue({ valueOf: function() { return Object(12345); }, + toString: function() { return 2n; } -}) << 1n, 4n, "ToPrimitive: skip valueOf when it returns an object"); +} << 1n, 4n, 'The result of (({valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) << 1n) is 4n'); + assert.sameValue(1n << { valueOf: function() { return Object(12345); }, + toString: function() { return 2n; } -}, 4n, "ToPrimitive: skip valueOf when it returns an object"); +}, 4n, 'The result of (1n << {valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) is 4n'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: 1 }) << 0n; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '({[Symbol.toPrimitive]: 1}) << 0n throws TypeError'); + assert.throws(TypeError, function() { 0n << { [Symbol.toPrimitive]: 1 }; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '0n << {[Symbol.toPrimitive]: 1} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: {} }) << 0n; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '({[Symbol.toPrimitive]: {}}) << 0n throws TypeError'); + assert.throws(TypeError, function() { 0n << { [Symbol.toPrimitive]: {} }; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '0n << {[Symbol.toPrimitive]: {}} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { return Object(1); } }) << 0n; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '({[Symbol.toPrimitive]: function() {return Object(1);}}) << 0n throws TypeError'); + assert.throws(TypeError, function() { 0n << { [Symbol.toPrimitive]: function() { return Object(1); } }; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '0n << {[Symbol.toPrimitive]: function() {return Object(1);}} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { return {}; } }) << 0n; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '({[Symbol.toPrimitive]: function() {return {};}}) << 0n throws TypeError'); + assert.throws(TypeError, function() { 0n << { [Symbol.toPrimitive]: function() { return {}; } }; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '0n << {[Symbol.toPrimitive]: function() {return {};}} throws TypeError'); + assert.throws(MyError, function() { ({ [Symbol.toPrimitive]: function() { throw new MyError(); } }) << 0n; -}, "ToPrimitive: propagate errors from @@toPrimitive"); +}, '({[Symbol.toPrimitive]: function() {throw new MyError();}}) << 0n throws MyError'); + assert.throws(MyError, function() { 0n << { [Symbol.toPrimitive]: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from @@toPrimitive"); +}, '0n << {[Symbol.toPrimitive]: function() {throw new MyError();}} throws MyError'); + assert.throws(MyError, function() { ({ valueOf: function() { throw new MyError(); } }) << 0n; -}, "ToPrimitive: propagate errors from valueOf"); +}, '({valueOf: function() {throw new MyError();}}) << 0n throws MyError'); + assert.throws(MyError, function() { 0n << { valueOf: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from valueOf"); +}, '0n << {valueOf: function() {throw new MyError();}} throws MyError'); + assert.throws(MyError, function() { ({ toString: function() { throw new MyError(); } }) << 0n; -}, "ToPrimitive: propagate errors from toString"); +}, '({toString: function() {throw new MyError();}}) << 0n throws MyError'); + assert.throws(MyError, function() { 0n << { toString: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from toString"); +}, '0n << {toString: function() {throw new MyError();}} throws MyError'); + assert.throws(TypeError, function() { ({ valueOf: null, toString: null }) << 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: null, toString: null}) << 0n throws TypeError'); + assert.throws(TypeError, function() { 0n << { valueOf: null, toString: null }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n << {valueOf: null, toString: null} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: 1, toString: 1 }) << 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: 1, toString: 1}) << 0n throws TypeError'); + assert.throws(TypeError, function() { 0n << { valueOf: 1, toString: 1 }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n << {valueOf: 1, toString: 1} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: {}, toString: {} }) << 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: {}, toString: {}}) << 0n throws TypeError'); + assert.throws(TypeError, function() { 0n << { valueOf: {}, toString: {} }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n << {valueOf: {}, toString: {}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { return Object(1); }, + toString: function() { return Object(1); } }) << 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: function() {return Object(1);}, toString: function() {return Object(1);}}) << 0n throws TypeError'); + assert.throws(TypeError, function() { 0n << { valueOf: function() { return Object(1); }, + toString: function() { return Object(1); } }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n << {valueOf: function() {return Object(1);}, toString: function() {return Object(1);}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { return {}; }, + toString: function() { return {}; } }) << 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: function() {return {};}, toString: function() {return {};}}) << 0n throws TypeError'); + assert.throws(TypeError, function() { 0n << { valueOf: function() { return {}; }, + toString: function() { return {}; } }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n << {valueOf: function() {return {};}, toString: function() {return {};}} throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/left-shift/bigint-wrapped-values.js b/test/language/expressions/left-shift/bigint-wrapped-values.js index 79422b11b99f9fbf2cf5ee416c6de3c242391c9a..2a0b71c1aacc45f5700c2b073626cb58688bad53 100644 --- a/test/language/expressions/left-shift/bigint-wrapped-values.js +++ b/test/language/expressions/left-shift/bigint-wrapped-values.js @@ -5,36 +5,41 @@ description: left-shift operator ToNumeric with BigInt operands esid: sec-left-shift-operator-runtime-semantics-evaluation features: [BigInt, Symbol.toPrimitive, computed-property-names] ---*/ +assert.sameValue(Object(2n) << 1n, 4n, 'The result of (Object(2n) << 1n) is 4n'); +assert.sameValue(1n << Object(2n), 4n, 'The result of (1n << Object(2n)) is 4n'); -assert.sameValue(Object(2n) << 1n, 4n, "ToPrimitive: unbox object with internal slot"); -assert.sameValue(1n << Object(2n), 4n, "ToPrimitive: unbox object with internal slot"); -assert.sameValue(({ +assert.sameValue({ [Symbol.toPrimitive]: function() { return 2n; } -}) << 1n, 4n, "ToPrimitive: @@toPrimitive"); +} << 1n, 4n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}}) << 1n) is 4n'); + assert.sameValue(1n << { [Symbol.toPrimitive]: function() { return 2n; } -}, 4n, "ToPrimitive: @@toPrimitive"); -assert.sameValue(({ +}, 4n, 'The result of (1n << {[Symbol.toPrimitive]: function() {return 2n;}}) is 4n'); + +assert.sameValue({ valueOf: function() { return 2n; } -}) << 1n, 4n, "ToPrimitive: valueOf"); +} << 1n, 4n, 'The result of (({valueOf: function() {return 2n;}}) << 1n) is 4n'); + assert.sameValue(1n << { valueOf: function() { return 2n; } -}, 4n, "ToPrimitive: valueOf"); -assert.sameValue(({ +}, 4n, 'The result of (1n << {valueOf: function() {return 2n;}}) is 4n'); + +assert.sameValue({ toString: function() { return 2n; } -}) << 1n, 4n, "ToPrimitive: toString"); +} << 1n, 4n, 'The result of (({toString: function() {return 2n;}}) << 1n) is 4n'); + assert.sameValue(1n << { toString: function() { return 2n; } -}, 4n, "ToPrimitive: toString"); +}, 4n, 'The result of (1n << {toString: function() {return 2n;}}) is 4n'); \ No newline at end of file diff --git a/test/language/expressions/less-than-or-equal/11.8.3-1.js b/test/language/expressions/less-than-or-equal/11.8.3-1.js index 7992e5d44c5647e0b6e88c55b9f5e2ad067ecf09..3eb706b82bce5798b9da9e26da95decca385df27 100644 --- a/test/language/expressions/less-than-or-equal/11.8.3-1.js +++ b/test/language/expressions/less-than-or-equal/11.8.3-1.js @@ -8,21 +8,18 @@ description: > enforced when using Less-than-or-equal operator: valueOf <= valueOf ---*/ - var accessed = false; - var obj1 = { - valueOf: function () { - accessed = true; - return 3; - } - }; - var obj2 = { - valueOf: function () { - if (accessed === true) { - return 4; - } else { - return 2; - } - } - }; +var accessed = false; +var obj1 = { + valueOf: function () { + accessed = true; + return 4; + } +}; +var obj2 = { + valueOf: function () { + return 2; + } +}; -assert((obj1 <= obj2), '(obj1 <= obj2) !== true'); +assert.sameValue(obj1 <= obj2, false, 'The result of (obj1 <= obj2) is false'); +assert.sameValue(accessed, true, 'The value of accessed is true'); diff --git a/test/language/expressions/less-than-or-equal/11.8.3-2.js b/test/language/expressions/less-than-or-equal/11.8.3-2.js index 70bbbce76ad99a80c9f48371b54943203bef7467..affb1fb214a2b5080f6eede0b2794c2c9d146e9f 100644 --- a/test/language/expressions/less-than-or-equal/11.8.3-2.js +++ b/test/language/expressions/less-than-or-equal/11.8.3-2.js @@ -9,21 +9,18 @@ description: > toString ---*/ - var accessed = false; - var obj1 = { - valueOf: function () { - accessed = true; - return 3; - } - }; - var obj2 = { - toString: function () { - if (accessed === true) { - return 4; - } else { - return 2; - } - } - }; +var accessed = false; +var obj1 = { + valueOf: function () { + accessed = true; + return 4; + } +}; +var obj2 = { + toString: function () { + return 2; + } +}; -assert((obj1 <= obj2), '(obj1 <= obj2) !== true'); +assert.sameValue(obj1 <= obj2, false, 'The result of (obj1 <= obj2) is false'); +assert.sameValue(accessed, true, 'The value of accessed is true'); diff --git a/test/language/expressions/less-than-or-equal/11.8.3-3.js b/test/language/expressions/less-than-or-equal/11.8.3-3.js index a7aeed1cc0aa2c6955397dc12ce3ae499a523d8c..1beb0d5681e781f8c8805d8de427b44486375890 100644 --- a/test/language/expressions/less-than-or-equal/11.8.3-3.js +++ b/test/language/expressions/less-than-or-equal/11.8.3-3.js @@ -9,21 +9,18 @@ description: > valueOf ---*/ - var accessed = false; - var obj1 = { - toString: function () { - accessed = true; - return 3; - } - }; - var obj2 = { - valueOf: function () { - if (accessed === true) { - return 4; - } else { - return 2; - } - } - }; +var accessed = false; +var obj1 = { + toString: function () { + accessed = true; + return 4; + } +}; +var obj2 = { + valueOf: function () { + return 2; + } +}; -assert((obj1 <= obj2), '(obj1 <= obj2) !== true'); +assert.sameValue(obj1 <= obj2, false, 'The result of (obj1 <= obj2) is false'); +assert.sameValue(accessed, true, 'The value of accessed is true'); diff --git a/test/language/expressions/less-than-or-equal/11.8.3-4.js b/test/language/expressions/less-than-or-equal/11.8.3-4.js index 7c736cdcca6f1acbf675f6a5c0f4e8a726d42f59..6c276bdf2fd429105c64d91ce76a11264f00f0e6 100644 --- a/test/language/expressions/less-than-or-equal/11.8.3-4.js +++ b/test/language/expressions/less-than-or-equal/11.8.3-4.js @@ -9,21 +9,18 @@ description: > toString ---*/ - var accessed = false; - var obj1 = { - toString: function () { - accessed = true; - return 3; - } - }; - var obj2 = { - toString: function () { - if (accessed === true) { - return 4; - } else { - return 2; - } - } - }; +var accessed = false; +var obj1 = { + toString: function () { + accessed = true; + return 4; + } +}; +var obj2 = { + toString: function () { + return 2; + } +}; -assert((obj1 <= obj2), '(obj1 <= obj2) !== true'); +assert.sameValue(obj1 <= obj2, false, 'The result of (obj1 <= obj2) is false'); +assert.sameValue(accessed, true, 'The value of accessed is true'); diff --git a/test/language/expressions/less-than-or-equal/11.8.3-5.js b/test/language/expressions/less-than-or-equal/11.8.3-5.js deleted file mode 100644 index 6177acc3815f9cd69431a80c8f371746ff97dc7d..0000000000000000000000000000000000000000 --- a/test/language/expressions/less-than-or-equal/11.8.3-5.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2012 Ecma International. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 11.8.3-5 -description: > - 11.8.3 Less-than-or-equal Operator - Partial left to right order - enforced when using Less-than-or-equal operator: valueOf <= valueOf ----*/ - - var accessed = false; - var obj1 = { - valueOf: function () { - accessed = true; - return 3; - } - }; - var obj2 = { - valueOf: function () { - if (accessed === true) { - return 3; - } else { - return 2; - } - } - }; - -assert((obj1 <= obj2), '(obj1 <= obj2) !== true'); diff --git a/test/language/expressions/less-than-or-equal/bigint-and-bigint.js b/test/language/expressions/less-than-or-equal/bigint-and-bigint.js index c667c60c644d0340f0cbd7ae10b3efb1c267c634..204bd5139f559724d1d57b04e69baa3c2b241144 100644 --- a/test/language/expressions/less-than-or-equal/bigint-and-bigint.js +++ b/test/language/expressions/less-than-or-equal/bigint-and-bigint.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Comparisons of BigInt and BigInt values esid: sec-abstract-relational-comparison @@ -20,37 +19,146 @@ info: | features: [BigInt] ---*/ +assert.sameValue(0n <= 0n, true, 'The result of (0n <= 0n) is true'); +assert.sameValue(1n <= 1n, true, 'The result of (1n <= 1n) is true'); +assert.sameValue(-1n <= -1n, true, 'The result of (-1n <= -1n) is true'); +assert.sameValue(0n <= -0n, true, 'The result of (0n <= -0n) is true'); +assert.sameValue(-0n <= 0n, true, 'The result of (-0n <= 0n) is true'); +assert.sameValue(0n <= 1n, true, 'The result of (0n <= 1n) is true'); +assert.sameValue(1n <= 0n, false, 'The result of (1n <= 0n) is false'); +assert.sameValue(0n <= -1n, false, 'The result of (0n <= -1n) is false'); +assert.sameValue(-1n <= 0n, true, 'The result of (-1n <= 0n) is true'); +assert.sameValue(1n <= -1n, false, 'The result of (1n <= -1n) is false'); +assert.sameValue(-1n <= 1n, true, 'The result of (-1n <= 1n) is true'); + +assert.sameValue( + 0x1fffffffffffff01n <= 0x1fffffffffffff02n, + true, + 'The result of (0x1fffffffffffff01n <= 0x1fffffffffffff02n) is true' +); + +assert.sameValue( + 0x1fffffffffffff02n <= 0x1fffffffffffff01n, + false, + 'The result of (0x1fffffffffffff02n <= 0x1fffffffffffff01n) is false' +); + +assert.sameValue( + -0x1fffffffffffff01n <= -0x1fffffffffffff02n, + false, + 'The result of (-0x1fffffffffffff01n <= -0x1fffffffffffff02n) is false' +); + +assert.sameValue( + -0x1fffffffffffff02n <= -0x1fffffffffffff01n, + true, + 'The result of (-0x1fffffffffffff02n <= -0x1fffffffffffff01n) is true' +); + +assert.sameValue( + 0x10000000000000000n <= 0n, + false, + 'The result of (0x10000000000000000n <= 0n) is false' +); + +assert.sameValue( + 0n <= 0x10000000000000000n, + true, + 'The result of (0n <= 0x10000000000000000n) is true' +); + +assert.sameValue( + 0x10000000000000000n <= 1n, + false, + 'The result of (0x10000000000000000n <= 1n) is false' +); + +assert.sameValue( + 1n <= 0x10000000000000000n, + true, + 'The result of (1n <= 0x10000000000000000n) is true' +); + +assert.sameValue( + 0x10000000000000000n <= -1n, + false, + 'The result of (0x10000000000000000n <= -1n) is false' +); + +assert.sameValue( + -1n <= 0x10000000000000000n, + true, + 'The result of (-1n <= 0x10000000000000000n) is true' +); + +assert.sameValue( + 0x10000000000000001n <= 0n, + false, + 'The result of (0x10000000000000001n <= 0n) is false' +); + +assert.sameValue( + 0n <= 0x10000000000000001n, + true, + 'The result of (0n <= 0x10000000000000001n) is true' +); + +assert.sameValue( + -0x10000000000000000n <= 0n, + true, + 'The result of (-0x10000000000000000n <= 0n) is true' +); + +assert.sameValue( + 0n <= -0x10000000000000000n, + false, + 'The result of (0n <= -0x10000000000000000n) is false' +); + +assert.sameValue( + -0x10000000000000000n <= 1n, + true, + 'The result of (-0x10000000000000000n <= 1n) is true' +); + +assert.sameValue( + 1n <= -0x10000000000000000n, + false, + 'The result of (1n <= -0x10000000000000000n) is false' +); + +assert.sameValue( + -0x10000000000000000n <= -1n, + true, + 'The result of (-0x10000000000000000n <= -1n) is true' +); + +assert.sameValue( + -1n <= -0x10000000000000000n, + false, + 'The result of (-1n <= -0x10000000000000000n) is false' +); + +assert.sameValue( + -0x10000000000000001n <= 0n, + true, + 'The result of (-0x10000000000000001n <= 0n) is true' +); + +assert.sameValue( + 0n <= -0x10000000000000001n, + false, + 'The result of (0n <= -0x10000000000000001n) is false' +); + +assert.sameValue( + 0x10000000000000000n <= 0x100000000n, + false, + 'The result of (0x10000000000000000n <= 0x100000000n) is false' +); -assert.sameValue(0n <= 0n, true, "0n <= 0n"); -assert.sameValue(1n <= 1n, true, "1n <= 1n"); -assert.sameValue(-1n <= -1n, true, "-1n <= -1n"); -assert.sameValue(0n <= -0n, true, "0n <= -0n"); -assert.sameValue(-0n <= 0n, true, "-0n <= 0n"); -assert.sameValue(0n <= 1n, true, "0n <= 1n"); -assert.sameValue(1n <= 0n, false, "1n <= 0n"); -assert.sameValue(0n <= -1n, false, "0n <= -1n"); -assert.sameValue(-1n <= 0n, true, "-1n <= 0n"); -assert.sameValue(1n <= -1n, false, "1n <= -1n"); -assert.sameValue(-1n <= 1n, true, "-1n <= 1n"); -assert.sameValue(0x1fffffffffffff01n <= 0x1fffffffffffff02n, true, "0x1fffffffffffff01n <= 0x1fffffffffffff02n"); -assert.sameValue(0x1fffffffffffff02n <= 0x1fffffffffffff01n, false, "0x1fffffffffffff02n <= 0x1fffffffffffff01n"); -assert.sameValue(-0x1fffffffffffff01n <= -0x1fffffffffffff02n, false, "-0x1fffffffffffff01n <= -0x1fffffffffffff02n"); -assert.sameValue(-0x1fffffffffffff02n <= -0x1fffffffffffff01n, true, "-0x1fffffffffffff02n <= -0x1fffffffffffff01n"); -assert.sameValue(0x10000000000000000n <= 0n, false, "0x10000000000000000n <= 0n"); -assert.sameValue(0n <= 0x10000000000000000n, true, "0n <= 0x10000000000000000n"); -assert.sameValue(0x10000000000000000n <= 1n, false, "0x10000000000000000n <= 1n"); -assert.sameValue(1n <= 0x10000000000000000n, true, "1n <= 0x10000000000000000n"); -assert.sameValue(0x10000000000000000n <= -1n, false, "0x10000000000000000n <= -1n"); -assert.sameValue(-1n <= 0x10000000000000000n, true, "-1n <= 0x10000000000000000n"); -assert.sameValue(0x10000000000000001n <= 0n, false, "0x10000000000000001n <= 0n"); -assert.sameValue(0n <= 0x10000000000000001n, true, "0n <= 0x10000000000000001n"); -assert.sameValue(-0x10000000000000000n <= 0n, true, "-0x10000000000000000n <= 0n"); -assert.sameValue(0n <= -0x10000000000000000n, false, "0n <= -0x10000000000000000n"); -assert.sameValue(-0x10000000000000000n <= 1n, true, "-0x10000000000000000n <= 1n"); -assert.sameValue(1n <= -0x10000000000000000n, false, "1n <= -0x10000000000000000n"); -assert.sameValue(-0x10000000000000000n <= -1n, true, "-0x10000000000000000n <= -1n"); -assert.sameValue(-1n <= -0x10000000000000000n, false, "-1n <= -0x10000000000000000n"); -assert.sameValue(-0x10000000000000001n <= 0n, true, "-0x10000000000000001n <= 0n"); -assert.sameValue(0n <= -0x10000000000000001n, false, "0n <= -0x10000000000000001n"); -assert.sameValue(0x10000000000000000n <= 0x100000000n, false, "0x10000000000000000n <= 0x100000000n"); -assert.sameValue(0x100000000n <= 0x10000000000000000n, true, "0x100000000n <= 0x10000000000000000n"); +assert.sameValue( + 0x100000000n <= 0x10000000000000000n, + true, + 'The result of (0x100000000n <= 0x10000000000000000n) is true' +); \ No newline at end of file diff --git a/test/language/expressions/less-than-or-equal/bigint-and-incomparable-string.js b/test/language/expressions/less-than-or-equal/bigint-and-incomparable-string.js index f606992fc65887aebe3785e0581edd55de78db83..ac09ce0eee10f1ad277af083a9c4db064028f2f3 100644 --- a/test/language/expressions/less-than-or-equal/bigint-and-incomparable-string.js +++ b/test/language/expressions/less-than-or-equal/bigint-and-incomparable-string.js @@ -1,30 +1,27 @@ // Copyright (C) 2018 Igalia, S.L. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Relational comparison of BigInt and string values esid: sec-abstract-relational-comparison features: [BigInt] ---*/ - -assert.sameValue("0n" <= 1n, false, "'0n' <= 1n"); -assert.sameValue("0." <= 1n, false, "'0.' <= 1n"); -assert.sameValue(".0" <= 1n, false, "'.0' <= 1n"); -assert.sameValue("0/1" <= 1n, false, "'0/1' <= 1n"); -assert.sameValue("z0" <= 1n, false, "'z0' <= 1n"); -assert.sameValue("0z" <= 1n, false, "'0z' <= 1n"); -assert.sameValue("++0" <= 1n, false, "'++0' <= 1n"); -assert.sameValue("--0" <= 1n, false, "'--0' <= 1n"); -assert.sameValue("0e0" <= 1n, false, "'0e0' <= 1n"); -assert.sameValue("Infinity" <= 1n, false, "'Infinity' <= 1n"); - -assert.sameValue(0n <= "1n", false, "0n <= '1n'"); -assert.sameValue(0n <= "1.", false, "0n <= '1.'"); -assert.sameValue(0n <= ".1", false, "0n <= '.1'"); -assert.sameValue(0n <= "1/1", false, "0n <= '1/1'"); -assert.sameValue(0n <= "z1", false, "0n <= 'z1'"); -assert.sameValue(0n <= "1z", false, "0n <= '1z'"); -assert.sameValue(0n <= "++1", false, "0n <= '++1'"); -assert.sameValue(0n <= "--1", false, "0n <= '--1'"); -assert.sameValue(0n <= "1e0", false, "0n <= '1e0'"); -assert.sameValue(0n <= "Infinity", false, "0n <= 'Infinity'"); +assert.sameValue('0n' <= 1n, false, 'The result of ("0n" <= 1n) is false'); +assert.sameValue('0.' <= 1n, false, 'The result of ("0." <= 1n) is false'); +assert.sameValue('.0' <= 1n, false, 'The result of (".0" <= 1n) is false'); +assert.sameValue('0/1' <= 1n, false, 'The result of ("0/1" <= 1n) is false'); +assert.sameValue('z0' <= 1n, false, 'The result of ("z0" <= 1n) is false'); +assert.sameValue('0z' <= 1n, false, 'The result of ("0z" <= 1n) is false'); +assert.sameValue('++0' <= 1n, false, 'The result of ("++0" <= 1n) is false'); +assert.sameValue('--0' <= 1n, false, 'The result of ("--0" <= 1n) is false'); +assert.sameValue('0e0' <= 1n, false, 'The result of ("0e0" <= 1n) is false'); +assert.sameValue('Infinity' <= 1n, false, 'The result of ("Infinity" <= 1n) is false'); +assert.sameValue(0n <= '1n', false, 'The result of (0n <= "1n") is false'); +assert.sameValue(0n <= '1.', false, 'The result of (0n <= "1.") is false'); +assert.sameValue(0n <= '.1', false, 'The result of (0n <= ".1") is false'); +assert.sameValue(0n <= '1/1', false, 'The result of (0n <= "1/1") is false'); +assert.sameValue(0n <= 'z1', false, 'The result of (0n <= "z1") is false'); +assert.sameValue(0n <= '1z', false, 'The result of (0n <= "1z") is false'); +assert.sameValue(0n <= '++1', false, 'The result of (0n <= "++1") is false'); +assert.sameValue(0n <= '--1', false, 'The result of (0n <= "--1") is false'); +assert.sameValue(0n <= '1e0', false, 'The result of (0n <= "1e0") is false'); +assert.sameValue(0n <= 'Infinity', false, 'The result of (0n <= "Infinity") is false'); \ No newline at end of file diff --git a/test/language/expressions/less-than-or-equal/bigint-and-non-finite.js b/test/language/expressions/less-than-or-equal/bigint-and-non-finite.js index e7053f218c44afdbf434464c82e5fda71a5fd512..b5e3eae7952a1a6aef6546fa41afd524c75a70a5 100644 --- a/test/language/expressions/less-than-or-equal/bigint-and-non-finite.js +++ b/test/language/expressions/less-than-or-equal/bigint-and-non-finite.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Comparisons of BigInt and non-finite Number values esid: sec-abstract-relational-comparison @@ -18,14 +17,13 @@ info: | g. If x is +∞, or y is -∞, return false. features: [BigInt] ---*/ - -assert.sameValue(1n <= Infinity, true, "1n <= Infinity"); -assert.sameValue(Infinity <= 1n, false, "Infinity <= 1n"); -assert.sameValue(-1n <= Infinity, true, "-1n <= Infinity"); -assert.sameValue(Infinity <= -1n, false, "Infinity <= -1n"); -assert.sameValue(1n <= -Infinity, false, "1n <= -Infinity"); -assert.sameValue(-Infinity <= 1n, true, "-Infinity <= 1n"); -assert.sameValue(-1n <= -Infinity, false, "-1n <= -Infinity"); -assert.sameValue(-Infinity <= -1n, true, "-Infinity <= -1n"); -assert.sameValue(0n <= NaN, false, "0n <= NaN"); -assert.sameValue(NaN <= 0n, false, "NaN <= 0n"); +assert.sameValue(1n <= Infinity, true, 'The result of (1n <= Infinity) is true'); +assert.sameValue(Infinity <= 1n, false, 'The result of (Infinity <= 1n) is false'); +assert.sameValue(-1n <= Infinity, true, 'The result of (-1n <= Infinity) is true'); +assert.sameValue(Infinity <= -1n, false, 'The result of (Infinity <= -1n) is false'); +assert.sameValue(1n <= -Infinity, false, 'The result of (1n <= -Infinity) is false'); +assert.sameValue(-Infinity <= 1n, true, 'The result of (-Infinity <= 1n) is true'); +assert.sameValue(-1n <= -Infinity, false, 'The result of (-1n <= -Infinity) is false'); +assert.sameValue(-Infinity <= -1n, true, 'The result of (-Infinity <= -1n) is true'); +assert.sameValue(0n <= NaN, false, 'The result of (0n <= NaN) is false'); +assert.sameValue(NaN <= 0n, false, 'The result of (NaN <= 0n) is false'); \ No newline at end of file diff --git a/test/language/expressions/less-than-or-equal/bigint-and-number-extremes.js b/test/language/expressions/less-than-or-equal/bigint-and-number-extremes.js index 5b502b07c65a98ed6d6dfa66d187fca63555f6be..c900b8d2776c510f51b852239e85464c27281d03 100644 --- a/test/language/expressions/less-than-or-equal/bigint-and-number-extremes.js +++ b/test/language/expressions/less-than-or-equal/bigint-and-number-extremes.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Comparisons of BigInt and Number values esid: sec-abstract-relational-comparison @@ -19,24 +18,37 @@ info: | h. If the mathematical value of nx is less than the mathematical value of ny, return true, otherwise return false. features: [BigInt] ---*/ +assert.sameValue(1n <= Number.MAX_VALUE, true, 'The result of (1n <= Number.MAX_VALUE) is true'); +assert.sameValue(Number.MAX_VALUE <= 1n, false, 'The result of (Number.MAX_VALUE <= 1n) is false'); + +assert.sameValue( + 1n <= -Number.MAX_VALUE, + false, + 'The result of (1n <= -Number.MAX_VALUE) is false' +); + +assert.sameValue(-Number.MAX_VALUE <= 1n, true, 'The result of (-Number.MAX_VALUE <= 1n) is true'); -assert.sameValue(1n <= Number.MAX_VALUE, true, "1n <= Number.MAX_VALUE"); -assert.sameValue(Number.MAX_VALUE <= 1n, false, "Number.MAX_VALUE <= 1n"); -assert.sameValue(1n <= -Number.MAX_VALUE, false, "1n <= -Number.MAX_VALUE"); -assert.sameValue(-Number.MAX_VALUE <= 1n, true, "-Number.MAX_VALUE <= 1n"); assert.sameValue( 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn <= Number.MAX_VALUE, true, - "0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn <= Number.MAX_VALUE"); + 'The result of (0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn <= Number.MAX_VALUE) is true' +); + assert.sameValue( Number.MAX_VALUE <= 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn, false, - "Number.MAX_VALUE <= 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn"); + 'The result of (Number.MAX_VALUE <= 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn) is false' +); + assert.sameValue( 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n <= Number.MAX_VALUE, false, - "0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n <= Number.MAX_VALUE"); + 'The result of (0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n <= Number.MAX_VALUE) is false' +); + assert.sameValue( Number.MAX_VALUE <= 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n, true, - "Number.MAX_VALUE <= 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n"); + 'The result of (Number.MAX_VALUE <= 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n) is true' +); \ No newline at end of file diff --git a/test/language/expressions/less-than-or-equal/bigint-and-number.js b/test/language/expressions/less-than-or-equal/bigint-and-number.js index cef45145961dee5c76cf0b1edfdb24a59eb35235..06fe0675a962e93ed13920d612496bcda1208705 100644 --- a/test/language/expressions/less-than-or-equal/bigint-and-number.js +++ b/test/language/expressions/less-than-or-equal/bigint-and-number.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Robin Templeton. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Comparisons of BigInt and Number values esid: sec-abstract-relational-comparison @@ -19,24 +18,39 @@ info: | h. If the mathematical value of nx is less than the mathematical value of ny, return true, otherwise return false. features: [BigInt] ---*/ +assert.sameValue(0n <= 0, true, 'The result of (0n <= 0) is true'); +assert.sameValue(0 <= 0n, true, 'The result of (0 <= 0n) is true'); +assert.sameValue(0n <= -0, true, 'The result of (0n <= -0) is true'); +assert.sameValue(-0 <= 0n, true, 'The result of (-0 <= 0n) is true'); +assert.sameValue(0n <= 0.000000000001, true, 'The result of (0n <= 0.000000000001) is true'); +assert.sameValue(0.000000000001 <= 0n, false, 'The result of (0.000000000001 <= 0n) is false'); +assert.sameValue(0n <= 1, true, 'The result of (0n <= 1) is true'); +assert.sameValue(1 <= 0n, false, 'The result of (1 <= 0n) is false'); +assert.sameValue(1n <= 0, false, 'The result of (1n <= 0) is false'); +assert.sameValue(0 <= 1n, true, 'The result of (0 <= 1n) is true'); +assert.sameValue(1n <= 0.999999999999, false, 'The result of (1n <= 0.999999999999) is false'); +assert.sameValue(0.999999999999 <= 1n, true, 'The result of (0.999999999999 <= 1n) is true'); +assert.sameValue(1n <= 1, true, 'The result of (1n <= 1) is true'); +assert.sameValue(1 <= 1n, true, 'The result of (1 <= 1n) is true'); +assert.sameValue(0n <= Number.MIN_VALUE, true, 'The result of (0n <= Number.MIN_VALUE) is true'); +assert.sameValue(Number.MIN_VALUE <= 0n, false, 'The result of (Number.MIN_VALUE <= 0n) is false'); + +assert.sameValue( + 0n <= -Number.MIN_VALUE, + false, + 'The result of (0n <= -Number.MIN_VALUE) is false' +); + +assert.sameValue(-Number.MIN_VALUE <= 0n, true, 'The result of (-Number.MIN_VALUE <= 0n) is true'); + +assert.sameValue( + -10n <= Number.MIN_VALUE, + true, + 'The result of (-10n <= Number.MIN_VALUE) is true' +); -assert.sameValue(0n <= 0, true, "0n <= 0"); -assert.sameValue(0 <= 0n, true, "0 <= 0n"); -assert.sameValue(0n <= -0, true, "0n <= -0"); -assert.sameValue(-0 <= 0n, true, "-0 <= 0n"); -assert.sameValue(0n <= 0.000000000001, true, "0n <= 0.000000000001"); -assert.sameValue(0.000000000001 <= 0n, false, "0.000000000001 <= 0n"); -assert.sameValue(0n <= 1, true, "0n <= 1"); -assert.sameValue(1 <= 0n, false, "1 <= 0n"); -assert.sameValue(1n <= 0, false, "1n <= 0"); -assert.sameValue(0 <= 1n, true, "0 <= 1n"); -assert.sameValue(1n <= 0.999999999999, false, "1n <= 0.999999999999"); -assert.sameValue(0.999999999999 <= 1n, true, "0.999999999999 <= 1n"); -assert.sameValue(1n <= 1, true, "1n <= 1"); -assert.sameValue(1 <= 1n, true, "1 <= 1n"); -assert.sameValue(0n <= Number.MIN_VALUE, true, "0n <= Number.MIN_VALUE"); -assert.sameValue(Number.MIN_VALUE <= 0n, false, "Number.MIN_VALUE <= 0n"); -assert.sameValue(0n <= -Number.MIN_VALUE, false, "0n <= -Number.MIN_VALUE"); -assert.sameValue(-Number.MIN_VALUE <= 0n, true, "-Number.MIN_VALUE <= 0n"); -assert.sameValue(-10n <= Number.MIN_VALUE, true, "-10n <= Number.MIN_VALUE"); -assert.sameValue(Number.MIN_VALUE <= -10n, false, "Number.MIN_VALUE <= -10n"); +assert.sameValue( + Number.MIN_VALUE <= -10n, + false, + 'The result of (Number.MIN_VALUE <= -10n) is false' +); \ No newline at end of file diff --git a/test/language/expressions/less-than-or-equal/bigint-and-string.js b/test/language/expressions/less-than-or-equal/bigint-and-string.js index 3d0176cf6cadc561b495ad0369399e56dd418b10..a604d17a75b35abe3e64b397fb92bf92f8fa3131 100644 --- a/test/language/expressions/less-than-or-equal/bigint-and-string.js +++ b/test/language/expressions/less-than-or-equal/bigint-and-string.js @@ -1,48 +1,51 @@ // Copyright (C) 2018 Igalia, S.L. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Relational comparison of BigInt and string values esid: sec-abstract-relational-comparison features: [BigInt] ---*/ - -assert.sameValue(0n <= "0", true, "0n <= '0'"); -assert.sameValue("0" <= 0n, true, "'0' <= 0n"); - -assert.sameValue(0n <= "1", true, "0n <= '1'"); -assert.sameValue("0" <= 1n, true, "'0' <= 1n"); - -assert.sameValue(1n <= "0", false, "1n <= '0'"); -assert.sameValue("1" <= 0n, false, "'1' <= 0n"); - -assert.sameValue(0n <= "", true, "0n <= ''"); -assert.sameValue("" <= 0n, true, "'' <= 0n"); - -assert.sameValue(0n <= "1", true, "0n <= '1'"); -assert.sameValue("" <= 1n, true, "'' <= 1n"); - -assert.sameValue(1n <= "", false, "1n <= ''"); -assert.sameValue("1" <= 0n, false, "'1' <= 0n"); - -assert.sameValue(1n <= "1", true, "1n <= '1'"); -assert.sameValue("1" <= 1n, true, "'1' <= 1n"); - -assert.sameValue(1n <= "-1", false, "1n <= '-1'"); -assert.sameValue("1" <= -1n, false, "'1' <= -1n"); - -assert.sameValue(-1n <= "1", true, "-1n <= '1'"); -assert.sameValue("-1" <= 1n, true, "'-1' <= 1n"); - -assert.sameValue(-1n <= "-1", true, "-1n <= '-1'"); -assert.sameValue("-1" <= -1n, true, "'-1' <= -1n"); - -assert.sameValue(9007199254740993n <= "9007199254740992", false, - "9007199254740993n <= '9007199254740992'"); -assert.sameValue("9007199254740993" <= 9007199254740992n, false, - "'9007199254740993' <= 9007199254740992n"); - -assert.sameValue(-9007199254740992n <= "-9007199254740993", false, - "-9007199254740992n <= '-9007199254740993'"); -assert.sameValue("-9007199254740992" <= -9007199254740993n, false, - "'-9007199254740992' <= -9007199254740993n"); +assert.sameValue(0n <= '0', true, 'The result of (0n <= "0") is true'); +assert.sameValue('0' <= 0n, true, 'The result of ("0" <= 0n) is true'); +assert.sameValue(0n <= '1', true, 'The result of (0n <= "1") is true'); +assert.sameValue('0' <= 1n, true, 'The result of ("0" <= 1n) is true'); +assert.sameValue(1n <= '0', false, 'The result of (1n <= "0") is false'); +assert.sameValue('1' <= 0n, false, 'The result of ("1" <= 0n) is false'); +assert.sameValue(0n <= '', true, 'The result of (0n <= "") is true'); +assert.sameValue('' <= 0n, true, 'The result of ("" <= 0n) is true'); +assert.sameValue(0n <= '1', true, 'The result of (0n <= "1") is true'); +assert.sameValue('' <= 1n, true, 'The result of ("" <= 1n) is true'); +assert.sameValue(1n <= '', false, 'The result of (1n <= "") is false'); +assert.sameValue('1' <= 0n, false, 'The result of ("1" <= 0n) is false'); +assert.sameValue(1n <= '1', true, 'The result of (1n <= "1") is true'); +assert.sameValue('1' <= 1n, true, 'The result of ("1" <= 1n) is true'); +assert.sameValue(1n <= '-1', false, 'The result of (1n <= "-1") is false'); +assert.sameValue('1' <= -1n, false, 'The result of ("1" <= -1n) is false'); +assert.sameValue(-1n <= '1', true, 'The result of (-1n <= "1") is true'); +assert.sameValue('-1' <= 1n, true, 'The result of ("-1" <= 1n) is true'); +assert.sameValue(-1n <= '-1', true, 'The result of (-1n <= "-1") is true'); +assert.sameValue('-1' <= -1n, true, 'The result of ("-1" <= -1n) is true'); + +assert.sameValue( + 9007199254740993n <= '9007199254740992', + false, + 'The result of (9007199254740993n <= "9007199254740992") is false' +); + +assert.sameValue( + '9007199254740993' <= 9007199254740992n, + false, + 'The result of ("9007199254740993" <= 9007199254740992n) is false' +); + +assert.sameValue( + -9007199254740992n <= '-9007199254740993', + false, + 'The result of (-9007199254740992n <= "-9007199254740993") is false' +); + +assert.sameValue( + '-9007199254740992' <= -9007199254740993n, + false, + 'The result of ("-9007199254740992" <= -9007199254740993n) is false' +); \ No newline at end of file diff --git a/test/language/expressions/less-than/bigint-and-bigint.js b/test/language/expressions/less-than/bigint-and-bigint.js index b3b37d76d79bcfcdc91901700ce6d7559810f53c..987496ffd01e5c3a3fcc6db0b1eefbf0ad230a4b 100644 --- a/test/language/expressions/less-than/bigint-and-bigint.js +++ b/test/language/expressions/less-than/bigint-and-bigint.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Comparisons of BigInt and BigInt values esid: sec-abstract-relational-comparison @@ -20,37 +19,146 @@ info: | features: [BigInt] ---*/ +assert.sameValue(0n < 0n, false, 'The result of (0n < 0n) is false'); +assert.sameValue(1n < 1n, false, 'The result of (1n < 1n) is false'); +assert.sameValue(-1n < -1n, false, 'The result of (-1n < -1n) is false'); +assert.sameValue(0n < -0n, false, 'The result of (0n < -0n) is false'); +assert.sameValue(-0n < 0n, false, 'The result of (-0n < 0n) is false'); +assert.sameValue(0n < 1n, true, 'The result of (0n < 1n) is true'); +assert.sameValue(1n < 0n, false, 'The result of (1n < 0n) is false'); +assert.sameValue(0n < -1n, false, 'The result of (0n < -1n) is false'); +assert.sameValue(-1n < 0n, true, 'The result of (-1n < 0n) is true'); +assert.sameValue(1n < -1n, false, 'The result of (1n < -1n) is false'); +assert.sameValue(-1n < 1n, true, 'The result of (-1n < 1n) is true'); + +assert.sameValue( + 0x1fffffffffffff01n < 0x1fffffffffffff02n, + true, + 'The result of (0x1fffffffffffff01n < 0x1fffffffffffff02n) is true' +); + +assert.sameValue( + 0x1fffffffffffff02n < 0x1fffffffffffff01n, + false, + 'The result of (0x1fffffffffffff02n < 0x1fffffffffffff01n) is false' +); + +assert.sameValue( + -0x1fffffffffffff01n < -0x1fffffffffffff02n, + false, + 'The result of (-0x1fffffffffffff01n < -0x1fffffffffffff02n) is false' +); + +assert.sameValue( + -0x1fffffffffffff02n < -0x1fffffffffffff01n, + true, + 'The result of (-0x1fffffffffffff02n < -0x1fffffffffffff01n) is true' +); + +assert.sameValue( + 0x10000000000000000n < 0n, + false, + 'The result of (0x10000000000000000n < 0n) is false' +); + +assert.sameValue( + 0n < 0x10000000000000000n, + true, + 'The result of (0n < 0x10000000000000000n) is true' +); + +assert.sameValue( + 0x10000000000000000n < 1n, + false, + 'The result of (0x10000000000000000n < 1n) is false' +); + +assert.sameValue( + 1n < 0x10000000000000000n, + true, + 'The result of (1n < 0x10000000000000000n) is true' +); + +assert.sameValue( + 0x10000000000000000n < -1n, + false, + 'The result of (0x10000000000000000n < -1n) is false' +); + +assert.sameValue( + -1n < 0x10000000000000000n, + true, + 'The result of (-1n < 0x10000000000000000n) is true' +); + +assert.sameValue( + 0x10000000000000001n < 0n, + false, + 'The result of (0x10000000000000001n < 0n) is false' +); + +assert.sameValue( + 0n < 0x10000000000000001n, + true, + 'The result of (0n < 0x10000000000000001n) is true' +); + +assert.sameValue( + -0x10000000000000000n < 0n, + true, + 'The result of (-0x10000000000000000n < 0n) is true' +); + +assert.sameValue( + 0n < -0x10000000000000000n, + false, + 'The result of (0n < -0x10000000000000000n) is false' +); + +assert.sameValue( + -0x10000000000000000n < 1n, + true, + 'The result of (-0x10000000000000000n < 1n) is true' +); + +assert.sameValue( + 1n < -0x10000000000000000n, + false, + 'The result of (1n < -0x10000000000000000n) is false' +); + +assert.sameValue( + -0x10000000000000000n < -1n, + true, + 'The result of (-0x10000000000000000n < -1n) is true' +); + +assert.sameValue( + -1n < -0x10000000000000000n, + false, + 'The result of (-1n < -0x10000000000000000n) is false' +); + +assert.sameValue( + -0x10000000000000001n < 0n, + true, + 'The result of (-0x10000000000000001n < 0n) is true' +); + +assert.sameValue( + 0n < -0x10000000000000001n, + false, + 'The result of (0n < -0x10000000000000001n) is false' +); + +assert.sameValue( + 0x10000000000000000n < 0x100000000n, + false, + 'The result of (0x10000000000000000n < 0x100000000n) is false' +); -assert.sameValue(0n < 0n, false, "0n < 0n"); -assert.sameValue(1n < 1n, false, "1n < 1n"); -assert.sameValue(-1n < -1n, false, "-1n < -1n"); -assert.sameValue(0n < -0n, false, "0n < -0n"); -assert.sameValue(-0n < 0n, false, "-0n < 0n"); -assert.sameValue(0n < 1n, true, "0n < 1n"); -assert.sameValue(1n < 0n, false, "1n < 0n"); -assert.sameValue(0n < -1n, false, "0n < -1n"); -assert.sameValue(-1n < 0n, true, "-1n < 0n"); -assert.sameValue(1n < -1n, false, "1n < -1n"); -assert.sameValue(-1n < 1n, true, "-1n < 1n"); -assert.sameValue(0x1fffffffffffff01n < 0x1fffffffffffff02n, true, "0x1fffffffffffff01n < 0x1fffffffffffff02n"); -assert.sameValue(0x1fffffffffffff02n < 0x1fffffffffffff01n, false, "0x1fffffffffffff02n < 0x1fffffffffffff01n"); -assert.sameValue(-0x1fffffffffffff01n < -0x1fffffffffffff02n, false, "-0x1fffffffffffff01n < -0x1fffffffffffff02n"); -assert.sameValue(-0x1fffffffffffff02n < -0x1fffffffffffff01n, true, "-0x1fffffffffffff02n < -0x1fffffffffffff01n"); -assert.sameValue(0x10000000000000000n < 0n, false, "0x10000000000000000n < 0n"); -assert.sameValue(0n < 0x10000000000000000n, true, "0n < 0x10000000000000000n"); -assert.sameValue(0x10000000000000000n < 1n, false, "0x10000000000000000n < 1n"); -assert.sameValue(1n < 0x10000000000000000n, true, "1n < 0x10000000000000000n"); -assert.sameValue(0x10000000000000000n < -1n, false, "0x10000000000000000n < -1n"); -assert.sameValue(-1n < 0x10000000000000000n, true, "-1n < 0x10000000000000000n"); -assert.sameValue(0x10000000000000001n < 0n, false, "0x10000000000000001n < 0n"); -assert.sameValue(0n < 0x10000000000000001n, true, "0n < 0x10000000000000001n"); -assert.sameValue(-0x10000000000000000n < 0n, true, "-0x10000000000000000n < 0n"); -assert.sameValue(0n < -0x10000000000000000n, false, "0n < -0x10000000000000000n"); -assert.sameValue(-0x10000000000000000n < 1n, true, "-0x10000000000000000n < 1n"); -assert.sameValue(1n < -0x10000000000000000n, false, "1n < -0x10000000000000000n"); -assert.sameValue(-0x10000000000000000n < -1n, true, "-0x10000000000000000n < -1n"); -assert.sameValue(-1n < -0x10000000000000000n, false, "-1n < -0x10000000000000000n"); -assert.sameValue(-0x10000000000000001n < 0n, true, "-0x10000000000000001n < 0n"); -assert.sameValue(0n < -0x10000000000000001n, false, "0n < -0x10000000000000001n"); -assert.sameValue(0x10000000000000000n < 0x100000000n, false, "0x10000000000000000n < 0x100000000n"); -assert.sameValue(0x100000000n < 0x10000000000000000n, true, "0x100000000n < 0x10000000000000000n"); +assert.sameValue( + 0x100000000n < 0x10000000000000000n, + true, + 'The result of (0x100000000n < 0x10000000000000000n) is true' +); \ No newline at end of file diff --git a/test/language/expressions/less-than/bigint-and-boolean.js b/test/language/expressions/less-than/bigint-and-boolean.js index 1bead8de9b100109632d8513fced7bcc7669b43c..583bf24a088f2faed19c4733c9e88786d3b6f413 100644 --- a/test/language/expressions/less-than/bigint-and-boolean.js +++ b/test/language/expressions/less-than/bigint-and-boolean.js @@ -1,30 +1,21 @@ // Copyright (C) 2018 Caio Lima. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Relational comparison of BigInt and boolean values esid: sec-abstract-relational-comparison features: [BigInt] ---*/ - -assert.sameValue(0n < false, false, "0n < false"); -assert.sameValue(false < 0n, false, "false < 0n"); - -assert.sameValue(0n < true, true, "0n < true"); -assert.sameValue(true < 0n, false, "true < 0n"); - -assert.sameValue(1n < false, false, "1n < false"); -assert.sameValue(false < 1n, true, "false < 1n"); - -assert.sameValue(1n < true, false, "1n < true"); -assert.sameValue(true < 1n, false, "true < 1n"); - -assert.sameValue(31n < true, false, "31n < true"); -assert.sameValue(true < 31n, true, "true < 31n"); - -assert.sameValue(-3n < true, true, "-3n < true"); -assert.sameValue(true < -3n, false, "true < -3n"); - -assert.sameValue(-3n < false, true, "-3n < false"); -assert.sameValue(false < -3n, false, "false < -3n"); - +assert.sameValue(0n < false, false, 'The result of (0n < false) is false'); +assert.sameValue(false < 0n, false, 'The result of (false < 0n) is false'); +assert.sameValue(0n < true, true, 'The result of (0n < true) is true'); +assert.sameValue(true < 0n, false, 'The result of (true < 0n) is false'); +assert.sameValue(1n < false, false, 'The result of (1n < false) is false'); +assert.sameValue(false < 1n, true, 'The result of (false < 1n) is true'); +assert.sameValue(1n < true, false, 'The result of (1n < true) is false'); +assert.sameValue(true < 1n, false, 'The result of (true < 1n) is false'); +assert.sameValue(31n < true, false, 'The result of (31n < true) is false'); +assert.sameValue(true < 31n, true, 'The result of (true < 31n) is true'); +assert.sameValue(-3n < true, true, 'The result of (-3n < true) is true'); +assert.sameValue(true < -3n, false, 'The result of (true < -3n) is false'); +assert.sameValue(-3n < false, true, 'The result of (-3n < false) is true'); +assert.sameValue(false < -3n, false, 'The result of (false < -3n) is false'); \ No newline at end of file diff --git a/test/language/expressions/less-than/bigint-and-incomparable-string.js b/test/language/expressions/less-than/bigint-and-incomparable-string.js index c48e9fb5567e64fd988fb1d279ca205f46484c7b..878f412c4668bd36fcee65cf68b6c591613667a1 100644 --- a/test/language/expressions/less-than/bigint-and-incomparable-string.js +++ b/test/language/expressions/less-than/bigint-and-incomparable-string.js @@ -1,30 +1,27 @@ // Copyright (C) 2018 Igalia, S.L. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Relational comparison of BigInt and string values esid: sec-abstract-relational-comparison features: [BigInt] ---*/ - -assert.sameValue("0n" < 1n, false, "'0n' < 1n"); -assert.sameValue("0." < 1n, false, "'0.' < 1n"); -assert.sameValue(".0" < 1n, false, "'.0' < 1n"); -assert.sameValue("0/1" < 1n, false, "'0/1' < 1n"); -assert.sameValue("z0" < 1n, false, "'z0' < 1n"); -assert.sameValue("0z" < 1n, false, "'0z' < 1n"); -assert.sameValue("++0" < 1n, false, "'++0' < 1n"); -assert.sameValue("--0" < 1n, false, "'--0' < 1n"); -assert.sameValue("0e0" < 1n, false, "'0e0' < 1n"); -assert.sameValue("Infinity" < 1n, false, "'Infinity' < 1n"); - -assert.sameValue(0n < "1n", false, "0n < '1n'"); -assert.sameValue(0n < "1.", false, "0n < '1.'"); -assert.sameValue(0n < ".1", false, "0n < '.1'"); -assert.sameValue(0n < "1/1", false, "0n < '1/1'"); -assert.sameValue(0n < "z1", false, "0n < 'z1'"); -assert.sameValue(0n < "1z", false, "0n < '1z'"); -assert.sameValue(0n < "++1", false, "0n < '++1'"); -assert.sameValue(0n < "--1", false, "0n < '--1'"); -assert.sameValue(0n < "1e0", false, "0n < '1e0'"); -assert.sameValue(0n < "Infinity", false, "0n < 'Infinity'"); +assert.sameValue('0n' < 1n, false, 'The result of ("0n" < 1n) is false'); +assert.sameValue('0.' < 1n, false, 'The result of ("0." < 1n) is false'); +assert.sameValue('.0' < 1n, false, 'The result of (".0" < 1n) is false'); +assert.sameValue('0/1' < 1n, false, 'The result of ("0/1" < 1n) is false'); +assert.sameValue('z0' < 1n, false, 'The result of ("z0" < 1n) is false'); +assert.sameValue('0z' < 1n, false, 'The result of ("0z" < 1n) is false'); +assert.sameValue('++0' < 1n, false, 'The result of ("++0" < 1n) is false'); +assert.sameValue('--0' < 1n, false, 'The result of ("--0" < 1n) is false'); +assert.sameValue('0e0' < 1n, false, 'The result of ("0e0" < 1n) is false'); +assert.sameValue('Infinity' < 1n, false, 'The result of ("Infinity" < 1n) is false'); +assert.sameValue(0n < '1n', false, 'The result of (0n < "1n") is false'); +assert.sameValue(0n < '1.', false, 'The result of (0n < "1.") is false'); +assert.sameValue(0n < '.1', false, 'The result of (0n < ".1") is false'); +assert.sameValue(0n < '1/1', false, 'The result of (0n < "1/1") is false'); +assert.sameValue(0n < 'z1', false, 'The result of (0n < "z1") is false'); +assert.sameValue(0n < '1z', false, 'The result of (0n < "1z") is false'); +assert.sameValue(0n < '++1', false, 'The result of (0n < "++1") is false'); +assert.sameValue(0n < '--1', false, 'The result of (0n < "--1") is false'); +assert.sameValue(0n < '1e0', false, 'The result of (0n < "1e0") is false'); +assert.sameValue(0n < 'Infinity', false, 'The result of (0n < "Infinity") is false'); \ No newline at end of file diff --git a/test/language/expressions/less-than/bigint-and-non-finite.js b/test/language/expressions/less-than/bigint-and-non-finite.js index 7ad15a7c19d8ba83e25fa74928e881f858401bbd..594c446ed7767da4d516eb3ff21d5d43f268afc8 100644 --- a/test/language/expressions/less-than/bigint-and-non-finite.js +++ b/test/language/expressions/less-than/bigint-and-non-finite.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Comparisons of BigInt and non-finite Number values esid: sec-abstract-relational-comparison @@ -18,14 +17,13 @@ info: | g. If x is +∞, or y is -∞, return false. features: [BigInt] ---*/ - -assert.sameValue(1n < Infinity, true, "1n < Infinity"); -assert.sameValue(Infinity < 1n, false, "Infinity < 1n"); -assert.sameValue(-1n < Infinity, true, "-1n < Infinity"); -assert.sameValue(Infinity < -1n, false, "Infinity < -1n"); -assert.sameValue(1n < -Infinity, false, "1n < -Infinity"); -assert.sameValue(-Infinity < 1n, true, "-Infinity < 1n"); -assert.sameValue(-1n < -Infinity, false, "-1n < -Infinity"); -assert.sameValue(-Infinity < -1n, true, "-Infinity < -1n"); -assert.sameValue(0n < NaN, false, "0n < NaN"); -assert.sameValue(NaN < 0n, false, "NaN < 0n"); +assert.sameValue(1n < Infinity, true, 'The result of (1n < Infinity) is true'); +assert.sameValue(Infinity < 1n, false, 'The result of (Infinity < 1n) is false'); +assert.sameValue(-1n < Infinity, true, 'The result of (-1n < Infinity) is true'); +assert.sameValue(Infinity < -1n, false, 'The result of (Infinity < -1n) is false'); +assert.sameValue(1n < -Infinity, false, 'The result of (1n < -Infinity) is false'); +assert.sameValue(-Infinity < 1n, true, 'The result of (-Infinity < 1n) is true'); +assert.sameValue(-1n < -Infinity, false, 'The result of (-1n < -Infinity) is false'); +assert.sameValue(-Infinity < -1n, true, 'The result of (-Infinity < -1n) is true'); +assert.sameValue(0n < NaN, false, 'The result of (0n < NaN) is false'); +assert.sameValue(NaN < 0n, false, 'The result of (NaN < 0n) is false'); \ No newline at end of file diff --git a/test/language/expressions/less-than/bigint-and-number-extremes.js b/test/language/expressions/less-than/bigint-and-number-extremes.js index c367b02d2af6de776c68529b21fc0b7223cd7fc2..8ae15abc89c7f5dbd1ad29db96933789be620b59 100644 --- a/test/language/expressions/less-than/bigint-and-number-extremes.js +++ b/test/language/expressions/less-than/bigint-and-number-extremes.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Comparisons of large BigInt and Number values esid: sec-abstract-relational-comparison @@ -19,24 +18,31 @@ info: | h. If the mathematical value of nx is less than the mathematical value of ny, return true, otherwise return false. features: [BigInt] ---*/ +assert.sameValue(1n < Number.MAX_VALUE, true, 'The result of (1n < Number.MAX_VALUE) is true'); +assert.sameValue(Number.MAX_VALUE < 1n, false, 'The result of (Number.MAX_VALUE < 1n) is false'); +assert.sameValue(1n < -Number.MAX_VALUE, false, 'The result of (1n < -Number.MAX_VALUE) is false'); +assert.sameValue(-Number.MAX_VALUE < 1n, true, 'The result of (-Number.MAX_VALUE < 1n) is true'); -assert.sameValue(1n < Number.MAX_VALUE, true, "1n < Number.MAX_VALUE"); -assert.sameValue(Number.MAX_VALUE < 1n, false, "Number.MAX_VALUE < 1n"); -assert.sameValue(1n < -Number.MAX_VALUE, false, "1n < -Number.MAX_VALUE"); -assert.sameValue(-Number.MAX_VALUE < 1n, true, "-Number.MAX_VALUE < 1n"); assert.sameValue( 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn < Number.MAX_VALUE, true, - "0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn < Number.MAX_VALUE"); + 'The result of (0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn < Number.MAX_VALUE) is true' +); + assert.sameValue( Number.MAX_VALUE < 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn, false, - "Number.MAX_VALUE < 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn"); + 'The result of (Number.MAX_VALUE < 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn) is false' +); + assert.sameValue( 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n < Number.MAX_VALUE, false, - "0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n < Number.MAX_VALUE"); + 'The result of (0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n < Number.MAX_VALUE) is false' +); + assert.sameValue( Number.MAX_VALUE < 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n, true, - "Number.MAX_VALUE < 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n"); + 'The result of (Number.MAX_VALUE < 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n) is true' +); \ No newline at end of file diff --git a/test/language/expressions/less-than/bigint-and-number.js b/test/language/expressions/less-than/bigint-and-number.js index 1478baf8c6a88951b8268d58626aff1164ab7d4c..4b95fa6f78928d890fbd0b2d93eceaf0d486cc05 100644 --- a/test/language/expressions/less-than/bigint-and-number.js +++ b/test/language/expressions/less-than/bigint-and-number.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Robin Templeton. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Comparisons of BigInt and Number values esid: sec-abstract-relational-comparison @@ -19,24 +18,28 @@ info: | h. If the mathematical value of nx is less than the mathematical value of ny, return true, otherwise return false. features: [BigInt] ---*/ +assert.sameValue(0n < 0, false, 'The result of (0n < 0) is false'); +assert.sameValue(0 < 0n, false, 'The result of (0 < 0n) is false'); +assert.sameValue(0n < -0, false, 'The result of (0n < -0) is false'); +assert.sameValue(-0 < 0n, false, 'The result of (-0 < 0n) is false'); +assert.sameValue(0n < 0.000000000001, true, 'The result of (0n < 0.000000000001) is true'); +assert.sameValue(0.000000000001 < 0n, false, 'The result of (0.000000000001 < 0n) is false'); +assert.sameValue(0n < 1, true, 'The result of (0n < 1) is true'); +assert.sameValue(1 < 0n, false, 'The result of (1 < 0n) is false'); +assert.sameValue(1n < 0, false, 'The result of (1n < 0) is false'); +assert.sameValue(0 < 1n, true, 'The result of (0 < 1n) is true'); +assert.sameValue(1n < 0.999999999999, false, 'The result of (1n < 0.999999999999) is false'); +assert.sameValue(0.999999999999 < 1n, true, 'The result of (0.999999999999 < 1n) is true'); +assert.sameValue(1n < 1, false, 'The result of (1n < 1) is false'); +assert.sameValue(1 < 1n, false, 'The result of (1 < 1n) is false'); +assert.sameValue(0n < Number.MIN_VALUE, true, 'The result of (0n < Number.MIN_VALUE) is true'); +assert.sameValue(Number.MIN_VALUE < 0n, false, 'The result of (Number.MIN_VALUE < 0n) is false'); +assert.sameValue(0n < -Number.MIN_VALUE, false, 'The result of (0n < -Number.MIN_VALUE) is false'); +assert.sameValue(-Number.MIN_VALUE < 0n, true, 'The result of (-Number.MIN_VALUE < 0n) is true'); +assert.sameValue(-10n < Number.MIN_VALUE, true, 'The result of (-10n < Number.MIN_VALUE) is true'); -assert.sameValue(0n < 0, false, "0n < 0"); -assert.sameValue(0 < 0n, false, "0 < 0n"); -assert.sameValue(0n < -0, false, "0n < -0"); -assert.sameValue(-0 < 0n, false, "-0 < 0n"); -assert.sameValue(0n < 0.000000000001, true, "0n < 0.000000000001"); -assert.sameValue(0.000000000001 < 0n, false, "0.000000000001 < 0n"); -assert.sameValue(0n < 1, true, "0n < 1"); -assert.sameValue(1 < 0n, false, "1 < 0n"); -assert.sameValue(1n < 0, false, "1n < 0"); -assert.sameValue(0 < 1n, true, "0 < 1n"); -assert.sameValue(1n < 0.999999999999, false, "1n < 0.999999999999"); -assert.sameValue(0.999999999999 < 1n, true, "0.999999999999 < 1n"); -assert.sameValue(1n < 1, false, "1n < 1"); -assert.sameValue(1 < 1n, false, "1 < 1n"); -assert.sameValue(0n < Number.MIN_VALUE, true, "0n < Number.MIN_VALUE"); -assert.sameValue(Number.MIN_VALUE < 0n, false, "Number.MIN_VALUE < 0n"); -assert.sameValue(0n < -Number.MIN_VALUE, false, "0n < -Number.MIN_VALUE"); -assert.sameValue(-Number.MIN_VALUE < 0n, true, "-Number.MIN_VALUE < 0n"); -assert.sameValue(-10n < Number.MIN_VALUE, true, "-10n < Number.MIN_VALUE"); -assert.sameValue(Number.MIN_VALUE < -10n, false, "Number.MIN_VALUE < -10n"); +assert.sameValue( + Number.MIN_VALUE < -10n, + false, + 'The result of (Number.MIN_VALUE < -10n) is false' +); \ No newline at end of file diff --git a/test/language/expressions/less-than/bigint-and-string.js b/test/language/expressions/less-than/bigint-and-string.js index 858466685382804a4d8d46762579219b371e921a..1866b3c382c9984e45830d3c9701ba2c209353b3 100644 --- a/test/language/expressions/less-than/bigint-and-string.js +++ b/test/language/expressions/less-than/bigint-and-string.js @@ -1,48 +1,51 @@ // Copyright (C) 2018 Igalia, S.L. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Relational comparison of BigInt and string values esid: sec-abstract-relational-comparison features: [BigInt] ---*/ - -assert.sameValue(0n < "0", false, "0n < '0'"); -assert.sameValue("0" < 0n, false, "'0' < 0n"); - -assert.sameValue(0n < "1", true, "0n < '1'"); -assert.sameValue("0" < 1n, true, "'0' < 1n"); - -assert.sameValue(1n < "0", false, "1n < '0'"); -assert.sameValue("1" < 0n, false, "'1' < 0n"); - -assert.sameValue(0n < "", false, "0n < ''"); -assert.sameValue("" < 0n, false, "'' < 0n"); - -assert.sameValue(0n < "1", true, "0n < '1'"); -assert.sameValue("" < 1n, true, "'' < 1n"); - -assert.sameValue(1n < "", false, "1n < ''"); -assert.sameValue("1" < 0n, false, "'1' < 0n"); - -assert.sameValue(1n < "1", false, "1n < '1'"); -assert.sameValue("1" < 1n, false, "'1' < 1n"); - -assert.sameValue(1n < "-1", false, "1n < '-1'"); -assert.sameValue("1" < -1n, false, "'1' < -1n"); - -assert.sameValue(-1n < "1", true, "-1n < '1'"); -assert.sameValue("-1" < 1n, true, "'-1' < 1n"); - -assert.sameValue(-1n < "-1", false, "-1n < '-1'"); -assert.sameValue("-1" < -1n, false, "'-1' < -1n"); - -assert.sameValue(9007199254740993n < "9007199254740992", false, - "9007199254740993n < '9007199254740992'"); -assert.sameValue("9007199254740993" < 9007199254740992n, false, - "'9007199254740993' < 9007199254740992n"); - -assert.sameValue(-9007199254740992n < "-9007199254740993", false, - "-9007199254740992n < '-9007199254740993'"); -assert.sameValue("-9007199254740992" < -9007199254740993n, false, - "'-9007199254740992' < -9007199254740993n"); +assert.sameValue(0n < '0', false, 'The result of (0n < "0") is false'); +assert.sameValue('0' < 0n, false, 'The result of ("0" < 0n) is false'); +assert.sameValue(0n < '1', true, 'The result of (0n < "1") is true'); +assert.sameValue('0' < 1n, true, 'The result of ("0" < 1n) is true'); +assert.sameValue(1n < '0', false, 'The result of (1n < "0") is false'); +assert.sameValue('1' < 0n, false, 'The result of ("1" < 0n) is false'); +assert.sameValue(0n < '', false, 'The result of (0n < "") is false'); +assert.sameValue('' < 0n, false, 'The result of ("" < 0n) is false'); +assert.sameValue(0n < '1', true, 'The result of (0n < "1") is true'); +assert.sameValue('' < 1n, true, 'The result of ("" < 1n) is true'); +assert.sameValue(1n < '', false, 'The result of (1n < "") is false'); +assert.sameValue('1' < 0n, false, 'The result of ("1" < 0n) is false'); +assert.sameValue(1n < '1', false, 'The result of (1n < "1") is false'); +assert.sameValue('1' < 1n, false, 'The result of ("1" < 1n) is false'); +assert.sameValue(1n < '-1', false, 'The result of (1n < "-1") is false'); +assert.sameValue('1' < -1n, false, 'The result of ("1" < -1n) is false'); +assert.sameValue(-1n < '1', true, 'The result of (-1n < "1") is true'); +assert.sameValue('-1' < 1n, true, 'The result of ("-1" < 1n) is true'); +assert.sameValue(-1n < '-1', false, 'The result of (-1n < "-1") is false'); +assert.sameValue('-1' < -1n, false, 'The result of ("-1" < -1n) is false'); + +assert.sameValue( + 9007199254740993n < '9007199254740992', + false, + 'The result of (9007199254740993n < "9007199254740992") is false' +); + +assert.sameValue( + '9007199254740993' < 9007199254740992n, + false, + 'The result of ("9007199254740993" < 9007199254740992n) is false' +); + +assert.sameValue( + -9007199254740992n < '-9007199254740993', + false, + 'The result of (-9007199254740992n < "-9007199254740993") is false' +); + +assert.sameValue( + '-9007199254740992' < -9007199254740993n, + false, + 'The result of ("-9007199254740992" < -9007199254740993n) is false' +); \ No newline at end of file diff --git a/test/language/expressions/less-than/bigint-and-symbol.js b/test/language/expressions/less-than/bigint-and-symbol.js index b428218ea41561b2047b2289784fae1458a6eb23..2434d12cdab69b35da8ee53eae39db43ca2f080c 100644 --- a/test/language/expressions/less-than/bigint-and-symbol.js +++ b/test/language/expressions/less-than/bigint-and-symbol.js @@ -1,19 +1,14 @@ // Copyright (C) 2018 Caio Lima. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Relational comparison of BigInt and Symbol values esid: sec-abstract-relational-comparison features: [BigInt, Symbol] ---*/ - -function MyError() {} - assert.throws(TypeError, function() { - 3n < Symbol("2"); -}, "ToNumeric(Symbol) on RHS throws."); + 3n < Symbol('2'); +}, '3n < Symbol("2") throws TypeError'); assert.throws(TypeError, function() { - Symbol("2") < 3n; -}, "ToNumeric(Symbol) on LHS throws."); - + Symbol('2') < 3n; +}, 'Symbol("2") < 3n throws TypeError'); diff --git a/test/language/expressions/modulus/bigint-and-number.js b/test/language/expressions/modulus/bigint-and-number.js index afdb0aa8708c930e65e44bb1d459208990c25941..60a4d76d488263efaf0acf82bf2b30d09fe4d306 100644 --- a/test/language/expressions/modulus/bigint-and-number.js +++ b/test/language/expressions/modulus/bigint-and-number.js @@ -9,24 +9,82 @@ info: | Let rnum be ? ToNumeric(rightValue). If Type(lnum) does not equal Type(rnum), throw a TypeError exception. ---*/ +assert.throws(TypeError, function() { + 1n % 1; +}, '1n % 1 throws TypeError'); -assert.throws(TypeError, function() { 1n % 1; }, "1n % 1 throws TypeError"); -assert.throws(TypeError, function() { 1 % 1n; }, "1 % 1n throws TypeError"); -assert.throws(TypeError, function() { Object(1n) % 1; }, "Object(1n) % 1 throws TypeError"); -assert.throws(TypeError, function() { 1 % Object(1n); }, "1 % Object(1n) throws TypeError"); -assert.throws(TypeError, function() { 1n % Object(1); }, "1n % Object(1) throws TypeError"); -assert.throws(TypeError, function() { Object(1) % 1n; }, "Object(1) % 1n throws TypeError"); -assert.throws(TypeError, function() { Object(1n) % Object(1); }, "Object(1n) % Object(1) throws TypeError"); -assert.throws(TypeError, function() { Object(1) % Object(1n); }, "Object(1) % Object(1n) throws TypeError"); -assert.throws(TypeError, function() { 1n % NaN; }, "1n % NaN throws TypeError"); -assert.throws(TypeError, function() { NaN % 1n; }, "NaN % 1n throws TypeError"); -assert.throws(TypeError, function() { 1n % Infinity; }, "1n % Infinity throws TypeError"); -assert.throws(TypeError, function() { Infinity % 1n; }, "Infinity % 1n throws TypeError"); -assert.throws(TypeError, function() { 1n % true; }, "1n % true throws TypeError"); -assert.throws(TypeError, function() { true % 1n; }, "true % 1n throws TypeError"); -assert.throws(TypeError, function() { 1n % "1"; }, '1n % "1" throws TypeError'); -assert.throws(TypeError, function() { "1" % 1n; }, '"1" % 1n throws TypeError'); -assert.throws(TypeError, function() { 1n % null; }, "1n % null throws TypeError"); -assert.throws(TypeError, function() { null % 1n; }, "null % 1n throws TypeError"); -assert.throws(TypeError, function() { 1n % undefined; }, "1n % undefined throws TypeError"); -assert.throws(TypeError, function() { undefined % 1n; }, "undefined % 1n throws TypeError"); +assert.throws(TypeError, function() { + 1 % 1n; +}, '1 % 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) % 1; +}, 'Object(1n) % 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 % Object(1n); +}, '1 % Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n % Object(1); +}, '1n % Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) % 1n; +}, 'Object(1) % 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) % Object(1); +}, 'Object(1n) % Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) % Object(1n); +}, 'Object(1) % Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n % NaN; +}, '1n % NaN throws TypeError'); + +assert.throws(TypeError, function() { + NaN % 1n; +}, 'NaN % 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n % Infinity; +}, '1n % Infinity throws TypeError'); + +assert.throws(TypeError, function() { + Infinity % 1n; +}, 'Infinity % 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n % true; +}, '1n % true throws TypeError'); + +assert.throws(TypeError, function() { + true % 1n; +}, 'true % 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n % '1'; +}, '1n % "1" throws TypeError'); + +assert.throws(TypeError, function() { + '1' % 1n; +}, '"1" % 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n % null; +}, '1n % null throws TypeError'); + +assert.throws(TypeError, function() { + null % 1n; +}, 'null % 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n % undefined; +}, '1n % undefined throws TypeError'); + +assert.throws(TypeError, function() { + undefined % 1n; +}, 'undefined % 1n throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/modulus/bigint-arithmetic.js b/test/language/expressions/modulus/bigint-arithmetic.js index 79f7bc2083df1c5f7ebb7c9abbac4d5614b16ea3..9d7497b5986e4e4c0a6b4b2fddb94f1392e93a4f 100644 --- a/test/language/expressions/modulus/bigint-arithmetic.js +++ b/test/language/expressions/modulus/bigint-arithmetic.js @@ -1,269 +1,984 @@ // Copyright (C) 2017 Robin Templeton. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- esid: sec-multiplicative-operators-runtime-semantics-evaluation description: BigInt remainder arithmetic features: [BigInt] ---*/ +assert.sameValue( + 0xFEDCBA9876543210n % 0xFEDCBA9876543210n, + 0x0n, + 'The result of (0xFEDCBA9876543210n % 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % 0xFEDCBA987654320Fn, + 0x1n, + 'The result of (0xFEDCBA9876543210n % 0xFEDCBA987654320Fn) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % 0xFEDCBA98n, + 0x76543210n, + 'The result of (0xFEDCBA9876543210n % 0xFEDCBA98n) is 0x76543210n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % 0xFEDCBA97n, + 0x77777779n, + 'The result of (0xFEDCBA9876543210n % 0xFEDCBA97n) is 0x77777779n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % 0x1234n, + 0x960n, + 'The result of (0xFEDCBA9876543210n % 0x1234n) is 0x960n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % 0x3n, + 0x0n, + 'The result of (0xFEDCBA9876543210n % 0x3n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % 0x2n, + 0x0n, + 'The result of (0xFEDCBA9876543210n % 0x2n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % 0x1n, + 0x0n, + 'The result of (0xFEDCBA9876543210n % 0x1n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % -0x1n, + 0x0n, + 'The result of (0xFEDCBA9876543210n % -0x1n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % -0x2n, + 0x0n, + 'The result of (0xFEDCBA9876543210n % -0x2n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % -0x3n, + 0x0n, + 'The result of (0xFEDCBA9876543210n % -0x3n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % -0x1234n, + 0x960n, + 'The result of (0xFEDCBA9876543210n % -0x1234n) is 0x960n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % -0xFEDCBA97n, + 0x77777779n, + 'The result of (0xFEDCBA9876543210n % -0xFEDCBA97n) is 0x77777779n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % -0xFEDCBA98n, + 0x76543210n, + 'The result of (0xFEDCBA9876543210n % -0xFEDCBA98n) is 0x76543210n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % -0xFEDCBA987654320Fn, + 0x1n, + 'The result of (0xFEDCBA9876543210n % -0xFEDCBA987654320Fn) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % -0xFEDCBA9876543210n, + 0x0n, + 'The result of (0xFEDCBA9876543210n % -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % 0xFEDCBA9876543210n, + 0xFEDCBA987654320Fn, + 'The result of (0xFEDCBA987654320Fn % 0xFEDCBA9876543210n) is 0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0xFEDCBA987654320Fn % 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % 0xFEDCBA98n, + 0x7654320Fn, + 'The result of (0xFEDCBA987654320Fn % 0xFEDCBA98n) is 0x7654320Fn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % 0xFEDCBA97n, + 0x77777778n, + 'The result of (0xFEDCBA987654320Fn % 0xFEDCBA97n) is 0x77777778n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % 0x1234n, + 0x95Fn, + 'The result of (0xFEDCBA987654320Fn % 0x1234n) is 0x95Fn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % 0x3n, + 0x2n, + 'The result of (0xFEDCBA987654320Fn % 0x3n) is 0x2n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % 0x2n, + 0x1n, + 'The result of (0xFEDCBA987654320Fn % 0x2n) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % 0x1n, + 0x0n, + 'The result of (0xFEDCBA987654320Fn % 0x1n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % -0x1n, + 0x0n, + 'The result of (0xFEDCBA987654320Fn % -0x1n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % -0x2n, + 0x1n, + 'The result of (0xFEDCBA987654320Fn % -0x2n) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % -0x3n, + 0x2n, + 'The result of (0xFEDCBA987654320Fn % -0x3n) is 0x2n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % -0x1234n, + 0x95Fn, + 'The result of (0xFEDCBA987654320Fn % -0x1234n) is 0x95Fn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % -0xFEDCBA97n, + 0x77777778n, + 'The result of (0xFEDCBA987654320Fn % -0xFEDCBA97n) is 0x77777778n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % -0xFEDCBA98n, + 0x7654320Fn, + 'The result of (0xFEDCBA987654320Fn % -0xFEDCBA98n) is 0x7654320Fn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0xFEDCBA987654320Fn % -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % -0xFEDCBA9876543210n, + 0xFEDCBA987654320Fn, + 'The result of (0xFEDCBA987654320Fn % -0xFEDCBA9876543210n) is 0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0xFEDCBA98n % 0xFEDCBA9876543210n, + 0xFEDCBA98n, + 'The result of (0xFEDCBA98n % 0xFEDCBA9876543210n) is 0xFEDCBA98n' +); + +assert.sameValue( + 0xFEDCBA98n % 0xFEDCBA987654320Fn, + 0xFEDCBA98n, + 'The result of (0xFEDCBA98n % 0xFEDCBA987654320Fn) is 0xFEDCBA98n' +); + +assert.sameValue( + 0xFEDCBA98n % 0xFEDCBA98n, + 0x0n, + 'The result of (0xFEDCBA98n % 0xFEDCBA98n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA98n % 0xFEDCBA97n, + 0x1n, + 'The result of (0xFEDCBA98n % 0xFEDCBA97n) is 0x1n' +); + +assert.sameValue(0xFEDCBA98n % 0x1234n, 0x930n, 'The result of (0xFEDCBA98n % 0x1234n) is 0x930n'); +assert.sameValue(0xFEDCBA98n % 0x3n, 0x2n, 'The result of (0xFEDCBA98n % 0x3n) is 0x2n'); +assert.sameValue(0xFEDCBA98n % 0x2n, 0x0n, 'The result of (0xFEDCBA98n % 0x2n) is 0x0n'); +assert.sameValue(0xFEDCBA98n % 0x1n, 0x0n, 'The result of (0xFEDCBA98n % 0x1n) is 0x0n'); +assert.sameValue(0xFEDCBA98n % -0x1n, 0x0n, 'The result of (0xFEDCBA98n % -0x1n) is 0x0n'); +assert.sameValue(0xFEDCBA98n % -0x2n, 0x0n, 'The result of (0xFEDCBA98n % -0x2n) is 0x0n'); +assert.sameValue(0xFEDCBA98n % -0x3n, 0x2n, 'The result of (0xFEDCBA98n % -0x3n) is 0x2n'); + +assert.sameValue( + 0xFEDCBA98n % -0x1234n, + 0x930n, + 'The result of (0xFEDCBA98n % -0x1234n) is 0x930n' +); + +assert.sameValue( + 0xFEDCBA98n % -0xFEDCBA97n, + 0x1n, + 'The result of (0xFEDCBA98n % -0xFEDCBA97n) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA98n % -0xFEDCBA98n, + 0x0n, + 'The result of (0xFEDCBA98n % -0xFEDCBA98n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA98n % -0xFEDCBA987654320Fn, + 0xFEDCBA98n, + 'The result of (0xFEDCBA98n % -0xFEDCBA987654320Fn) is 0xFEDCBA98n' +); + +assert.sameValue( + 0xFEDCBA98n % -0xFEDCBA9876543210n, + 0xFEDCBA98n, + 'The result of (0xFEDCBA98n % -0xFEDCBA9876543210n) is 0xFEDCBA98n' +); + +assert.sameValue( + 0xFEDCBA97n % 0xFEDCBA9876543210n, + 0xFEDCBA97n, + 'The result of (0xFEDCBA97n % 0xFEDCBA9876543210n) is 0xFEDCBA97n' +); + +assert.sameValue( + 0xFEDCBA97n % 0xFEDCBA987654320Fn, + 0xFEDCBA97n, + 'The result of (0xFEDCBA97n % 0xFEDCBA987654320Fn) is 0xFEDCBA97n' +); + +assert.sameValue( + 0xFEDCBA97n % 0xFEDCBA98n, + 0xFEDCBA97n, + 'The result of (0xFEDCBA97n % 0xFEDCBA98n) is 0xFEDCBA97n' +); + +assert.sameValue( + 0xFEDCBA97n % 0xFEDCBA97n, + 0x0n, + 'The result of (0xFEDCBA97n % 0xFEDCBA97n) is 0x0n' +); + +assert.sameValue(0xFEDCBA97n % 0x1234n, 0x92Fn, 'The result of (0xFEDCBA97n % 0x1234n) is 0x92Fn'); +assert.sameValue(0xFEDCBA97n % 0x3n, 0x1n, 'The result of (0xFEDCBA97n % 0x3n) is 0x1n'); +assert.sameValue(0xFEDCBA97n % 0x2n, 0x1n, 'The result of (0xFEDCBA97n % 0x2n) is 0x1n'); +assert.sameValue(0xFEDCBA97n % 0x1n, 0x0n, 'The result of (0xFEDCBA97n % 0x1n) is 0x0n'); +assert.sameValue(0xFEDCBA97n % -0x1n, 0x0n, 'The result of (0xFEDCBA97n % -0x1n) is 0x0n'); +assert.sameValue(0xFEDCBA97n % -0x2n, 0x1n, 'The result of (0xFEDCBA97n % -0x2n) is 0x1n'); +assert.sameValue(0xFEDCBA97n % -0x3n, 0x1n, 'The result of (0xFEDCBA97n % -0x3n) is 0x1n'); + +assert.sameValue( + 0xFEDCBA97n % -0x1234n, + 0x92Fn, + 'The result of (0xFEDCBA97n % -0x1234n) is 0x92Fn' +); + +assert.sameValue( + 0xFEDCBA97n % -0xFEDCBA97n, + 0x0n, + 'The result of (0xFEDCBA97n % -0xFEDCBA97n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA97n % -0xFEDCBA98n, + 0xFEDCBA97n, + 'The result of (0xFEDCBA97n % -0xFEDCBA98n) is 0xFEDCBA97n' +); + +assert.sameValue( + 0xFEDCBA97n % -0xFEDCBA987654320Fn, + 0xFEDCBA97n, + 'The result of (0xFEDCBA97n % -0xFEDCBA987654320Fn) is 0xFEDCBA97n' +); + +assert.sameValue( + 0xFEDCBA97n % -0xFEDCBA9876543210n, + 0xFEDCBA97n, + 'The result of (0xFEDCBA97n % -0xFEDCBA9876543210n) is 0xFEDCBA97n' +); + +assert.sameValue( + 0x1234n % 0xFEDCBA9876543210n, + 0x1234n, + 'The result of (0x1234n % 0xFEDCBA9876543210n) is 0x1234n' +); + +assert.sameValue( + 0x1234n % 0xFEDCBA987654320Fn, + 0x1234n, + 'The result of (0x1234n % 0xFEDCBA987654320Fn) is 0x1234n' +); + +assert.sameValue( + 0x1234n % 0xFEDCBA98n, + 0x1234n, + 'The result of (0x1234n % 0xFEDCBA98n) is 0x1234n' +); + +assert.sameValue( + 0x1234n % 0xFEDCBA97n, + 0x1234n, + 'The result of (0x1234n % 0xFEDCBA97n) is 0x1234n' +); + +assert.sameValue(0x1234n % 0x1234n, 0x0n, 'The result of (0x1234n % 0x1234n) is 0x0n'); +assert.sameValue(0x1234n % 0x3n, 0x1n, 'The result of (0x1234n % 0x3n) is 0x1n'); +assert.sameValue(0x1234n % 0x2n, 0x0n, 'The result of (0x1234n % 0x2n) is 0x0n'); +assert.sameValue(0x1234n % 0x1n, 0x0n, 'The result of (0x1234n % 0x1n) is 0x0n'); +assert.sameValue(0x1234n % -0x1n, 0x0n, 'The result of (0x1234n % -0x1n) is 0x0n'); +assert.sameValue(0x1234n % -0x2n, 0x0n, 'The result of (0x1234n % -0x2n) is 0x0n'); +assert.sameValue(0x1234n % -0x3n, 0x1n, 'The result of (0x1234n % -0x3n) is 0x1n'); +assert.sameValue(0x1234n % -0x1234n, 0x0n, 'The result of (0x1234n % -0x1234n) is 0x0n'); + +assert.sameValue( + 0x1234n % -0xFEDCBA97n, + 0x1234n, + 'The result of (0x1234n % -0xFEDCBA97n) is 0x1234n' +); + +assert.sameValue( + 0x1234n % -0xFEDCBA98n, + 0x1234n, + 'The result of (0x1234n % -0xFEDCBA98n) is 0x1234n' +); + +assert.sameValue( + 0x1234n % -0xFEDCBA987654320Fn, + 0x1234n, + 'The result of (0x1234n % -0xFEDCBA987654320Fn) is 0x1234n' +); + +assert.sameValue( + 0x1234n % -0xFEDCBA9876543210n, + 0x1234n, + 'The result of (0x1234n % -0xFEDCBA9876543210n) is 0x1234n' +); + +assert.sameValue( + 0x3n % 0xFEDCBA9876543210n, + 0x3n, + 'The result of (0x3n % 0xFEDCBA9876543210n) is 0x3n' +); + +assert.sameValue( + 0x3n % 0xFEDCBA987654320Fn, + 0x3n, + 'The result of (0x3n % 0xFEDCBA987654320Fn) is 0x3n' +); + +assert.sameValue(0x3n % 0xFEDCBA98n, 0x3n, 'The result of (0x3n % 0xFEDCBA98n) is 0x3n'); +assert.sameValue(0x3n % 0xFEDCBA97n, 0x3n, 'The result of (0x3n % 0xFEDCBA97n) is 0x3n'); +assert.sameValue(0x3n % 0x1234n, 0x3n, 'The result of (0x3n % 0x1234n) is 0x3n'); +assert.sameValue(0x3n % 0x3n, 0x0n, 'The result of (0x3n % 0x3n) is 0x0n'); +assert.sameValue(0x3n % 0x2n, 0x1n, 'The result of (0x3n % 0x2n) is 0x1n'); +assert.sameValue(0x3n % 0x1n, 0x0n, 'The result of (0x3n % 0x1n) is 0x0n'); +assert.sameValue(0x3n % -0x1n, 0x0n, 'The result of (0x3n % -0x1n) is 0x0n'); +assert.sameValue(0x3n % -0x2n, 0x1n, 'The result of (0x3n % -0x2n) is 0x1n'); +assert.sameValue(0x3n % -0x3n, 0x0n, 'The result of (0x3n % -0x3n) is 0x0n'); +assert.sameValue(0x3n % -0x1234n, 0x3n, 'The result of (0x3n % -0x1234n) is 0x3n'); +assert.sameValue(0x3n % -0xFEDCBA97n, 0x3n, 'The result of (0x3n % -0xFEDCBA97n) is 0x3n'); +assert.sameValue(0x3n % -0xFEDCBA98n, 0x3n, 'The result of (0x3n % -0xFEDCBA98n) is 0x3n'); + +assert.sameValue( + 0x3n % -0xFEDCBA987654320Fn, + 0x3n, + 'The result of (0x3n % -0xFEDCBA987654320Fn) is 0x3n' +); + +assert.sameValue( + 0x3n % -0xFEDCBA9876543210n, + 0x3n, + 'The result of (0x3n % -0xFEDCBA9876543210n) is 0x3n' +); + +assert.sameValue( + 0x2n % 0xFEDCBA9876543210n, + 0x2n, + 'The result of (0x2n % 0xFEDCBA9876543210n) is 0x2n' +); + +assert.sameValue( + 0x2n % 0xFEDCBA987654320Fn, + 0x2n, + 'The result of (0x2n % 0xFEDCBA987654320Fn) is 0x2n' +); + +assert.sameValue(0x2n % 0xFEDCBA98n, 0x2n, 'The result of (0x2n % 0xFEDCBA98n) is 0x2n'); +assert.sameValue(0x2n % 0xFEDCBA97n, 0x2n, 'The result of (0x2n % 0xFEDCBA97n) is 0x2n'); +assert.sameValue(0x2n % 0x1234n, 0x2n, 'The result of (0x2n % 0x1234n) is 0x2n'); +assert.sameValue(0x2n % 0x3n, 0x2n, 'The result of (0x2n % 0x3n) is 0x2n'); +assert.sameValue(0x2n % 0x2n, 0x0n, 'The result of (0x2n % 0x2n) is 0x0n'); +assert.sameValue(0x2n % 0x1n, 0x0n, 'The result of (0x2n % 0x1n) is 0x0n'); +assert.sameValue(0x2n % -0x1n, 0x0n, 'The result of (0x2n % -0x1n) is 0x0n'); +assert.sameValue(0x2n % -0x2n, 0x0n, 'The result of (0x2n % -0x2n) is 0x0n'); +assert.sameValue(0x2n % -0x3n, 0x2n, 'The result of (0x2n % -0x3n) is 0x2n'); +assert.sameValue(0x2n % -0x1234n, 0x2n, 'The result of (0x2n % -0x1234n) is 0x2n'); +assert.sameValue(0x2n % -0xFEDCBA97n, 0x2n, 'The result of (0x2n % -0xFEDCBA97n) is 0x2n'); +assert.sameValue(0x2n % -0xFEDCBA98n, 0x2n, 'The result of (0x2n % -0xFEDCBA98n) is 0x2n'); + +assert.sameValue( + 0x2n % -0xFEDCBA987654320Fn, + 0x2n, + 'The result of (0x2n % -0xFEDCBA987654320Fn) is 0x2n' +); + +assert.sameValue( + 0x2n % -0xFEDCBA9876543210n, + 0x2n, + 'The result of (0x2n % -0xFEDCBA9876543210n) is 0x2n' +); + +assert.sameValue( + 0x1n % 0xFEDCBA9876543210n, + 0x1n, + 'The result of (0x1n % 0xFEDCBA9876543210n) is 0x1n' +); + +assert.sameValue( + 0x1n % 0xFEDCBA987654320Fn, + 0x1n, + 'The result of (0x1n % 0xFEDCBA987654320Fn) is 0x1n' +); + +assert.sameValue(0x1n % 0xFEDCBA98n, 0x1n, 'The result of (0x1n % 0xFEDCBA98n) is 0x1n'); +assert.sameValue(0x1n % 0xFEDCBA97n, 0x1n, 'The result of (0x1n % 0xFEDCBA97n) is 0x1n'); +assert.sameValue(0x1n % 0x1234n, 0x1n, 'The result of (0x1n % 0x1234n) is 0x1n'); +assert.sameValue(0x1n % 0x3n, 0x1n, 'The result of (0x1n % 0x3n) is 0x1n'); +assert.sameValue(0x1n % 0x2n, 0x1n, 'The result of (0x1n % 0x2n) is 0x1n'); +assert.sameValue(0x1n % 0x1n, 0x0n, 'The result of (0x1n % 0x1n) is 0x0n'); +assert.sameValue(0x1n % -0x1n, 0x0n, 'The result of (0x1n % -0x1n) is 0x0n'); +assert.sameValue(0x1n % -0x2n, 0x1n, 'The result of (0x1n % -0x2n) is 0x1n'); +assert.sameValue(0x1n % -0x3n, 0x1n, 'The result of (0x1n % -0x3n) is 0x1n'); +assert.sameValue(0x1n % -0x1234n, 0x1n, 'The result of (0x1n % -0x1234n) is 0x1n'); +assert.sameValue(0x1n % -0xFEDCBA97n, 0x1n, 'The result of (0x1n % -0xFEDCBA97n) is 0x1n'); +assert.sameValue(0x1n % -0xFEDCBA98n, 0x1n, 'The result of (0x1n % -0xFEDCBA98n) is 0x1n'); + +assert.sameValue( + 0x1n % -0xFEDCBA987654320Fn, + 0x1n, + 'The result of (0x1n % -0xFEDCBA987654320Fn) is 0x1n' +); + +assert.sameValue( + 0x1n % -0xFEDCBA9876543210n, + 0x1n, + 'The result of (0x1n % -0xFEDCBA9876543210n) is 0x1n' +); + +assert.sameValue( + -0x1n % 0xFEDCBA9876543210n, + -0x1n, + 'The result of (-0x1n % 0xFEDCBA9876543210n) is -0x1n' +); + +assert.sameValue( + -0x1n % 0xFEDCBA987654320Fn, + -0x1n, + 'The result of (-0x1n % 0xFEDCBA987654320Fn) is -0x1n' +); + +assert.sameValue(-0x1n % 0xFEDCBA98n, -0x1n, 'The result of (-0x1n % 0xFEDCBA98n) is -0x1n'); +assert.sameValue(-0x1n % 0xFEDCBA97n, -0x1n, 'The result of (-0x1n % 0xFEDCBA97n) is -0x1n'); +assert.sameValue(-0x1n % 0x1234n, -0x1n, 'The result of (-0x1n % 0x1234n) is -0x1n'); +assert.sameValue(-0x1n % 0x3n, -0x1n, 'The result of (-0x1n % 0x3n) is -0x1n'); +assert.sameValue(-0x1n % 0x2n, -0x1n, 'The result of (-0x1n % 0x2n) is -0x1n'); +assert.sameValue(-0x1n % 0x1n, 0x0n, 'The result of (-0x1n % 0x1n) is 0x0n'); +assert.sameValue(-0x1n % -0x1n, 0x0n, 'The result of (-0x1n % -0x1n) is 0x0n'); +assert.sameValue(-0x1n % -0x2n, -0x1n, 'The result of (-0x1n % -0x2n) is -0x1n'); +assert.sameValue(-0x1n % -0x3n, -0x1n, 'The result of (-0x1n % -0x3n) is -0x1n'); +assert.sameValue(-0x1n % -0x1234n, -0x1n, 'The result of (-0x1n % -0x1234n) is -0x1n'); +assert.sameValue(-0x1n % -0xFEDCBA97n, -0x1n, 'The result of (-0x1n % -0xFEDCBA97n) is -0x1n'); +assert.sameValue(-0x1n % -0xFEDCBA98n, -0x1n, 'The result of (-0x1n % -0xFEDCBA98n) is -0x1n'); + +assert.sameValue( + -0x1n % -0xFEDCBA987654320Fn, + -0x1n, + 'The result of (-0x1n % -0xFEDCBA987654320Fn) is -0x1n' +); + +assert.sameValue( + -0x1n % -0xFEDCBA9876543210n, + -0x1n, + 'The result of (-0x1n % -0xFEDCBA9876543210n) is -0x1n' +); + +assert.sameValue( + -0x2n % 0xFEDCBA9876543210n, + -0x2n, + 'The result of (-0x2n % 0xFEDCBA9876543210n) is -0x2n' +); + +assert.sameValue( + -0x2n % 0xFEDCBA987654320Fn, + -0x2n, + 'The result of (-0x2n % 0xFEDCBA987654320Fn) is -0x2n' +); + +assert.sameValue(-0x2n % 0xFEDCBA98n, -0x2n, 'The result of (-0x2n % 0xFEDCBA98n) is -0x2n'); +assert.sameValue(-0x2n % 0xFEDCBA97n, -0x2n, 'The result of (-0x2n % 0xFEDCBA97n) is -0x2n'); +assert.sameValue(-0x2n % 0x1234n, -0x2n, 'The result of (-0x2n % 0x1234n) is -0x2n'); +assert.sameValue(-0x2n % 0x3n, -0x2n, 'The result of (-0x2n % 0x3n) is -0x2n'); +assert.sameValue(-0x2n % 0x2n, 0x0n, 'The result of (-0x2n % 0x2n) is 0x0n'); +assert.sameValue(-0x2n % 0x1n, 0x0n, 'The result of (-0x2n % 0x1n) is 0x0n'); +assert.sameValue(-0x2n % -0x1n, 0x0n, 'The result of (-0x2n % -0x1n) is 0x0n'); +assert.sameValue(-0x2n % -0x2n, 0x0n, 'The result of (-0x2n % -0x2n) is 0x0n'); +assert.sameValue(-0x2n % -0x3n, -0x2n, 'The result of (-0x2n % -0x3n) is -0x2n'); +assert.sameValue(-0x2n % -0x1234n, -0x2n, 'The result of (-0x2n % -0x1234n) is -0x2n'); +assert.sameValue(-0x2n % -0xFEDCBA97n, -0x2n, 'The result of (-0x2n % -0xFEDCBA97n) is -0x2n'); +assert.sameValue(-0x2n % -0xFEDCBA98n, -0x2n, 'The result of (-0x2n % -0xFEDCBA98n) is -0x2n'); + +assert.sameValue( + -0x2n % -0xFEDCBA987654320Fn, + -0x2n, + 'The result of (-0x2n % -0xFEDCBA987654320Fn) is -0x2n' +); + +assert.sameValue( + -0x2n % -0xFEDCBA9876543210n, + -0x2n, + 'The result of (-0x2n % -0xFEDCBA9876543210n) is -0x2n' +); + +assert.sameValue( + -0x3n % 0xFEDCBA9876543210n, + -0x3n, + 'The result of (-0x3n % 0xFEDCBA9876543210n) is -0x3n' +); + +assert.sameValue( + -0x3n % 0xFEDCBA987654320Fn, + -0x3n, + 'The result of (-0x3n % 0xFEDCBA987654320Fn) is -0x3n' +); + +assert.sameValue(-0x3n % 0xFEDCBA98n, -0x3n, 'The result of (-0x3n % 0xFEDCBA98n) is -0x3n'); +assert.sameValue(-0x3n % 0xFEDCBA97n, -0x3n, 'The result of (-0x3n % 0xFEDCBA97n) is -0x3n'); +assert.sameValue(-0x3n % 0x1234n, -0x3n, 'The result of (-0x3n % 0x1234n) is -0x3n'); +assert.sameValue(-0x3n % 0x3n, 0x0n, 'The result of (-0x3n % 0x3n) is 0x0n'); +assert.sameValue(-0x3n % 0x2n, -0x1n, 'The result of (-0x3n % 0x2n) is -0x1n'); +assert.sameValue(-0x3n % 0x1n, 0x0n, 'The result of (-0x3n % 0x1n) is 0x0n'); +assert.sameValue(-0x3n % -0x1n, 0x0n, 'The result of (-0x3n % -0x1n) is 0x0n'); +assert.sameValue(-0x3n % -0x2n, -0x1n, 'The result of (-0x3n % -0x2n) is -0x1n'); +assert.sameValue(-0x3n % -0x3n, 0x0n, 'The result of (-0x3n % -0x3n) is 0x0n'); +assert.sameValue(-0x3n % -0x1234n, -0x3n, 'The result of (-0x3n % -0x1234n) is -0x3n'); +assert.sameValue(-0x3n % -0xFEDCBA97n, -0x3n, 'The result of (-0x3n % -0xFEDCBA97n) is -0x3n'); +assert.sameValue(-0x3n % -0xFEDCBA98n, -0x3n, 'The result of (-0x3n % -0xFEDCBA98n) is -0x3n'); + +assert.sameValue( + -0x3n % -0xFEDCBA987654320Fn, + -0x3n, + 'The result of (-0x3n % -0xFEDCBA987654320Fn) is -0x3n' +); + +assert.sameValue( + -0x3n % -0xFEDCBA9876543210n, + -0x3n, + 'The result of (-0x3n % -0xFEDCBA9876543210n) is -0x3n' +); + +assert.sameValue( + -0x1234n % 0xFEDCBA9876543210n, + -0x1234n, + 'The result of (-0x1234n % 0xFEDCBA9876543210n) is -0x1234n' +); + +assert.sameValue( + -0x1234n % 0xFEDCBA987654320Fn, + -0x1234n, + 'The result of (-0x1234n % 0xFEDCBA987654320Fn) is -0x1234n' +); + +assert.sameValue( + -0x1234n % 0xFEDCBA98n, + -0x1234n, + 'The result of (-0x1234n % 0xFEDCBA98n) is -0x1234n' +); + +assert.sameValue( + -0x1234n % 0xFEDCBA97n, + -0x1234n, + 'The result of (-0x1234n % 0xFEDCBA97n) is -0x1234n' +); + +assert.sameValue(-0x1234n % 0x1234n, 0x0n, 'The result of (-0x1234n % 0x1234n) is 0x0n'); +assert.sameValue(-0x1234n % 0x3n, -0x1n, 'The result of (-0x1234n % 0x3n) is -0x1n'); +assert.sameValue(-0x1234n % 0x2n, 0x0n, 'The result of (-0x1234n % 0x2n) is 0x0n'); +assert.sameValue(-0x1234n % 0x1n, 0x0n, 'The result of (-0x1234n % 0x1n) is 0x0n'); +assert.sameValue(-0x1234n % -0x1n, 0x0n, 'The result of (-0x1234n % -0x1n) is 0x0n'); +assert.sameValue(-0x1234n % -0x2n, 0x0n, 'The result of (-0x1234n % -0x2n) is 0x0n'); +assert.sameValue(-0x1234n % -0x3n, -0x1n, 'The result of (-0x1234n % -0x3n) is -0x1n'); +assert.sameValue(-0x1234n % -0x1234n, 0x0n, 'The result of (-0x1234n % -0x1234n) is 0x0n'); + +assert.sameValue( + -0x1234n % -0xFEDCBA97n, + -0x1234n, + 'The result of (-0x1234n % -0xFEDCBA97n) is -0x1234n' +); + +assert.sameValue( + -0x1234n % -0xFEDCBA98n, + -0x1234n, + 'The result of (-0x1234n % -0xFEDCBA98n) is -0x1234n' +); + +assert.sameValue( + -0x1234n % -0xFEDCBA987654320Fn, + -0x1234n, + 'The result of (-0x1234n % -0xFEDCBA987654320Fn) is -0x1234n' +); + +assert.sameValue( + -0x1234n % -0xFEDCBA9876543210n, + -0x1234n, + 'The result of (-0x1234n % -0xFEDCBA9876543210n) is -0x1234n' +); + +assert.sameValue( + -0xFEDCBA97n % 0xFEDCBA9876543210n, + -0xFEDCBA97n, + 'The result of (-0xFEDCBA97n % 0xFEDCBA9876543210n) is -0xFEDCBA97n' +); + +assert.sameValue( + -0xFEDCBA97n % 0xFEDCBA987654320Fn, + -0xFEDCBA97n, + 'The result of (-0xFEDCBA97n % 0xFEDCBA987654320Fn) is -0xFEDCBA97n' +); + +assert.sameValue( + -0xFEDCBA97n % 0xFEDCBA98n, + -0xFEDCBA97n, + 'The result of (-0xFEDCBA97n % 0xFEDCBA98n) is -0xFEDCBA97n' +); + +assert.sameValue( + -0xFEDCBA97n % 0xFEDCBA97n, + 0x0n, + 'The result of (-0xFEDCBA97n % 0xFEDCBA97n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA97n % 0x1234n, + -0x92Fn, + 'The result of (-0xFEDCBA97n % 0x1234n) is -0x92Fn' +); + +assert.sameValue(-0xFEDCBA97n % 0x3n, -0x1n, 'The result of (-0xFEDCBA97n % 0x3n) is -0x1n'); +assert.sameValue(-0xFEDCBA97n % 0x2n, -0x1n, 'The result of (-0xFEDCBA97n % 0x2n) is -0x1n'); +assert.sameValue(-0xFEDCBA97n % 0x1n, 0x0n, 'The result of (-0xFEDCBA97n % 0x1n) is 0x0n'); +assert.sameValue(-0xFEDCBA97n % -0x1n, 0x0n, 'The result of (-0xFEDCBA97n % -0x1n) is 0x0n'); +assert.sameValue(-0xFEDCBA97n % -0x2n, -0x1n, 'The result of (-0xFEDCBA97n % -0x2n) is -0x1n'); +assert.sameValue(-0xFEDCBA97n % -0x3n, -0x1n, 'The result of (-0xFEDCBA97n % -0x3n) is -0x1n'); + +assert.sameValue( + -0xFEDCBA97n % -0x1234n, + -0x92Fn, + 'The result of (-0xFEDCBA97n % -0x1234n) is -0x92Fn' +); + +assert.sameValue( + -0xFEDCBA97n % -0xFEDCBA97n, + 0x0n, + 'The result of (-0xFEDCBA97n % -0xFEDCBA97n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA97n % -0xFEDCBA98n, + -0xFEDCBA97n, + 'The result of (-0xFEDCBA97n % -0xFEDCBA98n) is -0xFEDCBA97n' +); + +assert.sameValue( + -0xFEDCBA97n % -0xFEDCBA987654320Fn, + -0xFEDCBA97n, + 'The result of (-0xFEDCBA97n % -0xFEDCBA987654320Fn) is -0xFEDCBA97n' +); + +assert.sameValue( + -0xFEDCBA97n % -0xFEDCBA9876543210n, + -0xFEDCBA97n, + 'The result of (-0xFEDCBA97n % -0xFEDCBA9876543210n) is -0xFEDCBA97n' +); + +assert.sameValue( + -0xFEDCBA98n % 0xFEDCBA9876543210n, + -0xFEDCBA98n, + 'The result of (-0xFEDCBA98n % 0xFEDCBA9876543210n) is -0xFEDCBA98n' +); + +assert.sameValue( + -0xFEDCBA98n % 0xFEDCBA987654320Fn, + -0xFEDCBA98n, + 'The result of (-0xFEDCBA98n % 0xFEDCBA987654320Fn) is -0xFEDCBA98n' +); + +assert.sameValue( + -0xFEDCBA98n % 0xFEDCBA98n, + 0x0n, + 'The result of (-0xFEDCBA98n % 0xFEDCBA98n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA98n % 0xFEDCBA97n, + -0x1n, + 'The result of (-0xFEDCBA98n % 0xFEDCBA97n) is -0x1n' +); + +assert.sameValue( + -0xFEDCBA98n % 0x1234n, + -0x930n, + 'The result of (-0xFEDCBA98n % 0x1234n) is -0x930n' +); + +assert.sameValue(-0xFEDCBA98n % 0x3n, -0x2n, 'The result of (-0xFEDCBA98n % 0x3n) is -0x2n'); +assert.sameValue(-0xFEDCBA98n % 0x2n, 0x0n, 'The result of (-0xFEDCBA98n % 0x2n) is 0x0n'); +assert.sameValue(-0xFEDCBA98n % 0x1n, 0x0n, 'The result of (-0xFEDCBA98n % 0x1n) is 0x0n'); +assert.sameValue(-0xFEDCBA98n % -0x1n, 0x0n, 'The result of (-0xFEDCBA98n % -0x1n) is 0x0n'); +assert.sameValue(-0xFEDCBA98n % -0x2n, 0x0n, 'The result of (-0xFEDCBA98n % -0x2n) is 0x0n'); +assert.sameValue(-0xFEDCBA98n % -0x3n, -0x2n, 'The result of (-0xFEDCBA98n % -0x3n) is -0x2n'); + +assert.sameValue( + -0xFEDCBA98n % -0x1234n, + -0x930n, + 'The result of (-0xFEDCBA98n % -0x1234n) is -0x930n' +); + +assert.sameValue( + -0xFEDCBA98n % -0xFEDCBA97n, + -0x1n, + 'The result of (-0xFEDCBA98n % -0xFEDCBA97n) is -0x1n' +); + +assert.sameValue( + -0xFEDCBA98n % -0xFEDCBA98n, + 0x0n, + 'The result of (-0xFEDCBA98n % -0xFEDCBA98n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA98n % -0xFEDCBA987654320Fn, + -0xFEDCBA98n, + 'The result of (-0xFEDCBA98n % -0xFEDCBA987654320Fn) is -0xFEDCBA98n' +); + +assert.sameValue( + -0xFEDCBA98n % -0xFEDCBA9876543210n, + -0xFEDCBA98n, + 'The result of (-0xFEDCBA98n % -0xFEDCBA9876543210n) is -0xFEDCBA98n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % 0xFEDCBA9876543210n, + -0xFEDCBA987654320Fn, + 'The result of (-0xFEDCBA987654320Fn % 0xFEDCBA9876543210n) is -0xFEDCBA987654320Fn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0xFEDCBA987654320Fn % 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % 0xFEDCBA98n, + -0x7654320Fn, + 'The result of (-0xFEDCBA987654320Fn % 0xFEDCBA98n) is -0x7654320Fn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % 0xFEDCBA97n, + -0x77777778n, + 'The result of (-0xFEDCBA987654320Fn % 0xFEDCBA97n) is -0x77777778n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % 0x1234n, + -0x95Fn, + 'The result of (-0xFEDCBA987654320Fn % 0x1234n) is -0x95Fn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % 0x3n, + -0x2n, + 'The result of (-0xFEDCBA987654320Fn % 0x3n) is -0x2n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % 0x2n, + -0x1n, + 'The result of (-0xFEDCBA987654320Fn % 0x2n) is -0x1n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % 0x1n, + 0x0n, + 'The result of (-0xFEDCBA987654320Fn % 0x1n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % -0x1n, + 0x0n, + 'The result of (-0xFEDCBA987654320Fn % -0x1n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % -0x2n, + -0x1n, + 'The result of (-0xFEDCBA987654320Fn % -0x2n) is -0x1n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % -0x3n, + -0x2n, + 'The result of (-0xFEDCBA987654320Fn % -0x3n) is -0x2n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % -0x1234n, + -0x95Fn, + 'The result of (-0xFEDCBA987654320Fn % -0x1234n) is -0x95Fn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % -0xFEDCBA97n, + -0x77777778n, + 'The result of (-0xFEDCBA987654320Fn % -0xFEDCBA97n) is -0x77777778n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % -0xFEDCBA98n, + -0x7654320Fn, + 'The result of (-0xFEDCBA987654320Fn % -0xFEDCBA98n) is -0x7654320Fn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0xFEDCBA987654320Fn % -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % -0xFEDCBA9876543210n, + -0xFEDCBA987654320Fn, + 'The result of (-0xFEDCBA987654320Fn % -0xFEDCBA9876543210n) is -0xFEDCBA987654320Fn' +); + +assert.sameValue( + -0xFEDCBA9876543210n % 0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0xFEDCBA9876543210n % 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA9876543210n % 0xFEDCBA987654320Fn, + -0x1n, + 'The result of (-0xFEDCBA9876543210n % 0xFEDCBA987654320Fn) is -0x1n' +); + +assert.sameValue( + -0xFEDCBA9876543210n % 0xFEDCBA98n, + -0x76543210n, + 'The result of (-0xFEDCBA9876543210n % 0xFEDCBA98n) is -0x76543210n' +); + +assert.sameValue( + -0xFEDCBA9876543210n % 0xFEDCBA97n, + -0x77777779n, + 'The result of (-0xFEDCBA9876543210n % 0xFEDCBA97n) is -0x77777779n' +); + +assert.sameValue( + -0xFEDCBA9876543210n % 0x1234n, + -0x960n, + 'The result of (-0xFEDCBA9876543210n % 0x1234n) is -0x960n' +); + +assert.sameValue( + -0xFEDCBA9876543210n % 0x3n, + 0x0n, + 'The result of (-0xFEDCBA9876543210n % 0x3n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA9876543210n % 0x2n, + 0x0n, + 'The result of (-0xFEDCBA9876543210n % 0x2n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA9876543210n % 0x1n, + 0x0n, + 'The result of (-0xFEDCBA9876543210n % 0x1n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA9876543210n % -0x1n, + 0x0n, + 'The result of (-0xFEDCBA9876543210n % -0x1n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA9876543210n % -0x2n, + 0x0n, + 'The result of (-0xFEDCBA9876543210n % -0x2n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA9876543210n % -0x3n, + 0x0n, + 'The result of (-0xFEDCBA9876543210n % -0x3n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA9876543210n % -0x1234n, + -0x960n, + 'The result of (-0xFEDCBA9876543210n % -0x1234n) is -0x960n' +); + +assert.sameValue( + -0xFEDCBA9876543210n % -0xFEDCBA97n, + -0x77777779n, + 'The result of (-0xFEDCBA9876543210n % -0xFEDCBA97n) is -0x77777779n' +); + +assert.sameValue( + -0xFEDCBA9876543210n % -0xFEDCBA98n, + -0x76543210n, + 'The result of (-0xFEDCBA9876543210n % -0xFEDCBA98n) is -0x76543210n' +); + +assert.sameValue( + -0xFEDCBA9876543210n % -0xFEDCBA987654320Fn, + -0x1n, + 'The result of (-0xFEDCBA9876543210n % -0xFEDCBA987654320Fn) is -0x1n' +); -function testMod(x, y, z) { - assert.sameValue(x % y, z, x + " % " + y + " = " + z); -} - -testMod(0xFEDCBA9876543210n, 0xFEDCBA9876543210n, 0x0n); -testMod(0xFEDCBA9876543210n, 0xFEDCBA987654320Fn, 0x1n); -testMod(0xFEDCBA9876543210n, 0xFEDCBA98n, 0x76543210n); -testMod(0xFEDCBA9876543210n, 0xFEDCBA97n, 0x77777779n); -testMod(0xFEDCBA9876543210n, 0x1234n, 0x960n); -testMod(0xFEDCBA9876543210n, 0x3n, 0x0n); -testMod(0xFEDCBA9876543210n, 0x2n, 0x0n); -testMod(0xFEDCBA9876543210n, 0x1n, 0x0n); -testMod(0xFEDCBA9876543210n, -0x1n, 0x0n); -testMod(0xFEDCBA9876543210n, -0x2n, 0x0n); -testMod(0xFEDCBA9876543210n, -0x3n, 0x0n); -testMod(0xFEDCBA9876543210n, -0x1234n, 0x960n); -testMod(0xFEDCBA9876543210n, -0xFEDCBA97n, 0x77777779n); -testMod(0xFEDCBA9876543210n, -0xFEDCBA98n, 0x76543210n); -testMod(0xFEDCBA9876543210n, -0xFEDCBA987654320Fn, 0x1n); -testMod(0xFEDCBA9876543210n, -0xFEDCBA9876543210n, 0x0n); -testMod(0xFEDCBA987654320Fn, 0xFEDCBA9876543210n, 0xFEDCBA987654320Fn); -testMod(0xFEDCBA987654320Fn, 0xFEDCBA987654320Fn, 0x0n); -testMod(0xFEDCBA987654320Fn, 0xFEDCBA98n, 0x7654320Fn); -testMod(0xFEDCBA987654320Fn, 0xFEDCBA97n, 0x77777778n); -testMod(0xFEDCBA987654320Fn, 0x1234n, 0x95Fn); -testMod(0xFEDCBA987654320Fn, 0x3n, 0x2n); -testMod(0xFEDCBA987654320Fn, 0x2n, 0x1n); -testMod(0xFEDCBA987654320Fn, 0x1n, 0x0n); -testMod(0xFEDCBA987654320Fn, -0x1n, 0x0n); -testMod(0xFEDCBA987654320Fn, -0x2n, 0x1n); -testMod(0xFEDCBA987654320Fn, -0x3n, 0x2n); -testMod(0xFEDCBA987654320Fn, -0x1234n, 0x95Fn); -testMod(0xFEDCBA987654320Fn, -0xFEDCBA97n, 0x77777778n); -testMod(0xFEDCBA987654320Fn, -0xFEDCBA98n, 0x7654320Fn); -testMod(0xFEDCBA987654320Fn, -0xFEDCBA987654320Fn, 0x0n); -testMod(0xFEDCBA987654320Fn, -0xFEDCBA9876543210n, 0xFEDCBA987654320Fn); -testMod(0xFEDCBA98n, 0xFEDCBA9876543210n, 0xFEDCBA98n); -testMod(0xFEDCBA98n, 0xFEDCBA987654320Fn, 0xFEDCBA98n); -testMod(0xFEDCBA98n, 0xFEDCBA98n, 0x0n); -testMod(0xFEDCBA98n, 0xFEDCBA97n, 0x1n); -testMod(0xFEDCBA98n, 0x1234n, 0x930n); -testMod(0xFEDCBA98n, 0x3n, 0x2n); -testMod(0xFEDCBA98n, 0x2n, 0x0n); -testMod(0xFEDCBA98n, 0x1n, 0x0n); -testMod(0xFEDCBA98n, -0x1n, 0x0n); -testMod(0xFEDCBA98n, -0x2n, 0x0n); -testMod(0xFEDCBA98n, -0x3n, 0x2n); -testMod(0xFEDCBA98n, -0x1234n, 0x930n); -testMod(0xFEDCBA98n, -0xFEDCBA97n, 0x1n); -testMod(0xFEDCBA98n, -0xFEDCBA98n, 0x0n); -testMod(0xFEDCBA98n, -0xFEDCBA987654320Fn, 0xFEDCBA98n); -testMod(0xFEDCBA98n, -0xFEDCBA9876543210n, 0xFEDCBA98n); -testMod(0xFEDCBA97n, 0xFEDCBA9876543210n, 0xFEDCBA97n); -testMod(0xFEDCBA97n, 0xFEDCBA987654320Fn, 0xFEDCBA97n); -testMod(0xFEDCBA97n, 0xFEDCBA98n, 0xFEDCBA97n); -testMod(0xFEDCBA97n, 0xFEDCBA97n, 0x0n); -testMod(0xFEDCBA97n, 0x1234n, 0x92Fn); -testMod(0xFEDCBA97n, 0x3n, 0x1n); -testMod(0xFEDCBA97n, 0x2n, 0x1n); -testMod(0xFEDCBA97n, 0x1n, 0x0n); -testMod(0xFEDCBA97n, -0x1n, 0x0n); -testMod(0xFEDCBA97n, -0x2n, 0x1n); -testMod(0xFEDCBA97n, -0x3n, 0x1n); -testMod(0xFEDCBA97n, -0x1234n, 0x92Fn); -testMod(0xFEDCBA97n, -0xFEDCBA97n, 0x0n); -testMod(0xFEDCBA97n, -0xFEDCBA98n, 0xFEDCBA97n); -testMod(0xFEDCBA97n, -0xFEDCBA987654320Fn, 0xFEDCBA97n); -testMod(0xFEDCBA97n, -0xFEDCBA9876543210n, 0xFEDCBA97n); -testMod(0x1234n, 0xFEDCBA9876543210n, 0x1234n); -testMod(0x1234n, 0xFEDCBA987654320Fn, 0x1234n); -testMod(0x1234n, 0xFEDCBA98n, 0x1234n); -testMod(0x1234n, 0xFEDCBA97n, 0x1234n); -testMod(0x1234n, 0x1234n, 0x0n); -testMod(0x1234n, 0x3n, 0x1n); -testMod(0x1234n, 0x2n, 0x0n); -testMod(0x1234n, 0x1n, 0x0n); -testMod(0x1234n, -0x1n, 0x0n); -testMod(0x1234n, -0x2n, 0x0n); -testMod(0x1234n, -0x3n, 0x1n); -testMod(0x1234n, -0x1234n, 0x0n); -testMod(0x1234n, -0xFEDCBA97n, 0x1234n); -testMod(0x1234n, -0xFEDCBA98n, 0x1234n); -testMod(0x1234n, -0xFEDCBA987654320Fn, 0x1234n); -testMod(0x1234n, -0xFEDCBA9876543210n, 0x1234n); -testMod(0x3n, 0xFEDCBA9876543210n, 0x3n); -testMod(0x3n, 0xFEDCBA987654320Fn, 0x3n); -testMod(0x3n, 0xFEDCBA98n, 0x3n); -testMod(0x3n, 0xFEDCBA97n, 0x3n); -testMod(0x3n, 0x1234n, 0x3n); -testMod(0x3n, 0x3n, 0x0n); -testMod(0x3n, 0x2n, 0x1n); -testMod(0x3n, 0x1n, 0x0n); -testMod(0x3n, -0x1n, 0x0n); -testMod(0x3n, -0x2n, 0x1n); -testMod(0x3n, -0x3n, 0x0n); -testMod(0x3n, -0x1234n, 0x3n); -testMod(0x3n, -0xFEDCBA97n, 0x3n); -testMod(0x3n, -0xFEDCBA98n, 0x3n); -testMod(0x3n, -0xFEDCBA987654320Fn, 0x3n); -testMod(0x3n, -0xFEDCBA9876543210n, 0x3n); -testMod(0x2n, 0xFEDCBA9876543210n, 0x2n); -testMod(0x2n, 0xFEDCBA987654320Fn, 0x2n); -testMod(0x2n, 0xFEDCBA98n, 0x2n); -testMod(0x2n, 0xFEDCBA97n, 0x2n); -testMod(0x2n, 0x1234n, 0x2n); -testMod(0x2n, 0x3n, 0x2n); -testMod(0x2n, 0x2n, 0x0n); -testMod(0x2n, 0x1n, 0x0n); -testMod(0x2n, -0x1n, 0x0n); -testMod(0x2n, -0x2n, 0x0n); -testMod(0x2n, -0x3n, 0x2n); -testMod(0x2n, -0x1234n, 0x2n); -testMod(0x2n, -0xFEDCBA97n, 0x2n); -testMod(0x2n, -0xFEDCBA98n, 0x2n); -testMod(0x2n, -0xFEDCBA987654320Fn, 0x2n); -testMod(0x2n, -0xFEDCBA9876543210n, 0x2n); -testMod(0x1n, 0xFEDCBA9876543210n, 0x1n); -testMod(0x1n, 0xFEDCBA987654320Fn, 0x1n); -testMod(0x1n, 0xFEDCBA98n, 0x1n); -testMod(0x1n, 0xFEDCBA97n, 0x1n); -testMod(0x1n, 0x1234n, 0x1n); -testMod(0x1n, 0x3n, 0x1n); -testMod(0x1n, 0x2n, 0x1n); -testMod(0x1n, 0x1n, 0x0n); -testMod(0x1n, -0x1n, 0x0n); -testMod(0x1n, -0x2n, 0x1n); -testMod(0x1n, -0x3n, 0x1n); -testMod(0x1n, -0x1234n, 0x1n); -testMod(0x1n, -0xFEDCBA97n, 0x1n); -testMod(0x1n, -0xFEDCBA98n, 0x1n); -testMod(0x1n, -0xFEDCBA987654320Fn, 0x1n); -testMod(0x1n, -0xFEDCBA9876543210n, 0x1n); -testMod(-0x1n, 0xFEDCBA9876543210n, -0x1n); -testMod(-0x1n, 0xFEDCBA987654320Fn, -0x1n); -testMod(-0x1n, 0xFEDCBA98n, -0x1n); -testMod(-0x1n, 0xFEDCBA97n, -0x1n); -testMod(-0x1n, 0x1234n, -0x1n); -testMod(-0x1n, 0x3n, -0x1n); -testMod(-0x1n, 0x2n, -0x1n); -testMod(-0x1n, 0x1n, 0x0n); -testMod(-0x1n, -0x1n, 0x0n); -testMod(-0x1n, -0x2n, -0x1n); -testMod(-0x1n, -0x3n, -0x1n); -testMod(-0x1n, -0x1234n, -0x1n); -testMod(-0x1n, -0xFEDCBA97n, -0x1n); -testMod(-0x1n, -0xFEDCBA98n, -0x1n); -testMod(-0x1n, -0xFEDCBA987654320Fn, -0x1n); -testMod(-0x1n, -0xFEDCBA9876543210n, -0x1n); -testMod(-0x2n, 0xFEDCBA9876543210n, -0x2n); -testMod(-0x2n, 0xFEDCBA987654320Fn, -0x2n); -testMod(-0x2n, 0xFEDCBA98n, -0x2n); -testMod(-0x2n, 0xFEDCBA97n, -0x2n); -testMod(-0x2n, 0x1234n, -0x2n); -testMod(-0x2n, 0x3n, -0x2n); -testMod(-0x2n, 0x2n, 0x0n); -testMod(-0x2n, 0x1n, 0x0n); -testMod(-0x2n, -0x1n, 0x0n); -testMod(-0x2n, -0x2n, 0x0n); -testMod(-0x2n, -0x3n, -0x2n); -testMod(-0x2n, -0x1234n, -0x2n); -testMod(-0x2n, -0xFEDCBA97n, -0x2n); -testMod(-0x2n, -0xFEDCBA98n, -0x2n); -testMod(-0x2n, -0xFEDCBA987654320Fn, -0x2n); -testMod(-0x2n, -0xFEDCBA9876543210n, -0x2n); -testMod(-0x3n, 0xFEDCBA9876543210n, -0x3n); -testMod(-0x3n, 0xFEDCBA987654320Fn, -0x3n); -testMod(-0x3n, 0xFEDCBA98n, -0x3n); -testMod(-0x3n, 0xFEDCBA97n, -0x3n); -testMod(-0x3n, 0x1234n, -0x3n); -testMod(-0x3n, 0x3n, 0x0n); -testMod(-0x3n, 0x2n, -0x1n); -testMod(-0x3n, 0x1n, 0x0n); -testMod(-0x3n, -0x1n, 0x0n); -testMod(-0x3n, -0x2n, -0x1n); -testMod(-0x3n, -0x3n, 0x0n); -testMod(-0x3n, -0x1234n, -0x3n); -testMod(-0x3n, -0xFEDCBA97n, -0x3n); -testMod(-0x3n, -0xFEDCBA98n, -0x3n); -testMod(-0x3n, -0xFEDCBA987654320Fn, -0x3n); -testMod(-0x3n, -0xFEDCBA9876543210n, -0x3n); -testMod(-0x1234n, 0xFEDCBA9876543210n, -0x1234n); -testMod(-0x1234n, 0xFEDCBA987654320Fn, -0x1234n); -testMod(-0x1234n, 0xFEDCBA98n, -0x1234n); -testMod(-0x1234n, 0xFEDCBA97n, -0x1234n); -testMod(-0x1234n, 0x1234n, 0x0n); -testMod(-0x1234n, 0x3n, -0x1n); -testMod(-0x1234n, 0x2n, 0x0n); -testMod(-0x1234n, 0x1n, 0x0n); -testMod(-0x1234n, -0x1n, 0x0n); -testMod(-0x1234n, -0x2n, 0x0n); -testMod(-0x1234n, -0x3n, -0x1n); -testMod(-0x1234n, -0x1234n, 0x0n); -testMod(-0x1234n, -0xFEDCBA97n, -0x1234n); -testMod(-0x1234n, -0xFEDCBA98n, -0x1234n); -testMod(-0x1234n, -0xFEDCBA987654320Fn, -0x1234n); -testMod(-0x1234n, -0xFEDCBA9876543210n, -0x1234n); -testMod(-0xFEDCBA97n, 0xFEDCBA9876543210n, -0xFEDCBA97n); -testMod(-0xFEDCBA97n, 0xFEDCBA987654320Fn, -0xFEDCBA97n); -testMod(-0xFEDCBA97n, 0xFEDCBA98n, -0xFEDCBA97n); -testMod(-0xFEDCBA97n, 0xFEDCBA97n, 0x0n); -testMod(-0xFEDCBA97n, 0x1234n, -0x92Fn); -testMod(-0xFEDCBA97n, 0x3n, -0x1n); -testMod(-0xFEDCBA97n, 0x2n, -0x1n); -testMod(-0xFEDCBA97n, 0x1n, 0x0n); -testMod(-0xFEDCBA97n, -0x1n, 0x0n); -testMod(-0xFEDCBA97n, -0x2n, -0x1n); -testMod(-0xFEDCBA97n, -0x3n, -0x1n); -testMod(-0xFEDCBA97n, -0x1234n, -0x92Fn); -testMod(-0xFEDCBA97n, -0xFEDCBA97n, 0x0n); -testMod(-0xFEDCBA97n, -0xFEDCBA98n, -0xFEDCBA97n); -testMod(-0xFEDCBA97n, -0xFEDCBA987654320Fn, -0xFEDCBA97n); -testMod(-0xFEDCBA97n, -0xFEDCBA9876543210n, -0xFEDCBA97n); -testMod(-0xFEDCBA98n, 0xFEDCBA9876543210n, -0xFEDCBA98n); -testMod(-0xFEDCBA98n, 0xFEDCBA987654320Fn, -0xFEDCBA98n); -testMod(-0xFEDCBA98n, 0xFEDCBA98n, 0x0n); -testMod(-0xFEDCBA98n, 0xFEDCBA97n, -0x1n); -testMod(-0xFEDCBA98n, 0x1234n, -0x930n); -testMod(-0xFEDCBA98n, 0x3n, -0x2n); -testMod(-0xFEDCBA98n, 0x2n, 0x0n); -testMod(-0xFEDCBA98n, 0x1n, 0x0n); -testMod(-0xFEDCBA98n, -0x1n, 0x0n); -testMod(-0xFEDCBA98n, -0x2n, 0x0n); -testMod(-0xFEDCBA98n, -0x3n, -0x2n); -testMod(-0xFEDCBA98n, -0x1234n, -0x930n); -testMod(-0xFEDCBA98n, -0xFEDCBA97n, -0x1n); -testMod(-0xFEDCBA98n, -0xFEDCBA98n, 0x0n); -testMod(-0xFEDCBA98n, -0xFEDCBA987654320Fn, -0xFEDCBA98n); -testMod(-0xFEDCBA98n, -0xFEDCBA9876543210n, -0xFEDCBA98n); -testMod(-0xFEDCBA987654320Fn, 0xFEDCBA9876543210n, -0xFEDCBA987654320Fn); -testMod(-0xFEDCBA987654320Fn, 0xFEDCBA987654320Fn, 0x0n); -testMod(-0xFEDCBA987654320Fn, 0xFEDCBA98n, -0x7654320Fn); -testMod(-0xFEDCBA987654320Fn, 0xFEDCBA97n, -0x77777778n); -testMod(-0xFEDCBA987654320Fn, 0x1234n, -0x95Fn); -testMod(-0xFEDCBA987654320Fn, 0x3n, -0x2n); -testMod(-0xFEDCBA987654320Fn, 0x2n, -0x1n); -testMod(-0xFEDCBA987654320Fn, 0x1n, 0x0n); -testMod(-0xFEDCBA987654320Fn, -0x1n, 0x0n); -testMod(-0xFEDCBA987654320Fn, -0x2n, -0x1n); -testMod(-0xFEDCBA987654320Fn, -0x3n, -0x2n); -testMod(-0xFEDCBA987654320Fn, -0x1234n, -0x95Fn); -testMod(-0xFEDCBA987654320Fn, -0xFEDCBA97n, -0x77777778n); -testMod(-0xFEDCBA987654320Fn, -0xFEDCBA98n, -0x7654320Fn); -testMod(-0xFEDCBA987654320Fn, -0xFEDCBA987654320Fn, 0x0n); -testMod(-0xFEDCBA987654320Fn, -0xFEDCBA9876543210n, -0xFEDCBA987654320Fn); -testMod(-0xFEDCBA9876543210n, 0xFEDCBA9876543210n, 0x0n); -testMod(-0xFEDCBA9876543210n, 0xFEDCBA987654320Fn, -0x1n); -testMod(-0xFEDCBA9876543210n, 0xFEDCBA98n, -0x76543210n); -testMod(-0xFEDCBA9876543210n, 0xFEDCBA97n, -0x77777779n); -testMod(-0xFEDCBA9876543210n, 0x1234n, -0x960n); -testMod(-0xFEDCBA9876543210n, 0x3n, 0x0n); -testMod(-0xFEDCBA9876543210n, 0x2n, 0x0n); -testMod(-0xFEDCBA9876543210n, 0x1n, 0x0n); -testMod(-0xFEDCBA9876543210n, -0x1n, 0x0n); -testMod(-0xFEDCBA9876543210n, -0x2n, 0x0n); -testMod(-0xFEDCBA9876543210n, -0x3n, 0x0n); -testMod(-0xFEDCBA9876543210n, -0x1234n, -0x960n); -testMod(-0xFEDCBA9876543210n, -0xFEDCBA97n, -0x77777779n); -testMod(-0xFEDCBA9876543210n, -0xFEDCBA98n, -0x76543210n); -testMod(-0xFEDCBA9876543210n, -0xFEDCBA987654320Fn, -0x1n); -testMod(-0xFEDCBA9876543210n, -0xFEDCBA9876543210n, 0x0n); +assert.sameValue( + -0xFEDCBA9876543210n % -0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0xFEDCBA9876543210n % -0xFEDCBA9876543210n) is 0x0n' +); \ No newline at end of file diff --git a/test/language/expressions/modulus/bigint-errors.js b/test/language/expressions/modulus/bigint-errors.js index ec59400418554e7687cb1cfc58eed48c8d8ac23a..5b986028319ffb35840d04447312f30d32c22898 100644 --- a/test/language/expressions/modulus/bigint-errors.js +++ b/test/language/expressions/modulus/bigint-errors.js @@ -5,58 +5,66 @@ description: modulus operator ToNumeric with BigInt operands esid: sec-multiplicative-operators-runtime-semantics-evaluation features: [BigInt, Symbol, Symbol.toPrimitive, computed-property-names] ---*/ - assert.throws(TypeError, function() { - Symbol("1") % 1n; -}, "ToBigInt: Symbol => TypeError"); + Symbol('1') % 1n; +}, 'Symbol("1") % 1n throws TypeError'); + assert.throws(TypeError, function() { - 0n % Symbol("1"); -}, "ToBigInt: Symbol => TypeError"); + 0n % Symbol('1'); +}, '0n % Symbol("1") throws TypeError'); + assert.throws(TypeError, function() { - Object(Symbol("1")) % 1n; -}, "ToBigInt: unbox object with internal slot => Symbol => TypeError"); + Object(Symbol('1')) % 1n; +}, 'Object(Symbol("1")) % 1n throws TypeError'); + assert.throws(TypeError, function() { - 0n % Object(Symbol("1")); -}, "ToBigInt: unbox object with internal slot => Symbol => TypeError"); + 0n % Object(Symbol('1')); +}, '0n % Object(Symbol("1")) throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { - return Symbol("1"); + return Symbol('1'); } }) % 1n; -}, "ToBigInt: @@toPrimitive => Symbol => TypeError"); +}, '({[Symbol.toPrimitive]: function() {return Symbol("1");}}) % 1n throws TypeError'); + assert.throws(TypeError, function() { 0n % { [Symbol.toPrimitive]: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: @@toPrimitive => Symbol => TypeError"); +}, '0n % {[Symbol.toPrimitive]: function() {return Symbol("1");}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { - return Symbol("1"); + return Symbol('1'); } }) % 1n; -}, "ToBigInt: valueOf => Symbol => TypeError"); +}, '({valueOf: function() {return Symbol("1");}}) % 1n throws TypeError'); + assert.throws(TypeError, function() { 0n % { valueOf: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: valueOf => Symbol => TypeError"); +}, '0n % {valueOf: function() {return Symbol("1");}} throws TypeError'); + assert.throws(TypeError, function() { ({ toString: function() { - return Symbol("1"); + return Symbol('1'); } }) % 1n; -}, "ToBigInt: toString => Symbol => TypeError"); +}, '({toString: function() {return Symbol("1");}}) % 1n throws TypeError'); + assert.throws(TypeError, function() { 0n % { toString: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: toString => Symbol => TypeError"); +}, '0n % {toString: function() {return Symbol("1");}} throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/modulus/bigint-modulo-zero.js b/test/language/expressions/modulus/bigint-modulo-zero.js index b309a7e676d066a97518c685c44ef0550583567e..40000b95a33876c87fcd9487189ab3003e846fdf 100644 --- a/test/language/expressions/modulus/bigint-modulo-zero.js +++ b/test/language/expressions/modulus/bigint-modulo-zero.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Robin Templeton. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: BigInt modulo 0 throws a range error esid: sec-multiplicative-operators-runtime-semantics-evaluation @@ -19,19 +18,18 @@ info: | 2. Return the BigInt representing x modulo y. features: [BigInt] ---*/ - assert.throws(RangeError, function() { - 1n % 0n -}); + 1n % 0n; +}, '1n % 0n throws RangeError'); assert.throws(RangeError, function() { - 10n % 0n -}); + 10n % 0n; +}, '10n % 0n throws RangeError'); assert.throws(RangeError, function() { - 0n % 0n -}); + 0n % 0n; +}, '0n % 0n throws RangeError'); assert.throws(RangeError, function() { - 1000000000000000000n % 0n -}); + 1000000000000000000n % 0n; +}, '1000000000000000000n % 0n throws RangeError'); \ No newline at end of file diff --git a/test/language/expressions/modulus/bigint-toprimitive.js b/test/language/expressions/modulus/bigint-toprimitive.js index 00c7cd611048329b752d8db424cab2ed6a1d9d62..1bbc67e8ae36a8debf321bab72d839fafd256f70 100644 --- a/test/language/expressions/modulus/bigint-toprimitive.js +++ b/test/language/expressions/modulus/bigint-toprimitive.js @@ -5,304 +5,368 @@ description: modulus operator ToNumeric with BigInt operands esid: sec-multiplicative-operators-runtime-semantics-evaluation features: [BigInt, Symbol.toPrimitive, computed-property-names] ---*/ - function err() { throw new Test262Error(); } function MyError() {} -assert.sameValue(({ +assert.sameValue({ [Symbol.toPrimitive]: function() { return 2n; }, + valueOf: err, toString: err -}) % 2n, 0n, "ToPrimitive: @@toPrimitive takes precedence"); +} % 2n, 0n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) % 2n) is 0n'); + assert.sameValue(2n % { [Symbol.toPrimitive]: function() { return 2n; }, + valueOf: err, toString: err -}, 0n, "ToPrimitive: @@toPrimitive takes precedence"); -assert.sameValue(({ +}, 0n, 'The result of (2n % {[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) is 0n'); + +assert.sameValue({ valueOf: function() { return 2n; }, + toString: err -}) % 2n, 0n, "ToPrimitive: valueOf takes precedence over toString"); +} % 2n, 0n, 'The result of (({valueOf: function() {return 2n;}, toString: err}) % 2n) is 0n'); + assert.sameValue(2n % { valueOf: function() { return 2n; }, + toString: err -}, 0n, "ToPrimitive: valueOf takes precedence over toString"); -assert.sameValue(({ +}, 0n, 'The result of (2n % {valueOf: function() {return 2n;}, toString: err}) is 0n'); + +assert.sameValue({ toString: function() { return 2n; } -}) % 2n, 0n, "ToPrimitive: toString with no valueOf"); +} % 2n, 0n, 'The result of (({toString: function() {return 2n;}}) % 2n) is 0n'); + assert.sameValue(2n % { toString: function() { return 2n; } -}, 0n, "ToPrimitive: toString with no valueOf"); -assert.sameValue(({ +}, 0n, 'The result of (2n % {toString: function() {return 2n;}}) is 0n'); + +assert.sameValue({ [Symbol.toPrimitive]: undefined, + valueOf: function() { return 2n; } -}) % 2n, 0n, "ToPrimitive: skip @@toPrimitive when it's undefined"); +} % 2n, 0n, 'The result of (({[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) % 2n) is 0n'); + assert.sameValue(2n % { [Symbol.toPrimitive]: undefined, + valueOf: function() { return 2n; } -}, 0n, "ToPrimitive: skip @@toPrimitive when it's undefined"); -assert.sameValue(({ +}, 0n, 'The result of (2n % {[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) is 0n'); + +assert.sameValue({ [Symbol.toPrimitive]: null, + valueOf: function() { return 2n; } -}) % 2n, 0n, "ToPrimitive: skip @@toPrimitive when it's null"); +} % 2n, 0n, 'The result of (({[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) % 2n) is 0n'); + assert.sameValue(2n % { [Symbol.toPrimitive]: null, + valueOf: function() { return 2n; } -}, 0n, "ToPrimitive: skip @@toPrimitive when it's null"); -assert.sameValue(({ +}, 0n, 'The result of (2n % {[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) is 0n'); + +assert.sameValue({ valueOf: null, + toString: function() { return 2n; } -}) % 2n, 0n, "ToPrimitive: skip valueOf when it's not callable"); +} % 2n, 0n, 'The result of (({valueOf: null, toString: function() {return 2n;}}) % 2n) is 0n'); + assert.sameValue(2n % { valueOf: null, + toString: function() { return 2n; } -}, 0n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 0n, 'The result of (2n % {valueOf: null, toString: function() {return 2n;}}) is 0n'); + +assert.sameValue({ valueOf: 1, + toString: function() { return 2n; } -}) % 2n, 0n, "ToPrimitive: skip valueOf when it's not callable"); +} % 2n, 0n, 'The result of (({valueOf: 1, toString: function() {return 2n;}}) % 2n) is 0n'); + assert.sameValue(2n % { valueOf: 1, + toString: function() { return 2n; } -}, 0n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 0n, 'The result of (2n % {valueOf: 1, toString: function() {return 2n;}}) is 0n'); + +assert.sameValue({ valueOf: {}, + toString: function() { return 2n; } -}) % 2n, 0n, "ToPrimitive: skip valueOf when it's not callable"); +} % 2n, 0n, 'The result of (({valueOf: {}, toString: function() {return 2n;}}) % 2n) is 0n'); + assert.sameValue(2n % { valueOf: {}, + toString: function() { return 2n; } -}, 0n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 0n, 'The result of (2n % {valueOf: {}, toString: function() {return 2n;}}) is 0n'); + +assert.sameValue({ valueOf: function() { return {}; }, + toString: function() { return 2n; } -}) % 2n, 0n, "ToPrimitive: skip valueOf when it returns an object"); +} % 2n, 0n, 'The result of (({valueOf: function() {return {};}, toString: function() {return 2n;}}) % 2n) is 0n'); + assert.sameValue(2n % { valueOf: function() { return {}; }, + toString: function() { return 2n; } -}, 0n, "ToPrimitive: skip valueOf when it returns an object"); -assert.sameValue(({ +}, 0n, 'The result of (2n % {valueOf: function() {return {};}, toString: function() {return 2n;}}) is 0n'); + +assert.sameValue({ valueOf: function() { return Object(12345); }, + toString: function() { return 2n; } -}) % 2n, 0n, "ToPrimitive: skip valueOf when it returns an object"); +} % 2n, 0n, 'The result of (({valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) % 2n) is 0n'); + assert.sameValue(2n % { valueOf: function() { return Object(12345); }, + toString: function() { return 2n; } -}, 0n, "ToPrimitive: skip valueOf when it returns an object"); +}, 0n, 'The result of (2n % {valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) is 0n'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: 1 }) % 1n; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '({[Symbol.toPrimitive]: 1}) % 1n throws TypeError'); + assert.throws(TypeError, function() { 0n % { [Symbol.toPrimitive]: 1 }; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '0n % {[Symbol.toPrimitive]: 1} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: {} }) % 1n; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '({[Symbol.toPrimitive]: {}}) % 1n throws TypeError'); + assert.throws(TypeError, function() { 0n % { [Symbol.toPrimitive]: {} }; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '0n % {[Symbol.toPrimitive]: {}} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { return Object(1); } }) % 1n; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '({[Symbol.toPrimitive]: function() {return Object(1);}}) % 1n throws TypeError'); + assert.throws(TypeError, function() { 0n % { [Symbol.toPrimitive]: function() { return Object(1); } }; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '0n % {[Symbol.toPrimitive]: function() {return Object(1);}} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { return {}; } }) % 1n; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '({[Symbol.toPrimitive]: function() {return {};}}) % 1n throws TypeError'); + assert.throws(TypeError, function() { 0n % { [Symbol.toPrimitive]: function() { return {}; } }; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '0n % {[Symbol.toPrimitive]: function() {return {};}} throws TypeError'); + assert.throws(MyError, function() { ({ [Symbol.toPrimitive]: function() { throw new MyError(); } }) % 1n; -}, "ToPrimitive: propagate errors from @@toPrimitive"); +}, '({[Symbol.toPrimitive]: function() {throw new MyError();}}) % 1n throws MyError'); + assert.throws(MyError, function() { 0n % { [Symbol.toPrimitive]: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from @@toPrimitive"); +}, '0n % {[Symbol.toPrimitive]: function() {throw new MyError();}} throws MyError'); + assert.throws(MyError, function() { ({ valueOf: function() { throw new MyError(); } }) % 1n; -}, "ToPrimitive: propagate errors from valueOf"); +}, '({valueOf: function() {throw new MyError();}}) % 1n throws MyError'); + assert.throws(MyError, function() { 0n % { valueOf: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from valueOf"); +}, '0n % {valueOf: function() {throw new MyError();}} throws MyError'); + assert.throws(MyError, function() { ({ toString: function() { throw new MyError(); } }) % 1n; -}, "ToPrimitive: propagate errors from toString"); +}, '({toString: function() {throw new MyError();}}) % 1n throws MyError'); + assert.throws(MyError, function() { 0n % { toString: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from toString"); +}, '0n % {toString: function() {throw new MyError();}} throws MyError'); + assert.throws(TypeError, function() { ({ valueOf: null, toString: null }) % 1n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: null, toString: null}) % 1n throws TypeError'); + assert.throws(TypeError, function() { 0n % { valueOf: null, toString: null }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n % {valueOf: null, toString: null} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: 1, toString: 1 }) % 1n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: 1, toString: 1}) % 1n throws TypeError'); + assert.throws(TypeError, function() { 0n % { valueOf: 1, toString: 1 }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n % {valueOf: 1, toString: 1} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: {}, toString: {} }) % 1n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: {}, toString: {}}) % 1n throws TypeError'); + assert.throws(TypeError, function() { 0n % { valueOf: {}, toString: {} }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n % {valueOf: {}, toString: {}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { return Object(1); }, + toString: function() { return Object(1); } }) % 1n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: function() {return Object(1);}, toString: function() {return Object(1);}}) % 1n throws TypeError'); + assert.throws(TypeError, function() { 0n % { valueOf: function() { return Object(1); }, + toString: function() { return Object(1); } }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n % {valueOf: function() {return Object(1);}, toString: function() {return Object(1);}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { return {}; }, + toString: function() { return {}; } }) % 1n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: function() {return {};}, toString: function() {return {};}}) % 1n throws TypeError'); + assert.throws(TypeError, function() { 0n % { valueOf: function() { return {}; }, + toString: function() { return {}; } }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n % {valueOf: function() {return {};}, toString: function() {return {};}} throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/modulus/bigint-wrapped-values.js b/test/language/expressions/modulus/bigint-wrapped-values.js index 474e7f43c738510054fdcdf30de21780bcaced47..eeb1c38c4632734242dc484c6a93d0310d346434 100644 --- a/test/language/expressions/modulus/bigint-wrapped-values.js +++ b/test/language/expressions/modulus/bigint-wrapped-values.js @@ -5,36 +5,41 @@ description: modulus operator ToNumeric with BigInt operands esid: sec-multiplicative-operators-runtime-semantics-evaluation features: [BigInt, Symbol.toPrimitive, computed-property-names] ---*/ +assert.sameValue(Object(2n) % 2n, 0n, 'The result of (Object(2n) % 2n) is 0n'); +assert.sameValue(2n % Object(2n), 0n, 'The result of (2n % Object(2n)) is 0n'); -assert.sameValue(Object(2n) % 2n, 0n, "ToPrimitive: unbox object with internal slot"); -assert.sameValue(2n % Object(2n), 0n, "ToPrimitive: unbox object with internal slot"); -assert.sameValue(({ +assert.sameValue({ [Symbol.toPrimitive]: function() { return 2n; } -}) % 2n, 0n, "ToPrimitive: @@toPrimitive"); +} % 2n, 0n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}}) % 2n) is 0n'); + assert.sameValue(2n % { [Symbol.toPrimitive]: function() { return 2n; } -}, 0n, "ToPrimitive: @@toPrimitive"); -assert.sameValue(({ +}, 0n, 'The result of (2n % {[Symbol.toPrimitive]: function() {return 2n;}}) is 0n'); + +assert.sameValue({ valueOf: function() { return 2n; } -}) % 2n, 0n, "ToPrimitive: valueOf"); +} % 2n, 0n, 'The result of (({valueOf: function() {return 2n;}}) % 2n) is 0n'); + assert.sameValue(2n % { valueOf: function() { return 2n; } -}, 0n, "ToPrimitive: valueOf"); -assert.sameValue(({ +}, 0n, 'The result of (2n % {valueOf: function() {return 2n;}}) is 0n'); + +assert.sameValue({ toString: function() { return 2n; } -}) % 2n, 0n, "ToPrimitive: toString"); +} % 2n, 0n, 'The result of (({toString: function() {return 2n;}}) % 2n) is 0n'); + assert.sameValue(2n % { toString: function() { return 2n; } -}, 0n, "ToPrimitive: toString"); +}, 0n, 'The result of (2n % {toString: function() {return 2n;}}) is 0n'); \ No newline at end of file diff --git a/test/language/expressions/multiplication/bigint-and-number.js b/test/language/expressions/multiplication/bigint-and-number.js index a62f585671f5514f33d6d1b8bf57f60ae355b0bd..4a9eb0c2ed908892388e8e4938c394ad65e5a022 100644 --- a/test/language/expressions/multiplication/bigint-and-number.js +++ b/test/language/expressions/multiplication/bigint-and-number.js @@ -9,24 +9,82 @@ info: | Let rnum be ? ToNumeric(rightValue). If Type(lnum) does not equal Type(rnum), throw a TypeError exception. ---*/ +assert.throws(TypeError, function() { + 1n * 1; +}, '1n * 1 throws TypeError'); -assert.throws(TypeError, function() { 1n * 1; }, "1n * 1 throws TypeError"); -assert.throws(TypeError, function() { 1 * 1n; }, "1 * 1n throws TypeError"); -assert.throws(TypeError, function() { Object(1n) * 1; }, "Object(1n) * 1 throws TypeError"); -assert.throws(TypeError, function() { 1 * Object(1n); }, "1 * Object(1n) throws TypeError"); -assert.throws(TypeError, function() { 1n * Object(1); }, "1n * Object(1) throws TypeError"); -assert.throws(TypeError, function() { Object(1) * 1n; }, "Object(1) * 1n throws TypeError"); -assert.throws(TypeError, function() { Object(1n) * Object(1); }, "Object(1n) * Object(1) throws TypeError"); -assert.throws(TypeError, function() { Object(1) * Object(1n); }, "Object(1) * Object(1n) throws TypeError"); -assert.throws(TypeError, function() { 1n * NaN; }, "1n * NaN throws TypeError"); -assert.throws(TypeError, function() { NaN * 1n; }, "NaN * 1n throws TypeError"); -assert.throws(TypeError, function() { 1n * Infinity; }, "1n * Infinity throws TypeError"); -assert.throws(TypeError, function() { Infinity * 1n; }, "Infinity * 1n throws TypeError"); -assert.throws(TypeError, function() { 1n * true; }, "1n * true throws TypeError"); -assert.throws(TypeError, function() { true * 1n; }, "true * 1n throws TypeError"); -assert.throws(TypeError, function() { 1n * "1"; }, '1n * "1" throws TypeError'); -assert.throws(TypeError, function() { "1" * 1n; }, '"1" * 1n throws TypeError'); -assert.throws(TypeError, function() { 1n * null; }, "1n * null throws TypeError"); -assert.throws(TypeError, function() { null * 1n; }, "null * 1n throws TypeError"); -assert.throws(TypeError, function() { 1n * undefined; }, "1n * undefined throws TypeError"); -assert.throws(TypeError, function() { undefined * 1n; }, "undefined * 1n throws TypeError"); +assert.throws(TypeError, function() { + 1 * 1n; +}, '1 * 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) * 1; +}, 'Object(1n) * 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 * Object(1n); +}, '1 * Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n * Object(1); +}, '1n * Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) * 1n; +}, 'Object(1) * 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) * Object(1); +}, 'Object(1n) * Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) * Object(1n); +}, 'Object(1) * Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n * NaN; +}, '1n * NaN throws TypeError'); + +assert.throws(TypeError, function() { + NaN * 1n; +}, 'NaN * 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n * Infinity; +}, '1n * Infinity throws TypeError'); + +assert.throws(TypeError, function() { + Infinity * 1n; +}, 'Infinity * 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n * true; +}, '1n * true throws TypeError'); + +assert.throws(TypeError, function() { + true * 1n; +}, 'true * 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n * '1'; +}, '1n * "1" throws TypeError'); + +assert.throws(TypeError, function() { + '1' * 1n; +}, '"1" * 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n * null; +}, '1n * null throws TypeError'); + +assert.throws(TypeError, function() { + null * 1n; +}, 'null * 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n * undefined; +}, '1n * undefined throws TypeError'); + +assert.throws(TypeError, function() { + undefined * 1n; +}, 'undefined * 1n throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/multiplication/bigint-arithmetic.js b/test/language/expressions/multiplication/bigint-arithmetic.js index 8e828e459c525aaeb3251cc4e358264a6d881d36..8305f167993936440e259f077896befc13460e23 100644 --- a/test/language/expressions/multiplication/bigint-arithmetic.js +++ b/test/language/expressions/multiplication/bigint-arithmetic.js @@ -1,167 +1,699 @@ // Copyright (C) 2017 Robin Templeton. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- esid: sec-multiplicative-operators-runtime-semantics-evaluation description: BigInt multiplication arithmetic features: [BigInt] ---*/ +assert.sameValue( + 0xFEDCBA9876543210n * 0xFEDCBA9876543210n, + 0xFDBAC097C8DC5ACCDEEC6CD7A44A4100n, + 'The result of (0xFEDCBA9876543210n * 0xFEDCBA9876543210n) is 0xFDBAC097C8DC5ACCDEEC6CD7A44A4100n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * 0xFEDCBA987654320Fn, + 0xFDBAC097C8DC5ACBE00FB23F2DF60EF0n, + 'The result of (0xFEDCBA9876543210n * 0xFEDCBA987654320Fn) is 0xFDBAC097C8DC5ACBE00FB23F2DF60EF0n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * 0xFEDCBA98n, + 0xFDBAC097530ECA86541D5980n, + 'The result of (0xFEDCBA9876543210n * 0xFEDCBA98n) is 0xFDBAC097530ECA86541D5980n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * 0xFEDCBA97n, + 0xFDBAC09654320FEDDDC92770n, + 'The result of (0xFEDCBA9876543210n * 0xFEDCBA97n) is 0xFDBAC09654320FEDDDC92770n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * 0x1234n, + 0x121F49F49F49F49F4B40n, + 'The result of (0xFEDCBA9876543210n * 0x1234n) is 0x121F49F49F49F49F4B40n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * 0x3n, + 0x2FC962FC962FC9630n, + 'The result of (0xFEDCBA9876543210n * 0x3n) is 0x2FC962FC962FC9630n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * 0x2n, + 0x1FDB97530ECA86420n, + 'The result of (0xFEDCBA9876543210n * 0x2n) is 0x1FDB97530ECA86420n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * 0x1n, + 0xFEDCBA9876543210n, + 'The result of (0xFEDCBA9876543210n * 0x1n) is 0xFEDCBA9876543210n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * 0x0n, + 0x0n, + 'The result of (0xFEDCBA9876543210n * 0x0n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * -0x1n, + -0xFEDCBA9876543210n, + 'The result of (0xFEDCBA9876543210n * -0x1n) is -0xFEDCBA9876543210n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * -0x2n, + -0x1FDB97530ECA86420n, + 'The result of (0xFEDCBA9876543210n * -0x2n) is -0x1FDB97530ECA86420n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * -0x3n, + -0x2FC962FC962FC9630n, + 'The result of (0xFEDCBA9876543210n * -0x3n) is -0x2FC962FC962FC9630n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * -0x1234n, + -0x121F49F49F49F49F4B40n, + 'The result of (0xFEDCBA9876543210n * -0x1234n) is -0x121F49F49F49F49F4B40n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * -0xFEDCBA97n, + -0xFDBAC09654320FEDDDC92770n, + 'The result of (0xFEDCBA9876543210n * -0xFEDCBA97n) is -0xFDBAC09654320FEDDDC92770n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * -0xFEDCBA98n, + -0xFDBAC097530ECA86541D5980n, + 'The result of (0xFEDCBA9876543210n * -0xFEDCBA98n) is -0xFDBAC097530ECA86541D5980n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * -0xFEDCBA987654320Fn, + -0xFDBAC097C8DC5ACBE00FB23F2DF60EF0n, + 'The result of (0xFEDCBA9876543210n * -0xFEDCBA987654320Fn) is -0xFDBAC097C8DC5ACBE00FB23F2DF60EF0n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * -0xFEDCBA9876543210n, + -0xFDBAC097C8DC5ACCDEEC6CD7A44A4100n, + 'The result of (0xFEDCBA9876543210n * -0xFEDCBA9876543210n) is -0xFDBAC097C8DC5ACCDEEC6CD7A44A4100n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * 0xFEDCBA987654320Fn, + 0xFDBAC097C8DC5ACAE132F7A6B7A1DCE1n, + 'The result of (0xFEDCBA987654320Fn * 0xFEDCBA987654320Fn) is 0xFDBAC097C8DC5ACAE132F7A6B7A1DCE1n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * 0xFEDCBA98n, + 0xFDBAC097530ECA8555409EE8n, + 'The result of (0xFEDCBA987654320Fn * 0xFEDCBA98n) is 0xFDBAC097530ECA8555409EE8n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * 0xFEDCBA97n, + 0xFDBAC09654320FECDEEC6CD9n, + 'The result of (0xFEDCBA987654320Fn * 0xFEDCBA97n) is 0xFDBAC09654320FECDEEC6CD9n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * 0x1234n, + 0x121F49F49F49F49F390Cn, + 'The result of (0xFEDCBA987654320Fn * 0x1234n) is 0x121F49F49F49F49F390Cn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * 0x3n, + 0x2FC962FC962FC962Dn, + 'The result of (0xFEDCBA987654320Fn * 0x3n) is 0x2FC962FC962FC962Dn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * 0x2n, + 0x1FDB97530ECA8641En, + 'The result of (0xFEDCBA987654320Fn * 0x2n) is 0x1FDB97530ECA8641En' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * 0x1n, + 0xFEDCBA987654320Fn, + 'The result of (0xFEDCBA987654320Fn * 0x1n) is 0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * 0x0n, + 0x0n, + 'The result of (0xFEDCBA987654320Fn * 0x0n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * -0x1n, + -0xFEDCBA987654320Fn, + 'The result of (0xFEDCBA987654320Fn * -0x1n) is -0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * -0x2n, + -0x1FDB97530ECA8641En, + 'The result of (0xFEDCBA987654320Fn * -0x2n) is -0x1FDB97530ECA8641En' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * -0x3n, + -0x2FC962FC962FC962Dn, + 'The result of (0xFEDCBA987654320Fn * -0x3n) is -0x2FC962FC962FC962Dn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * -0x1234n, + -0x121F49F49F49F49F390Cn, + 'The result of (0xFEDCBA987654320Fn * -0x1234n) is -0x121F49F49F49F49F390Cn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * -0xFEDCBA97n, + -0xFDBAC09654320FECDEEC6CD9n, + 'The result of (0xFEDCBA987654320Fn * -0xFEDCBA97n) is -0xFDBAC09654320FECDEEC6CD9n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * -0xFEDCBA98n, + -0xFDBAC097530ECA8555409EE8n, + 'The result of (0xFEDCBA987654320Fn * -0xFEDCBA98n) is -0xFDBAC097530ECA8555409EE8n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * -0xFEDCBA987654320Fn, + -0xFDBAC097C8DC5ACAE132F7A6B7A1DCE1n, + 'The result of (0xFEDCBA987654320Fn * -0xFEDCBA987654320Fn) is -0xFDBAC097C8DC5ACAE132F7A6B7A1DCE1n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * -0xFEDCBA9876543210n, + -0xFDBAC097C8DC5ACBE00FB23F2DF60EF0n, + 'The result of (0xFEDCBA987654320Fn * -0xFEDCBA9876543210n) is -0xFDBAC097C8DC5ACBE00FB23F2DF60EF0n' +); + +assert.sameValue( + 0xFEDCBA98n * 0xFEDCBA98n, + 0xFDBAC096DD413A40n, + 'The result of (0xFEDCBA98n * 0xFEDCBA98n) is 0xFDBAC096DD413A40n' +); + +assert.sameValue( + 0xFEDCBA98n * 0xFEDCBA97n, + 0xFDBAC095DE647FA8n, + 'The result of (0xFEDCBA98n * 0xFEDCBA97n) is 0xFDBAC095DE647FA8n' +); + +assert.sameValue( + 0xFEDCBA98n * 0x1234n, + 0x121F49F496E0n, + 'The result of (0xFEDCBA98n * 0x1234n) is 0x121F49F496E0n' +); + +assert.sameValue( + 0xFEDCBA98n * 0x3n, + 0x2FC962FC8n, + 'The result of (0xFEDCBA98n * 0x3n) is 0x2FC962FC8n' +); + +assert.sameValue( + 0xFEDCBA98n * 0x2n, + 0x1FDB97530n, + 'The result of (0xFEDCBA98n * 0x2n) is 0x1FDB97530n' +); + +assert.sameValue( + 0xFEDCBA98n * 0x1n, + 0xFEDCBA98n, + 'The result of (0xFEDCBA98n * 0x1n) is 0xFEDCBA98n' +); + +assert.sameValue(0xFEDCBA98n * 0x0n, 0x0n, 'The result of (0xFEDCBA98n * 0x0n) is 0x0n'); + +assert.sameValue( + 0xFEDCBA98n * -0x1n, + -0xFEDCBA98n, + 'The result of (0xFEDCBA98n * -0x1n) is -0xFEDCBA98n' +); + +assert.sameValue( + 0xFEDCBA98n * -0x2n, + -0x1FDB97530n, + 'The result of (0xFEDCBA98n * -0x2n) is -0x1FDB97530n' +); + +assert.sameValue( + 0xFEDCBA98n * -0x3n, + -0x2FC962FC8n, + 'The result of (0xFEDCBA98n * -0x3n) is -0x2FC962FC8n' +); + +assert.sameValue( + 0xFEDCBA98n * -0x1234n, + -0x121F49F496E0n, + 'The result of (0xFEDCBA98n * -0x1234n) is -0x121F49F496E0n' +); + +assert.sameValue( + 0xFEDCBA98n * -0xFEDCBA97n, + -0xFDBAC095DE647FA8n, + 'The result of (0xFEDCBA98n * -0xFEDCBA97n) is -0xFDBAC095DE647FA8n' +); + +assert.sameValue( + 0xFEDCBA98n * -0xFEDCBA98n, + -0xFDBAC096DD413A40n, + 'The result of (0xFEDCBA98n * -0xFEDCBA98n) is -0xFDBAC096DD413A40n' +); + +assert.sameValue( + 0xFEDCBA98n * -0xFEDCBA987654320Fn, + -0xFDBAC097530ECA8555409EE8n, + 'The result of (0xFEDCBA98n * -0xFEDCBA987654320Fn) is -0xFDBAC097530ECA8555409EE8n' +); + +assert.sameValue( + 0xFEDCBA98n * -0xFEDCBA9876543210n, + -0xFDBAC097530ECA86541D5980n, + 'The result of (0xFEDCBA98n * -0xFEDCBA9876543210n) is -0xFDBAC097530ECA86541D5980n' +); + +assert.sameValue( + 0xFEDCBA97n * 0xFEDCBA97n, + 0xFDBAC094DF87C511n, + 'The result of (0xFEDCBA97n * 0xFEDCBA97n) is 0xFDBAC094DF87C511n' +); + +assert.sameValue( + 0xFEDCBA97n * 0x1234n, + 0x121F49F484ACn, + 'The result of (0xFEDCBA97n * 0x1234n) is 0x121F49F484ACn' +); + +assert.sameValue( + 0xFEDCBA97n * 0x3n, + 0x2FC962FC5n, + 'The result of (0xFEDCBA97n * 0x3n) is 0x2FC962FC5n' +); + +assert.sameValue( + 0xFEDCBA97n * 0x2n, + 0x1FDB9752En, + 'The result of (0xFEDCBA97n * 0x2n) is 0x1FDB9752En' +); + +assert.sameValue( + 0xFEDCBA97n * 0x1n, + 0xFEDCBA97n, + 'The result of (0xFEDCBA97n * 0x1n) is 0xFEDCBA97n' +); + +assert.sameValue(0xFEDCBA97n * 0x0n, 0x0n, 'The result of (0xFEDCBA97n * 0x0n) is 0x0n'); + +assert.sameValue( + 0xFEDCBA97n * -0x1n, + -0xFEDCBA97n, + 'The result of (0xFEDCBA97n * -0x1n) is -0xFEDCBA97n' +); + +assert.sameValue( + 0xFEDCBA97n * -0x2n, + -0x1FDB9752En, + 'The result of (0xFEDCBA97n * -0x2n) is -0x1FDB9752En' +); + +assert.sameValue( + 0xFEDCBA97n * -0x3n, + -0x2FC962FC5n, + 'The result of (0xFEDCBA97n * -0x3n) is -0x2FC962FC5n' +); + +assert.sameValue( + 0xFEDCBA97n * -0x1234n, + -0x121F49F484ACn, + 'The result of (0xFEDCBA97n * -0x1234n) is -0x121F49F484ACn' +); + +assert.sameValue( + 0xFEDCBA97n * -0xFEDCBA97n, + -0xFDBAC094DF87C511n, + 'The result of (0xFEDCBA97n * -0xFEDCBA97n) is -0xFDBAC094DF87C511n' +); + +assert.sameValue( + 0xFEDCBA97n * -0xFEDCBA98n, + -0xFDBAC095DE647FA8n, + 'The result of (0xFEDCBA97n * -0xFEDCBA98n) is -0xFDBAC095DE647FA8n' +); + +assert.sameValue( + 0xFEDCBA97n * -0xFEDCBA987654320Fn, + -0xFDBAC09654320FECDEEC6CD9n, + 'The result of (0xFEDCBA97n * -0xFEDCBA987654320Fn) is -0xFDBAC09654320FECDEEC6CD9n' +); + +assert.sameValue( + 0xFEDCBA97n * -0xFEDCBA9876543210n, + -0xFDBAC09654320FEDDDC92770n, + 'The result of (0xFEDCBA97n * -0xFEDCBA9876543210n) is -0xFDBAC09654320FEDDDC92770n' +); + +assert.sameValue(0x1234n * 0x1234n, 0x14B5A90n, 'The result of (0x1234n * 0x1234n) is 0x14B5A90n'); +assert.sameValue(0x1234n * 0x3n, 0x369Cn, 'The result of (0x1234n * 0x3n) is 0x369Cn'); +assert.sameValue(0x1234n * 0x2n, 0x2468n, 'The result of (0x1234n * 0x2n) is 0x2468n'); +assert.sameValue(0x1234n * 0x1n, 0x1234n, 'The result of (0x1234n * 0x1n) is 0x1234n'); +assert.sameValue(0x1234n * 0x0n, 0x0n, 'The result of (0x1234n * 0x0n) is 0x0n'); +assert.sameValue(0x1234n * -0x1n, -0x1234n, 'The result of (0x1234n * -0x1n) is -0x1234n'); +assert.sameValue(0x1234n * -0x2n, -0x2468n, 'The result of (0x1234n * -0x2n) is -0x2468n'); +assert.sameValue(0x1234n * -0x3n, -0x369Cn, 'The result of (0x1234n * -0x3n) is -0x369Cn'); + +assert.sameValue( + 0x1234n * -0x1234n, + -0x14B5A90n, + 'The result of (0x1234n * -0x1234n) is -0x14B5A90n' +); + +assert.sameValue( + 0x1234n * -0xFEDCBA97n, + -0x121F49F484ACn, + 'The result of (0x1234n * -0xFEDCBA97n) is -0x121F49F484ACn' +); + +assert.sameValue( + 0x1234n * -0xFEDCBA98n, + -0x121F49F496E0n, + 'The result of (0x1234n * -0xFEDCBA98n) is -0x121F49F496E0n' +); + +assert.sameValue( + 0x1234n * -0xFEDCBA987654320Fn, + -0x121F49F49F49F49F390Cn, + 'The result of (0x1234n * -0xFEDCBA987654320Fn) is -0x121F49F49F49F49F390Cn' +); + +assert.sameValue( + 0x1234n * -0xFEDCBA9876543210n, + -0x121F49F49F49F49F4B40n, + 'The result of (0x1234n * -0xFEDCBA9876543210n) is -0x121F49F49F49F49F4B40n' +); + +assert.sameValue(0x3n * 0x3n, 0x9n, 'The result of (0x3n * 0x3n) is 0x9n'); +assert.sameValue(0x3n * 0x2n, 0x6n, 'The result of (0x3n * 0x2n) is 0x6n'); +assert.sameValue(0x3n * 0x1n, 0x3n, 'The result of (0x3n * 0x1n) is 0x3n'); +assert.sameValue(0x3n * 0x0n, 0x0n, 'The result of (0x3n * 0x0n) is 0x0n'); +assert.sameValue(0x3n * -0x1n, -0x3n, 'The result of (0x3n * -0x1n) is -0x3n'); +assert.sameValue(0x3n * -0x2n, -0x6n, 'The result of (0x3n * -0x2n) is -0x6n'); +assert.sameValue(0x3n * -0x3n, -0x9n, 'The result of (0x3n * -0x3n) is -0x9n'); +assert.sameValue(0x3n * -0x1234n, -0x369Cn, 'The result of (0x3n * -0x1234n) is -0x369Cn'); + +assert.sameValue( + 0x3n * -0xFEDCBA97n, + -0x2FC962FC5n, + 'The result of (0x3n * -0xFEDCBA97n) is -0x2FC962FC5n' +); + +assert.sameValue( + 0x3n * -0xFEDCBA98n, + -0x2FC962FC8n, + 'The result of (0x3n * -0xFEDCBA98n) is -0x2FC962FC8n' +); + +assert.sameValue( + 0x3n * -0xFEDCBA987654320Fn, + -0x2FC962FC962FC962Dn, + 'The result of (0x3n * -0xFEDCBA987654320Fn) is -0x2FC962FC962FC962Dn' +); + +assert.sameValue( + 0x3n * -0xFEDCBA9876543210n, + -0x2FC962FC962FC9630n, + 'The result of (0x3n * -0xFEDCBA9876543210n) is -0x2FC962FC962FC9630n' +); + +assert.sameValue(0x2n * 0x2n, 0x4n, 'The result of (0x2n * 0x2n) is 0x4n'); +assert.sameValue(0x2n * 0x1n, 0x2n, 'The result of (0x2n * 0x1n) is 0x2n'); +assert.sameValue(0x2n * 0x0n, 0x0n, 'The result of (0x2n * 0x0n) is 0x0n'); +assert.sameValue(0x2n * -0x1n, -0x2n, 'The result of (0x2n * -0x1n) is -0x2n'); +assert.sameValue(0x2n * -0x2n, -0x4n, 'The result of (0x2n * -0x2n) is -0x4n'); +assert.sameValue(0x2n * -0x3n, -0x6n, 'The result of (0x2n * -0x3n) is -0x6n'); +assert.sameValue(0x2n * -0x1234n, -0x2468n, 'The result of (0x2n * -0x1234n) is -0x2468n'); + +assert.sameValue( + 0x2n * -0xFEDCBA97n, + -0x1FDB9752En, + 'The result of (0x2n * -0xFEDCBA97n) is -0x1FDB9752En' +); + +assert.sameValue( + 0x2n * -0xFEDCBA98n, + -0x1FDB97530n, + 'The result of (0x2n * -0xFEDCBA98n) is -0x1FDB97530n' +); + +assert.sameValue( + 0x2n * -0xFEDCBA987654320Fn, + -0x1FDB97530ECA8641En, + 'The result of (0x2n * -0xFEDCBA987654320Fn) is -0x1FDB97530ECA8641En' +); + +assert.sameValue( + 0x2n * -0xFEDCBA9876543210n, + -0x1FDB97530ECA86420n, + 'The result of (0x2n * -0xFEDCBA9876543210n) is -0x1FDB97530ECA86420n' +); + +assert.sameValue(0x1n * 0x1n, 0x1n, 'The result of (0x1n * 0x1n) is 0x1n'); +assert.sameValue(0x1n * 0x0n, 0x0n, 'The result of (0x1n * 0x0n) is 0x0n'); +assert.sameValue(0x1n * -0x1n, -0x1n, 'The result of (0x1n * -0x1n) is -0x1n'); +assert.sameValue(0x1n * -0x2n, -0x2n, 'The result of (0x1n * -0x2n) is -0x2n'); +assert.sameValue(0x1n * -0x3n, -0x3n, 'The result of (0x1n * -0x3n) is -0x3n'); +assert.sameValue(0x1n * -0x1234n, -0x1234n, 'The result of (0x1n * -0x1234n) is -0x1234n'); + +assert.sameValue( + 0x1n * -0xFEDCBA97n, + -0xFEDCBA97n, + 'The result of (0x1n * -0xFEDCBA97n) is -0xFEDCBA97n' +); + +assert.sameValue( + 0x1n * -0xFEDCBA98n, + -0xFEDCBA98n, + 'The result of (0x1n * -0xFEDCBA98n) is -0xFEDCBA98n' +); + +assert.sameValue( + 0x1n * -0xFEDCBA987654320Fn, + -0xFEDCBA987654320Fn, + 'The result of (0x1n * -0xFEDCBA987654320Fn) is -0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0x1n * -0xFEDCBA9876543210n, + -0xFEDCBA9876543210n, + 'The result of (0x1n * -0xFEDCBA9876543210n) is -0xFEDCBA9876543210n' +); + +assert.sameValue(0x0n * 0x0n, 0x0n, 'The result of (0x0n * 0x0n) is 0x0n'); +assert.sameValue(0x0n * -0x1n, 0x0n, 'The result of (0x0n * -0x1n) is 0x0n'); +assert.sameValue(0x0n * -0x2n, 0x0n, 'The result of (0x0n * -0x2n) is 0x0n'); +assert.sameValue(0x0n * -0x3n, 0x0n, 'The result of (0x0n * -0x3n) is 0x0n'); +assert.sameValue(0x0n * -0x1234n, 0x0n, 'The result of (0x0n * -0x1234n) is 0x0n'); +assert.sameValue(0x0n * -0xFEDCBA97n, 0x0n, 'The result of (0x0n * -0xFEDCBA97n) is 0x0n'); +assert.sameValue(0x0n * -0xFEDCBA98n, 0x0n, 'The result of (0x0n * -0xFEDCBA98n) is 0x0n'); + +assert.sameValue( + 0x0n * -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0x0n * -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + 0x0n * -0xFEDCBA9876543210n, + 0x0n, + 'The result of (0x0n * -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue(-0x1n * -0x1n, 0x1n, 'The result of (-0x1n * -0x1n) is 0x1n'); +assert.sameValue(-0x1n * -0x2n, 0x2n, 'The result of (-0x1n * -0x2n) is 0x2n'); +assert.sameValue(-0x1n * -0x3n, 0x3n, 'The result of (-0x1n * -0x3n) is 0x3n'); +assert.sameValue(-0x1n * -0x1234n, 0x1234n, 'The result of (-0x1n * -0x1234n) is 0x1234n'); + +assert.sameValue( + -0x1n * -0xFEDCBA97n, + 0xFEDCBA97n, + 'The result of (-0x1n * -0xFEDCBA97n) is 0xFEDCBA97n' +); + +assert.sameValue( + -0x1n * -0xFEDCBA98n, + 0xFEDCBA98n, + 'The result of (-0x1n * -0xFEDCBA98n) is 0xFEDCBA98n' +); + +assert.sameValue( + -0x1n * -0xFEDCBA987654320Fn, + 0xFEDCBA987654320Fn, + 'The result of (-0x1n * -0xFEDCBA987654320Fn) is 0xFEDCBA987654320Fn' +); + +assert.sameValue( + -0x1n * -0xFEDCBA9876543210n, + 0xFEDCBA9876543210n, + 'The result of (-0x1n * -0xFEDCBA9876543210n) is 0xFEDCBA9876543210n' +); + +assert.sameValue(-0x2n * -0x2n, 0x4n, 'The result of (-0x2n * -0x2n) is 0x4n'); +assert.sameValue(-0x2n * -0x3n, 0x6n, 'The result of (-0x2n * -0x3n) is 0x6n'); +assert.sameValue(-0x2n * -0x1234n, 0x2468n, 'The result of (-0x2n * -0x1234n) is 0x2468n'); + +assert.sameValue( + -0x2n * -0xFEDCBA97n, + 0x1FDB9752En, + 'The result of (-0x2n * -0xFEDCBA97n) is 0x1FDB9752En' +); + +assert.sameValue( + -0x2n * -0xFEDCBA98n, + 0x1FDB97530n, + 'The result of (-0x2n * -0xFEDCBA98n) is 0x1FDB97530n' +); + +assert.sameValue( + -0x2n * -0xFEDCBA987654320Fn, + 0x1FDB97530ECA8641En, + 'The result of (-0x2n * -0xFEDCBA987654320Fn) is 0x1FDB97530ECA8641En' +); + +assert.sameValue( + -0x2n * -0xFEDCBA9876543210n, + 0x1FDB97530ECA86420n, + 'The result of (-0x2n * -0xFEDCBA9876543210n) is 0x1FDB97530ECA86420n' +); + +assert.sameValue(-0x3n * -0x3n, 0x9n, 'The result of (-0x3n * -0x3n) is 0x9n'); +assert.sameValue(-0x3n * -0x1234n, 0x369Cn, 'The result of (-0x3n * -0x1234n) is 0x369Cn'); + +assert.sameValue( + -0x3n * -0xFEDCBA97n, + 0x2FC962FC5n, + 'The result of (-0x3n * -0xFEDCBA97n) is 0x2FC962FC5n' +); + +assert.sameValue( + -0x3n * -0xFEDCBA98n, + 0x2FC962FC8n, + 'The result of (-0x3n * -0xFEDCBA98n) is 0x2FC962FC8n' +); + +assert.sameValue( + -0x3n * -0xFEDCBA987654320Fn, + 0x2FC962FC962FC962Dn, + 'The result of (-0x3n * -0xFEDCBA987654320Fn) is 0x2FC962FC962FC962Dn' +); + +assert.sameValue( + -0x3n * -0xFEDCBA9876543210n, + 0x2FC962FC962FC9630n, + 'The result of (-0x3n * -0xFEDCBA9876543210n) is 0x2FC962FC962FC9630n' +); + +assert.sameValue( + -0x1234n * -0x1234n, + 0x14B5A90n, + 'The result of (-0x1234n * -0x1234n) is 0x14B5A90n' +); + +assert.sameValue( + -0x1234n * -0xFEDCBA97n, + 0x121F49F484ACn, + 'The result of (-0x1234n * -0xFEDCBA97n) is 0x121F49F484ACn' +); + +assert.sameValue( + -0x1234n * -0xFEDCBA98n, + 0x121F49F496E0n, + 'The result of (-0x1234n * -0xFEDCBA98n) is 0x121F49F496E0n' +); + +assert.sameValue( + -0x1234n * -0xFEDCBA987654320Fn, + 0x121F49F49F49F49F390Cn, + 'The result of (-0x1234n * -0xFEDCBA987654320Fn) is 0x121F49F49F49F49F390Cn' +); + +assert.sameValue( + -0x1234n * -0xFEDCBA9876543210n, + 0x121F49F49F49F49F4B40n, + 'The result of (-0x1234n * -0xFEDCBA9876543210n) is 0x121F49F49F49F49F4B40n' +); + +assert.sameValue( + -0xFEDCBA97n * -0xFEDCBA97n, + 0xFDBAC094DF87C511n, + 'The result of (-0xFEDCBA97n * -0xFEDCBA97n) is 0xFDBAC094DF87C511n' +); + +assert.sameValue( + -0xFEDCBA97n * -0xFEDCBA98n, + 0xFDBAC095DE647FA8n, + 'The result of (-0xFEDCBA97n * -0xFEDCBA98n) is 0xFDBAC095DE647FA8n' +); + +assert.sameValue( + -0xFEDCBA97n * -0xFEDCBA987654320Fn, + 0xFDBAC09654320FECDEEC6CD9n, + 'The result of (-0xFEDCBA97n * -0xFEDCBA987654320Fn) is 0xFDBAC09654320FECDEEC6CD9n' +); + +assert.sameValue( + -0xFEDCBA97n * -0xFEDCBA9876543210n, + 0xFDBAC09654320FEDDDC92770n, + 'The result of (-0xFEDCBA97n * -0xFEDCBA9876543210n) is 0xFDBAC09654320FEDDDC92770n' +); + +assert.sameValue( + -0xFEDCBA98n * -0xFEDCBA98n, + 0xFDBAC096DD413A40n, + 'The result of (-0xFEDCBA98n * -0xFEDCBA98n) is 0xFDBAC096DD413A40n' +); + +assert.sameValue( + -0xFEDCBA98n * -0xFEDCBA987654320Fn, + 0xFDBAC097530ECA8555409EE8n, + 'The result of (-0xFEDCBA98n * -0xFEDCBA987654320Fn) is 0xFDBAC097530ECA8555409EE8n' +); + +assert.sameValue( + -0xFEDCBA98n * -0xFEDCBA9876543210n, + 0xFDBAC097530ECA86541D5980n, + 'The result of (-0xFEDCBA98n * -0xFEDCBA9876543210n) is 0xFDBAC097530ECA86541D5980n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn * -0xFEDCBA987654320Fn, + 0xFDBAC097C8DC5ACAE132F7A6B7A1DCE1n, + 'The result of (-0xFEDCBA987654320Fn * -0xFEDCBA987654320Fn) is 0xFDBAC097C8DC5ACAE132F7A6B7A1DCE1n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn * -0xFEDCBA9876543210n, + 0xFDBAC097C8DC5ACBE00FB23F2DF60EF0n, + 'The result of (-0xFEDCBA987654320Fn * -0xFEDCBA9876543210n) is 0xFDBAC097C8DC5ACBE00FB23F2DF60EF0n' +); -function testMul(x, y, z) { - assert.sameValue(x * y, z, x + " * " + y + " = " + z); - assert.sameValue(y * x, z, y + " * " + x + " = " + z); -} - -testMul(0xFEDCBA9876543210n, 0xFEDCBA9876543210n, 0xFDBAC097C8DC5ACCDEEC6CD7A44A4100n); -testMul(0xFEDCBA9876543210n, 0xFEDCBA987654320Fn, 0xFDBAC097C8DC5ACBE00FB23F2DF60EF0n); -testMul(0xFEDCBA9876543210n, 0xFEDCBA98n, 0xFDBAC097530ECA86541D5980n); -testMul(0xFEDCBA9876543210n, 0xFEDCBA97n, 0xFDBAC09654320FEDDDC92770n); -testMul(0xFEDCBA9876543210n, 0x1234n, 0x121F49F49F49F49F4B40n); -testMul(0xFEDCBA9876543210n, 0x3n, 0x2FC962FC962FC9630n); -testMul(0xFEDCBA9876543210n, 0x2n, 0x1FDB97530ECA86420n); -testMul(0xFEDCBA9876543210n, 0x1n, 0xFEDCBA9876543210n); -testMul(0xFEDCBA9876543210n, 0x0n, 0x0n); -testMul(0xFEDCBA9876543210n, -0x1n, -0xFEDCBA9876543210n); -testMul(0xFEDCBA9876543210n, -0x2n, -0x1FDB97530ECA86420n); -testMul(0xFEDCBA9876543210n, -0x3n, -0x2FC962FC962FC9630n); -testMul(0xFEDCBA9876543210n, -0x1234n, -0x121F49F49F49F49F4B40n); -testMul(0xFEDCBA9876543210n, -0xFEDCBA97n, -0xFDBAC09654320FEDDDC92770n); -testMul(0xFEDCBA9876543210n, -0xFEDCBA98n, -0xFDBAC097530ECA86541D5980n); -testMul(0xFEDCBA9876543210n, -0xFEDCBA987654320Fn, -0xFDBAC097C8DC5ACBE00FB23F2DF60EF0n); -testMul(0xFEDCBA9876543210n, -0xFEDCBA9876543210n, -0xFDBAC097C8DC5ACCDEEC6CD7A44A4100n); -testMul(0xFEDCBA987654320Fn, 0xFEDCBA987654320Fn, 0xFDBAC097C8DC5ACAE132F7A6B7A1DCE1n); -testMul(0xFEDCBA987654320Fn, 0xFEDCBA98n, 0xFDBAC097530ECA8555409EE8n); -testMul(0xFEDCBA987654320Fn, 0xFEDCBA97n, 0xFDBAC09654320FECDEEC6CD9n); -testMul(0xFEDCBA987654320Fn, 0x1234n, 0x121F49F49F49F49F390Cn); -testMul(0xFEDCBA987654320Fn, 0x3n, 0x2FC962FC962FC962Dn); -testMul(0xFEDCBA987654320Fn, 0x2n, 0x1FDB97530ECA8641En); -testMul(0xFEDCBA987654320Fn, 0x1n, 0xFEDCBA987654320Fn); -testMul(0xFEDCBA987654320Fn, 0x0n, 0x0n); -testMul(0xFEDCBA987654320Fn, -0x1n, -0xFEDCBA987654320Fn); -testMul(0xFEDCBA987654320Fn, -0x2n, -0x1FDB97530ECA8641En); -testMul(0xFEDCBA987654320Fn, -0x3n, -0x2FC962FC962FC962Dn); -testMul(0xFEDCBA987654320Fn, -0x1234n, -0x121F49F49F49F49F390Cn); -testMul(0xFEDCBA987654320Fn, -0xFEDCBA97n, -0xFDBAC09654320FECDEEC6CD9n); -testMul(0xFEDCBA987654320Fn, -0xFEDCBA98n, -0xFDBAC097530ECA8555409EE8n); -testMul(0xFEDCBA987654320Fn, -0xFEDCBA987654320Fn, -0xFDBAC097C8DC5ACAE132F7A6B7A1DCE1n); -testMul(0xFEDCBA987654320Fn, -0xFEDCBA9876543210n, -0xFDBAC097C8DC5ACBE00FB23F2DF60EF0n); -testMul(0xFEDCBA98n, 0xFEDCBA98n, 0xFDBAC096DD413A40n); -testMul(0xFEDCBA98n, 0xFEDCBA97n, 0xFDBAC095DE647FA8n); -testMul(0xFEDCBA98n, 0x1234n, 0x121F49F496E0n); -testMul(0xFEDCBA98n, 0x3n, 0x2FC962FC8n); -testMul(0xFEDCBA98n, 0x2n, 0x1FDB97530n); -testMul(0xFEDCBA98n, 0x1n, 0xFEDCBA98n); -testMul(0xFEDCBA98n, 0x0n, 0x0n); -testMul(0xFEDCBA98n, -0x1n, -0xFEDCBA98n); -testMul(0xFEDCBA98n, -0x2n, -0x1FDB97530n); -testMul(0xFEDCBA98n, -0x3n, -0x2FC962FC8n); -testMul(0xFEDCBA98n, -0x1234n, -0x121F49F496E0n); -testMul(0xFEDCBA98n, -0xFEDCBA97n, -0xFDBAC095DE647FA8n); -testMul(0xFEDCBA98n, -0xFEDCBA98n, -0xFDBAC096DD413A40n); -testMul(0xFEDCBA98n, -0xFEDCBA987654320Fn, -0xFDBAC097530ECA8555409EE8n); -testMul(0xFEDCBA98n, -0xFEDCBA9876543210n, -0xFDBAC097530ECA86541D5980n); -testMul(0xFEDCBA97n, 0xFEDCBA97n, 0xFDBAC094DF87C511n); -testMul(0xFEDCBA97n, 0x1234n, 0x121F49F484ACn); -testMul(0xFEDCBA97n, 0x3n, 0x2FC962FC5n); -testMul(0xFEDCBA97n, 0x2n, 0x1FDB9752En); -testMul(0xFEDCBA97n, 0x1n, 0xFEDCBA97n); -testMul(0xFEDCBA97n, 0x0n, 0x0n); -testMul(0xFEDCBA97n, -0x1n, -0xFEDCBA97n); -testMul(0xFEDCBA97n, -0x2n, -0x1FDB9752En); -testMul(0xFEDCBA97n, -0x3n, -0x2FC962FC5n); -testMul(0xFEDCBA97n, -0x1234n, -0x121F49F484ACn); -testMul(0xFEDCBA97n, -0xFEDCBA97n, -0xFDBAC094DF87C511n); -testMul(0xFEDCBA97n, -0xFEDCBA98n, -0xFDBAC095DE647FA8n); -testMul(0xFEDCBA97n, -0xFEDCBA987654320Fn, -0xFDBAC09654320FECDEEC6CD9n); -testMul(0xFEDCBA97n, -0xFEDCBA9876543210n, -0xFDBAC09654320FEDDDC92770n); -testMul(0x1234n, 0x1234n, 0x14B5A90n); -testMul(0x1234n, 0x3n, 0x369Cn); -testMul(0x1234n, 0x2n, 0x2468n); -testMul(0x1234n, 0x1n, 0x1234n); -testMul(0x1234n, 0x0n, 0x0n); -testMul(0x1234n, -0x1n, -0x1234n); -testMul(0x1234n, -0x2n, -0x2468n); -testMul(0x1234n, -0x3n, -0x369Cn); -testMul(0x1234n, -0x1234n, -0x14B5A90n); -testMul(0x1234n, -0xFEDCBA97n, -0x121F49F484ACn); -testMul(0x1234n, -0xFEDCBA98n, -0x121F49F496E0n); -testMul(0x1234n, -0xFEDCBA987654320Fn, -0x121F49F49F49F49F390Cn); -testMul(0x1234n, -0xFEDCBA9876543210n, -0x121F49F49F49F49F4B40n); -testMul(0x3n, 0x3n, 0x9n); -testMul(0x3n, 0x2n, 0x6n); -testMul(0x3n, 0x1n, 0x3n); -testMul(0x3n, 0x0n, 0x0n); -testMul(0x3n, -0x1n, -0x3n); -testMul(0x3n, -0x2n, -0x6n); -testMul(0x3n, -0x3n, -0x9n); -testMul(0x3n, -0x1234n, -0x369Cn); -testMul(0x3n, -0xFEDCBA97n, -0x2FC962FC5n); -testMul(0x3n, -0xFEDCBA98n, -0x2FC962FC8n); -testMul(0x3n, -0xFEDCBA987654320Fn, -0x2FC962FC962FC962Dn); -testMul(0x3n, -0xFEDCBA9876543210n, -0x2FC962FC962FC9630n); -testMul(0x2n, 0x2n, 0x4n); -testMul(0x2n, 0x1n, 0x2n); -testMul(0x2n, 0x0n, 0x0n); -testMul(0x2n, -0x1n, -0x2n); -testMul(0x2n, -0x2n, -0x4n); -testMul(0x2n, -0x3n, -0x6n); -testMul(0x2n, -0x1234n, -0x2468n); -testMul(0x2n, -0xFEDCBA97n, -0x1FDB9752En); -testMul(0x2n, -0xFEDCBA98n, -0x1FDB97530n); -testMul(0x2n, -0xFEDCBA987654320Fn, -0x1FDB97530ECA8641En); -testMul(0x2n, -0xFEDCBA9876543210n, -0x1FDB97530ECA86420n); -testMul(0x1n, 0x1n, 0x1n); -testMul(0x1n, 0x0n, 0x0n); -testMul(0x1n, -0x1n, -0x1n); -testMul(0x1n, -0x2n, -0x2n); -testMul(0x1n, -0x3n, -0x3n); -testMul(0x1n, -0x1234n, -0x1234n); -testMul(0x1n, -0xFEDCBA97n, -0xFEDCBA97n); -testMul(0x1n, -0xFEDCBA98n, -0xFEDCBA98n); -testMul(0x1n, -0xFEDCBA987654320Fn, -0xFEDCBA987654320Fn); -testMul(0x1n, -0xFEDCBA9876543210n, -0xFEDCBA9876543210n); -testMul(0x0n, 0x0n, 0x0n); -testMul(0x0n, -0x1n, 0x0n); -testMul(0x0n, -0x2n, 0x0n); -testMul(0x0n, -0x3n, 0x0n); -testMul(0x0n, -0x1234n, 0x0n); -testMul(0x0n, -0xFEDCBA97n, 0x0n); -testMul(0x0n, -0xFEDCBA98n, 0x0n); -testMul(0x0n, -0xFEDCBA987654320Fn, 0x0n); -testMul(0x0n, -0xFEDCBA9876543210n, 0x0n); -testMul(-0x1n, -0x1n, 0x1n); -testMul(-0x1n, -0x2n, 0x2n); -testMul(-0x1n, -0x3n, 0x3n); -testMul(-0x1n, -0x1234n, 0x1234n); -testMul(-0x1n, -0xFEDCBA97n, 0xFEDCBA97n); -testMul(-0x1n, -0xFEDCBA98n, 0xFEDCBA98n); -testMul(-0x1n, -0xFEDCBA987654320Fn, 0xFEDCBA987654320Fn); -testMul(-0x1n, -0xFEDCBA9876543210n, 0xFEDCBA9876543210n); -testMul(-0x2n, -0x2n, 0x4n); -testMul(-0x2n, -0x3n, 0x6n); -testMul(-0x2n, -0x1234n, 0x2468n); -testMul(-0x2n, -0xFEDCBA97n, 0x1FDB9752En); -testMul(-0x2n, -0xFEDCBA98n, 0x1FDB97530n); -testMul(-0x2n, -0xFEDCBA987654320Fn, 0x1FDB97530ECA8641En); -testMul(-0x2n, -0xFEDCBA9876543210n, 0x1FDB97530ECA86420n); -testMul(-0x3n, -0x3n, 0x9n); -testMul(-0x3n, -0x1234n, 0x369Cn); -testMul(-0x3n, -0xFEDCBA97n, 0x2FC962FC5n); -testMul(-0x3n, -0xFEDCBA98n, 0x2FC962FC8n); -testMul(-0x3n, -0xFEDCBA987654320Fn, 0x2FC962FC962FC962Dn); -testMul(-0x3n, -0xFEDCBA9876543210n, 0x2FC962FC962FC9630n); -testMul(-0x1234n, -0x1234n, 0x14B5A90n); -testMul(-0x1234n, -0xFEDCBA97n, 0x121F49F484ACn); -testMul(-0x1234n, -0xFEDCBA98n, 0x121F49F496E0n); -testMul(-0x1234n, -0xFEDCBA987654320Fn, 0x121F49F49F49F49F390Cn); -testMul(-0x1234n, -0xFEDCBA9876543210n, 0x121F49F49F49F49F4B40n); -testMul(-0xFEDCBA97n, -0xFEDCBA97n, 0xFDBAC094DF87C511n); -testMul(-0xFEDCBA97n, -0xFEDCBA98n, 0xFDBAC095DE647FA8n); -testMul(-0xFEDCBA97n, -0xFEDCBA987654320Fn, 0xFDBAC09654320FECDEEC6CD9n); -testMul(-0xFEDCBA97n, -0xFEDCBA9876543210n, 0xFDBAC09654320FEDDDC92770n); -testMul(-0xFEDCBA98n, -0xFEDCBA98n, 0xFDBAC096DD413A40n); -testMul(-0xFEDCBA98n, -0xFEDCBA987654320Fn, 0xFDBAC097530ECA8555409EE8n); -testMul(-0xFEDCBA98n, -0xFEDCBA9876543210n, 0xFDBAC097530ECA86541D5980n); -testMul(-0xFEDCBA987654320Fn, -0xFEDCBA987654320Fn, 0xFDBAC097C8DC5ACAE132F7A6B7A1DCE1n); -testMul(-0xFEDCBA987654320Fn, -0xFEDCBA9876543210n, 0xFDBAC097C8DC5ACBE00FB23F2DF60EF0n); -testMul(-0xFEDCBA9876543210n, -0xFEDCBA9876543210n, 0xFDBAC097C8DC5ACCDEEC6CD7A44A4100n); +assert.sameValue( + -0xFEDCBA9876543210n * -0xFEDCBA9876543210n, + 0xFDBAC097C8DC5ACCDEEC6CD7A44A4100n, + 'The result of (-0xFEDCBA9876543210n * -0xFEDCBA9876543210n) is 0xFDBAC097C8DC5ACCDEEC6CD7A44A4100n' +); \ No newline at end of file diff --git a/test/language/expressions/multiplication/bigint-errors.js b/test/language/expressions/multiplication/bigint-errors.js index a2cc666b4d26c0cdb7287d3cd1e84a7a2f3005bc..30a8553452a54ccc404aff02f1a83b84878bbe67 100644 --- a/test/language/expressions/multiplication/bigint-errors.js +++ b/test/language/expressions/multiplication/bigint-errors.js @@ -5,58 +5,66 @@ description: multiplication operator ToNumeric with BigInt operands esid: sec-multiplicative-operators-runtime-semantics-evaluation features: [BigInt, Symbol, Symbol.toPrimitive, computed-property-names] ---*/ - assert.throws(TypeError, function() { - Symbol("1") * 0n; -}, "ToBigInt: Symbol => TypeError"); + Symbol('1') * 0n; +}, 'Symbol("1") * 0n throws TypeError'); + assert.throws(TypeError, function() { - 0n * Symbol("1"); -}, "ToBigInt: Symbol => TypeError"); + 0n * Symbol('1'); +}, '0n * Symbol("1") throws TypeError'); + assert.throws(TypeError, function() { - Object(Symbol("1")) * 0n; -}, "ToBigInt: unbox object with internal slot => Symbol => TypeError"); + Object(Symbol('1')) * 0n; +}, 'Object(Symbol("1")) * 0n throws TypeError'); + assert.throws(TypeError, function() { - 0n * Object(Symbol("1")); -}, "ToBigInt: unbox object with internal slot => Symbol => TypeError"); + 0n * Object(Symbol('1')); +}, '0n * Object(Symbol("1")) throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { - return Symbol("1"); + return Symbol('1'); } }) * 0n; -}, "ToBigInt: @@toPrimitive => Symbol => TypeError"); +}, '({[Symbol.toPrimitive]: function() {return Symbol("1");}}) * 0n throws TypeError'); + assert.throws(TypeError, function() { 0n * { [Symbol.toPrimitive]: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: @@toPrimitive => Symbol => TypeError"); +}, '0n * {[Symbol.toPrimitive]: function() {return Symbol("1");}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { - return Symbol("1"); + return Symbol('1'); } }) * 0n; -}, "ToBigInt: valueOf => Symbol => TypeError"); +}, '({valueOf: function() {return Symbol("1");}}) * 0n throws TypeError'); + assert.throws(TypeError, function() { 0n * { valueOf: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: valueOf => Symbol => TypeError"); +}, '0n * {valueOf: function() {return Symbol("1");}} throws TypeError'); + assert.throws(TypeError, function() { ({ toString: function() { - return Symbol("1"); + return Symbol('1'); } }) * 0n; -}, "ToBigInt: toString => Symbol => TypeError"); +}, '({toString: function() {return Symbol("1");}}) * 0n throws TypeError'); + assert.throws(TypeError, function() { 0n * { toString: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: toString => Symbol => TypeError"); +}, '0n * {toString: function() {return Symbol("1");}} throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/multiplication/bigint-toprimitive.js b/test/language/expressions/multiplication/bigint-toprimitive.js index adb1a64745726d02f02e7d2df91a6aa5dd71516a..95127189c126b0ffbb5bea944eb4b79d0f7d89cb 100644 --- a/test/language/expressions/multiplication/bigint-toprimitive.js +++ b/test/language/expressions/multiplication/bigint-toprimitive.js @@ -5,304 +5,368 @@ description: multiplication operator ToNumeric with BigInt operands esid: sec-multiplicative-operators-runtime-semantics-evaluation features: [BigInt, Symbol.toPrimitive, computed-property-names] ---*/ - function err() { throw new Test262Error(); } function MyError() {} -assert.sameValue(({ +assert.sameValue({ [Symbol.toPrimitive]: function() { return 2n; }, + valueOf: err, toString: err -}) * 2n, 4n, "ToPrimitive: @@toPrimitive takes precedence"); +} * 2n, 4n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) * 2n) is 4n'); + assert.sameValue(2n * { [Symbol.toPrimitive]: function() { return 2n; }, + valueOf: err, toString: err -}, 4n, "ToPrimitive: @@toPrimitive takes precedence"); -assert.sameValue(({ +}, 4n, 'The result of (2n * {[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) is 4n'); + +assert.sameValue({ valueOf: function() { return 2n; }, + toString: err -}) * 2n, 4n, "ToPrimitive: valueOf takes precedence over toString"); +} * 2n, 4n, 'The result of (({valueOf: function() {return 2n;}, toString: err}) * 2n) is 4n'); + assert.sameValue(2n * { valueOf: function() { return 2n; }, + toString: err -}, 4n, "ToPrimitive: valueOf takes precedence over toString"); -assert.sameValue(({ +}, 4n, 'The result of (2n * {valueOf: function() {return 2n;}, toString: err}) is 4n'); + +assert.sameValue({ toString: function() { return 2n; } -}) * 2n, 4n, "ToPrimitive: toString with no valueOf"); +} * 2n, 4n, 'The result of (({toString: function() {return 2n;}}) * 2n) is 4n'); + assert.sameValue(2n * { toString: function() { return 2n; } -}, 4n, "ToPrimitive: toString with no valueOf"); -assert.sameValue(({ +}, 4n, 'The result of (2n * {toString: function() {return 2n;}}) is 4n'); + +assert.sameValue({ [Symbol.toPrimitive]: undefined, + valueOf: function() { return 2n; } -}) * 2n, 4n, "ToPrimitive: skip @@toPrimitive when it's undefined"); +} * 2n, 4n, 'The result of (({[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) * 2n) is 4n'); + assert.sameValue(2n * { [Symbol.toPrimitive]: undefined, + valueOf: function() { return 2n; } -}, 4n, "ToPrimitive: skip @@toPrimitive when it's undefined"); -assert.sameValue(({ +}, 4n, 'The result of (2n * {[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) is 4n'); + +assert.sameValue({ [Symbol.toPrimitive]: null, + valueOf: function() { return 2n; } -}) * 2n, 4n, "ToPrimitive: skip @@toPrimitive when it's null"); +} * 2n, 4n, 'The result of (({[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) * 2n) is 4n'); + assert.sameValue(2n * { [Symbol.toPrimitive]: null, + valueOf: function() { return 2n; } -}, 4n, "ToPrimitive: skip @@toPrimitive when it's null"); -assert.sameValue(({ +}, 4n, 'The result of (2n * {[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) is 4n'); + +assert.sameValue({ valueOf: null, + toString: function() { return 2n; } -}) * 2n, 4n, "ToPrimitive: skip valueOf when it's not callable"); +} * 2n, 4n, 'The result of (({valueOf: null, toString: function() {return 2n;}}) * 2n) is 4n'); + assert.sameValue(2n * { valueOf: null, + toString: function() { return 2n; } -}, 4n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 4n, 'The result of (2n * {valueOf: null, toString: function() {return 2n;}}) is 4n'); + +assert.sameValue({ valueOf: 1, + toString: function() { return 2n; } -}) * 2n, 4n, "ToPrimitive: skip valueOf when it's not callable"); +} * 2n, 4n, 'The result of (({valueOf: 1, toString: function() {return 2n;}}) * 2n) is 4n'); + assert.sameValue(2n * { valueOf: 1, + toString: function() { return 2n; } -}, 4n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 4n, 'The result of (2n * {valueOf: 1, toString: function() {return 2n;}}) is 4n'); + +assert.sameValue({ valueOf: {}, + toString: function() { return 2n; } -}) * 2n, 4n, "ToPrimitive: skip valueOf when it's not callable"); +} * 2n, 4n, 'The result of (({valueOf: {}, toString: function() {return 2n;}}) * 2n) is 4n'); + assert.sameValue(2n * { valueOf: {}, + toString: function() { return 2n; } -}, 4n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 4n, 'The result of (2n * {valueOf: {}, toString: function() {return 2n;}}) is 4n'); + +assert.sameValue({ valueOf: function() { return {}; }, + toString: function() { return 2n; } -}) * 2n, 4n, "ToPrimitive: skip valueOf when it returns an object"); +} * 2n, 4n, 'The result of (({valueOf: function() {return {};}, toString: function() {return 2n;}}) * 2n) is 4n'); + assert.sameValue(2n * { valueOf: function() { return {}; }, + toString: function() { return 2n; } -}, 4n, "ToPrimitive: skip valueOf when it returns an object"); -assert.sameValue(({ +}, 4n, 'The result of (2n * {valueOf: function() {return {};}, toString: function() {return 2n;}}) is 4n'); + +assert.sameValue({ valueOf: function() { return Object(12345); }, + toString: function() { return 2n; } -}) * 2n, 4n, "ToPrimitive: skip valueOf when it returns an object"); +} * 2n, 4n, 'The result of (({valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) * 2n) is 4n'); + assert.sameValue(2n * { valueOf: function() { return Object(12345); }, + toString: function() { return 2n; } -}, 4n, "ToPrimitive: skip valueOf when it returns an object"); +}, 4n, 'The result of (2n * {valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) is 4n'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: 1 }) * 0n; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '({[Symbol.toPrimitive]: 1}) * 0n throws TypeError'); + assert.throws(TypeError, function() { 0n * { [Symbol.toPrimitive]: 1 }; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '0n * {[Symbol.toPrimitive]: 1} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: {} }) * 0n; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '({[Symbol.toPrimitive]: {}}) * 0n throws TypeError'); + assert.throws(TypeError, function() { 0n * { [Symbol.toPrimitive]: {} }; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '0n * {[Symbol.toPrimitive]: {}} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { return Object(1); } }) * 0n; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '({[Symbol.toPrimitive]: function() {return Object(1);}}) * 0n throws TypeError'); + assert.throws(TypeError, function() { 0n * { [Symbol.toPrimitive]: function() { return Object(1); } }; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '0n * {[Symbol.toPrimitive]: function() {return Object(1);}} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { return {}; } }) * 0n; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '({[Symbol.toPrimitive]: function() {return {};}}) * 0n throws TypeError'); + assert.throws(TypeError, function() { 0n * { [Symbol.toPrimitive]: function() { return {}; } }; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '0n * {[Symbol.toPrimitive]: function() {return {};}} throws TypeError'); + assert.throws(MyError, function() { ({ [Symbol.toPrimitive]: function() { throw new MyError(); } }) * 0n; -}, "ToPrimitive: propagate errors from @@toPrimitive"); +}, '({[Symbol.toPrimitive]: function() {throw new MyError();}}) * 0n throws MyError'); + assert.throws(MyError, function() { 0n * { [Symbol.toPrimitive]: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from @@toPrimitive"); +}, '0n * {[Symbol.toPrimitive]: function() {throw new MyError();}} throws MyError'); + assert.throws(MyError, function() { ({ valueOf: function() { throw new MyError(); } }) * 0n; -}, "ToPrimitive: propagate errors from valueOf"); +}, '({valueOf: function() {throw new MyError();}}) * 0n throws MyError'); + assert.throws(MyError, function() { 0n * { valueOf: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from valueOf"); +}, '0n * {valueOf: function() {throw new MyError();}} throws MyError'); + assert.throws(MyError, function() { ({ toString: function() { throw new MyError(); } }) * 0n; -}, "ToPrimitive: propagate errors from toString"); +}, '({toString: function() {throw new MyError();}}) * 0n throws MyError'); + assert.throws(MyError, function() { 0n * { toString: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from toString"); +}, '0n * {toString: function() {throw new MyError();}} throws MyError'); + assert.throws(TypeError, function() { ({ valueOf: null, toString: null }) * 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: null, toString: null}) * 0n throws TypeError'); + assert.throws(TypeError, function() { 0n * { valueOf: null, toString: null }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n * {valueOf: null, toString: null} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: 1, toString: 1 }) * 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: 1, toString: 1}) * 0n throws TypeError'); + assert.throws(TypeError, function() { 0n * { valueOf: 1, toString: 1 }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n * {valueOf: 1, toString: 1} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: {}, toString: {} }) * 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: {}, toString: {}}) * 0n throws TypeError'); + assert.throws(TypeError, function() { 0n * { valueOf: {}, toString: {} }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n * {valueOf: {}, toString: {}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { return Object(1); }, + toString: function() { return Object(1); } }) * 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: function() {return Object(1);}, toString: function() {return Object(1);}}) * 0n throws TypeError'); + assert.throws(TypeError, function() { 0n * { valueOf: function() { return Object(1); }, + toString: function() { return Object(1); } }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n * {valueOf: function() {return Object(1);}, toString: function() {return Object(1);}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { return {}; }, + toString: function() { return {}; } }) * 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: function() {return {};}, toString: function() {return {};}}) * 0n throws TypeError'); + assert.throws(TypeError, function() { 0n * { valueOf: function() { return {}; }, + toString: function() { return {}; } }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n * {valueOf: function() {return {};}, toString: function() {return {};}} throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/multiplication/bigint-wrapped-values.js b/test/language/expressions/multiplication/bigint-wrapped-values.js index 2421ee83a704540b69c296670a2ec3c47cd1f6b6..5a5c5506aedd3ce447f9a81c5fa8df157a6e4a85 100644 --- a/test/language/expressions/multiplication/bigint-wrapped-values.js +++ b/test/language/expressions/multiplication/bigint-wrapped-values.js @@ -5,36 +5,41 @@ description: multiplication operator ToNumeric with BigInt operands esid: sec-multiplicative-operators-runtime-semantics-evaluation features: [BigInt, Symbol.toPrimitive, computed-property-names] ---*/ +assert.sameValue(Object(2n) * 2n, 4n, 'The result of (Object(2n) * 2n) is 4n'); +assert.sameValue(2n * Object(2n), 4n, 'The result of (2n * Object(2n)) is 4n'); -assert.sameValue(Object(2n) * 2n, 4n, "ToPrimitive: unbox object with internal slot"); -assert.sameValue(2n * Object(2n), 4n, "ToPrimitive: unbox object with internal slot"); -assert.sameValue(({ +assert.sameValue({ [Symbol.toPrimitive]: function() { return 2n; } -}) * 2n, 4n, "ToPrimitive: @@toPrimitive"); +} * 2n, 4n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}}) * 2n) is 4n'); + assert.sameValue(2n * { [Symbol.toPrimitive]: function() { return 2n; } -}, 4n, "ToPrimitive: @@toPrimitive"); -assert.sameValue(({ +}, 4n, 'The result of (2n * {[Symbol.toPrimitive]: function() {return 2n;}}) is 4n'); + +assert.sameValue({ valueOf: function() { return 2n; } -}) * 2n, 4n, "ToPrimitive: valueOf"); +} * 2n, 4n, 'The result of (({valueOf: function() {return 2n;}}) * 2n) is 4n'); + assert.sameValue(2n * { valueOf: function() { return 2n; } -}, 4n, "ToPrimitive: valueOf"); -assert.sameValue(({ +}, 4n, 'The result of (2n * {valueOf: function() {return 2n;}}) is 4n'); + +assert.sameValue({ toString: function() { return 2n; } -}) * 2n, 4n, "ToPrimitive: toString"); +} * 2n, 4n, 'The result of (({toString: function() {return 2n;}}) * 2n) is 4n'); + assert.sameValue(2n * { toString: function() { return 2n; } -}, 4n, "ToPrimitive: toString"); +}, 4n, 'The result of (2n * {toString: function() {return 2n;}}) is 4n'); \ No newline at end of file diff --git a/test/language/expressions/right-shift/bigint-and-number.js b/test/language/expressions/right-shift/bigint-and-number.js index e8dde0473b9dc10698e0c4f528896153e50d7e89..81ca9f27579e1c25758ddef34234c0cc9dd98149 100644 --- a/test/language/expressions/right-shift/bigint-and-number.js +++ b/test/language/expressions/right-shift/bigint-and-number.js @@ -9,24 +9,82 @@ info: | Let rnum be ? ToNumeric(rightValue). If Type(lnum) does not equal Type(rnum), throw a TypeError exception. ---*/ +assert.throws(TypeError, function() { + 1n >> 1; +}, '1n >> 1 throws TypeError'); -assert.throws(TypeError, function() { 1n >> 1; }, "1n >> 1 throws TypeError"); -assert.throws(TypeError, function() { 1 >> 1n; }, "1 >> 1n throws TypeError"); -assert.throws(TypeError, function() { Object(1n) >> 1; }, "Object(1n) >> 1 throws TypeError"); -assert.throws(TypeError, function() { 1 >> Object(1n); }, "1 >> Object(1n) throws TypeError"); -assert.throws(TypeError, function() { 1n >> Object(1); }, "1n >> Object(1) throws TypeError"); -assert.throws(TypeError, function() { Object(1) >> 1n; }, "Object(1) >> 1n throws TypeError"); -assert.throws(TypeError, function() { Object(1n) >> Object(1); }, "Object(1n) >> Object(1) throws TypeError"); -assert.throws(TypeError, function() { Object(1) >> Object(1n); }, "Object(1) >> Object(1n) throws TypeError"); -assert.throws(TypeError, function() { 1n >> NaN; }, "1n >> NaN throws TypeError"); -assert.throws(TypeError, function() { NaN >> 1n; }, "NaN >> 1n throws TypeError"); -assert.throws(TypeError, function() { 1n >> Infinity; }, "1n >> Infinity throws TypeError"); -assert.throws(TypeError, function() { Infinity >> 1n; }, "Infinity >> 1n throws TypeError"); -assert.throws(TypeError, function() { 1n >> true; }, "1n >> true throws TypeError"); -assert.throws(TypeError, function() { true >> 1n; }, "true >> 1n throws TypeError"); -assert.throws(TypeError, function() { 1n >> "1"; }, '1n >> "1" throws TypeError'); -assert.throws(TypeError, function() { "1" >> 1n; }, '"1" >> 1n throws TypeError'); -assert.throws(TypeError, function() { 1n >> null; }, "1n >> null throws TypeError"); -assert.throws(TypeError, function() { null >> 1n; }, "null >> 1n throws TypeError"); -assert.throws(TypeError, function() { 1n >> undefined; }, "1n >> undefined throws TypeError"); -assert.throws(TypeError, function() { undefined >> 1n; }, "undefined >> 1n throws TypeError"); +assert.throws(TypeError, function() { + 1 >> 1n; +}, '1 >> 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) >> 1; +}, 'Object(1n) >> 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 >> Object(1n); +}, '1 >> Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n >> Object(1); +}, '1n >> Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) >> 1n; +}, 'Object(1) >> 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) >> Object(1); +}, 'Object(1n) >> Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) >> Object(1n); +}, 'Object(1) >> Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n >> NaN; +}, '1n >> NaN throws TypeError'); + +assert.throws(TypeError, function() { + NaN >> 1n; +}, 'NaN >> 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n >> Infinity; +}, '1n >> Infinity throws TypeError'); + +assert.throws(TypeError, function() { + Infinity >> 1n; +}, 'Infinity >> 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n >> true; +}, '1n >> true throws TypeError'); + +assert.throws(TypeError, function() { + true >> 1n; +}, 'true >> 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n >> '1'; +}, '1n >> "1" throws TypeError'); + +assert.throws(TypeError, function() { + '1' >> 1n; +}, '"1" >> 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n >> null; +}, '1n >> null throws TypeError'); + +assert.throws(TypeError, function() { + null >> 1n; +}, 'null >> 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n >> undefined; +}, '1n >> undefined throws TypeError'); + +assert.throws(TypeError, function() { + undefined >> 1n; +}, 'undefined >> 1n throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/right-shift/bigint-errors.js b/test/language/expressions/right-shift/bigint-errors.js index c7c7371cd975985c1108fce08304002df7862ff9..a5e77bc4e192491103beec5af9590d95d5c3f5a7 100644 --- a/test/language/expressions/right-shift/bigint-errors.js +++ b/test/language/expressions/right-shift/bigint-errors.js @@ -5,58 +5,66 @@ description: right-shift operator ToNumeric with BigInt operands esid: sec-signed-right-shift-operator-runtime-semantics-evaluation features: [BigInt, Symbol, Symbol.toPrimitive, computed-property-names] ---*/ - assert.throws(TypeError, function() { - Symbol("1") >> 0n; -}, "ToBigInt: Symbol => TypeError"); + Symbol('1') >> 0n; +}, 'Symbol("1") >> 0n throws TypeError'); + assert.throws(TypeError, function() { - 0n >> Symbol("1"); -}, "ToBigInt: Symbol => TypeError"); + 0n >> Symbol('1'); +}, '0n >> Symbol("1") throws TypeError'); + assert.throws(TypeError, function() { - Object(Symbol("1")) >> 0n; -}, "ToBigInt: unbox object with internal slot => Symbol => TypeError"); + Object(Symbol('1')) >> 0n; +}, 'Object(Symbol("1")) >> 0n throws TypeError'); + assert.throws(TypeError, function() { - 0n >> Object(Symbol("1")); -}, "ToBigInt: unbox object with internal slot => Symbol => TypeError"); + 0n >> Object(Symbol('1')); +}, '0n >> Object(Symbol("1")) throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { - return Symbol("1"); + return Symbol('1'); } }) >> 0n; -}, "ToBigInt: @@toPrimitive => Symbol => TypeError"); +}, '({[Symbol.toPrimitive]: function() {return Symbol("1");}}) >> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >> { [Symbol.toPrimitive]: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: @@toPrimitive => Symbol => TypeError"); +}, '0n >> {[Symbol.toPrimitive]: function() {return Symbol("1");}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { - return Symbol("1"); + return Symbol('1'); } }) >> 0n; -}, "ToBigInt: valueOf => Symbol => TypeError"); +}, '({valueOf: function() {return Symbol("1");}}) >> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >> { valueOf: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: valueOf => Symbol => TypeError"); +}, '0n >> {valueOf: function() {return Symbol("1");}} throws TypeError'); + assert.throws(TypeError, function() { ({ toString: function() { - return Symbol("1"); + return Symbol('1'); } }) >> 0n; -}, "ToBigInt: toString => Symbol => TypeError"); +}, '({toString: function() {return Symbol("1");}}) >> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >> { toString: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: toString => Symbol => TypeError"); +}, '0n >> {toString: function() {return Symbol("1");}} throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/right-shift/bigint-non-primitive.js b/test/language/expressions/right-shift/bigint-non-primitive.js index 6a44f7b03ba5cc693acfdf47c55884bd773f83be..7abdca846ed0e869b45b0e37805af34e5024b0ca 100644 --- a/test/language/expressions/right-shift/bigint-non-primitive.js +++ b/test/language/expressions/right-shift/bigint-non-primitive.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Right shift for non-primitive BigInt values esid: sec-signed-right-shift-operator-runtime-semantics-evaluation @@ -19,32 +18,70 @@ info: | features: [BigInt, Symbol.toPrimitive] ---*/ +assert.sameValue(Object(0b101n) >> 1n, 0b10n, 'The result of (Object(0b101n) >> 1n) is 0b10n'); -assert.sameValue(Object(0b101n) >> 1n, 0b10n, "Object(0b101n) >> 1n === 0b10n"); -assert.sameValue(Object(0b101n) >> Object(1n), 0b10n, "Object(0b101n) >> Object(1n) === 0b10n"); +assert.sameValue( + Object(0b101n) >> Object(1n), + 0b10n, + 'The result of (Object(0b101n) >> Object(1n)) is 0b10n' +); function err() { throw new Test262Error(); } -assert.sameValue( - {[Symbol.toPrimitive]: function() { return 0b101n; }, valueOf: err, toString: err} >> 1n, 0b10n, - "primitive from @@toPrimitive"); -assert.sameValue( - {valueOf: function() { return 0b101n; }, toString: err} >> 1n, 0b10n, - "primitive from {}.valueOf"); -assert.sameValue( - {toString: function() { return 0b101n; }} >> 1n, 0b10n, - "primitive from {}.toString"); -assert.sameValue( - 0b101n >> {[Symbol.toPrimitive]: function() { return 1n; }, valueOf: err, toString: err}, 0b10n, - "primitive from @@toPrimitive"); -assert.sameValue( - 0b101n >> {valueOf: function() { return 1n; }, toString: err}, 0b10n, - "primitive from {}.valueOf"); -assert.sameValue( - 0b101n >> {toString: function() { return 1n; }}, 0b10n, - "primitive from {}.toString"); -assert.sameValue( - {valueOf: function() { return 0b101n; }} >> {valueOf: function() { return 1n; }}, 0b10n, - "primitive from {}.valueOf"); +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 0b101n; + }, + + valueOf: err, + toString: err +} >> 1n, 0b10n, 'The result of (({[Symbol.toPrimitive]: function() {return 0b101n;}, valueOf: err, toString: err}) >> 1n) is 0b10n'); + +assert.sameValue({ + valueOf: function() { + return 0b101n; + }, + + toString: err +} >> 1n, 0b10n, 'The result of (({valueOf: function() {return 0b101n;}, toString: err}) >> 1n) is 0b10n'); + +assert.sameValue({ + toString: function() { + return 0b101n; + } +} >> 1n, 0b10n, 'The result of (({toString: function() {return 0b101n;}}) >> 1n) is 0b10n'); + +assert.sameValue(0b101n >> { + [Symbol.toPrimitive]: function() { + return 1n; + }, + + valueOf: err, + toString: err +}, 0b10n, 'The result of (0b101n >> {[Symbol.toPrimitive]: function() {return 1n;}, valueOf: err, toString: err}) is 0b10n'); + +assert.sameValue(0b101n >> { + valueOf: function() { + return 1n; + }, + + toString: err +}, 0b10n, 'The result of (0b101n >> {valueOf: function() {return 1n;}, toString: err}) is 0b10n'); + +assert.sameValue(0b101n >> { + toString: function() { + return 1n; + } +}, 0b10n, 'The result of (0b101n >> {toString: function() {return 1n;}}) is 0b10n'); + +assert.sameValue({ + valueOf: function() { + return 0b101n; + } +} >> { + valueOf: function() { + return 1n; + } +}, 0b10n, 'The result of (({valueOf: function() {return 0b101n;}}) >> {valueOf: function() {return 1n;}}) is 0b10n'); \ No newline at end of file diff --git a/test/language/expressions/right-shift/bigint-toprimitive.js b/test/language/expressions/right-shift/bigint-toprimitive.js index 3d40f35b2de8b6beab335888b5eab7bb0dcb0a42..a1dd9746f79fb15fc829517842dca267f9abc747 100644 --- a/test/language/expressions/right-shift/bigint-toprimitive.js +++ b/test/language/expressions/right-shift/bigint-toprimitive.js @@ -5,304 +5,368 @@ description: right-shift operator ToNumeric with BigInt operands esid: sec-signed-right-shift-operator-runtime-semantics-evaluation features: [BigInt, Symbol.toPrimitive, computed-property-names] ---*/ - function err() { throw new Test262Error(); } function MyError() {} -assert.sameValue(({ +assert.sameValue({ [Symbol.toPrimitive]: function() { return 2n; }, + valueOf: err, toString: err -}) >> 1n, 1n, "ToPrimitive: @@toPrimitive takes precedence"); +} >> 1n, 1n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) >> 1n) is 1n'); + assert.sameValue(4n >> { [Symbol.toPrimitive]: function() { return 2n; }, + valueOf: err, toString: err -}, 1n, "ToPrimitive: @@toPrimitive takes precedence"); -assert.sameValue(({ +}, 1n, 'The result of (4n >> {[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) is 1n'); + +assert.sameValue({ valueOf: function() { return 2n; }, + toString: err -}) >> 1n, 1n, "ToPrimitive: valueOf takes precedence over toString"); +} >> 1n, 1n, 'The result of (({valueOf: function() {return 2n;}, toString: err}) >> 1n) is 1n'); + assert.sameValue(4n >> { valueOf: function() { return 2n; }, + toString: err -}, 1n, "ToPrimitive: valueOf takes precedence over toString"); -assert.sameValue(({ +}, 1n, 'The result of (4n >> {valueOf: function() {return 2n;}, toString: err}) is 1n'); + +assert.sameValue({ toString: function() { return 2n; } -}) >> 1n, 1n, "ToPrimitive: toString with no valueOf"); +} >> 1n, 1n, 'The result of (({toString: function() {return 2n;}}) >> 1n) is 1n'); + assert.sameValue(4n >> { toString: function() { return 2n; } -}, 1n, "ToPrimitive: toString with no valueOf"); -assert.sameValue(({ +}, 1n, 'The result of (4n >> {toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ [Symbol.toPrimitive]: undefined, + valueOf: function() { return 2n; } -}) >> 1n, 1n, "ToPrimitive: skip @@toPrimitive when it's undefined"); +} >> 1n, 1n, 'The result of (({[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) >> 1n) is 1n'); + assert.sameValue(4n >> { [Symbol.toPrimitive]: undefined, + valueOf: function() { return 2n; } -}, 1n, "ToPrimitive: skip @@toPrimitive when it's undefined"); -assert.sameValue(({ +}, 1n, 'The result of (4n >> {[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ [Symbol.toPrimitive]: null, + valueOf: function() { return 2n; } -}) >> 1n, 1n, "ToPrimitive: skip @@toPrimitive when it's null"); +} >> 1n, 1n, 'The result of (({[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) >> 1n) is 1n'); + assert.sameValue(4n >> { [Symbol.toPrimitive]: null, + valueOf: function() { return 2n; } -}, 1n, "ToPrimitive: skip @@toPrimitive when it's null"); -assert.sameValue(({ +}, 1n, 'The result of (4n >> {[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: null, + toString: function() { return 2n; } -}) >> 1n, 1n, "ToPrimitive: skip valueOf when it's not callable"); +} >> 1n, 1n, 'The result of (({valueOf: null, toString: function() {return 2n;}}) >> 1n) is 1n'); + assert.sameValue(4n >> { valueOf: null, + toString: function() { return 2n; } -}, 1n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 1n, 'The result of (4n >> {valueOf: null, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: 1, + toString: function() { return 2n; } -}) >> 1n, 1n, "ToPrimitive: skip valueOf when it's not callable"); +} >> 1n, 1n, 'The result of (({valueOf: 1, toString: function() {return 2n;}}) >> 1n) is 1n'); + assert.sameValue(4n >> { valueOf: 1, + toString: function() { return 2n; } -}, 1n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 1n, 'The result of (4n >> {valueOf: 1, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: {}, + toString: function() { return 2n; } -}) >> 1n, 1n, "ToPrimitive: skip valueOf when it's not callable"); +} >> 1n, 1n, 'The result of (({valueOf: {}, toString: function() {return 2n;}}) >> 1n) is 1n'); + assert.sameValue(4n >> { valueOf: {}, + toString: function() { return 2n; } -}, 1n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 1n, 'The result of (4n >> {valueOf: {}, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: function() { return {}; }, + toString: function() { return 2n; } -}) >> 1n, 1n, "ToPrimitive: skip valueOf when it returns an object"); +} >> 1n, 1n, 'The result of (({valueOf: function() {return {};}, toString: function() {return 2n;}}) >> 1n) is 1n'); + assert.sameValue(4n >> { valueOf: function() { return {}; }, + toString: function() { return 2n; } -}, 1n, "ToPrimitive: skip valueOf when it returns an object"); -assert.sameValue(({ +}, 1n, 'The result of (4n >> {valueOf: function() {return {};}, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: function() { return Object(12345); }, + toString: function() { return 2n; } -}) >> 1n, 1n, "ToPrimitive: skip valueOf when it returns an object"); +} >> 1n, 1n, 'The result of (({valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) >> 1n) is 1n'); + assert.sameValue(4n >> { valueOf: function() { return Object(12345); }, + toString: function() { return 2n; } -}, 1n, "ToPrimitive: skip valueOf when it returns an object"); +}, 1n, 'The result of (4n >> {valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) is 1n'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: 1 }) >> 0n; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '({[Symbol.toPrimitive]: 1}) >> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >> { [Symbol.toPrimitive]: 1 }; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '0n >> {[Symbol.toPrimitive]: 1} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: {} }) >> 0n; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '({[Symbol.toPrimitive]: {}}) >> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >> { [Symbol.toPrimitive]: {} }; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '0n >> {[Symbol.toPrimitive]: {}} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { return Object(1); } }) >> 0n; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '({[Symbol.toPrimitive]: function() {return Object(1);}}) >> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >> { [Symbol.toPrimitive]: function() { return Object(1); } }; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '0n >> {[Symbol.toPrimitive]: function() {return Object(1);}} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { return {}; } }) >> 0n; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '({[Symbol.toPrimitive]: function() {return {};}}) >> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >> { [Symbol.toPrimitive]: function() { return {}; } }; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '0n >> {[Symbol.toPrimitive]: function() {return {};}} throws TypeError'); + assert.throws(MyError, function() { ({ [Symbol.toPrimitive]: function() { throw new MyError(); } }) >> 0n; -}, "ToPrimitive: propagate errors from @@toPrimitive"); +}, '({[Symbol.toPrimitive]: function() {throw new MyError();}}) >> 0n throws MyError'); + assert.throws(MyError, function() { 0n >> { [Symbol.toPrimitive]: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from @@toPrimitive"); +}, '0n >> {[Symbol.toPrimitive]: function() {throw new MyError();}} throws MyError'); + assert.throws(MyError, function() { ({ valueOf: function() { throw new MyError(); } }) >> 0n; -}, "ToPrimitive: propagate errors from valueOf"); +}, '({valueOf: function() {throw new MyError();}}) >> 0n throws MyError'); + assert.throws(MyError, function() { 0n >> { valueOf: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from valueOf"); +}, '0n >> {valueOf: function() {throw new MyError();}} throws MyError'); + assert.throws(MyError, function() { ({ toString: function() { throw new MyError(); } }) >> 0n; -}, "ToPrimitive: propagate errors from toString"); +}, '({toString: function() {throw new MyError();}}) >> 0n throws MyError'); + assert.throws(MyError, function() { 0n >> { toString: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from toString"); +}, '0n >> {toString: function() {throw new MyError();}} throws MyError'); + assert.throws(TypeError, function() { ({ valueOf: null, toString: null }) >> 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: null, toString: null}) >> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >> { valueOf: null, toString: null }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n >> {valueOf: null, toString: null} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: 1, toString: 1 }) >> 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: 1, toString: 1}) >> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >> { valueOf: 1, toString: 1 }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n >> {valueOf: 1, toString: 1} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: {}, toString: {} }) >> 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: {}, toString: {}}) >> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >> { valueOf: {}, toString: {} }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n >> {valueOf: {}, toString: {}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { return Object(1); }, + toString: function() { return Object(1); } }) >> 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: function() {return Object(1);}, toString: function() {return Object(1);}}) >> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >> { valueOf: function() { return Object(1); }, + toString: function() { return Object(1); } }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n >> {valueOf: function() {return Object(1);}, toString: function() {return Object(1);}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { return {}; }, + toString: function() { return {}; } }) >> 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: function() {return {};}, toString: function() {return {};}}) >> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >> { valueOf: function() { return {}; }, + toString: function() { return {}; } }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n >> {valueOf: function() {return {};}, toString: function() {return {};}} throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/right-shift/bigint-wrapped-values.js b/test/language/expressions/right-shift/bigint-wrapped-values.js index dd0069afb869e034bfc6dcdd8c8186061beb9bef..ad0d6c0d78f928ec2cde7ec601c177ce37ecf07e 100644 --- a/test/language/expressions/right-shift/bigint-wrapped-values.js +++ b/test/language/expressions/right-shift/bigint-wrapped-values.js @@ -5,36 +5,41 @@ description: right-shift operator ToNumeric with BigInt operands esid: sec-signed-right-shift-operator-runtime-semantics-evaluation features: [BigInt, Symbol.toPrimitive, computed-property-names] ---*/ +assert.sameValue(Object(2n) >> 1n, 1n, 'The result of (Object(2n) >> 1n) is 1n'); +assert.sameValue(4n >> Object(2n), 1n, 'The result of (4n >> Object(2n)) is 1n'); -assert.sameValue(Object(2n) >> 1n, 1n, "ToPrimitive: unbox object with internal slot"); -assert.sameValue(4n >> Object(2n), 1n, "ToPrimitive: unbox object with internal slot"); -assert.sameValue(({ +assert.sameValue({ [Symbol.toPrimitive]: function() { return 2n; } -}) >> 1n, 1n, "ToPrimitive: @@toPrimitive"); +} >> 1n, 1n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}}) >> 1n) is 1n'); + assert.sameValue(4n >> { [Symbol.toPrimitive]: function() { return 2n; } -}, 1n, "ToPrimitive: @@toPrimitive"); -assert.sameValue(({ +}, 1n, 'The result of (4n >> {[Symbol.toPrimitive]: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: function() { return 2n; } -}) >> 1n, 1n, "ToPrimitive: valueOf"); +} >> 1n, 1n, 'The result of (({valueOf: function() {return 2n;}}) >> 1n) is 1n'); + assert.sameValue(4n >> { valueOf: function() { return 2n; } -}, 1n, "ToPrimitive: valueOf"); -assert.sameValue(({ +}, 1n, 'The result of (4n >> {valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ toString: function() { return 2n; } -}) >> 1n, 1n, "ToPrimitive: toString"); +} >> 1n, 1n, 'The result of (({toString: function() {return 2n;}}) >> 1n) is 1n'); + assert.sameValue(4n >> { toString: function() { return 2n; } -}, 1n, "ToPrimitive: toString"); +}, 1n, 'The result of (4n >> {toString: function() {return 2n;}}) is 1n'); \ No newline at end of file diff --git a/test/language/expressions/strict-does-not-equals/bigint-and-bigint.js b/test/language/expressions/strict-does-not-equals/bigint-and-bigint.js index 3486a4dd528fe30619329c2317e12acc90147c6a..ab8f7d57f333126234c013f942ad0726051c0ca1 100644 --- a/test/language/expressions/strict-does-not-equals/bigint-and-bigint.js +++ b/test/language/expressions/strict-does-not-equals/bigint-and-bigint.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Strict inequality comparison of BigInt values esid: sec-strict-equality-comparison @@ -16,39 +15,158 @@ info: | features: [BigInt] ---*/ +assert.sameValue(0n !== 0n, false, 'The result of (0n !== 0n) is false'); +assert.sameValue(1n !== 1n, false, 'The result of (1n !== 1n) is false'); +assert.sameValue(-1n !== -1n, false, 'The result of (-1n !== -1n) is false'); +assert.sameValue(0n !== -0n, false, 'The result of (0n !== -0n) is false'); +assert.sameValue(-0n !== 0n, false, 'The result of (-0n !== 0n) is false'); +assert.sameValue(0n !== 1n, true, 'The result of (0n !== 1n) is true'); +assert.sameValue(1n !== 0n, true, 'The result of (1n !== 0n) is true'); +assert.sameValue(0n !== -1n, true, 'The result of (0n !== -1n) is true'); +assert.sameValue(-1n !== 0n, true, 'The result of (-1n !== 0n) is true'); +assert.sameValue(1n !== -1n, true, 'The result of (1n !== -1n) is true'); +assert.sameValue(-1n !== 1n, true, 'The result of (-1n !== 1n) is true'); + +assert.sameValue( + 0x1fffffffffffff01n !== 0x1fffffffffffff01n, + false, + 'The result of (0x1fffffffffffff01n !== 0x1fffffffffffff01n) is false' +); + +assert.sameValue( + 0x1fffffffffffff01n !== 0x1fffffffffffff02n, + true, + 'The result of (0x1fffffffffffff01n !== 0x1fffffffffffff02n) is true' +); + +assert.sameValue( + 0x1fffffffffffff02n !== 0x1fffffffffffff01n, + true, + 'The result of (0x1fffffffffffff02n !== 0x1fffffffffffff01n) is true' +); + +assert.sameValue( + -0x1fffffffffffff01n !== -0x1fffffffffffff01n, + false, + 'The result of (-0x1fffffffffffff01n !== -0x1fffffffffffff01n) is false' +); + +assert.sameValue( + -0x1fffffffffffff01n !== -0x1fffffffffffff02n, + true, + 'The result of (-0x1fffffffffffff01n !== -0x1fffffffffffff02n) is true' +); + +assert.sameValue( + -0x1fffffffffffff02n !== -0x1fffffffffffff01n, + true, + 'The result of (-0x1fffffffffffff02n !== -0x1fffffffffffff01n) is true' +); + +assert.sameValue( + 0x10000000000000000n !== 0n, + true, + 'The result of (0x10000000000000000n !== 0n) is true' +); + +assert.sameValue( + 0n !== 0x10000000000000000n, + true, + 'The result of (0n !== 0x10000000000000000n) is true' +); + +assert.sameValue( + 0x10000000000000000n !== 1n, + true, + 'The result of (0x10000000000000000n !== 1n) is true' +); + +assert.sameValue( + 1n !== 0x10000000000000000n, + true, + 'The result of (1n !== 0x10000000000000000n) is true' +); + +assert.sameValue( + 0x10000000000000000n !== -1n, + true, + 'The result of (0x10000000000000000n !== -1n) is true' +); + +assert.sameValue( + -1n !== 0x10000000000000000n, + true, + 'The result of (-1n !== 0x10000000000000000n) is true' +); + +assert.sameValue( + 0x10000000000000001n !== 0n, + true, + 'The result of (0x10000000000000001n !== 0n) is true' +); + +assert.sameValue( + 0n !== 0x10000000000000001n, + true, + 'The result of (0n !== 0x10000000000000001n) is true' +); + +assert.sameValue( + -0x10000000000000000n !== 0n, + true, + 'The result of (-0x10000000000000000n !== 0n) is true' +); + +assert.sameValue( + 0n !== -0x10000000000000000n, + true, + 'The result of (0n !== -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000000n !== 1n, + true, + 'The result of (-0x10000000000000000n !== 1n) is true' +); + +assert.sameValue( + 1n !== -0x10000000000000000n, + true, + 'The result of (1n !== -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000000n !== -1n, + true, + 'The result of (-0x10000000000000000n !== -1n) is true' +); + +assert.sameValue( + -1n !== -0x10000000000000000n, + true, + 'The result of (-1n !== -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000001n !== 0n, + true, + 'The result of (-0x10000000000000001n !== 0n) is true' +); + +assert.sameValue( + 0n !== -0x10000000000000001n, + true, + 'The result of (0n !== -0x10000000000000001n) is true' +); + +assert.sameValue( + 0x10000000000000000n !== 0x100000000n, + true, + 'The result of (0x10000000000000000n !== 0x100000000n) is true' +); -assert.sameValue(0n !== 0n, false, "0n !== 0n"); -assert.sameValue(1n !== 1n, false, "1n !== 1n"); -assert.sameValue(-1n !== -1n, false, "-1n !== -1n"); -assert.sameValue(0n !== -0n, false, "0n !== -0n"); -assert.sameValue(-0n !== 0n, false, "-0n !== 0n"); -assert.sameValue(0n !== 1n, true, "0n !== 1n"); -assert.sameValue(1n !== 0n, true, "1n !== 0n"); -assert.sameValue(0n !== -1n, true, "0n !== -1n"); -assert.sameValue(-1n !== 0n, true, "-1n !== 0n"); -assert.sameValue(1n !== -1n, true, "1n !== -1n"); -assert.sameValue(-1n !== 1n, true, "-1n !== 1n"); -assert.sameValue(0x1fffffffffffff01n !== 0x1fffffffffffff01n, false, "0x1fffffffffffff01n !== 0x1fffffffffffff01n"); -assert.sameValue(0x1fffffffffffff01n !== 0x1fffffffffffff02n, true, "0x1fffffffffffff01n !== 0x1fffffffffffff02n"); -assert.sameValue(0x1fffffffffffff02n !== 0x1fffffffffffff01n, true, "0x1fffffffffffff02n !== 0x1fffffffffffff01n"); -assert.sameValue(-0x1fffffffffffff01n !== -0x1fffffffffffff01n, false, "-0x1fffffffffffff01n !== -0x1fffffffffffff01n"); -assert.sameValue(-0x1fffffffffffff01n !== -0x1fffffffffffff02n, true, "-0x1fffffffffffff01n !== -0x1fffffffffffff02n"); -assert.sameValue(-0x1fffffffffffff02n !== -0x1fffffffffffff01n, true, "-0x1fffffffffffff02n !== -0x1fffffffffffff01n"); -assert.sameValue(0x10000000000000000n !== 0n, true, "0x10000000000000000n !== 0n"); -assert.sameValue(0n !== 0x10000000000000000n, true, "0n !== 0x10000000000000000n"); -assert.sameValue(0x10000000000000000n !== 1n, true, "0x10000000000000000n !== 1n"); -assert.sameValue(1n !== 0x10000000000000000n, true, "1n !== 0x10000000000000000n"); -assert.sameValue(0x10000000000000000n !== -1n, true, "0x10000000000000000n !== -1n"); -assert.sameValue(-1n !== 0x10000000000000000n, true, "-1n !== 0x10000000000000000n"); -assert.sameValue(0x10000000000000001n !== 0n, true, "0x10000000000000001n !== 0n"); -assert.sameValue(0n !== 0x10000000000000001n, true, "0n !== 0x10000000000000001n"); -assert.sameValue(-0x10000000000000000n !== 0n, true, "-0x10000000000000000n !== 0n"); -assert.sameValue(0n !== -0x10000000000000000n, true, "0n !== -0x10000000000000000n"); -assert.sameValue(-0x10000000000000000n !== 1n, true, "-0x10000000000000000n !== 1n"); -assert.sameValue(1n !== -0x10000000000000000n, true, "1n !== -0x10000000000000000n"); -assert.sameValue(-0x10000000000000000n !== -1n, true, "-0x10000000000000000n !== -1n"); -assert.sameValue(-1n !== -0x10000000000000000n, true, "-1n !== -0x10000000000000000n"); -assert.sameValue(-0x10000000000000001n !== 0n, true, "-0x10000000000000001n !== 0n"); -assert.sameValue(0n !== -0x10000000000000001n, true, "0n !== -0x10000000000000001n"); -assert.sameValue(0x10000000000000000n !== 0x100000000n, true, "0x10000000000000000n !== 0x100000000n"); -assert.sameValue(0x100000000n !== 0x10000000000000000n, true, "0x100000000n !== 0x10000000000000000n"); +assert.sameValue( + 0x100000000n !== 0x10000000000000000n, + true, + 'The result of (0x100000000n !== 0x10000000000000000n) is true' +); \ No newline at end of file diff --git a/test/language/expressions/strict-does-not-equals/bigint-and-boolean.js b/test/language/expressions/strict-does-not-equals/bigint-and-boolean.js index fc33b2bf6a6d2c2930b45beeb9944c232325569b..8259acb3915d1da449f02f383b8e0b149d0ca8af 100644 --- a/test/language/expressions/strict-does-not-equals/bigint-and-boolean.js +++ b/test/language/expressions/strict-does-not-equals/bigint-and-boolean.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Strict inequality comparison of BigInt and Boolean values esid: sec-strict-equality-comparison @@ -9,20 +8,19 @@ info: | features: [BigInt] ---*/ - -assert.sameValue(-1n !== false, true, "-1n !== false"); -assert.sameValue(false !== -1n, true, "false !== -1n"); -assert.sameValue(-1n !== true, true, "-1n !== true"); -assert.sameValue(true !== -1n, true, "true !== -1n"); -assert.sameValue(0n !== false, true, "0n !== false"); -assert.sameValue(false !== 0n, true, "false !== 0n"); -assert.sameValue(0n !== true, true, "0n !== true"); -assert.sameValue(true !== 0n, true, "true !== 0n"); -assert.sameValue(1n !== false, true, "1n !== false"); -assert.sameValue(false !== 1n, true, "false !== 1n"); -assert.sameValue(1n !== true, true, "1n !== true"); -assert.sameValue(true !== 1n, true, "true !== 1n"); -assert.sameValue(2n !== false, true, "2n !== false"); -assert.sameValue(false !== 2n, true, "false !== 2n"); -assert.sameValue(2n !== true, true, "2n !== true"); -assert.sameValue(true !== 2n, true, "true !== 2n"); +assert.sameValue(-1n !== false, true, 'The result of (-1n !== false) is true'); +assert.sameValue(false !== -1n, true, 'The result of (false !== -1n) is true'); +assert.sameValue(-1n !== true, true, 'The result of (-1n !== true) is true'); +assert.sameValue(true !== -1n, true, 'The result of (true !== -1n) is true'); +assert.sameValue(0n !== false, true, 'The result of (0n !== false) is true'); +assert.sameValue(false !== 0n, true, 'The result of (false !== 0n) is true'); +assert.sameValue(0n !== true, true, 'The result of (0n !== true) is true'); +assert.sameValue(true !== 0n, true, 'The result of (true !== 0n) is true'); +assert.sameValue(1n !== false, true, 'The result of (1n !== false) is true'); +assert.sameValue(false !== 1n, true, 'The result of (false !== 1n) is true'); +assert.sameValue(1n !== true, true, 'The result of (1n !== true) is true'); +assert.sameValue(true !== 1n, true, 'The result of (true !== 1n) is true'); +assert.sameValue(2n !== false, true, 'The result of (2n !== false) is true'); +assert.sameValue(false !== 2n, true, 'The result of (false !== 2n) is true'); +assert.sameValue(2n !== true, true, 'The result of (2n !== true) is true'); +assert.sameValue(true !== 2n, true, 'The result of (true !== 2n) is true'); \ No newline at end of file diff --git a/test/language/expressions/strict-does-not-equals/bigint-and-incomparable-primitive.js b/test/language/expressions/strict-does-not-equals/bigint-and-incomparable-primitive.js index 8aa41f663172eb6ddbc7983192be1c4cd4e96f35..26a3012d092787f58626de00ecf93c43b1c9204b 100644 --- a/test/language/expressions/strict-does-not-equals/bigint-and-incomparable-primitive.js +++ b/test/language/expressions/strict-does-not-equals/bigint-and-incomparable-primitive.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Strict inequality comparison of BigInt and miscellaneous primitive values esid: sec-strict-equality-comparison @@ -9,16 +8,15 @@ info: | features: [BigInt, Symbol] ---*/ - -assert.sameValue(0n !== undefined, true, "0n !== undefined"); -assert.sameValue(undefined !== 0n, true, "undefined !== 0n"); -assert.sameValue(1n !== undefined, true, "1n !== undefined"); -assert.sameValue(undefined !== 1n, true, "undefined !== 1n"); -assert.sameValue(0n !== null, true, "0n !== null"); -assert.sameValue(null !== 0n, true, "null !== 0n"); -assert.sameValue(1n !== null, true, "1n !== null"); -assert.sameValue(null !== 1n, true, "null !== 1n"); -assert.sameValue(0n !== Symbol("1"), true, '0n !== Symbol("1")'); -assert.sameValue(Symbol("1") !== 0n, true, 'Symbol("1") !== 0n'); -assert.sameValue(1n !== Symbol("1"), true, '1n !== Symbol("1")'); -assert.sameValue(Symbol("1") !== 1n, true, 'Symbol("1") !== 1n'); +assert.sameValue(0n !== undefined, true, 'The result of (0n !== undefined) is true'); +assert.sameValue(undefined !== 0n, true, 'The result of (undefined !== 0n) is true'); +assert.sameValue(1n !== undefined, true, 'The result of (1n !== undefined) is true'); +assert.sameValue(undefined !== 1n, true, 'The result of (undefined !== 1n) is true'); +assert.sameValue(0n !== null, true, 'The result of (0n !== null) is true'); +assert.sameValue(null !== 0n, true, 'The result of (null !== 0n) is true'); +assert.sameValue(1n !== null, true, 'The result of (1n !== null) is true'); +assert.sameValue(null !== 1n, true, 'The result of (null !== 1n) is true'); +assert.sameValue(0n !== Symbol('1'), true, 'The result of (0n !== Symbol("1")) is true'); +assert.sameValue(Symbol('1') !== 0n, true, 'The result of (Symbol("1") !== 0n) is true'); +assert.sameValue(1n !== Symbol('1'), true, 'The result of (1n !== Symbol("1")) is true'); +assert.sameValue(Symbol('1') !== 1n, true, 'The result of (Symbol("1") !== 1n) is true'); \ No newline at end of file diff --git a/test/language/expressions/strict-does-not-equals/bigint-and-non-finite.js b/test/language/expressions/strict-does-not-equals/bigint-and-non-finite.js index 52708d8e94ee7cd7a1f785e7a961a36f10f2b91b..0bf8148eae8b70f46a0cef72686681a66dbac9a9 100644 --- a/test/language/expressions/strict-does-not-equals/bigint-and-non-finite.js +++ b/test/language/expressions/strict-does-not-equals/bigint-and-non-finite.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Strict inequality comparison of BigInt and non-finite Number values esid: sec-strict-equality-comparison @@ -9,22 +8,21 @@ info: | features: [BigInt] ---*/ - -assert.sameValue(0n !== Infinity, true, "0n !== Infinity"); -assert.sameValue(Infinity !== 0n, true, "Infinity !== 0n"); -assert.sameValue(1n !== Infinity, true, "1n !== Infinity"); -assert.sameValue(Infinity !== 1n, true, "Infinity !== 1n"); -assert.sameValue(-1n !== Infinity, true, "-1n !== Infinity"); -assert.sameValue(Infinity !== -1n, true, "Infinity !== -1n"); -assert.sameValue(0n !== -Infinity, true, "0n !== -Infinity"); -assert.sameValue(-Infinity !== 0n, true, "-Infinity !== 0n"); -assert.sameValue(1n !== -Infinity, true, "1n !== -Infinity"); -assert.sameValue(-Infinity !== 1n, true, "-Infinity !== 1n"); -assert.sameValue(-1n !== -Infinity, true, "-1n !== -Infinity"); -assert.sameValue(-Infinity !== -1n, true, "-Infinity !== -1n"); -assert.sameValue(0n !== NaN, true, "0n !== NaN"); -assert.sameValue(NaN !== 0n, true, "NaN !== 0n"); -assert.sameValue(1n !== NaN, true, "1n !== NaN"); -assert.sameValue(NaN !== 1n, true, "NaN !== 1n"); -assert.sameValue(-1n !== NaN, true, "-1n !== NaN"); -assert.sameValue(NaN !== -1n, true, "NaN !== -1n"); +assert.sameValue(0n !== Infinity, true, 'The result of (0n !== Infinity) is true'); +assert.sameValue(Infinity !== 0n, true, 'The result of (Infinity !== 0n) is true'); +assert.sameValue(1n !== Infinity, true, 'The result of (1n !== Infinity) is true'); +assert.sameValue(Infinity !== 1n, true, 'The result of (Infinity !== 1n) is true'); +assert.sameValue(-1n !== Infinity, true, 'The result of (-1n !== Infinity) is true'); +assert.sameValue(Infinity !== -1n, true, 'The result of (Infinity !== -1n) is true'); +assert.sameValue(0n !== -Infinity, true, 'The result of (0n !== -Infinity) is true'); +assert.sameValue(-Infinity !== 0n, true, 'The result of (-Infinity !== 0n) is true'); +assert.sameValue(1n !== -Infinity, true, 'The result of (1n !== -Infinity) is true'); +assert.sameValue(-Infinity !== 1n, true, 'The result of (-Infinity !== 1n) is true'); +assert.sameValue(-1n !== -Infinity, true, 'The result of (-1n !== -Infinity) is true'); +assert.sameValue(-Infinity !== -1n, true, 'The result of (-Infinity !== -1n) is true'); +assert.sameValue(0n !== NaN, true, 'The result of (0n !== NaN) is true'); +assert.sameValue(NaN !== 0n, true, 'The result of (NaN !== 0n) is true'); +assert.sameValue(1n !== NaN, true, 'The result of (1n !== NaN) is true'); +assert.sameValue(NaN !== 1n, true, 'The result of (NaN !== 1n) is true'); +assert.sameValue(-1n !== NaN, true, 'The result of (-1n !== NaN) is true'); +assert.sameValue(NaN !== -1n, true, 'The result of (NaN !== -1n) is true'); \ No newline at end of file diff --git a/test/language/expressions/strict-does-not-equals/bigint-and-number-extremes.js b/test/language/expressions/strict-does-not-equals/bigint-and-number-extremes.js index 6449e350cd9ae23969e03fcbd4f0d0dc7eb9d08c..74f82676ecff394cbd31a05803913e824d8a46ca 100644 --- a/test/language/expressions/strict-does-not-equals/bigint-and-number-extremes.js +++ b/test/language/expressions/strict-does-not-equals/bigint-and-number-extremes.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Strict inequality comparison of BigInt and large Number values esid: sec-strict-equality-comparison @@ -9,32 +8,53 @@ info: | features: [BigInt] ---*/ +assert.sameValue(1n !== Number.MAX_VALUE, true, 'The result of (1n !== Number.MAX_VALUE) is true'); +assert.sameValue(Number.MAX_VALUE !== 1n, true, 'The result of (Number.MAX_VALUE !== 1n) is true'); + +assert.sameValue( + 1n !== -Number.MAX_VALUE, + true, + 'The result of (1n !== -Number.MAX_VALUE) is true' +); + +assert.sameValue( + -Number.MAX_VALUE !== 1n, + true, + 'The result of (-Number.MAX_VALUE !== 1n) is true' +); -assert.sameValue(1n !== Number.MAX_VALUE, true, "1n !== Number.MAX_VALUE"); -assert.sameValue(Number.MAX_VALUE !== 1n, true, "Number.MAX_VALUE !== 1n"); -assert.sameValue(1n !== -Number.MAX_VALUE, true, "1n !== -Number.MAX_VALUE"); -assert.sameValue(-Number.MAX_VALUE !== 1n, true, "-Number.MAX_VALUE !== 1n"); assert.sameValue( 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn !== Number.MAX_VALUE, true, - "0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn !== Number.MAX_VALUE"); + 'The result of (0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn !== Number.MAX_VALUE) is true' +); + assert.sameValue( Number.MAX_VALUE !== 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn, true, - "Number.MAX_VALUE !== 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn"); + 'The result of (Number.MAX_VALUE !== 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn) is true' +); + assert.sameValue( 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n !== Number.MAX_VALUE, true, - "0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n !== Number.MAX_VALUE"); + 'The result of (0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n !== Number.MAX_VALUE) is true' +); + assert.sameValue( Number.MAX_VALUE !== 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, true, - "Number.MAX_VALUE !== 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n"); + 'The result of (Number.MAX_VALUE !== 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n) is true' +); + assert.sameValue( 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n !== Number.MAX_VALUE, true, - "0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n !== Number.MAX_VALUE"); + 'The result of (0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n !== Number.MAX_VALUE) is true' +); + assert.sameValue( Number.MAX_VALUE !== 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n, true, - "Number.MAX_VALUE !== 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n"); + 'The result of (Number.MAX_VALUE !== 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n) is true' +); \ No newline at end of file diff --git a/test/language/expressions/strict-does-not-equals/bigint-and-number.js b/test/language/expressions/strict-does-not-equals/bigint-and-number.js index eb3f991ed78a8ec1edffa5209318d87cba098dda..26146460553f10001b34599a6ad352a44f64417b 100644 --- a/test/language/expressions/strict-does-not-equals/bigint-and-number.js +++ b/test/language/expressions/strict-does-not-equals/bigint-and-number.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Strict inequality comparison of BigInt and Number values esid: sec-strict-equality-comparison @@ -9,24 +8,43 @@ info: | features: [BigInt] ---*/ +assert.sameValue(0n !== 0, true, 'The result of (0n !== 0) is true'); +assert.sameValue(0 !== 0n, true, 'The result of (0 !== 0n) is true'); +assert.sameValue(0n !== -0, true, 'The result of (0n !== -0) is true'); +assert.sameValue(-0 !== 0n, true, 'The result of (-0 !== 0n) is true'); +assert.sameValue(0n !== 0.000000000001, true, 'The result of (0n !== 0.000000000001) is true'); +assert.sameValue(0.000000000001 !== 0n, true, 'The result of (0.000000000001 !== 0n) is true'); +assert.sameValue(0n !== 1, true, 'The result of (0n !== 1) is true'); +assert.sameValue(1 !== 0n, true, 'The result of (1 !== 0n) is true'); +assert.sameValue(1n !== 0, true, 'The result of (1n !== 0) is true'); +assert.sameValue(0 !== 1n, true, 'The result of (0 !== 1n) is true'); +assert.sameValue(1n !== 0.999999999999, true, 'The result of (1n !== 0.999999999999) is true'); +assert.sameValue(0.999999999999 !== 1n, true, 'The result of (0.999999999999 !== 1n) is true'); +assert.sameValue(1n !== 1, true, 'The result of (1n !== 1) is true'); +assert.sameValue(1 !== 1n, true, 'The result of (1 !== 1n) is true'); +assert.sameValue(0n !== Number.MIN_VALUE, true, 'The result of (0n !== Number.MIN_VALUE) is true'); +assert.sameValue(Number.MIN_VALUE !== 0n, true, 'The result of (Number.MIN_VALUE !== 0n) is true'); + +assert.sameValue( + 0n !== -Number.MIN_VALUE, + true, + 'The result of (0n !== -Number.MIN_VALUE) is true' +); + +assert.sameValue( + -Number.MIN_VALUE !== 0n, + true, + 'The result of (-Number.MIN_VALUE !== 0n) is true' +); + +assert.sameValue( + -10n !== Number.MIN_VALUE, + true, + 'The result of (-10n !== Number.MIN_VALUE) is true' +); -assert.sameValue(0n !== 0, true, "0n !== 0"); -assert.sameValue(0 !== 0n, true, "0 !== 0n"); -assert.sameValue(0n !== -0, true, "0n !== -0"); -assert.sameValue(-0 !== 0n, true, "-0 !== 0n"); -assert.sameValue(0n !== 0.000000000001, true, "0n !== 0.000000000001"); -assert.sameValue(0.000000000001 !== 0n, true, "0.000000000001 !== 0n"); -assert.sameValue(0n !== 1, true, "0n !== 1"); -assert.sameValue(1 !== 0n, true, "1 !== 0n"); -assert.sameValue(1n !== 0, true, "1n !== 0"); -assert.sameValue(0 !== 1n, true, "0 !== 1n"); -assert.sameValue(1n !== 0.999999999999, true, "1n !== 0.999999999999"); -assert.sameValue(0.999999999999 !== 1n, true, "0.999999999999 !== 1n"); -assert.sameValue(1n !== 1, true, "1n !== 1"); -assert.sameValue(1 !== 1n, true, "1 !== 1n"); -assert.sameValue(0n !== Number.MIN_VALUE, true, "0n !== Number.MIN_VALUE"); -assert.sameValue(Number.MIN_VALUE !== 0n, true, "Number.MIN_VALUE !== 0n"); -assert.sameValue(0n !== -Number.MIN_VALUE, true, "0n !== -Number.MIN_VALUE"); -assert.sameValue(-Number.MIN_VALUE !== 0n, true, "-Number.MIN_VALUE !== 0n"); -assert.sameValue(-10n !== Number.MIN_VALUE, true, "-10n !== Number.MIN_VALUE"); -assert.sameValue(Number.MIN_VALUE !== -10n, true, "Number.MIN_VALUE !== -10n"); +assert.sameValue( + Number.MIN_VALUE !== -10n, + true, + 'The result of (Number.MIN_VALUE !== -10n) is true' +); \ No newline at end of file diff --git a/test/language/expressions/strict-does-not-equals/bigint-and-object.js b/test/language/expressions/strict-does-not-equals/bigint-and-object.js index 4121f5dddcafaa9c541ccb862f427293f1acc4e6..73b992803db3b682f9b863524ff800f323cdb41a 100644 --- a/test/language/expressions/strict-does-not-equals/bigint-and-object.js +++ b/test/language/expressions/strict-does-not-equals/bigint-and-object.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Strict inequality comparison of BigInt values and non-primitive objects esid: sec-strict-equality-comparison @@ -9,36 +8,115 @@ info: | features: [BigInt] ---*/ +assert.sameValue(0n !== Object(0n), true, 'The result of (0n !== Object(0n)) is true'); +assert.sameValue(Object(0n) !== 0n, true, 'The result of (Object(0n) !== 0n) is true'); +assert.sameValue(0n !== Object(1n), true, 'The result of (0n !== Object(1n)) is true'); +assert.sameValue(Object(1n) !== 0n, true, 'The result of (Object(1n) !== 0n) is true'); +assert.sameValue(1n !== Object(0n), true, 'The result of (1n !== Object(0n)) is true'); +assert.sameValue(Object(0n) !== 1n, true, 'The result of (Object(0n) !== 1n) is true'); +assert.sameValue(1n !== Object(1n), true, 'The result of (1n !== Object(1n)) is true'); +assert.sameValue(Object(1n) !== 1n, true, 'The result of (Object(1n) !== 1n) is true'); +assert.sameValue(2n !== Object(0n), true, 'The result of (2n !== Object(0n)) is true'); +assert.sameValue(Object(0n) !== 2n, true, 'The result of (Object(0n) !== 2n) is true'); +assert.sameValue(2n !== Object(1n), true, 'The result of (2n !== Object(1n)) is true'); +assert.sameValue(Object(1n) !== 2n, true, 'The result of (Object(1n) !== 2n) is true'); +assert.sameValue(2n !== Object(2n), true, 'The result of (2n !== Object(2n)) is true'); +assert.sameValue(Object(2n) !== 2n, true, 'The result of (Object(2n) !== 2n) is true'); +assert.sameValue(0n !== {}, true, 'The result of (0n !== {}) is true'); +assert.sameValue({} !== 0n, true, 'The result of (({}) !== 0n) is true'); + +assert.sameValue(0n !== { + valueOf: function() { + return 0n; + } +}, true, 'The result of (0n !== {valueOf: function() {return 0n;}}) is true'); + +assert.sameValue({ + valueOf: function() { + return 0n; + } +} !== 0n, true, 'The result of (({valueOf: function() {return 0n;}}) !== 0n) is true'); + +assert.sameValue(0n !== { + valueOf: function() { + return 1n; + } +}, true, 'The result of (0n !== {valueOf: function() {return 1n;}}) is true'); + +assert.sameValue({ + valueOf: function() { + return 1n; + } +} !== 0n, true, 'The result of (({valueOf: function() {return 1n;}}) !== 0n) is true'); + +assert.sameValue(0n !== { + toString: function() { + return '0'; + } +}, true, 'The result of (0n !== {toString: function() {return "0";}}) is true'); + +assert.sameValue({ + toString: function() { + return '0'; + } +} !== 0n, true, 'The result of (({toString: function() {return "0";}}) !== 0n) is true'); + +assert.sameValue(0n !== { + toString: function() { + return '1'; + } +}, true, 'The result of (0n !== {toString: function() {return "1";}}) is true'); + +assert.sameValue({ + toString: function() { + return '1'; + } +} !== 0n, true, 'The result of (({toString: function() {return "1";}}) !== 0n) is true'); + +assert.sameValue(900719925474099101n !== { + valueOf: function() { + return 900719925474099101n; + } +}, true, 'The result of (900719925474099101n !== {valueOf: function() {return 900719925474099101n;}}) is true'); + +assert.sameValue({ + valueOf: function() { + return 900719925474099101n; + } +} !== 900719925474099101n, true, 'The result of (({valueOf: function() {return 900719925474099101n;}}) !== 900719925474099101n) is true'); + +assert.sameValue(900719925474099101n !== { + valueOf: function() { + return 900719925474099102n; + } +}, true, 'The result of (900719925474099101n !== {valueOf: function() {return 900719925474099102n;}}) is true'); + +assert.sameValue({ + valueOf: function() { + return 900719925474099102n; + } +} !== 900719925474099101n, true, 'The result of (({valueOf: function() {return 900719925474099102n;}}) !== 900719925474099101n) is true'); + +assert.sameValue(900719925474099101n !== { + toString: function() { + return '900719925474099101'; + } +}, true, 'The result of (900719925474099101n !== {toString: function() {return "900719925474099101";}}) is true'); + +assert.sameValue({ + toString: function() { + return '900719925474099101'; + } +} !== 900719925474099101n, true, 'The result of (({toString: function() {return "900719925474099101";}}) !== 900719925474099101n) is true'); + +assert.sameValue(900719925474099101n !== { + toString: function() { + return '900719925474099102'; + } +}, true, 'The result of (900719925474099101n !== {toString: function() {return "900719925474099102";}}) is true'); -assert.sameValue(0n !== Object(0n), true, "0n !== Object(0n)"); -assert.sameValue(Object(0n) !== 0n, true, "Object(0n) !== 0n"); -assert.sameValue(0n !== Object(1n), true, "0n !== Object(1n)"); -assert.sameValue(Object(1n) !== 0n, true, "Object(1n) !== 0n"); -assert.sameValue(1n !== Object(0n), true, "1n !== Object(0n)"); -assert.sameValue(Object(0n) !== 1n, true, "Object(0n) !== 1n"); -assert.sameValue(1n !== Object(1n), true, "1n !== Object(1n)"); -assert.sameValue(Object(1n) !== 1n, true, "Object(1n) !== 1n"); -assert.sameValue(2n !== Object(0n), true, "2n !== Object(0n)"); -assert.sameValue(Object(0n) !== 2n, true, "Object(0n) !== 2n"); -assert.sameValue(2n !== Object(1n), true, "2n !== Object(1n)"); -assert.sameValue(Object(1n) !== 2n, true, "Object(1n) !== 2n"); -assert.sameValue(2n !== Object(2n), true, "2n !== Object(2n)"); -assert.sameValue(Object(2n) !== 2n, true, "Object(2n) !== 2n"); -assert.sameValue(0n !== {}, true, "0n !== {}"); -assert.sameValue({} !== 0n, true, "{} !== 0n"); -assert.sameValue(0n !== {valueOf: function() { return 0n; }}, true, "0n !== {valueOf: function() { return 0n; }}"); -assert.sameValue({valueOf: function() { return 0n; }} !== 0n, true, "{valueOf: function() { return 0n; }} !== 0n"); -assert.sameValue(0n !== {valueOf: function() { return 1n; }}, true, "0n !== {valueOf: function() { return 1n; }}"); -assert.sameValue({valueOf: function() { return 1n; }} !== 0n, true, "{valueOf: function() { return 1n; }} !== 0n"); -assert.sameValue(0n !== {toString: function() { return "0"; }}, true, '0n !== {toString: function() { return "0"; }}'); -assert.sameValue({toString: function() { return "0"; }} !== 0n, true, '{toString: function() { return "0"; }} !== 0n'); -assert.sameValue(0n !== {toString: function() { return "1"; }}, true, '0n !== {toString: function() { return "1"; }}'); -assert.sameValue({toString: function() { return "1"; }} !== 0n, true, '{toString: function() { return "1"; }} !== 0n'); -assert.sameValue(900719925474099101n !== {valueOf: function() { return 900719925474099101n; }}, true, "900719925474099101n !== {valueOf: function() { return 900719925474099101n; }}"); -assert.sameValue({valueOf: function() { return 900719925474099101n; }} !== 900719925474099101n, true, "{valueOf: function() { return 900719925474099101n; }} !== 900719925474099101n"); -assert.sameValue(900719925474099101n !== {valueOf: function() { return 900719925474099102n; }}, true, "900719925474099101n !== {valueOf: function() { return 900719925474099102n; }}"); -assert.sameValue({valueOf: function() { return 900719925474099102n; }} !== 900719925474099101n, true, "{valueOf: function() { return 900719925474099102n; }} !== 900719925474099101n"); -assert.sameValue(900719925474099101n !== {toString: function() { return "900719925474099101"; }}, true, '900719925474099101n !== {toString: function() { return "900719925474099101"; }}'); -assert.sameValue({toString: function() { return "900719925474099101"; }} !== 900719925474099101n, true, '{toString: function() { return "900719925474099101"; }} !== 900719925474099101n'); -assert.sameValue(900719925474099101n !== {toString: function() { return "900719925474099102"; }}, true, '900719925474099101n !== {toString: function() { return "900719925474099102"; }}'); -assert.sameValue({toString: function() { return "900719925474099102"; }} !== 900719925474099101n, true, '{toString: function() { return "900719925474099102"; }} !== 900719925474099101n'); +assert.sameValue({ + toString: function() { + return '900719925474099102'; + } +} !== 900719925474099101n, true, 'The result of (({toString: function() {return "900719925474099102";}}) !== 900719925474099101n) is true'); \ No newline at end of file diff --git a/test/language/expressions/strict-does-not-equals/bigint-and-string.js b/test/language/expressions/strict-does-not-equals/bigint-and-string.js index 4be6cd41278465d7da6972f4c8071b1f2a5a8e05..8b1e5e6fb346415f30b8b3a5467d400b68056750 100644 --- a/test/language/expressions/strict-does-not-equals/bigint-and-string.js +++ b/test/language/expressions/strict-does-not-equals/bigint-and-string.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Strict inequality comparison of BigInt and String values esid: sec-strict-equality-comparison @@ -9,40 +8,59 @@ info: | features: [BigInt] ---*/ +assert.sameValue(0n !== '', true, 'The result of (0n !== "") is true'); +assert.sameValue('' !== 0n, true, 'The result of ("" !== 0n) is true'); +assert.sameValue(0n !== '-0', true, 'The result of (0n !== "-0") is true'); +assert.sameValue('-0' !== 0n, true, 'The result of ("-0" !== 0n) is true'); +assert.sameValue(0n !== '0', true, 'The result of (0n !== "0") is true'); +assert.sameValue('0' !== 0n, true, 'The result of ("0" !== 0n) is true'); +assert.sameValue(0n !== '-1', true, 'The result of (0n !== "-1") is true'); +assert.sameValue('-1' !== 0n, true, 'The result of ("-1" !== 0n) is true'); +assert.sameValue(0n !== '1', true, 'The result of (0n !== "1") is true'); +assert.sameValue('1' !== 0n, true, 'The result of ("1" !== 0n) is true'); +assert.sameValue(0n !== 'foo', true, 'The result of (0n !== "foo") is true'); +assert.sameValue('foo' !== 0n, true, 'The result of ("foo" !== 0n) is true'); +assert.sameValue(1n !== '', true, 'The result of (1n !== "") is true'); +assert.sameValue('' !== 1n, true, 'The result of ("" !== 1n) is true'); +assert.sameValue(1n !== '-0', true, 'The result of (1n !== "-0") is true'); +assert.sameValue('-0' !== 1n, true, 'The result of ("-0" !== 1n) is true'); +assert.sameValue(1n !== '0', true, 'The result of (1n !== "0") is true'); +assert.sameValue('0' !== 1n, true, 'The result of ("0" !== 1n) is true'); +assert.sameValue(1n !== '-1', true, 'The result of (1n !== "-1") is true'); +assert.sameValue('-1' !== 1n, true, 'The result of ("-1" !== 1n) is true'); +assert.sameValue(1n !== '1', true, 'The result of (1n !== "1") is true'); +assert.sameValue('1' !== 1n, true, 'The result of ("1" !== 1n) is true'); +assert.sameValue(1n !== 'foo', true, 'The result of (1n !== "foo") is true'); +assert.sameValue('foo' !== 1n, true, 'The result of ("foo" !== 1n) is true'); +assert.sameValue(-1n !== '-', true, 'The result of (-1n !== "-") is true'); +assert.sameValue('-' !== -1n, true, 'The result of ("-" !== -1n) is true'); +assert.sameValue(-1n !== '-0', true, 'The result of (-1n !== "-0") is true'); +assert.sameValue('-0' !== -1n, true, 'The result of ("-0" !== -1n) is true'); +assert.sameValue(-1n !== '-1', true, 'The result of (-1n !== "-1") is true'); +assert.sameValue('-1' !== -1n, true, 'The result of ("-1" !== -1n) is true'); +assert.sameValue(-1n !== '-foo', true, 'The result of (-1n !== "-foo") is true'); +assert.sameValue('-foo' !== -1n, true, 'The result of ("-foo" !== -1n) is true'); + +assert.sameValue( + 900719925474099101n !== '900719925474099101', + true, + 'The result of (900719925474099101n !== "900719925474099101") is true' +); + +assert.sameValue( + '900719925474099101' !== 900719925474099101n, + true, + 'The result of ("900719925474099101" !== 900719925474099101n) is true' +); + +assert.sameValue( + 900719925474099102n !== '900719925474099101', + true, + 'The result of (900719925474099102n !== "900719925474099101") is true' +); -assert.sameValue(0n !== "", true, '0n !== ""'); -assert.sameValue("" !== 0n, true, '"" !== 0n'); -assert.sameValue(0n !== "-0", true, '0n !== "-0"'); -assert.sameValue("-0" !== 0n, true, '"-0" !== 0n'); -assert.sameValue(0n !== "0", true, '0n !== "0"'); -assert.sameValue("0" !== 0n, true, '"0" !== 0n'); -assert.sameValue(0n !== "-1", true, '0n !== "-1"'); -assert.sameValue("-1" !== 0n, true, '"-1" !== 0n'); -assert.sameValue(0n !== "1", true, '0n !== "1"'); -assert.sameValue("1" !== 0n, true, '"1" !== 0n'); -assert.sameValue(0n !== "foo", true, '0n !== "foo"'); -assert.sameValue("foo" !== 0n, true, '"foo" !== 0n'); -assert.sameValue(1n !== "", true, '1n !== ""'); -assert.sameValue("" !== 1n, true, '"" !== 1n'); -assert.sameValue(1n !== "-0", true, '1n !== "-0"'); -assert.sameValue("-0" !== 1n, true, '"-0" !== 1n'); -assert.sameValue(1n !== "0", true, '1n !== "0"'); -assert.sameValue("0" !== 1n, true, '"0" !== 1n'); -assert.sameValue(1n !== "-1", true, '1n !== "-1"'); -assert.sameValue("-1" !== 1n, true, '"-1" !== 1n'); -assert.sameValue(1n !== "1", true, '1n !== "1"'); -assert.sameValue("1" !== 1n, true, '"1" !== 1n'); -assert.sameValue(1n !== "foo", true, '1n !== "foo"'); -assert.sameValue("foo" !== 1n, true, '"foo" !== 1n'); -assert.sameValue(-1n !== "-", true, '-1n !== "-"'); -assert.sameValue("-" !== -1n, true, '"-" !== -1n'); -assert.sameValue(-1n !== "-0", true, '-1n !== "-0"'); -assert.sameValue("-0" !== -1n, true, '"-0" !== -1n'); -assert.sameValue(-1n !== "-1", true, '-1n !== "-1"'); -assert.sameValue("-1" !== -1n, true, '"-1" !== -1n'); -assert.sameValue(-1n !== "-foo", true, '-1n !== "-foo"'); -assert.sameValue("-foo" !== -1n, true, '"-foo" !== -1n'); -assert.sameValue(900719925474099101n !== "900719925474099101", true, '900719925474099101n !== "900719925474099101"'); -assert.sameValue("900719925474099101" !== 900719925474099101n, true, '"900719925474099101" !== 900719925474099101n'); -assert.sameValue(900719925474099102n !== "900719925474099101", true, '900719925474099102n !== "900719925474099101"'); -assert.sameValue("900719925474099101" !== 900719925474099102n, true, '"900719925474099101" !== 900719925474099102n'); +assert.sameValue( + '900719925474099101' !== 900719925474099102n, + true, + 'The result of ("900719925474099101" !== 900719925474099102n) is true' +); \ No newline at end of file diff --git a/test/language/expressions/strict-equals/bigint-and-bigint.js b/test/language/expressions/strict-equals/bigint-and-bigint.js index 8d733b37bc879434daa1695855821e1c8162b0da..057f432b0394eac6ff6d6b1d7c04a7a2e3f6dae4 100644 --- a/test/language/expressions/strict-equals/bigint-and-bigint.js +++ b/test/language/expressions/strict-equals/bigint-and-bigint.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Strict equality comparison of BigInt values esid: sec-strict-equality-comparison @@ -16,39 +15,158 @@ info: | features: [BigInt] ---*/ +assert.sameValue(0n === 0n, true, 'The result of (0n === 0n) is true'); +assert.sameValue(1n === 1n, true, 'The result of (1n === 1n) is true'); +assert.sameValue(-1n === -1n, true, 'The result of (-1n === -1n) is true'); +assert.sameValue(0n === -0n, true, 'The result of (0n === -0n) is true'); +assert.sameValue(-0n === 0n, true, 'The result of (-0n === 0n) is true'); +assert.sameValue(0n === 1n, false, 'The result of (0n === 1n) is false'); +assert.sameValue(1n === 0n, false, 'The result of (1n === 0n) is false'); +assert.sameValue(0n === -1n, false, 'The result of (0n === -1n) is false'); +assert.sameValue(-1n === 0n, false, 'The result of (-1n === 0n) is false'); +assert.sameValue(1n === -1n, false, 'The result of (1n === -1n) is false'); +assert.sameValue(-1n === 1n, false, 'The result of (-1n === 1n) is false'); + +assert.sameValue( + 0x1fffffffffffff01n === 0x1fffffffffffff01n, + true, + 'The result of (0x1fffffffffffff01n === 0x1fffffffffffff01n) is true' +); + +assert.sameValue( + 0x1fffffffffffff01n === 0x1fffffffffffff02n, + false, + 'The result of (0x1fffffffffffff01n === 0x1fffffffffffff02n) is false' +); + +assert.sameValue( + 0x1fffffffffffff02n === 0x1fffffffffffff01n, + false, + 'The result of (0x1fffffffffffff02n === 0x1fffffffffffff01n) is false' +); + +assert.sameValue( + -0x1fffffffffffff01n === -0x1fffffffffffff01n, + true, + 'The result of (-0x1fffffffffffff01n === -0x1fffffffffffff01n) is true' +); + +assert.sameValue( + -0x1fffffffffffff01n === -0x1fffffffffffff02n, + false, + 'The result of (-0x1fffffffffffff01n === -0x1fffffffffffff02n) is false' +); + +assert.sameValue( + -0x1fffffffffffff02n === -0x1fffffffffffff01n, + false, + 'The result of (-0x1fffffffffffff02n === -0x1fffffffffffff01n) is false' +); + +assert.sameValue( + 0x10000000000000000n === 0n, + false, + 'The result of (0x10000000000000000n === 0n) is false' +); + +assert.sameValue( + 0n === 0x10000000000000000n, + false, + 'The result of (0n === 0x10000000000000000n) is false' +); + +assert.sameValue( + 0x10000000000000000n === 1n, + false, + 'The result of (0x10000000000000000n === 1n) is false' +); + +assert.sameValue( + 1n === 0x10000000000000000n, + false, + 'The result of (1n === 0x10000000000000000n) is false' +); + +assert.sameValue( + 0x10000000000000000n === -1n, + false, + 'The result of (0x10000000000000000n === -1n) is false' +); + +assert.sameValue( + -1n === 0x10000000000000000n, + false, + 'The result of (-1n === 0x10000000000000000n) is false' +); + +assert.sameValue( + 0x10000000000000001n === 0n, + false, + 'The result of (0x10000000000000001n === 0n) is false' +); + +assert.sameValue( + 0n === 0x10000000000000001n, + false, + 'The result of (0n === 0x10000000000000001n) is false' +); + +assert.sameValue( + -0x10000000000000000n === 0n, + false, + 'The result of (-0x10000000000000000n === 0n) is false' +); + +assert.sameValue( + 0n === -0x10000000000000000n, + false, + 'The result of (0n === -0x10000000000000000n) is false' +); + +assert.sameValue( + -0x10000000000000000n === 1n, + false, + 'The result of (-0x10000000000000000n === 1n) is false' +); + +assert.sameValue( + 1n === -0x10000000000000000n, + false, + 'The result of (1n === -0x10000000000000000n) is false' +); + +assert.sameValue( + -0x10000000000000000n === -1n, + false, + 'The result of (-0x10000000000000000n === -1n) is false' +); + +assert.sameValue( + -1n === -0x10000000000000000n, + false, + 'The result of (-1n === -0x10000000000000000n) is false' +); + +assert.sameValue( + -0x10000000000000001n === 0n, + false, + 'The result of (-0x10000000000000001n === 0n) is false' +); + +assert.sameValue( + 0n === -0x10000000000000001n, + false, + 'The result of (0n === -0x10000000000000001n) is false' +); + +assert.sameValue( + 0x10000000000000000n === 0x100000000n, + false, + 'The result of (0x10000000000000000n === 0x100000000n) is false' +); -assert.sameValue(0n === 0n, true, "0n === 0n"); -assert.sameValue(1n === 1n, true, "1n === 1n"); -assert.sameValue(-1n === -1n, true, "-1n === -1n"); -assert.sameValue(0n === -0n, true, "0n === -0n"); -assert.sameValue(-0n === 0n, true, "-0n === 0n"); -assert.sameValue(0n === 1n, false, "0n === 1n"); -assert.sameValue(1n === 0n, false, "1n === 0n"); -assert.sameValue(0n === -1n, false, "0n === -1n"); -assert.sameValue(-1n === 0n, false, "-1n === 0n"); -assert.sameValue(1n === -1n, false, "1n === -1n"); -assert.sameValue(-1n === 1n, false, "-1n === 1n"); -assert.sameValue(0x1fffffffffffff01n === 0x1fffffffffffff01n, true, "0x1fffffffffffff01n === 0x1fffffffffffff01n"); -assert.sameValue(0x1fffffffffffff01n === 0x1fffffffffffff02n, false, "0x1fffffffffffff01n === 0x1fffffffffffff02n"); -assert.sameValue(0x1fffffffffffff02n === 0x1fffffffffffff01n, false, "0x1fffffffffffff02n === 0x1fffffffffffff01n"); -assert.sameValue(-0x1fffffffffffff01n === -0x1fffffffffffff01n, true, "-0x1fffffffffffff01n === -0x1fffffffffffff01n"); -assert.sameValue(-0x1fffffffffffff01n === -0x1fffffffffffff02n, false, "-0x1fffffffffffff01n === -0x1fffffffffffff02n"); -assert.sameValue(-0x1fffffffffffff02n === -0x1fffffffffffff01n, false, "-0x1fffffffffffff02n === -0x1fffffffffffff01n"); -assert.sameValue(0x10000000000000000n === 0n, false, "0x10000000000000000n === 0n"); -assert.sameValue(0n === 0x10000000000000000n, false, "0n === 0x10000000000000000n"); -assert.sameValue(0x10000000000000000n === 1n, false, "0x10000000000000000n === 1n"); -assert.sameValue(1n === 0x10000000000000000n, false, "1n === 0x10000000000000000n"); -assert.sameValue(0x10000000000000000n === -1n, false, "0x10000000000000000n === -1n"); -assert.sameValue(-1n === 0x10000000000000000n, false, "-1n === 0x10000000000000000n"); -assert.sameValue(0x10000000000000001n === 0n, false, "0x10000000000000001n === 0n"); -assert.sameValue(0n === 0x10000000000000001n, false, "0n === 0x10000000000000001n"); -assert.sameValue(-0x10000000000000000n === 0n, false, "-0x10000000000000000n === 0n"); -assert.sameValue(0n === -0x10000000000000000n, false, "0n === -0x10000000000000000n"); -assert.sameValue(-0x10000000000000000n === 1n, false, "-0x10000000000000000n === 1n"); -assert.sameValue(1n === -0x10000000000000000n, false, "1n === -0x10000000000000000n"); -assert.sameValue(-0x10000000000000000n === -1n, false, "-0x10000000000000000n === -1n"); -assert.sameValue(-1n === -0x10000000000000000n, false, "-1n === -0x10000000000000000n"); -assert.sameValue(-0x10000000000000001n === 0n, false, "-0x10000000000000001n === 0n"); -assert.sameValue(0n === -0x10000000000000001n, false, "0n === -0x10000000000000001n"); -assert.sameValue(0x10000000000000000n === 0x100000000n, false, "0x10000000000000000n === 0x100000000n"); -assert.sameValue(0x100000000n === 0x10000000000000000n, false, "0x100000000n === 0x10000000000000000n"); +assert.sameValue( + 0x100000000n === 0x10000000000000000n, + false, + 'The result of (0x100000000n === 0x10000000000000000n) is false' +); \ No newline at end of file diff --git a/test/language/expressions/strict-equals/bigint-and-boolean.js b/test/language/expressions/strict-equals/bigint-and-boolean.js index 718a4afc005ba9ddc729f318b7573848afee7979..461b5ac34ba8c89229198ccb298731bee2c4e38c 100644 --- a/test/language/expressions/strict-equals/bigint-and-boolean.js +++ b/test/language/expressions/strict-equals/bigint-and-boolean.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Strict equality comparison of BigInt and Boolean values esid: sec-strict-equality-comparison @@ -9,20 +8,19 @@ info: | features: [BigInt] ---*/ - -assert.sameValue(-1n === false, false, "-1n === false"); -assert.sameValue(false === -1n, false, "false === -1n"); -assert.sameValue(-1n === true, false, "-1n === true"); -assert.sameValue(true === -1n, false, "true === -1n"); -assert.sameValue(0n === false, false, "0n === false"); -assert.sameValue(false === 0n, false, "false === 0n"); -assert.sameValue(0n === true, false, "0n === true"); -assert.sameValue(true === 0n, false, "true === 0n"); -assert.sameValue(1n === false, false, "1n === false"); -assert.sameValue(false === 1n, false, "false === 1n"); -assert.sameValue(1n === true, false, "1n === true"); -assert.sameValue(true === 1n, false, "true === 1n"); -assert.sameValue(2n === false, false, "2n === false"); -assert.sameValue(false === 2n, false, "false === 2n"); -assert.sameValue(2n === true, false, "2n === true"); -assert.sameValue(true === 2n, false, "true === 2n"); +assert.sameValue(-1n === false, false, 'The result of (-1n === false) is false'); +assert.sameValue(false === -1n, false, 'The result of (false === -1n) is false'); +assert.sameValue(-1n === true, false, 'The result of (-1n === true) is false'); +assert.sameValue(true === -1n, false, 'The result of (true === -1n) is false'); +assert.sameValue(0n === false, false, 'The result of (0n === false) is false'); +assert.sameValue(false === 0n, false, 'The result of (false === 0n) is false'); +assert.sameValue(0n === true, false, 'The result of (0n === true) is false'); +assert.sameValue(true === 0n, false, 'The result of (true === 0n) is false'); +assert.sameValue(1n === false, false, 'The result of (1n === false) is false'); +assert.sameValue(false === 1n, false, 'The result of (false === 1n) is false'); +assert.sameValue(1n === true, false, 'The result of (1n === true) is false'); +assert.sameValue(true === 1n, false, 'The result of (true === 1n) is false'); +assert.sameValue(2n === false, false, 'The result of (2n === false) is false'); +assert.sameValue(false === 2n, false, 'The result of (false === 2n) is false'); +assert.sameValue(2n === true, false, 'The result of (2n === true) is false'); +assert.sameValue(true === 2n, false, 'The result of (true === 2n) is false'); \ No newline at end of file diff --git a/test/language/expressions/strict-equals/bigint-and-incomparable-primitive.js b/test/language/expressions/strict-equals/bigint-and-incomparable-primitive.js index 042cc2cfe3bc807704b0f191300335bbdf381759..6ed9bd1bdc504e962037632e4063faf49df2ef46 100644 --- a/test/language/expressions/strict-equals/bigint-and-incomparable-primitive.js +++ b/test/language/expressions/strict-equals/bigint-and-incomparable-primitive.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Strict equality comparison of BigInt and miscellaneous primitive values esid: sec-strict-equality-comparison @@ -9,16 +8,15 @@ info: | features: [BigInt, Symbol] ---*/ - -assert.sameValue(0n === undefined, false, "0n === undefined"); -assert.sameValue(undefined === 0n, false, "undefined === 0n"); -assert.sameValue(1n === undefined, false, "1n === undefined"); -assert.sameValue(undefined === 1n, false, "undefined === 1n"); -assert.sameValue(0n === null, false, "0n === null"); -assert.sameValue(null === 0n, false, "null === 0n"); -assert.sameValue(1n === null, false, "1n === null"); -assert.sameValue(null === 1n, false, "null === 1n"); -assert.sameValue(0n === Symbol("1"), false, '0n === Symbol("1")'); -assert.sameValue(Symbol("1") === 0n, false, 'Symbol("1") === 0n'); -assert.sameValue(1n === Symbol("1"), false, '1n === Symbol("1")'); -assert.sameValue(Symbol("1") === 1n, false, 'Symbol("1") === 1n'); +assert.sameValue(0n === undefined, false, 'The result of (0n === undefined) is false'); +assert.sameValue(undefined === 0n, false, 'The result of (undefined === 0n) is false'); +assert.sameValue(1n === undefined, false, 'The result of (1n === undefined) is false'); +assert.sameValue(undefined === 1n, false, 'The result of (undefined === 1n) is false'); +assert.sameValue(0n === null, false, 'The result of (0n === null) is false'); +assert.sameValue(null === 0n, false, 'The result of (null === 0n) is false'); +assert.sameValue(1n === null, false, 'The result of (1n === null) is false'); +assert.sameValue(null === 1n, false, 'The result of (null === 1n) is false'); +assert.sameValue(0n === Symbol('1'), false, 'The result of (0n === Symbol("1")) is false'); +assert.sameValue(Symbol('1') === 0n, false, 'The result of (Symbol("1") === 0n) is false'); +assert.sameValue(1n === Symbol('1'), false, 'The result of (1n === Symbol("1")) is false'); +assert.sameValue(Symbol('1') === 1n, false, 'The result of (Symbol("1") === 1n) is false'); \ No newline at end of file diff --git a/test/language/expressions/strict-equals/bigint-and-non-finite.js b/test/language/expressions/strict-equals/bigint-and-non-finite.js index 7352fc3dc58ccb67cc4eb4a344bab73ea4204aa4..2ffa93ad46efb816b912ad68890975e203446a4c 100644 --- a/test/language/expressions/strict-equals/bigint-and-non-finite.js +++ b/test/language/expressions/strict-equals/bigint-and-non-finite.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Strict equality comparison of BigInt and non-finite Number values esid: sec-strict-equality-comparison @@ -9,22 +8,21 @@ info: | features: [BigInt] ---*/ - -assert.sameValue(0n === Infinity, false, "0n === Infinity"); -assert.sameValue(Infinity === 0n, false, "Infinity === 0n"); -assert.sameValue(1n === Infinity, false, "1n === Infinity"); -assert.sameValue(Infinity === 1n, false, "Infinity === 1n"); -assert.sameValue(-1n === Infinity, false, "-1n === Infinity"); -assert.sameValue(Infinity === -1n, false, "Infinity === -1n"); -assert.sameValue(0n === -Infinity, false, "0n === -Infinity"); -assert.sameValue(-Infinity === 0n, false, "-Infinity === 0n"); -assert.sameValue(1n === -Infinity, false, "1n === -Infinity"); -assert.sameValue(-Infinity === 1n, false, "-Infinity === 1n"); -assert.sameValue(-1n === -Infinity, false, "-1n === -Infinity"); -assert.sameValue(-Infinity === -1n, false, "-Infinity === -1n"); -assert.sameValue(0n === NaN, false, "0n === NaN"); -assert.sameValue(NaN === 0n, false, "NaN === 0n"); -assert.sameValue(1n === NaN, false, "1n === NaN"); -assert.sameValue(NaN === 1n, false, "NaN === 1n"); -assert.sameValue(-1n === NaN, false, "-1n === NaN"); -assert.sameValue(NaN === -1n, false, "NaN === -1n"); +assert.sameValue(0n === Infinity, false, 'The result of (0n === Infinity) is false'); +assert.sameValue(Infinity === 0n, false, 'The result of (Infinity === 0n) is false'); +assert.sameValue(1n === Infinity, false, 'The result of (1n === Infinity) is false'); +assert.sameValue(Infinity === 1n, false, 'The result of (Infinity === 1n) is false'); +assert.sameValue(-1n === Infinity, false, 'The result of (-1n === Infinity) is false'); +assert.sameValue(Infinity === -1n, false, 'The result of (Infinity === -1n) is false'); +assert.sameValue(0n === -Infinity, false, 'The result of (0n === -Infinity) is false'); +assert.sameValue(-Infinity === 0n, false, 'The result of (-Infinity === 0n) is false'); +assert.sameValue(1n === -Infinity, false, 'The result of (1n === -Infinity) is false'); +assert.sameValue(-Infinity === 1n, false, 'The result of (-Infinity === 1n) is false'); +assert.sameValue(-1n === -Infinity, false, 'The result of (-1n === -Infinity) is false'); +assert.sameValue(-Infinity === -1n, false, 'The result of (-Infinity === -1n) is false'); +assert.sameValue(0n === NaN, false, 'The result of (0n === NaN) is false'); +assert.sameValue(NaN === 0n, false, 'The result of (NaN === 0n) is false'); +assert.sameValue(1n === NaN, false, 'The result of (1n === NaN) is false'); +assert.sameValue(NaN === 1n, false, 'The result of (NaN === 1n) is false'); +assert.sameValue(-1n === NaN, false, 'The result of (-1n === NaN) is false'); +assert.sameValue(NaN === -1n, false, 'The result of (NaN === -1n) is false'); \ No newline at end of file diff --git a/test/language/expressions/strict-equals/bigint-and-number-extremes.js b/test/language/expressions/strict-equals/bigint-and-number-extremes.js index e129355737697a2c471252b1e69ffc3d45a07686..c6c1f5eee0ffc0be5e0b1f9201e551dc2f2c1fbb 100644 --- a/test/language/expressions/strict-equals/bigint-and-number-extremes.js +++ b/test/language/expressions/strict-equals/bigint-and-number-extremes.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Strict equality comparison of BigInt and large Number values esid: sec-strict-equality-comparison @@ -9,32 +8,62 @@ info: | features: [BigInt] ---*/ +assert.sameValue( + 1n === Number.MAX_VALUE, + false, + 'The result of (1n === Number.MAX_VALUE) is false' +); + +assert.sameValue( + Number.MAX_VALUE === 1n, + false, + 'The result of (Number.MAX_VALUE === 1n) is false' +); + +assert.sameValue( + 1n === -Number.MAX_VALUE, + false, + 'The result of (1n === -Number.MAX_VALUE) is false' +); + +assert.sameValue( + -Number.MAX_VALUE === 1n, + false, + 'The result of (-Number.MAX_VALUE === 1n) is false' +); -assert.sameValue(1n === Number.MAX_VALUE, false, "1n === Number.MAX_VALUE"); -assert.sameValue(Number.MAX_VALUE === 1n, false, "Number.MAX_VALUE === 1n"); -assert.sameValue(1n === -Number.MAX_VALUE, false, "1n === -Number.MAX_VALUE"); -assert.sameValue(-Number.MAX_VALUE === 1n, false, "-Number.MAX_VALUE === 1n"); assert.sameValue( 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn === Number.MAX_VALUE, false, - "0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn === Number.MAX_VALUE"); + 'The result of (0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn === Number.MAX_VALUE) is false' +); + assert.sameValue( Number.MAX_VALUE === 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn, false, - "Number.MAX_VALUE === 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn"); + 'The result of (Number.MAX_VALUE === 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn) is false' +); + assert.sameValue( 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n === Number.MAX_VALUE, false, - "0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n === Number.MAX_VALUE"); + 'The result of (0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n === Number.MAX_VALUE) is false' +); + assert.sameValue( Number.MAX_VALUE === 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, false, - "Number.MAX_VALUE === 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n"); + 'The result of (Number.MAX_VALUE === 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n) is false' +); + assert.sameValue( 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n === Number.MAX_VALUE, false, - "0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n === Number.MAX_VALUE"); + 'The result of (0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n === Number.MAX_VALUE) is false' +); + assert.sameValue( Number.MAX_VALUE === 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n, false, - "Number.MAX_VALUE === 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n"); + 'The result of (Number.MAX_VALUE === 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n) is false' +); \ No newline at end of file diff --git a/test/language/expressions/strict-equals/bigint-and-number.js b/test/language/expressions/strict-equals/bigint-and-number.js index ed1dde71a240818e645d6f550657eabfb6e84411..09d0c3a14ba39307ec1546c0a35cce537db988b8 100644 --- a/test/language/expressions/strict-equals/bigint-and-number.js +++ b/test/language/expressions/strict-equals/bigint-and-number.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Strict equality comparison of BigInt and Number values esid: sec-strict-equality-comparison @@ -9,24 +8,53 @@ info: | features: [BigInt] ---*/ +assert.sameValue(0n === 0, false, 'The result of (0n === 0) is false'); +assert.sameValue(0 === 0n, false, 'The result of (0 === 0n) is false'); +assert.sameValue(0n === -0, false, 'The result of (0n === -0) is false'); +assert.sameValue(-0 === 0n, false, 'The result of (-0 === 0n) is false'); +assert.sameValue(0n === 0.000000000001, false, 'The result of (0n === 0.000000000001) is false'); +assert.sameValue(0.000000000001 === 0n, false, 'The result of (0.000000000001 === 0n) is false'); +assert.sameValue(0n === 1, false, 'The result of (0n === 1) is false'); +assert.sameValue(1 === 0n, false, 'The result of (1 === 0n) is false'); +assert.sameValue(1n === 0, false, 'The result of (1n === 0) is false'); +assert.sameValue(0 === 1n, false, 'The result of (0 === 1n) is false'); +assert.sameValue(1n === 0.999999999999, false, 'The result of (1n === 0.999999999999) is false'); +assert.sameValue(0.999999999999 === 1n, false, 'The result of (0.999999999999 === 1n) is false'); +assert.sameValue(1n === 1, false, 'The result of (1n === 1) is false'); +assert.sameValue(1 === 1n, false, 'The result of (1 === 1n) is false'); + +assert.sameValue( + 0n === Number.MIN_VALUE, + false, + 'The result of (0n === Number.MIN_VALUE) is false' +); + +assert.sameValue( + Number.MIN_VALUE === 0n, + false, + 'The result of (Number.MIN_VALUE === 0n) is false' +); + +assert.sameValue( + 0n === -Number.MIN_VALUE, + false, + 'The result of (0n === -Number.MIN_VALUE) is false' +); + +assert.sameValue( + -Number.MIN_VALUE === 0n, + false, + 'The result of (-Number.MIN_VALUE === 0n) is false' +); + +assert.sameValue( + -10n === Number.MIN_VALUE, + false, + 'The result of (-10n === Number.MIN_VALUE) is false' +); -assert.sameValue(0n === 0, false, "0n === 0"); -assert.sameValue(0 === 0n, false, "0 === 0n"); -assert.sameValue(0n === -0, false, "0n === -0"); -assert.sameValue(-0 === 0n, false, "-0 === 0n"); -assert.sameValue(0n === 0.000000000001, false, "0n === 0.000000000001"); -assert.sameValue(0.000000000001 === 0n, false, "0.000000000001 === 0n"); -assert.sameValue(0n === 1, false, "0n === 1"); -assert.sameValue(1 === 0n, false, "1 === 0n"); -assert.sameValue(1n === 0, false, "1n === 0"); -assert.sameValue(0 === 1n, false, "0 === 1n"); -assert.sameValue(1n === 0.999999999999, false, "1n === 0.999999999999"); -assert.sameValue(0.999999999999 === 1n, false, "0.999999999999 === 1n"); -assert.sameValue(1n === 1, false, "1n === 1"); -assert.sameValue(1 === 1n, false, "1 === 1n"); -assert.sameValue(0n === Number.MIN_VALUE, false, "0n === Number.MIN_VALUE"); -assert.sameValue(Number.MIN_VALUE === 0n, false, "Number.MIN_VALUE === 0n"); -assert.sameValue(0n === -Number.MIN_VALUE, false, "0n === -Number.MIN_VALUE"); -assert.sameValue(-Number.MIN_VALUE === 0n, false, "-Number.MIN_VALUE === 0n"); -assert.sameValue(-10n === Number.MIN_VALUE, false, "-10n === Number.MIN_VALUE"); -assert.sameValue(Number.MIN_VALUE === -10n, false, "Number.MIN_VALUE === -10n"); +assert.sameValue( + Number.MIN_VALUE === -10n, + false, + 'The result of (Number.MIN_VALUE === -10n) is false' +); \ No newline at end of file diff --git a/test/language/expressions/strict-equals/bigint-and-object.js b/test/language/expressions/strict-equals/bigint-and-object.js index edcf182384432c42f43f9ab7961009a6fed331b3..638540d1537cc0264e46a28eeb68d82a68433a3a 100644 --- a/test/language/expressions/strict-equals/bigint-and-object.js +++ b/test/language/expressions/strict-equals/bigint-and-object.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Strict equality comparison of BigInt values and non-primitive objects esid: sec-strict-equality-comparison @@ -9,36 +8,115 @@ info: | features: [BigInt] ---*/ +assert.sameValue(0n === Object(0n), false, 'The result of (0n === Object(0n)) is false'); +assert.sameValue(Object(0n) === 0n, false, 'The result of (Object(0n) === 0n) is false'); +assert.sameValue(0n === Object(1n), false, 'The result of (0n === Object(1n)) is false'); +assert.sameValue(Object(1n) === 0n, false, 'The result of (Object(1n) === 0n) is false'); +assert.sameValue(1n === Object(0n), false, 'The result of (1n === Object(0n)) is false'); +assert.sameValue(Object(0n) === 1n, false, 'The result of (Object(0n) === 1n) is false'); +assert.sameValue(1n === Object(1n), false, 'The result of (1n === Object(1n)) is false'); +assert.sameValue(Object(1n) === 1n, false, 'The result of (Object(1n) === 1n) is false'); +assert.sameValue(2n === Object(0n), false, 'The result of (2n === Object(0n)) is false'); +assert.sameValue(Object(0n) === 2n, false, 'The result of (Object(0n) === 2n) is false'); +assert.sameValue(2n === Object(1n), false, 'The result of (2n === Object(1n)) is false'); +assert.sameValue(Object(1n) === 2n, false, 'The result of (Object(1n) === 2n) is false'); +assert.sameValue(2n === Object(2n), false, 'The result of (2n === Object(2n)) is false'); +assert.sameValue(Object(2n) === 2n, false, 'The result of (Object(2n) === 2n) is false'); +assert.sameValue(0n === {}, false, 'The result of (0n === {}) is false'); +assert.sameValue({} === 0n, false, 'The result of (({}) === 0n) is false'); + +assert.sameValue(0n === { + valueOf: function() { + return 0n; + } +}, false, 'The result of (0n === {valueOf: function() {return 0n;}}) is false'); + +assert.sameValue({ + valueOf: function() { + return 0n; + } +} === 0n, false, 'The result of (({valueOf: function() {return 0n;}}) === 0n) is false'); + +assert.sameValue(0n === { + valueOf: function() { + return 1n; + } +}, false, 'The result of (0n === {valueOf: function() {return 1n;}}) is false'); + +assert.sameValue({ + valueOf: function() { + return 1n; + } +} === 0n, false, 'The result of (({valueOf: function() {return 1n;}}) === 0n) is false'); + +assert.sameValue(0n === { + toString: function() { + return '0'; + } +}, false, 'The result of (0n === {toString: function() {return "0";}}) is false'); + +assert.sameValue({ + toString: function() { + return '0'; + } +} === 0n, false, 'The result of (({toString: function() {return "0";}}) === 0n) is false'); + +assert.sameValue(0n === { + toString: function() { + return '1'; + } +}, false, 'The result of (0n === {toString: function() {return "1";}}) is false'); + +assert.sameValue({ + toString: function() { + return '1'; + } +} === 0n, false, 'The result of (({toString: function() {return "1";}}) === 0n) is false'); + +assert.sameValue(900719925474099101n === { + valueOf: function() { + return 900719925474099101n; + } +}, false, 'The result of (900719925474099101n === {valueOf: function() {return 900719925474099101n;}}) is false'); + +assert.sameValue({ + valueOf: function() { + return 900719925474099101n; + } +} === 900719925474099101n, false, 'The result of (({valueOf: function() {return 900719925474099101n;}}) === 900719925474099101n) is false'); + +assert.sameValue(900719925474099101n === { + valueOf: function() { + return 900719925474099102n; + } +}, false, 'The result of (900719925474099101n === {valueOf: function() {return 900719925474099102n;}}) is false'); + +assert.sameValue({ + valueOf: function() { + return 900719925474099102n; + } +} === 900719925474099101n, false, 'The result of (({valueOf: function() {return 900719925474099102n;}}) === 900719925474099101n) is false'); + +assert.sameValue(900719925474099101n === { + toString: function() { + return '900719925474099101'; + } +}, false, 'The result of (900719925474099101n === {toString: function() {return "900719925474099101";}}) is false'); + +assert.sameValue({ + toString: function() { + return '900719925474099101'; + } +} === 900719925474099101n, false, 'The result of (({toString: function() {return "900719925474099101";}}) === 900719925474099101n) is false'); + +assert.sameValue(900719925474099101n === { + toString: function() { + return '900719925474099102'; + } +}, false, 'The result of (900719925474099101n === {toString: function() {return "900719925474099102";}}) is false'); -assert.sameValue(0n === Object(0n), false, "0n === Object(0n)"); -assert.sameValue(Object(0n) === 0n, false, "Object(0n) === 0n"); -assert.sameValue(0n === Object(1n), false, "0n === Object(1n)"); -assert.sameValue(Object(1n) === 0n, false, "Object(1n) === 0n"); -assert.sameValue(1n === Object(0n), false, "1n === Object(0n)"); -assert.sameValue(Object(0n) === 1n, false, "Object(0n) === 1n"); -assert.sameValue(1n === Object(1n), false, "1n === Object(1n)"); -assert.sameValue(Object(1n) === 1n, false, "Object(1n) === 1n"); -assert.sameValue(2n === Object(0n), false, "2n === Object(0n)"); -assert.sameValue(Object(0n) === 2n, false, "Object(0n) === 2n"); -assert.sameValue(2n === Object(1n), false, "2n === Object(1n)"); -assert.sameValue(Object(1n) === 2n, false, "Object(1n) === 2n"); -assert.sameValue(2n === Object(2n), false, "2n === Object(2n)"); -assert.sameValue(Object(2n) === 2n, false, "Object(2n) === 2n"); -assert.sameValue(0n === {}, false, "0n === {}"); -assert.sameValue({} === 0n, false, "{} === 0n"); -assert.sameValue(0n === {valueOf: function() { return 0n; }}, false, "0n === {valueOf: function() { return 0n; }}"); -assert.sameValue({valueOf: function() { return 0n; }} === 0n, false, "{valueOf: function() { return 0n; }} === 0n"); -assert.sameValue(0n === {valueOf: function() { return 1n; }}, false, "0n === {valueOf: function() { return 1n; }}"); -assert.sameValue({valueOf: function() { return 1n; }} === 0n, false, "{valueOf: function() { return 1n; }} === 0n"); -assert.sameValue(0n === {toString: function() { return "0"; }}, false, '0n === {toString: function() { return "0"; }}'); -assert.sameValue({toString: function() { return "0"; }} === 0n, false, '{toString: function() { return "0"; }} === 0n'); -assert.sameValue(0n === {toString: function() { return "1"; }}, false, '0n === {toString: function() { return "1"; }}'); -assert.sameValue({toString: function() { return "1"; }} === 0n, false, '{toString: function() { return "1"; }} === 0n'); -assert.sameValue(900719925474099101n === {valueOf: function() { return 900719925474099101n; }}, false, "900719925474099101n === {valueOf: function() { return 900719925474099101n; }}"); -assert.sameValue({valueOf: function() { return 900719925474099101n; }} === 900719925474099101n, false, "{valueOf: function() { return 900719925474099101n; }} === 900719925474099101n"); -assert.sameValue(900719925474099101n === {valueOf: function() { return 900719925474099102n; }}, false, "900719925474099101n === {valueOf: function() { return 900719925474099102n; }}"); -assert.sameValue({valueOf: function() { return 900719925474099102n; }} === 900719925474099101n, false, "{valueOf: function() { return 900719925474099102n; }} === 900719925474099101n"); -assert.sameValue(900719925474099101n === {toString: function() { return "900719925474099101"; }}, false, '900719925474099101n === {toString: function() { return "900719925474099101"; }}'); -assert.sameValue({toString: function() { return "900719925474099101"; }} === 900719925474099101n, false, '{toString: function() { return "900719925474099101"; }} === 900719925474099101n'); -assert.sameValue(900719925474099101n === {toString: function() { return "900719925474099102"; }}, false, '900719925474099101n === {toString: function() { return "900719925474099102"; }}'); -assert.sameValue({toString: function() { return "900719925474099102"; }} === 900719925474099101n, false, '{toString: function() { return "900719925474099102"; }} === 900719925474099101n'); +assert.sameValue({ + toString: function() { + return '900719925474099102'; + } +} === 900719925474099101n, false, 'The result of (({toString: function() {return "900719925474099102";}}) === 900719925474099101n) is false'); \ No newline at end of file diff --git a/test/language/expressions/strict-equals/bigint-and-string.js b/test/language/expressions/strict-equals/bigint-and-string.js index 7e83b80887c9cccde1f688f6571f15a7a27ab70c..f810c00e8f6b6565f2b89374e831b5c96242dfa8 100644 --- a/test/language/expressions/strict-equals/bigint-and-string.js +++ b/test/language/expressions/strict-equals/bigint-and-string.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Strict equality comparison of BigInt and String values esid: sec-strict-equality-comparison @@ -9,40 +8,59 @@ info: | features: [BigInt] ---*/ +assert.sameValue(0n === '', false, 'The result of (0n === "") is false'); +assert.sameValue('' === 0n, false, 'The result of ("" === 0n) is false'); +assert.sameValue(0n === '-0', false, 'The result of (0n === "-0") is false'); +assert.sameValue('-0' === 0n, false, 'The result of ("-0" === 0n) is false'); +assert.sameValue(0n === '0', false, 'The result of (0n === "0") is false'); +assert.sameValue('0' === 0n, false, 'The result of ("0" === 0n) is false'); +assert.sameValue(0n === '-1', false, 'The result of (0n === "-1") is false'); +assert.sameValue('-1' === 0n, false, 'The result of ("-1" === 0n) is false'); +assert.sameValue(0n === '1', false, 'The result of (0n === "1") is false'); +assert.sameValue('1' === 0n, false, 'The result of ("1" === 0n) is false'); +assert.sameValue(0n === 'foo', false, 'The result of (0n === "foo") is false'); +assert.sameValue('foo' === 0n, false, 'The result of ("foo" === 0n) is false'); +assert.sameValue(1n === '', false, 'The result of (1n === "") is false'); +assert.sameValue('' === 1n, false, 'The result of ("" === 1n) is false'); +assert.sameValue(1n === '-0', false, 'The result of (1n === "-0") is false'); +assert.sameValue('-0' === 1n, false, 'The result of ("-0" === 1n) is false'); +assert.sameValue(1n === '0', false, 'The result of (1n === "0") is false'); +assert.sameValue('0' === 1n, false, 'The result of ("0" === 1n) is false'); +assert.sameValue(1n === '-1', false, 'The result of (1n === "-1") is false'); +assert.sameValue('-1' === 1n, false, 'The result of ("-1" === 1n) is false'); +assert.sameValue(1n === '1', false, 'The result of (1n === "1") is false'); +assert.sameValue('1' === 1n, false, 'The result of ("1" === 1n) is false'); +assert.sameValue(1n === 'foo', false, 'The result of (1n === "foo") is false'); +assert.sameValue('foo' === 1n, false, 'The result of ("foo" === 1n) is false'); +assert.sameValue(-1n === '-', false, 'The result of (-1n === "-") is false'); +assert.sameValue('-' === -1n, false, 'The result of ("-" === -1n) is false'); +assert.sameValue(-1n === '-0', false, 'The result of (-1n === "-0") is false'); +assert.sameValue('-0' === -1n, false, 'The result of ("-0" === -1n) is false'); +assert.sameValue(-1n === '-1', false, 'The result of (-1n === "-1") is false'); +assert.sameValue('-1' === -1n, false, 'The result of ("-1" === -1n) is false'); +assert.sameValue(-1n === '-foo', false, 'The result of (-1n === "-foo") is false'); +assert.sameValue('-foo' === -1n, false, 'The result of ("-foo" === -1n) is false'); + +assert.sameValue( + 900719925474099101n === '900719925474099101', + false, + 'The result of (900719925474099101n === "900719925474099101") is false' +); + +assert.sameValue( + '900719925474099101' === 900719925474099101n, + false, + 'The result of ("900719925474099101" === 900719925474099101n) is false' +); + +assert.sameValue( + 900719925474099102n === '900719925474099101', + false, + 'The result of (900719925474099102n === "900719925474099101") is false' +); -assert.sameValue(0n === "", false, '0n === ""'); -assert.sameValue("" === 0n, false, '"" === 0n'); -assert.sameValue(0n === "-0", false, '0n === "-0"'); -assert.sameValue("-0" === 0n, false, '"-0" === 0n'); -assert.sameValue(0n === "0", false, '0n === "0"'); -assert.sameValue("0" === 0n, false, '"0" === 0n'); -assert.sameValue(0n === "-1", false, '0n === "-1"'); -assert.sameValue("-1" === 0n, false, '"-1" === 0n'); -assert.sameValue(0n === "1", false, '0n === "1"'); -assert.sameValue("1" === 0n, false, '"1" === 0n'); -assert.sameValue(0n === "foo", false, '0n === "foo"'); -assert.sameValue("foo" === 0n, false, '"foo" === 0n'); -assert.sameValue(1n === "", false, '1n === ""'); -assert.sameValue("" === 1n, false, '"" === 1n'); -assert.sameValue(1n === "-0", false, '1n === "-0"'); -assert.sameValue("-0" === 1n, false, '"-0" === 1n'); -assert.sameValue(1n === "0", false, '1n === "0"'); -assert.sameValue("0" === 1n, false, '"0" === 1n'); -assert.sameValue(1n === "-1", false, '1n === "-1"'); -assert.sameValue("-1" === 1n, false, '"-1" === 1n'); -assert.sameValue(1n === "1", false, '1n === "1"'); -assert.sameValue("1" === 1n, false, '"1" === 1n'); -assert.sameValue(1n === "foo", false, '1n === "foo"'); -assert.sameValue("foo" === 1n, false, '"foo" === 1n'); -assert.sameValue(-1n === "-", false, '-1n === "-"'); -assert.sameValue("-" === -1n, false, '"-" === -1n'); -assert.sameValue(-1n === "-0", false, '-1n === "-0"'); -assert.sameValue("-0" === -1n, false, '"-0" === -1n'); -assert.sameValue(-1n === "-1", false, '-1n === "-1"'); -assert.sameValue("-1" === -1n, false, '"-1" === -1n'); -assert.sameValue(-1n === "-foo", false, '-1n === "-foo"'); -assert.sameValue("-foo" === -1n, false, '"-foo" === -1n'); -assert.sameValue(900719925474099101n === "900719925474099101", false, '900719925474099101n === "900719925474099101"'); -assert.sameValue("900719925474099101" === 900719925474099101n, false, '"900719925474099101" === 900719925474099101n'); -assert.sameValue(900719925474099102n === "900719925474099101", false, '900719925474099102n === "900719925474099101"'); -assert.sameValue("900719925474099101" === 900719925474099102n, false, '"900719925474099101" === 900719925474099102n'); +assert.sameValue( + '900719925474099101' === 900719925474099102n, + false, + 'The result of ("900719925474099101" === 900719925474099102n) is false' +); \ No newline at end of file diff --git a/test/language/expressions/subtraction/bigint-and-number.js b/test/language/expressions/subtraction/bigint-and-number.js index c75fd73a0f35b4b140643c91d761c8548a0265ad..1e4f3a16fbf0574e9c524f0db025ffddd6df45db 100644 --- a/test/language/expressions/subtraction/bigint-and-number.js +++ b/test/language/expressions/subtraction/bigint-and-number.js @@ -9,24 +9,82 @@ info: | Let rnum be ? ToNumeric(rightValue). If Type(lnum) does not equal Type(rnum), throw a TypeError exception. ---*/ +assert.throws(TypeError, function() { + 1n - 1; +}, '1n - 1 throws TypeError'); -assert.throws(TypeError, function() { 1n - 1; }, "1n - 1 throws TypeError"); -assert.throws(TypeError, function() { 1 - 1n; }, "1 - 1n throws TypeError"); -assert.throws(TypeError, function() { Object(1n) - 1; }, "Object(1n) - 1 throws TypeError"); -assert.throws(TypeError, function() { 1 - Object(1n); }, "1 - Object(1n) throws TypeError"); -assert.throws(TypeError, function() { 1n - Object(1); }, "1n - Object(1) throws TypeError"); -assert.throws(TypeError, function() { Object(1) - 1n; }, "Object(1) - 1n throws TypeError"); -assert.throws(TypeError, function() { Object(1n) - Object(1); }, "Object(1n) - Object(1) throws TypeError"); -assert.throws(TypeError, function() { Object(1) - Object(1n); }, "Object(1) - Object(1n) throws TypeError"); -assert.throws(TypeError, function() { 1n - NaN; }, "1n - NaN throws TypeError"); -assert.throws(TypeError, function() { NaN - 1n; }, "NaN - 1n throws TypeError"); -assert.throws(TypeError, function() { 1n - Infinity; }, "1n - Infinity throws TypeError"); -assert.throws(TypeError, function() { Infinity - 1n; }, "Infinity - 1n throws TypeError"); -assert.throws(TypeError, function() { 1n - true; }, "1n - true throws TypeError"); -assert.throws(TypeError, function() { true - 1n; }, "true - 1n throws TypeError"); -assert.throws(TypeError, function() { 1n - "1"; }, '1n - "1" throws TypeError'); -assert.throws(TypeError, function() { "1" - 1n; }, '"1" - 1n throws TypeError'); -assert.throws(TypeError, function() { 1n - null; }, "1n - null throws TypeError"); -assert.throws(TypeError, function() { null - 1n; }, "null - 1n throws TypeError"); -assert.throws(TypeError, function() { 1n - undefined; }, "1n - undefined throws TypeError"); -assert.throws(TypeError, function() { undefined - 1n; }, "undefined - 1n throws TypeError"); +assert.throws(TypeError, function() { + 1 - 1n; +}, '1 - 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) - 1; +}, 'Object(1n) - 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 - Object(1n); +}, '1 - Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n - Object(1); +}, '1n - Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) - 1n; +}, 'Object(1) - 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) - Object(1); +}, 'Object(1n) - Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) - Object(1n); +}, 'Object(1) - Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n - NaN; +}, '1n - NaN throws TypeError'); + +assert.throws(TypeError, function() { + NaN - 1n; +}, 'NaN - 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n - Infinity; +}, '1n - Infinity throws TypeError'); + +assert.throws(TypeError, function() { + Infinity - 1n; +}, 'Infinity - 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n - true; +}, '1n - true throws TypeError'); + +assert.throws(TypeError, function() { + true - 1n; +}, 'true - 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n - '1'; +}, '1n - "1" throws TypeError'); + +assert.throws(TypeError, function() { + '1' - 1n; +}, '"1" - 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n - null; +}, '1n - null throws TypeError'); + +assert.throws(TypeError, function() { + null - 1n; +}, 'null - 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n - undefined; +}, '1n - undefined throws TypeError'); + +assert.throws(TypeError, function() { + undefined - 1n; +}, 'undefined - 1n throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/subtraction/bigint-arithmetic.js b/test/language/expressions/subtraction/bigint-arithmetic.js index 724486d86fad0c47e50c8e978c58e171f67e95c8..48b4b5c3b9866df9b7d87cecd562e4cfd214f418 100644 --- a/test/language/expressions/subtraction/bigint-arithmetic.js +++ b/test/language/expressions/subtraction/bigint-arithmetic.js @@ -1,302 +1,1344 @@ // Copyright (C) 2017 Robin Templeton. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- esid: sec-subtraction-operator-minus-runtime-semantics-evaluation description: BigInt subtraction arithmetic features: [BigInt] ---*/ +assert.sameValue( + 0xFEDCBA9876543210n - 0xFEDCBA9876543210n, + 0x0n, + 'The result of (0xFEDCBA9876543210n - 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA9876543210n - 0xFEDCBA987654320Fn, + 0x1n, + 'The result of (0xFEDCBA9876543210n - 0xFEDCBA987654320Fn) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA9876543210n - 0xFEDCBA98n, + 0xFEDCBA9777777778n, + 'The result of (0xFEDCBA9876543210n - 0xFEDCBA98n) is 0xFEDCBA9777777778n' +); + +assert.sameValue( + 0xFEDCBA9876543210n - 0xFEDCBA97n, + 0xFEDCBA9777777779n, + 'The result of (0xFEDCBA9876543210n - 0xFEDCBA97n) is 0xFEDCBA9777777779n' +); + +assert.sameValue( + 0xFEDCBA9876543210n - 0x1234n, + 0xFEDCBA9876541FDCn, + 'The result of (0xFEDCBA9876543210n - 0x1234n) is 0xFEDCBA9876541FDCn' +); + +assert.sameValue( + 0xFEDCBA9876543210n - 0x3n, + 0xFEDCBA987654320Dn, + 'The result of (0xFEDCBA9876543210n - 0x3n) is 0xFEDCBA987654320Dn' +); + +assert.sameValue( + 0xFEDCBA9876543210n - 0x2n, + 0xFEDCBA987654320En, + 'The result of (0xFEDCBA9876543210n - 0x2n) is 0xFEDCBA987654320En' +); + +assert.sameValue( + 0xFEDCBA9876543210n - 0x1n, + 0xFEDCBA987654320Fn, + 'The result of (0xFEDCBA9876543210n - 0x1n) is 0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0xFEDCBA9876543210n - 0x0n, + 0xFEDCBA9876543210n, + 'The result of (0xFEDCBA9876543210n - 0x0n) is 0xFEDCBA9876543210n' +); + +assert.sameValue( + 0xFEDCBA9876543210n - -0x1n, + 0xFEDCBA9876543211n, + 'The result of (0xFEDCBA9876543210n - -0x1n) is 0xFEDCBA9876543211n' +); + +assert.sameValue( + 0xFEDCBA9876543210n - -0x2n, + 0xFEDCBA9876543212n, + 'The result of (0xFEDCBA9876543210n - -0x2n) is 0xFEDCBA9876543212n' +); + +assert.sameValue( + 0xFEDCBA9876543210n - -0x3n, + 0xFEDCBA9876543213n, + 'The result of (0xFEDCBA9876543210n - -0x3n) is 0xFEDCBA9876543213n' +); + +assert.sameValue( + 0xFEDCBA9876543210n - -0x1234n, + 0xFEDCBA9876544444n, + 'The result of (0xFEDCBA9876543210n - -0x1234n) is 0xFEDCBA9876544444n' +); + +assert.sameValue( + 0xFEDCBA9876543210n - -0xFEDCBA97n, + 0xFEDCBA997530ECA7n, + 'The result of (0xFEDCBA9876543210n - -0xFEDCBA97n) is 0xFEDCBA997530ECA7n' +); + +assert.sameValue( + 0xFEDCBA9876543210n - -0xFEDCBA98n, + 0xFEDCBA997530ECA8n, + 'The result of (0xFEDCBA9876543210n - -0xFEDCBA98n) is 0xFEDCBA997530ECA8n' +); + +assert.sameValue( + 0xFEDCBA9876543210n - -0xFEDCBA987654320Fn, + 0x1FDB97530ECA8641Fn, + 'The result of (0xFEDCBA9876543210n - -0xFEDCBA987654320Fn) is 0x1FDB97530ECA8641Fn' +); + +assert.sameValue( + 0xFEDCBA9876543210n - -0xFEDCBA9876543210n, + 0x1FDB97530ECA86420n, + 'The result of (0xFEDCBA9876543210n - -0xFEDCBA9876543210n) is 0x1FDB97530ECA86420n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - 0xFEDCBA9876543210n, + -0x1n, + 'The result of (0xFEDCBA987654320Fn - 0xFEDCBA9876543210n) is -0x1n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0xFEDCBA987654320Fn - 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - 0xFEDCBA98n, + 0xFEDCBA9777777777n, + 'The result of (0xFEDCBA987654320Fn - 0xFEDCBA98n) is 0xFEDCBA9777777777n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - 0xFEDCBA97n, + 0xFEDCBA9777777778n, + 'The result of (0xFEDCBA987654320Fn - 0xFEDCBA97n) is 0xFEDCBA9777777778n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - 0x1234n, + 0xFEDCBA9876541FDBn, + 'The result of (0xFEDCBA987654320Fn - 0x1234n) is 0xFEDCBA9876541FDBn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - 0x3n, + 0xFEDCBA987654320Cn, + 'The result of (0xFEDCBA987654320Fn - 0x3n) is 0xFEDCBA987654320Cn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - 0x2n, + 0xFEDCBA987654320Dn, + 'The result of (0xFEDCBA987654320Fn - 0x2n) is 0xFEDCBA987654320Dn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - 0x1n, + 0xFEDCBA987654320En, + 'The result of (0xFEDCBA987654320Fn - 0x1n) is 0xFEDCBA987654320En' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - 0x0n, + 0xFEDCBA987654320Fn, + 'The result of (0xFEDCBA987654320Fn - 0x0n) is 0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - -0x1n, + 0xFEDCBA9876543210n, + 'The result of (0xFEDCBA987654320Fn - -0x1n) is 0xFEDCBA9876543210n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - -0x2n, + 0xFEDCBA9876543211n, + 'The result of (0xFEDCBA987654320Fn - -0x2n) is 0xFEDCBA9876543211n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - -0x3n, + 0xFEDCBA9876543212n, + 'The result of (0xFEDCBA987654320Fn - -0x3n) is 0xFEDCBA9876543212n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - -0x1234n, + 0xFEDCBA9876544443n, + 'The result of (0xFEDCBA987654320Fn - -0x1234n) is 0xFEDCBA9876544443n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - -0xFEDCBA97n, + 0xFEDCBA997530ECA6n, + 'The result of (0xFEDCBA987654320Fn - -0xFEDCBA97n) is 0xFEDCBA997530ECA6n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - -0xFEDCBA98n, + 0xFEDCBA997530ECA7n, + 'The result of (0xFEDCBA987654320Fn - -0xFEDCBA98n) is 0xFEDCBA997530ECA7n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - -0xFEDCBA987654320Fn, + 0x1FDB97530ECA8641En, + 'The result of (0xFEDCBA987654320Fn - -0xFEDCBA987654320Fn) is 0x1FDB97530ECA8641En' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - -0xFEDCBA9876543210n, + 0x1FDB97530ECA8641Fn, + 'The result of (0xFEDCBA987654320Fn - -0xFEDCBA9876543210n) is 0x1FDB97530ECA8641Fn' +); + +assert.sameValue( + 0xFEDCBA98n - 0xFEDCBA9876543210n, + -0xFEDCBA9777777778n, + 'The result of (0xFEDCBA98n - 0xFEDCBA9876543210n) is -0xFEDCBA9777777778n' +); + +assert.sameValue( + 0xFEDCBA98n - 0xFEDCBA987654320Fn, + -0xFEDCBA9777777777n, + 'The result of (0xFEDCBA98n - 0xFEDCBA987654320Fn) is -0xFEDCBA9777777777n' +); + +assert.sameValue( + 0xFEDCBA98n - 0xFEDCBA98n, + 0x0n, + 'The result of (0xFEDCBA98n - 0xFEDCBA98n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA98n - 0xFEDCBA97n, + 0x1n, + 'The result of (0xFEDCBA98n - 0xFEDCBA97n) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA98n - 0x1234n, + 0xFEDCA864n, + 'The result of (0xFEDCBA98n - 0x1234n) is 0xFEDCA864n' +); + +assert.sameValue( + 0xFEDCBA98n - 0x3n, + 0xFEDCBA95n, + 'The result of (0xFEDCBA98n - 0x3n) is 0xFEDCBA95n' +); + +assert.sameValue( + 0xFEDCBA98n - 0x2n, + 0xFEDCBA96n, + 'The result of (0xFEDCBA98n - 0x2n) is 0xFEDCBA96n' +); + +assert.sameValue( + 0xFEDCBA98n - 0x1n, + 0xFEDCBA97n, + 'The result of (0xFEDCBA98n - 0x1n) is 0xFEDCBA97n' +); + +assert.sameValue( + 0xFEDCBA98n - 0x0n, + 0xFEDCBA98n, + 'The result of (0xFEDCBA98n - 0x0n) is 0xFEDCBA98n' +); + +assert.sameValue( + 0xFEDCBA98n - -0x1n, + 0xFEDCBA99n, + 'The result of (0xFEDCBA98n - -0x1n) is 0xFEDCBA99n' +); + +assert.sameValue( + 0xFEDCBA98n - -0x2n, + 0xFEDCBA9An, + 'The result of (0xFEDCBA98n - -0x2n) is 0xFEDCBA9An' +); + +assert.sameValue( + 0xFEDCBA98n - -0x3n, + 0xFEDCBA9Bn, + 'The result of (0xFEDCBA98n - -0x3n) is 0xFEDCBA9Bn' +); + +assert.sameValue( + 0xFEDCBA98n - -0x1234n, + 0xFEDCCCCCn, + 'The result of (0xFEDCBA98n - -0x1234n) is 0xFEDCCCCCn' +); + +assert.sameValue( + 0xFEDCBA98n - -0xFEDCBA97n, + 0x1FDB9752Fn, + 'The result of (0xFEDCBA98n - -0xFEDCBA97n) is 0x1FDB9752Fn' +); + +assert.sameValue( + 0xFEDCBA98n - -0xFEDCBA98n, + 0x1FDB97530n, + 'The result of (0xFEDCBA98n - -0xFEDCBA98n) is 0x1FDB97530n' +); + +assert.sameValue( + 0xFEDCBA98n - -0xFEDCBA987654320Fn, + 0xFEDCBA997530ECA7n, + 'The result of (0xFEDCBA98n - -0xFEDCBA987654320Fn) is 0xFEDCBA997530ECA7n' +); + +assert.sameValue( + 0xFEDCBA98n - -0xFEDCBA9876543210n, + 0xFEDCBA997530ECA8n, + 'The result of (0xFEDCBA98n - -0xFEDCBA9876543210n) is 0xFEDCBA997530ECA8n' +); + +assert.sameValue( + 0xFEDCBA97n - 0xFEDCBA9876543210n, + -0xFEDCBA9777777779n, + 'The result of (0xFEDCBA97n - 0xFEDCBA9876543210n) is -0xFEDCBA9777777779n' +); + +assert.sameValue( + 0xFEDCBA97n - 0xFEDCBA987654320Fn, + -0xFEDCBA9777777778n, + 'The result of (0xFEDCBA97n - 0xFEDCBA987654320Fn) is -0xFEDCBA9777777778n' +); + +assert.sameValue( + 0xFEDCBA97n - 0xFEDCBA98n, + -0x1n, + 'The result of (0xFEDCBA97n - 0xFEDCBA98n) is -0x1n' +); + +assert.sameValue( + 0xFEDCBA97n - 0xFEDCBA97n, + 0x0n, + 'The result of (0xFEDCBA97n - 0xFEDCBA97n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA97n - 0x1234n, + 0xFEDCA863n, + 'The result of (0xFEDCBA97n - 0x1234n) is 0xFEDCA863n' +); + +assert.sameValue( + 0xFEDCBA97n - 0x3n, + 0xFEDCBA94n, + 'The result of (0xFEDCBA97n - 0x3n) is 0xFEDCBA94n' +); + +assert.sameValue( + 0xFEDCBA97n - 0x2n, + 0xFEDCBA95n, + 'The result of (0xFEDCBA97n - 0x2n) is 0xFEDCBA95n' +); + +assert.sameValue( + 0xFEDCBA97n - 0x1n, + 0xFEDCBA96n, + 'The result of (0xFEDCBA97n - 0x1n) is 0xFEDCBA96n' +); + +assert.sameValue( + 0xFEDCBA97n - 0x0n, + 0xFEDCBA97n, + 'The result of (0xFEDCBA97n - 0x0n) is 0xFEDCBA97n' +); + +assert.sameValue( + 0xFEDCBA97n - -0x1n, + 0xFEDCBA98n, + 'The result of (0xFEDCBA97n - -0x1n) is 0xFEDCBA98n' +); + +assert.sameValue( + 0xFEDCBA97n - -0x2n, + 0xFEDCBA99n, + 'The result of (0xFEDCBA97n - -0x2n) is 0xFEDCBA99n' +); + +assert.sameValue( + 0xFEDCBA97n - -0x3n, + 0xFEDCBA9An, + 'The result of (0xFEDCBA97n - -0x3n) is 0xFEDCBA9An' +); + +assert.sameValue( + 0xFEDCBA97n - -0x1234n, + 0xFEDCCCCBn, + 'The result of (0xFEDCBA97n - -0x1234n) is 0xFEDCCCCBn' +); + +assert.sameValue( + 0xFEDCBA97n - -0xFEDCBA97n, + 0x1FDB9752En, + 'The result of (0xFEDCBA97n - -0xFEDCBA97n) is 0x1FDB9752En' +); + +assert.sameValue( + 0xFEDCBA97n - -0xFEDCBA98n, + 0x1FDB9752Fn, + 'The result of (0xFEDCBA97n - -0xFEDCBA98n) is 0x1FDB9752Fn' +); + +assert.sameValue( + 0xFEDCBA97n - -0xFEDCBA987654320Fn, + 0xFEDCBA997530ECA6n, + 'The result of (0xFEDCBA97n - -0xFEDCBA987654320Fn) is 0xFEDCBA997530ECA6n' +); + +assert.sameValue( + 0xFEDCBA97n - -0xFEDCBA9876543210n, + 0xFEDCBA997530ECA7n, + 'The result of (0xFEDCBA97n - -0xFEDCBA9876543210n) is 0xFEDCBA997530ECA7n' +); + +assert.sameValue( + 0x1234n - 0xFEDCBA9876543210n, + -0xFEDCBA9876541FDCn, + 'The result of (0x1234n - 0xFEDCBA9876543210n) is -0xFEDCBA9876541FDCn' +); + +assert.sameValue( + 0x1234n - 0xFEDCBA987654320Fn, + -0xFEDCBA9876541FDBn, + 'The result of (0x1234n - 0xFEDCBA987654320Fn) is -0xFEDCBA9876541FDBn' +); + +assert.sameValue( + 0x1234n - 0xFEDCBA98n, + -0xFEDCA864n, + 'The result of (0x1234n - 0xFEDCBA98n) is -0xFEDCA864n' +); + +assert.sameValue( + 0x1234n - 0xFEDCBA97n, + -0xFEDCA863n, + 'The result of (0x1234n - 0xFEDCBA97n) is -0xFEDCA863n' +); + +assert.sameValue(0x1234n - 0x1234n, 0x0n, 'The result of (0x1234n - 0x1234n) is 0x0n'); +assert.sameValue(0x1234n - 0x3n, 0x1231n, 'The result of (0x1234n - 0x3n) is 0x1231n'); +assert.sameValue(0x1234n - 0x2n, 0x1232n, 'The result of (0x1234n - 0x2n) is 0x1232n'); +assert.sameValue(0x1234n - 0x1n, 0x1233n, 'The result of (0x1234n - 0x1n) is 0x1233n'); +assert.sameValue(0x1234n - 0x0n, 0x1234n, 'The result of (0x1234n - 0x0n) is 0x1234n'); +assert.sameValue(0x1234n - -0x1n, 0x1235n, 'The result of (0x1234n - -0x1n) is 0x1235n'); +assert.sameValue(0x1234n - -0x2n, 0x1236n, 'The result of (0x1234n - -0x2n) is 0x1236n'); +assert.sameValue(0x1234n - -0x3n, 0x1237n, 'The result of (0x1234n - -0x3n) is 0x1237n'); +assert.sameValue(0x1234n - -0x1234n, 0x2468n, 'The result of (0x1234n - -0x1234n) is 0x2468n'); + +assert.sameValue( + 0x1234n - -0xFEDCBA97n, + 0xFEDCCCCBn, + 'The result of (0x1234n - -0xFEDCBA97n) is 0xFEDCCCCBn' +); + +assert.sameValue( + 0x1234n - -0xFEDCBA98n, + 0xFEDCCCCCn, + 'The result of (0x1234n - -0xFEDCBA98n) is 0xFEDCCCCCn' +); + +assert.sameValue( + 0x1234n - -0xFEDCBA987654320Fn, + 0xFEDCBA9876544443n, + 'The result of (0x1234n - -0xFEDCBA987654320Fn) is 0xFEDCBA9876544443n' +); + +assert.sameValue( + 0x1234n - -0xFEDCBA9876543210n, + 0xFEDCBA9876544444n, + 'The result of (0x1234n - -0xFEDCBA9876543210n) is 0xFEDCBA9876544444n' +); + +assert.sameValue( + 0x3n - 0xFEDCBA9876543210n, + -0xFEDCBA987654320Dn, + 'The result of (0x3n - 0xFEDCBA9876543210n) is -0xFEDCBA987654320Dn' +); + +assert.sameValue( + 0x3n - 0xFEDCBA987654320Fn, + -0xFEDCBA987654320Cn, + 'The result of (0x3n - 0xFEDCBA987654320Fn) is -0xFEDCBA987654320Cn' +); + +assert.sameValue( + 0x3n - 0xFEDCBA98n, + -0xFEDCBA95n, + 'The result of (0x3n - 0xFEDCBA98n) is -0xFEDCBA95n' +); + +assert.sameValue( + 0x3n - 0xFEDCBA97n, + -0xFEDCBA94n, + 'The result of (0x3n - 0xFEDCBA97n) is -0xFEDCBA94n' +); + +assert.sameValue(0x3n - 0x1234n, -0x1231n, 'The result of (0x3n - 0x1234n) is -0x1231n'); +assert.sameValue(0x3n - 0x3n, 0x0n, 'The result of (0x3n - 0x3n) is 0x0n'); +assert.sameValue(0x3n - 0x2n, 0x1n, 'The result of (0x3n - 0x2n) is 0x1n'); +assert.sameValue(0x3n - 0x1n, 0x2n, 'The result of (0x3n - 0x1n) is 0x2n'); +assert.sameValue(0x3n - 0x0n, 0x3n, 'The result of (0x3n - 0x0n) is 0x3n'); +assert.sameValue(0x3n - -0x1n, 0x4n, 'The result of (0x3n - -0x1n) is 0x4n'); +assert.sameValue(0x3n - -0x2n, 0x5n, 'The result of (0x3n - -0x2n) is 0x5n'); +assert.sameValue(0x3n - -0x3n, 0x6n, 'The result of (0x3n - -0x3n) is 0x6n'); +assert.sameValue(0x3n - -0x1234n, 0x1237n, 'The result of (0x3n - -0x1234n) is 0x1237n'); + +assert.sameValue( + 0x3n - -0xFEDCBA97n, + 0xFEDCBA9An, + 'The result of (0x3n - -0xFEDCBA97n) is 0xFEDCBA9An' +); + +assert.sameValue( + 0x3n - -0xFEDCBA98n, + 0xFEDCBA9Bn, + 'The result of (0x3n - -0xFEDCBA98n) is 0xFEDCBA9Bn' +); + +assert.sameValue( + 0x3n - -0xFEDCBA987654320Fn, + 0xFEDCBA9876543212n, + 'The result of (0x3n - -0xFEDCBA987654320Fn) is 0xFEDCBA9876543212n' +); + +assert.sameValue( + 0x3n - -0xFEDCBA9876543210n, + 0xFEDCBA9876543213n, + 'The result of (0x3n - -0xFEDCBA9876543210n) is 0xFEDCBA9876543213n' +); + +assert.sameValue( + 0x2n - 0xFEDCBA9876543210n, + -0xFEDCBA987654320En, + 'The result of (0x2n - 0xFEDCBA9876543210n) is -0xFEDCBA987654320En' +); + +assert.sameValue( + 0x2n - 0xFEDCBA987654320Fn, + -0xFEDCBA987654320Dn, + 'The result of (0x2n - 0xFEDCBA987654320Fn) is -0xFEDCBA987654320Dn' +); + +assert.sameValue( + 0x2n - 0xFEDCBA98n, + -0xFEDCBA96n, + 'The result of (0x2n - 0xFEDCBA98n) is -0xFEDCBA96n' +); + +assert.sameValue( + 0x2n - 0xFEDCBA97n, + -0xFEDCBA95n, + 'The result of (0x2n - 0xFEDCBA97n) is -0xFEDCBA95n' +); + +assert.sameValue(0x2n - 0x1234n, -0x1232n, 'The result of (0x2n - 0x1234n) is -0x1232n'); +assert.sameValue(0x2n - 0x3n, -0x1n, 'The result of (0x2n - 0x3n) is -0x1n'); +assert.sameValue(0x2n - 0x2n, 0x0n, 'The result of (0x2n - 0x2n) is 0x0n'); +assert.sameValue(0x2n - 0x1n, 0x1n, 'The result of (0x2n - 0x1n) is 0x1n'); +assert.sameValue(0x2n - 0x0n, 0x2n, 'The result of (0x2n - 0x0n) is 0x2n'); +assert.sameValue(0x2n - -0x1n, 0x3n, 'The result of (0x2n - -0x1n) is 0x3n'); +assert.sameValue(0x2n - -0x2n, 0x4n, 'The result of (0x2n - -0x2n) is 0x4n'); +assert.sameValue(0x2n - -0x3n, 0x5n, 'The result of (0x2n - -0x3n) is 0x5n'); +assert.sameValue(0x2n - -0x1234n, 0x1236n, 'The result of (0x2n - -0x1234n) is 0x1236n'); + +assert.sameValue( + 0x2n - -0xFEDCBA97n, + 0xFEDCBA99n, + 'The result of (0x2n - -0xFEDCBA97n) is 0xFEDCBA99n' +); + +assert.sameValue( + 0x2n - -0xFEDCBA98n, + 0xFEDCBA9An, + 'The result of (0x2n - -0xFEDCBA98n) is 0xFEDCBA9An' +); + +assert.sameValue( + 0x2n - -0xFEDCBA987654320Fn, + 0xFEDCBA9876543211n, + 'The result of (0x2n - -0xFEDCBA987654320Fn) is 0xFEDCBA9876543211n' +); + +assert.sameValue( + 0x2n - -0xFEDCBA9876543210n, + 0xFEDCBA9876543212n, + 'The result of (0x2n - -0xFEDCBA9876543210n) is 0xFEDCBA9876543212n' +); + +assert.sameValue( + 0x1n - 0xFEDCBA9876543210n, + -0xFEDCBA987654320Fn, + 'The result of (0x1n - 0xFEDCBA9876543210n) is -0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0x1n - 0xFEDCBA987654320Fn, + -0xFEDCBA987654320En, + 'The result of (0x1n - 0xFEDCBA987654320Fn) is -0xFEDCBA987654320En' +); + +assert.sameValue( + 0x1n - 0xFEDCBA98n, + -0xFEDCBA97n, + 'The result of (0x1n - 0xFEDCBA98n) is -0xFEDCBA97n' +); + +assert.sameValue( + 0x1n - 0xFEDCBA97n, + -0xFEDCBA96n, + 'The result of (0x1n - 0xFEDCBA97n) is -0xFEDCBA96n' +); + +assert.sameValue(0x1n - 0x1234n, -0x1233n, 'The result of (0x1n - 0x1234n) is -0x1233n'); +assert.sameValue(0x1n - 0x3n, -0x2n, 'The result of (0x1n - 0x3n) is -0x2n'); +assert.sameValue(0x1n - 0x2n, -0x1n, 'The result of (0x1n - 0x2n) is -0x1n'); +assert.sameValue(0x1n - 0x1n, 0x0n, 'The result of (0x1n - 0x1n) is 0x0n'); +assert.sameValue(0x1n - 0x0n, 0x1n, 'The result of (0x1n - 0x0n) is 0x1n'); +assert.sameValue(0x1n - -0x1n, 0x2n, 'The result of (0x1n - -0x1n) is 0x2n'); +assert.sameValue(0x1n - -0x2n, 0x3n, 'The result of (0x1n - -0x2n) is 0x3n'); +assert.sameValue(0x1n - -0x3n, 0x4n, 'The result of (0x1n - -0x3n) is 0x4n'); +assert.sameValue(0x1n - -0x1234n, 0x1235n, 'The result of (0x1n - -0x1234n) is 0x1235n'); + +assert.sameValue( + 0x1n - -0xFEDCBA97n, + 0xFEDCBA98n, + 'The result of (0x1n - -0xFEDCBA97n) is 0xFEDCBA98n' +); + +assert.sameValue( + 0x1n - -0xFEDCBA98n, + 0xFEDCBA99n, + 'The result of (0x1n - -0xFEDCBA98n) is 0xFEDCBA99n' +); + +assert.sameValue( + 0x1n - -0xFEDCBA987654320Fn, + 0xFEDCBA9876543210n, + 'The result of (0x1n - -0xFEDCBA987654320Fn) is 0xFEDCBA9876543210n' +); + +assert.sameValue( + 0x1n - -0xFEDCBA9876543210n, + 0xFEDCBA9876543211n, + 'The result of (0x1n - -0xFEDCBA9876543210n) is 0xFEDCBA9876543211n' +); + +assert.sameValue( + 0x0n - 0xFEDCBA9876543210n, + -0xFEDCBA9876543210n, + 'The result of (0x0n - 0xFEDCBA9876543210n) is -0xFEDCBA9876543210n' +); + +assert.sameValue( + 0x0n - 0xFEDCBA987654320Fn, + -0xFEDCBA987654320Fn, + 'The result of (0x0n - 0xFEDCBA987654320Fn) is -0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0x0n - 0xFEDCBA98n, + -0xFEDCBA98n, + 'The result of (0x0n - 0xFEDCBA98n) is -0xFEDCBA98n' +); + +assert.sameValue( + 0x0n - 0xFEDCBA97n, + -0xFEDCBA97n, + 'The result of (0x0n - 0xFEDCBA97n) is -0xFEDCBA97n' +); + +assert.sameValue(0x0n - 0x1234n, -0x1234n, 'The result of (0x0n - 0x1234n) is -0x1234n'); +assert.sameValue(0x0n - 0x3n, -0x3n, 'The result of (0x0n - 0x3n) is -0x3n'); +assert.sameValue(0x0n - 0x2n, -0x2n, 'The result of (0x0n - 0x2n) is -0x2n'); +assert.sameValue(0x0n - 0x1n, -0x1n, 'The result of (0x0n - 0x1n) is -0x1n'); +assert.sameValue(0x0n - 0x0n, 0x0n, 'The result of (0x0n - 0x0n) is 0x0n'); +assert.sameValue(0x0n - -0x1n, 0x1n, 'The result of (0x0n - -0x1n) is 0x1n'); +assert.sameValue(0x0n - -0x2n, 0x2n, 'The result of (0x0n - -0x2n) is 0x2n'); +assert.sameValue(0x0n - -0x3n, 0x3n, 'The result of (0x0n - -0x3n) is 0x3n'); +assert.sameValue(0x0n - -0x1234n, 0x1234n, 'The result of (0x0n - -0x1234n) is 0x1234n'); + +assert.sameValue( + 0x0n - -0xFEDCBA97n, + 0xFEDCBA97n, + 'The result of (0x0n - -0xFEDCBA97n) is 0xFEDCBA97n' +); + +assert.sameValue( + 0x0n - -0xFEDCBA98n, + 0xFEDCBA98n, + 'The result of (0x0n - -0xFEDCBA98n) is 0xFEDCBA98n' +); + +assert.sameValue( + 0x0n - -0xFEDCBA987654320Fn, + 0xFEDCBA987654320Fn, + 'The result of (0x0n - -0xFEDCBA987654320Fn) is 0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0x0n - -0xFEDCBA9876543210n, + 0xFEDCBA9876543210n, + 'The result of (0x0n - -0xFEDCBA9876543210n) is 0xFEDCBA9876543210n' +); + +assert.sameValue( + -0x1n - 0xFEDCBA9876543210n, + -0xFEDCBA9876543211n, + 'The result of (-0x1n - 0xFEDCBA9876543210n) is -0xFEDCBA9876543211n' +); + +assert.sameValue( + -0x1n - 0xFEDCBA987654320Fn, + -0xFEDCBA9876543210n, + 'The result of (-0x1n - 0xFEDCBA987654320Fn) is -0xFEDCBA9876543210n' +); + +assert.sameValue( + -0x1n - 0xFEDCBA98n, + -0xFEDCBA99n, + 'The result of (-0x1n - 0xFEDCBA98n) is -0xFEDCBA99n' +); + +assert.sameValue( + -0x1n - 0xFEDCBA97n, + -0xFEDCBA98n, + 'The result of (-0x1n - 0xFEDCBA97n) is -0xFEDCBA98n' +); + +assert.sameValue(-0x1n - 0x1234n, -0x1235n, 'The result of (-0x1n - 0x1234n) is -0x1235n'); +assert.sameValue(-0x1n - 0x3n, -0x4n, 'The result of (-0x1n - 0x3n) is -0x4n'); +assert.sameValue(-0x1n - 0x2n, -0x3n, 'The result of (-0x1n - 0x2n) is -0x3n'); +assert.sameValue(-0x1n - 0x1n, -0x2n, 'The result of (-0x1n - 0x1n) is -0x2n'); +assert.sameValue(-0x1n - 0x0n, -0x1n, 'The result of (-0x1n - 0x0n) is -0x1n'); +assert.sameValue(-0x1n - -0x1n, 0x0n, 'The result of (-0x1n - -0x1n) is 0x0n'); +assert.sameValue(-0x1n - -0x2n, 0x1n, 'The result of (-0x1n - -0x2n) is 0x1n'); +assert.sameValue(-0x1n - -0x3n, 0x2n, 'The result of (-0x1n - -0x3n) is 0x2n'); +assert.sameValue(-0x1n - -0x1234n, 0x1233n, 'The result of (-0x1n - -0x1234n) is 0x1233n'); + +assert.sameValue( + -0x1n - -0xFEDCBA97n, + 0xFEDCBA96n, + 'The result of (-0x1n - -0xFEDCBA97n) is 0xFEDCBA96n' +); + +assert.sameValue( + -0x1n - -0xFEDCBA98n, + 0xFEDCBA97n, + 'The result of (-0x1n - -0xFEDCBA98n) is 0xFEDCBA97n' +); + +assert.sameValue( + -0x1n - -0xFEDCBA987654320Fn, + 0xFEDCBA987654320En, + 'The result of (-0x1n - -0xFEDCBA987654320Fn) is 0xFEDCBA987654320En' +); + +assert.sameValue( + -0x1n - -0xFEDCBA9876543210n, + 0xFEDCBA987654320Fn, + 'The result of (-0x1n - -0xFEDCBA9876543210n) is 0xFEDCBA987654320Fn' +); + +assert.sameValue( + -0x2n - 0xFEDCBA9876543210n, + -0xFEDCBA9876543212n, + 'The result of (-0x2n - 0xFEDCBA9876543210n) is -0xFEDCBA9876543212n' +); + +assert.sameValue( + -0x2n - 0xFEDCBA987654320Fn, + -0xFEDCBA9876543211n, + 'The result of (-0x2n - 0xFEDCBA987654320Fn) is -0xFEDCBA9876543211n' +); + +assert.sameValue( + -0x2n - 0xFEDCBA98n, + -0xFEDCBA9An, + 'The result of (-0x2n - 0xFEDCBA98n) is -0xFEDCBA9An' +); + +assert.sameValue( + -0x2n - 0xFEDCBA97n, + -0xFEDCBA99n, + 'The result of (-0x2n - 0xFEDCBA97n) is -0xFEDCBA99n' +); + +assert.sameValue(-0x2n - 0x1234n, -0x1236n, 'The result of (-0x2n - 0x1234n) is -0x1236n'); +assert.sameValue(-0x2n - 0x3n, -0x5n, 'The result of (-0x2n - 0x3n) is -0x5n'); +assert.sameValue(-0x2n - 0x2n, -0x4n, 'The result of (-0x2n - 0x2n) is -0x4n'); +assert.sameValue(-0x2n - 0x1n, -0x3n, 'The result of (-0x2n - 0x1n) is -0x3n'); +assert.sameValue(-0x2n - 0x0n, -0x2n, 'The result of (-0x2n - 0x0n) is -0x2n'); +assert.sameValue(-0x2n - -0x1n, -0x1n, 'The result of (-0x2n - -0x1n) is -0x1n'); +assert.sameValue(-0x2n - -0x2n, 0x0n, 'The result of (-0x2n - -0x2n) is 0x0n'); +assert.sameValue(-0x2n - -0x3n, 0x1n, 'The result of (-0x2n - -0x3n) is 0x1n'); +assert.sameValue(-0x2n - -0x1234n, 0x1232n, 'The result of (-0x2n - -0x1234n) is 0x1232n'); + +assert.sameValue( + -0x2n - -0xFEDCBA97n, + 0xFEDCBA95n, + 'The result of (-0x2n - -0xFEDCBA97n) is 0xFEDCBA95n' +); + +assert.sameValue( + -0x2n - -0xFEDCBA98n, + 0xFEDCBA96n, + 'The result of (-0x2n - -0xFEDCBA98n) is 0xFEDCBA96n' +); + +assert.sameValue( + -0x2n - -0xFEDCBA987654320Fn, + 0xFEDCBA987654320Dn, + 'The result of (-0x2n - -0xFEDCBA987654320Fn) is 0xFEDCBA987654320Dn' +); + +assert.sameValue( + -0x2n - -0xFEDCBA9876543210n, + 0xFEDCBA987654320En, + 'The result of (-0x2n - -0xFEDCBA9876543210n) is 0xFEDCBA987654320En' +); + +assert.sameValue( + -0x3n - 0xFEDCBA9876543210n, + -0xFEDCBA9876543213n, + 'The result of (-0x3n - 0xFEDCBA9876543210n) is -0xFEDCBA9876543213n' +); + +assert.sameValue( + -0x3n - 0xFEDCBA987654320Fn, + -0xFEDCBA9876543212n, + 'The result of (-0x3n - 0xFEDCBA987654320Fn) is -0xFEDCBA9876543212n' +); + +assert.sameValue( + -0x3n - 0xFEDCBA98n, + -0xFEDCBA9Bn, + 'The result of (-0x3n - 0xFEDCBA98n) is -0xFEDCBA9Bn' +); + +assert.sameValue( + -0x3n - 0xFEDCBA97n, + -0xFEDCBA9An, + 'The result of (-0x3n - 0xFEDCBA97n) is -0xFEDCBA9An' +); + +assert.sameValue(-0x3n - 0x1234n, -0x1237n, 'The result of (-0x3n - 0x1234n) is -0x1237n'); +assert.sameValue(-0x3n - 0x3n, -0x6n, 'The result of (-0x3n - 0x3n) is -0x6n'); +assert.sameValue(-0x3n - 0x2n, -0x5n, 'The result of (-0x3n - 0x2n) is -0x5n'); +assert.sameValue(-0x3n - 0x1n, -0x4n, 'The result of (-0x3n - 0x1n) is -0x4n'); +assert.sameValue(-0x3n - 0x0n, -0x3n, 'The result of (-0x3n - 0x0n) is -0x3n'); +assert.sameValue(-0x3n - -0x1n, -0x2n, 'The result of (-0x3n - -0x1n) is -0x2n'); +assert.sameValue(-0x3n - -0x2n, -0x1n, 'The result of (-0x3n - -0x2n) is -0x1n'); +assert.sameValue(-0x3n - -0x3n, 0x0n, 'The result of (-0x3n - -0x3n) is 0x0n'); +assert.sameValue(-0x3n - -0x1234n, 0x1231n, 'The result of (-0x3n - -0x1234n) is 0x1231n'); + +assert.sameValue( + -0x3n - -0xFEDCBA97n, + 0xFEDCBA94n, + 'The result of (-0x3n - -0xFEDCBA97n) is 0xFEDCBA94n' +); + +assert.sameValue( + -0x3n - -0xFEDCBA98n, + 0xFEDCBA95n, + 'The result of (-0x3n - -0xFEDCBA98n) is 0xFEDCBA95n' +); + +assert.sameValue( + -0x3n - -0xFEDCBA987654320Fn, + 0xFEDCBA987654320Cn, + 'The result of (-0x3n - -0xFEDCBA987654320Fn) is 0xFEDCBA987654320Cn' +); + +assert.sameValue( + -0x3n - -0xFEDCBA9876543210n, + 0xFEDCBA987654320Dn, + 'The result of (-0x3n - -0xFEDCBA9876543210n) is 0xFEDCBA987654320Dn' +); + +assert.sameValue( + -0x1234n - 0xFEDCBA9876543210n, + -0xFEDCBA9876544444n, + 'The result of (-0x1234n - 0xFEDCBA9876543210n) is -0xFEDCBA9876544444n' +); + +assert.sameValue( + -0x1234n - 0xFEDCBA987654320Fn, + -0xFEDCBA9876544443n, + 'The result of (-0x1234n - 0xFEDCBA987654320Fn) is -0xFEDCBA9876544443n' +); + +assert.sameValue( + -0x1234n - 0xFEDCBA98n, + -0xFEDCCCCCn, + 'The result of (-0x1234n - 0xFEDCBA98n) is -0xFEDCCCCCn' +); + +assert.sameValue( + -0x1234n - 0xFEDCBA97n, + -0xFEDCCCCBn, + 'The result of (-0x1234n - 0xFEDCBA97n) is -0xFEDCCCCBn' +); + +assert.sameValue(-0x1234n - 0x1234n, -0x2468n, 'The result of (-0x1234n - 0x1234n) is -0x2468n'); +assert.sameValue(-0x1234n - 0x3n, -0x1237n, 'The result of (-0x1234n - 0x3n) is -0x1237n'); +assert.sameValue(-0x1234n - 0x2n, -0x1236n, 'The result of (-0x1234n - 0x2n) is -0x1236n'); +assert.sameValue(-0x1234n - 0x1n, -0x1235n, 'The result of (-0x1234n - 0x1n) is -0x1235n'); +assert.sameValue(-0x1234n - 0x0n, -0x1234n, 'The result of (-0x1234n - 0x0n) is -0x1234n'); +assert.sameValue(-0x1234n - -0x1n, -0x1233n, 'The result of (-0x1234n - -0x1n) is -0x1233n'); +assert.sameValue(-0x1234n - -0x2n, -0x1232n, 'The result of (-0x1234n - -0x2n) is -0x1232n'); +assert.sameValue(-0x1234n - -0x3n, -0x1231n, 'The result of (-0x1234n - -0x3n) is -0x1231n'); +assert.sameValue(-0x1234n - -0x1234n, 0x0n, 'The result of (-0x1234n - -0x1234n) is 0x0n'); + +assert.sameValue( + -0x1234n - -0xFEDCBA97n, + 0xFEDCA863n, + 'The result of (-0x1234n - -0xFEDCBA97n) is 0xFEDCA863n' +); + +assert.sameValue( + -0x1234n - -0xFEDCBA98n, + 0xFEDCA864n, + 'The result of (-0x1234n - -0xFEDCBA98n) is 0xFEDCA864n' +); + +assert.sameValue( + -0x1234n - -0xFEDCBA987654320Fn, + 0xFEDCBA9876541FDBn, + 'The result of (-0x1234n - -0xFEDCBA987654320Fn) is 0xFEDCBA9876541FDBn' +); + +assert.sameValue( + -0x1234n - -0xFEDCBA9876543210n, + 0xFEDCBA9876541FDCn, + 'The result of (-0x1234n - -0xFEDCBA9876543210n) is 0xFEDCBA9876541FDCn' +); + +assert.sameValue( + -0xFEDCBA97n - 0xFEDCBA9876543210n, + -0xFEDCBA997530ECA7n, + 'The result of (-0xFEDCBA97n - 0xFEDCBA9876543210n) is -0xFEDCBA997530ECA7n' +); + +assert.sameValue( + -0xFEDCBA97n - 0xFEDCBA987654320Fn, + -0xFEDCBA997530ECA6n, + 'The result of (-0xFEDCBA97n - 0xFEDCBA987654320Fn) is -0xFEDCBA997530ECA6n' +); + +assert.sameValue( + -0xFEDCBA97n - 0xFEDCBA98n, + -0x1FDB9752Fn, + 'The result of (-0xFEDCBA97n - 0xFEDCBA98n) is -0x1FDB9752Fn' +); + +assert.sameValue( + -0xFEDCBA97n - 0xFEDCBA97n, + -0x1FDB9752En, + 'The result of (-0xFEDCBA97n - 0xFEDCBA97n) is -0x1FDB9752En' +); + +assert.sameValue( + -0xFEDCBA97n - 0x1234n, + -0xFEDCCCCBn, + 'The result of (-0xFEDCBA97n - 0x1234n) is -0xFEDCCCCBn' +); + +assert.sameValue( + -0xFEDCBA97n - 0x3n, + -0xFEDCBA9An, + 'The result of (-0xFEDCBA97n - 0x3n) is -0xFEDCBA9An' +); + +assert.sameValue( + -0xFEDCBA97n - 0x2n, + -0xFEDCBA99n, + 'The result of (-0xFEDCBA97n - 0x2n) is -0xFEDCBA99n' +); + +assert.sameValue( + -0xFEDCBA97n - 0x1n, + -0xFEDCBA98n, + 'The result of (-0xFEDCBA97n - 0x1n) is -0xFEDCBA98n' +); + +assert.sameValue( + -0xFEDCBA97n - 0x0n, + -0xFEDCBA97n, + 'The result of (-0xFEDCBA97n - 0x0n) is -0xFEDCBA97n' +); + +assert.sameValue( + -0xFEDCBA97n - -0x1n, + -0xFEDCBA96n, + 'The result of (-0xFEDCBA97n - -0x1n) is -0xFEDCBA96n' +); + +assert.sameValue( + -0xFEDCBA97n - -0x2n, + -0xFEDCBA95n, + 'The result of (-0xFEDCBA97n - -0x2n) is -0xFEDCBA95n' +); + +assert.sameValue( + -0xFEDCBA97n - -0x3n, + -0xFEDCBA94n, + 'The result of (-0xFEDCBA97n - -0x3n) is -0xFEDCBA94n' +); + +assert.sameValue( + -0xFEDCBA97n - -0x1234n, + -0xFEDCA863n, + 'The result of (-0xFEDCBA97n - -0x1234n) is -0xFEDCA863n' +); + +assert.sameValue( + -0xFEDCBA97n - -0xFEDCBA97n, + 0x0n, + 'The result of (-0xFEDCBA97n - -0xFEDCBA97n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA97n - -0xFEDCBA98n, + 0x1n, + 'The result of (-0xFEDCBA97n - -0xFEDCBA98n) is 0x1n' +); + +assert.sameValue( + -0xFEDCBA97n - -0xFEDCBA987654320Fn, + 0xFEDCBA9777777778n, + 'The result of (-0xFEDCBA97n - -0xFEDCBA987654320Fn) is 0xFEDCBA9777777778n' +); + +assert.sameValue( + -0xFEDCBA97n - -0xFEDCBA9876543210n, + 0xFEDCBA9777777779n, + 'The result of (-0xFEDCBA97n - -0xFEDCBA9876543210n) is 0xFEDCBA9777777779n' +); + +assert.sameValue( + -0xFEDCBA98n - 0xFEDCBA9876543210n, + -0xFEDCBA997530ECA8n, + 'The result of (-0xFEDCBA98n - 0xFEDCBA9876543210n) is -0xFEDCBA997530ECA8n' +); + +assert.sameValue( + -0xFEDCBA98n - 0xFEDCBA987654320Fn, + -0xFEDCBA997530ECA7n, + 'The result of (-0xFEDCBA98n - 0xFEDCBA987654320Fn) is -0xFEDCBA997530ECA7n' +); + +assert.sameValue( + -0xFEDCBA98n - 0xFEDCBA98n, + -0x1FDB97530n, + 'The result of (-0xFEDCBA98n - 0xFEDCBA98n) is -0x1FDB97530n' +); + +assert.sameValue( + -0xFEDCBA98n - 0xFEDCBA97n, + -0x1FDB9752Fn, + 'The result of (-0xFEDCBA98n - 0xFEDCBA97n) is -0x1FDB9752Fn' +); + +assert.sameValue( + -0xFEDCBA98n - 0x1234n, + -0xFEDCCCCCn, + 'The result of (-0xFEDCBA98n - 0x1234n) is -0xFEDCCCCCn' +); + +assert.sameValue( + -0xFEDCBA98n - 0x3n, + -0xFEDCBA9Bn, + 'The result of (-0xFEDCBA98n - 0x3n) is -0xFEDCBA9Bn' +); + +assert.sameValue( + -0xFEDCBA98n - 0x2n, + -0xFEDCBA9An, + 'The result of (-0xFEDCBA98n - 0x2n) is -0xFEDCBA9An' +); + +assert.sameValue( + -0xFEDCBA98n - 0x1n, + -0xFEDCBA99n, + 'The result of (-0xFEDCBA98n - 0x1n) is -0xFEDCBA99n' +); + +assert.sameValue( + -0xFEDCBA98n - 0x0n, + -0xFEDCBA98n, + 'The result of (-0xFEDCBA98n - 0x0n) is -0xFEDCBA98n' +); + +assert.sameValue( + -0xFEDCBA98n - -0x1n, + -0xFEDCBA97n, + 'The result of (-0xFEDCBA98n - -0x1n) is -0xFEDCBA97n' +); + +assert.sameValue( + -0xFEDCBA98n - -0x2n, + -0xFEDCBA96n, + 'The result of (-0xFEDCBA98n - -0x2n) is -0xFEDCBA96n' +); + +assert.sameValue( + -0xFEDCBA98n - -0x3n, + -0xFEDCBA95n, + 'The result of (-0xFEDCBA98n - -0x3n) is -0xFEDCBA95n' +); + +assert.sameValue( + -0xFEDCBA98n - -0x1234n, + -0xFEDCA864n, + 'The result of (-0xFEDCBA98n - -0x1234n) is -0xFEDCA864n' +); + +assert.sameValue( + -0xFEDCBA98n - -0xFEDCBA97n, + -0x1n, + 'The result of (-0xFEDCBA98n - -0xFEDCBA97n) is -0x1n' +); + +assert.sameValue( + -0xFEDCBA98n - -0xFEDCBA98n, + 0x0n, + 'The result of (-0xFEDCBA98n - -0xFEDCBA98n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA98n - -0xFEDCBA987654320Fn, + 0xFEDCBA9777777777n, + 'The result of (-0xFEDCBA98n - -0xFEDCBA987654320Fn) is 0xFEDCBA9777777777n' +); + +assert.sameValue( + -0xFEDCBA98n - -0xFEDCBA9876543210n, + 0xFEDCBA9777777778n, + 'The result of (-0xFEDCBA98n - -0xFEDCBA9876543210n) is 0xFEDCBA9777777778n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - 0xFEDCBA9876543210n, + -0x1FDB97530ECA8641Fn, + 'The result of (-0xFEDCBA987654320Fn - 0xFEDCBA9876543210n) is -0x1FDB97530ECA8641Fn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - 0xFEDCBA987654320Fn, + -0x1FDB97530ECA8641En, + 'The result of (-0xFEDCBA987654320Fn - 0xFEDCBA987654320Fn) is -0x1FDB97530ECA8641En' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - 0xFEDCBA98n, + -0xFEDCBA997530ECA7n, + 'The result of (-0xFEDCBA987654320Fn - 0xFEDCBA98n) is -0xFEDCBA997530ECA7n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - 0xFEDCBA97n, + -0xFEDCBA997530ECA6n, + 'The result of (-0xFEDCBA987654320Fn - 0xFEDCBA97n) is -0xFEDCBA997530ECA6n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - 0x1234n, + -0xFEDCBA9876544443n, + 'The result of (-0xFEDCBA987654320Fn - 0x1234n) is -0xFEDCBA9876544443n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - 0x3n, + -0xFEDCBA9876543212n, + 'The result of (-0xFEDCBA987654320Fn - 0x3n) is -0xFEDCBA9876543212n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - 0x2n, + -0xFEDCBA9876543211n, + 'The result of (-0xFEDCBA987654320Fn - 0x2n) is -0xFEDCBA9876543211n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - 0x1n, + -0xFEDCBA9876543210n, + 'The result of (-0xFEDCBA987654320Fn - 0x1n) is -0xFEDCBA9876543210n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - 0x0n, + -0xFEDCBA987654320Fn, + 'The result of (-0xFEDCBA987654320Fn - 0x0n) is -0xFEDCBA987654320Fn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - -0x1n, + -0xFEDCBA987654320En, + 'The result of (-0xFEDCBA987654320Fn - -0x1n) is -0xFEDCBA987654320En' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - -0x2n, + -0xFEDCBA987654320Dn, + 'The result of (-0xFEDCBA987654320Fn - -0x2n) is -0xFEDCBA987654320Dn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - -0x3n, + -0xFEDCBA987654320Cn, + 'The result of (-0xFEDCBA987654320Fn - -0x3n) is -0xFEDCBA987654320Cn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - -0x1234n, + -0xFEDCBA9876541FDBn, + 'The result of (-0xFEDCBA987654320Fn - -0x1234n) is -0xFEDCBA9876541FDBn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - -0xFEDCBA97n, + -0xFEDCBA9777777778n, + 'The result of (-0xFEDCBA987654320Fn - -0xFEDCBA97n) is -0xFEDCBA9777777778n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - -0xFEDCBA98n, + -0xFEDCBA9777777777n, + 'The result of (-0xFEDCBA987654320Fn - -0xFEDCBA98n) is -0xFEDCBA9777777777n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0xFEDCBA987654320Fn - -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - -0xFEDCBA9876543210n, + 0x1n, + 'The result of (-0xFEDCBA987654320Fn - -0xFEDCBA9876543210n) is 0x1n' +); + +assert.sameValue( + -0xFEDCBA9876543210n - 0xFEDCBA9876543210n, + -0x1FDB97530ECA86420n, + 'The result of (-0xFEDCBA9876543210n - 0xFEDCBA9876543210n) is -0x1FDB97530ECA86420n' +); + +assert.sameValue( + -0xFEDCBA9876543210n - 0xFEDCBA987654320Fn, + -0x1FDB97530ECA8641Fn, + 'The result of (-0xFEDCBA9876543210n - 0xFEDCBA987654320Fn) is -0x1FDB97530ECA8641Fn' +); + +assert.sameValue( + -0xFEDCBA9876543210n - 0xFEDCBA98n, + -0xFEDCBA997530ECA8n, + 'The result of (-0xFEDCBA9876543210n - 0xFEDCBA98n) is -0xFEDCBA997530ECA8n' +); + +assert.sameValue( + -0xFEDCBA9876543210n - 0xFEDCBA97n, + -0xFEDCBA997530ECA7n, + 'The result of (-0xFEDCBA9876543210n - 0xFEDCBA97n) is -0xFEDCBA997530ECA7n' +); + +assert.sameValue( + -0xFEDCBA9876543210n - 0x1234n, + -0xFEDCBA9876544444n, + 'The result of (-0xFEDCBA9876543210n - 0x1234n) is -0xFEDCBA9876544444n' +); + +assert.sameValue( + -0xFEDCBA9876543210n - 0x3n, + -0xFEDCBA9876543213n, + 'The result of (-0xFEDCBA9876543210n - 0x3n) is -0xFEDCBA9876543213n' +); + +assert.sameValue( + -0xFEDCBA9876543210n - 0x2n, + -0xFEDCBA9876543212n, + 'The result of (-0xFEDCBA9876543210n - 0x2n) is -0xFEDCBA9876543212n' +); + +assert.sameValue( + -0xFEDCBA9876543210n - 0x1n, + -0xFEDCBA9876543211n, + 'The result of (-0xFEDCBA9876543210n - 0x1n) is -0xFEDCBA9876543211n' +); + +assert.sameValue( + -0xFEDCBA9876543210n - 0x0n, + -0xFEDCBA9876543210n, + 'The result of (-0xFEDCBA9876543210n - 0x0n) is -0xFEDCBA9876543210n' +); + +assert.sameValue( + -0xFEDCBA9876543210n - -0x1n, + -0xFEDCBA987654320Fn, + 'The result of (-0xFEDCBA9876543210n - -0x1n) is -0xFEDCBA987654320Fn' +); + +assert.sameValue( + -0xFEDCBA9876543210n - -0x2n, + -0xFEDCBA987654320En, + 'The result of (-0xFEDCBA9876543210n - -0x2n) is -0xFEDCBA987654320En' +); + +assert.sameValue( + -0xFEDCBA9876543210n - -0x3n, + -0xFEDCBA987654320Dn, + 'The result of (-0xFEDCBA9876543210n - -0x3n) is -0xFEDCBA987654320Dn' +); + +assert.sameValue( + -0xFEDCBA9876543210n - -0x1234n, + -0xFEDCBA9876541FDCn, + 'The result of (-0xFEDCBA9876543210n - -0x1234n) is -0xFEDCBA9876541FDCn' +); + +assert.sameValue( + -0xFEDCBA9876543210n - -0xFEDCBA97n, + -0xFEDCBA9777777779n, + 'The result of (-0xFEDCBA9876543210n - -0xFEDCBA97n) is -0xFEDCBA9777777779n' +); + +assert.sameValue( + -0xFEDCBA9876543210n - -0xFEDCBA98n, + -0xFEDCBA9777777778n, + 'The result of (-0xFEDCBA9876543210n - -0xFEDCBA98n) is -0xFEDCBA9777777778n' +); + +assert.sameValue( + -0xFEDCBA9876543210n - -0xFEDCBA987654320Fn, + -0x1n, + 'The result of (-0xFEDCBA9876543210n - -0xFEDCBA987654320Fn) is -0x1n' +); -function testSub(x, y, z) { - assert.sameValue(x - y, z, x + " - " + y + " = " + z); -} - -testSub(0xFEDCBA9876543210n, 0xFEDCBA9876543210n, 0x0n); -testSub(0xFEDCBA9876543210n, 0xFEDCBA987654320Fn, 0x1n); -testSub(0xFEDCBA9876543210n, 0xFEDCBA98n, 0xFEDCBA9777777778n); -testSub(0xFEDCBA9876543210n, 0xFEDCBA97n, 0xFEDCBA9777777779n); -testSub(0xFEDCBA9876543210n, 0x1234n, 0xFEDCBA9876541FDCn); -testSub(0xFEDCBA9876543210n, 0x3n, 0xFEDCBA987654320Dn); -testSub(0xFEDCBA9876543210n, 0x2n, 0xFEDCBA987654320En); -testSub(0xFEDCBA9876543210n, 0x1n, 0xFEDCBA987654320Fn); -testSub(0xFEDCBA9876543210n, 0x0n, 0xFEDCBA9876543210n); -testSub(0xFEDCBA9876543210n, -0x1n, 0xFEDCBA9876543211n); -testSub(0xFEDCBA9876543210n, -0x2n, 0xFEDCBA9876543212n); -testSub(0xFEDCBA9876543210n, -0x3n, 0xFEDCBA9876543213n); -testSub(0xFEDCBA9876543210n, -0x1234n, 0xFEDCBA9876544444n); -testSub(0xFEDCBA9876543210n, -0xFEDCBA97n, 0xFEDCBA997530ECA7n); -testSub(0xFEDCBA9876543210n, -0xFEDCBA98n, 0xFEDCBA997530ECA8n); -testSub(0xFEDCBA9876543210n, -0xFEDCBA987654320Fn, 0x1FDB97530ECA8641Fn); -testSub(0xFEDCBA9876543210n, -0xFEDCBA9876543210n, 0x1FDB97530ECA86420n); -testSub(0xFEDCBA987654320Fn, 0xFEDCBA9876543210n, -0x1n); -testSub(0xFEDCBA987654320Fn, 0xFEDCBA987654320Fn, 0x0n); -testSub(0xFEDCBA987654320Fn, 0xFEDCBA98n, 0xFEDCBA9777777777n); -testSub(0xFEDCBA987654320Fn, 0xFEDCBA97n, 0xFEDCBA9777777778n); -testSub(0xFEDCBA987654320Fn, 0x1234n, 0xFEDCBA9876541FDBn); -testSub(0xFEDCBA987654320Fn, 0x3n, 0xFEDCBA987654320Cn); -testSub(0xFEDCBA987654320Fn, 0x2n, 0xFEDCBA987654320Dn); -testSub(0xFEDCBA987654320Fn, 0x1n, 0xFEDCBA987654320En); -testSub(0xFEDCBA987654320Fn, 0x0n, 0xFEDCBA987654320Fn); -testSub(0xFEDCBA987654320Fn, -0x1n, 0xFEDCBA9876543210n); -testSub(0xFEDCBA987654320Fn, -0x2n, 0xFEDCBA9876543211n); -testSub(0xFEDCBA987654320Fn, -0x3n, 0xFEDCBA9876543212n); -testSub(0xFEDCBA987654320Fn, -0x1234n, 0xFEDCBA9876544443n); -testSub(0xFEDCBA987654320Fn, -0xFEDCBA97n, 0xFEDCBA997530ECA6n); -testSub(0xFEDCBA987654320Fn, -0xFEDCBA98n, 0xFEDCBA997530ECA7n); -testSub(0xFEDCBA987654320Fn, -0xFEDCBA987654320Fn, 0x1FDB97530ECA8641En); -testSub(0xFEDCBA987654320Fn, -0xFEDCBA9876543210n, 0x1FDB97530ECA8641Fn); -testSub(0xFEDCBA98n, 0xFEDCBA9876543210n, -0xFEDCBA9777777778n); -testSub(0xFEDCBA98n, 0xFEDCBA987654320Fn, -0xFEDCBA9777777777n); -testSub(0xFEDCBA98n, 0xFEDCBA98n, 0x0n); -testSub(0xFEDCBA98n, 0xFEDCBA97n, 0x1n); -testSub(0xFEDCBA98n, 0x1234n, 0xFEDCA864n); -testSub(0xFEDCBA98n, 0x3n, 0xFEDCBA95n); -testSub(0xFEDCBA98n, 0x2n, 0xFEDCBA96n); -testSub(0xFEDCBA98n, 0x1n, 0xFEDCBA97n); -testSub(0xFEDCBA98n, 0x0n, 0xFEDCBA98n); -testSub(0xFEDCBA98n, -0x1n, 0xFEDCBA99n); -testSub(0xFEDCBA98n, -0x2n, 0xFEDCBA9An); -testSub(0xFEDCBA98n, -0x3n, 0xFEDCBA9Bn); -testSub(0xFEDCBA98n, -0x1234n, 0xFEDCCCCCn); -testSub(0xFEDCBA98n, -0xFEDCBA97n, 0x1FDB9752Fn); -testSub(0xFEDCBA98n, -0xFEDCBA98n, 0x1FDB97530n); -testSub(0xFEDCBA98n, -0xFEDCBA987654320Fn, 0xFEDCBA997530ECA7n); -testSub(0xFEDCBA98n, -0xFEDCBA9876543210n, 0xFEDCBA997530ECA8n); -testSub(0xFEDCBA97n, 0xFEDCBA9876543210n, -0xFEDCBA9777777779n); -testSub(0xFEDCBA97n, 0xFEDCBA987654320Fn, -0xFEDCBA9777777778n); -testSub(0xFEDCBA97n, 0xFEDCBA98n, -0x1n); -testSub(0xFEDCBA97n, 0xFEDCBA97n, 0x0n); -testSub(0xFEDCBA97n, 0x1234n, 0xFEDCA863n); -testSub(0xFEDCBA97n, 0x3n, 0xFEDCBA94n); -testSub(0xFEDCBA97n, 0x2n, 0xFEDCBA95n); -testSub(0xFEDCBA97n, 0x1n, 0xFEDCBA96n); -testSub(0xFEDCBA97n, 0x0n, 0xFEDCBA97n); -testSub(0xFEDCBA97n, -0x1n, 0xFEDCBA98n); -testSub(0xFEDCBA97n, -0x2n, 0xFEDCBA99n); -testSub(0xFEDCBA97n, -0x3n, 0xFEDCBA9An); -testSub(0xFEDCBA97n, -0x1234n, 0xFEDCCCCBn); -testSub(0xFEDCBA97n, -0xFEDCBA97n, 0x1FDB9752En); -testSub(0xFEDCBA97n, -0xFEDCBA98n, 0x1FDB9752Fn); -testSub(0xFEDCBA97n, -0xFEDCBA987654320Fn, 0xFEDCBA997530ECA6n); -testSub(0xFEDCBA97n, -0xFEDCBA9876543210n, 0xFEDCBA997530ECA7n); -testSub(0x1234n, 0xFEDCBA9876543210n, -0xFEDCBA9876541FDCn); -testSub(0x1234n, 0xFEDCBA987654320Fn, -0xFEDCBA9876541FDBn); -testSub(0x1234n, 0xFEDCBA98n, -0xFEDCA864n); -testSub(0x1234n, 0xFEDCBA97n, -0xFEDCA863n); -testSub(0x1234n, 0x1234n, 0x0n); -testSub(0x1234n, 0x3n, 0x1231n); -testSub(0x1234n, 0x2n, 0x1232n); -testSub(0x1234n, 0x1n, 0x1233n); -testSub(0x1234n, 0x0n, 0x1234n); -testSub(0x1234n, -0x1n, 0x1235n); -testSub(0x1234n, -0x2n, 0x1236n); -testSub(0x1234n, -0x3n, 0x1237n); -testSub(0x1234n, -0x1234n, 0x2468n); -testSub(0x1234n, -0xFEDCBA97n, 0xFEDCCCCBn); -testSub(0x1234n, -0xFEDCBA98n, 0xFEDCCCCCn); -testSub(0x1234n, -0xFEDCBA987654320Fn, 0xFEDCBA9876544443n); -testSub(0x1234n, -0xFEDCBA9876543210n, 0xFEDCBA9876544444n); -testSub(0x3n, 0xFEDCBA9876543210n, -0xFEDCBA987654320Dn); -testSub(0x3n, 0xFEDCBA987654320Fn, -0xFEDCBA987654320Cn); -testSub(0x3n, 0xFEDCBA98n, -0xFEDCBA95n); -testSub(0x3n, 0xFEDCBA97n, -0xFEDCBA94n); -testSub(0x3n, 0x1234n, -0x1231n); -testSub(0x3n, 0x3n, 0x0n); -testSub(0x3n, 0x2n, 0x1n); -testSub(0x3n, 0x1n, 0x2n); -testSub(0x3n, 0x0n, 0x3n); -testSub(0x3n, -0x1n, 0x4n); -testSub(0x3n, -0x2n, 0x5n); -testSub(0x3n, -0x3n, 0x6n); -testSub(0x3n, -0x1234n, 0x1237n); -testSub(0x3n, -0xFEDCBA97n, 0xFEDCBA9An); -testSub(0x3n, -0xFEDCBA98n, 0xFEDCBA9Bn); -testSub(0x3n, -0xFEDCBA987654320Fn, 0xFEDCBA9876543212n); -testSub(0x3n, -0xFEDCBA9876543210n, 0xFEDCBA9876543213n); -testSub(0x2n, 0xFEDCBA9876543210n, -0xFEDCBA987654320En); -testSub(0x2n, 0xFEDCBA987654320Fn, -0xFEDCBA987654320Dn); -testSub(0x2n, 0xFEDCBA98n, -0xFEDCBA96n); -testSub(0x2n, 0xFEDCBA97n, -0xFEDCBA95n); -testSub(0x2n, 0x1234n, -0x1232n); -testSub(0x2n, 0x3n, -0x1n); -testSub(0x2n, 0x2n, 0x0n); -testSub(0x2n, 0x1n, 0x1n); -testSub(0x2n, 0x0n, 0x2n); -testSub(0x2n, -0x1n, 0x3n); -testSub(0x2n, -0x2n, 0x4n); -testSub(0x2n, -0x3n, 0x5n); -testSub(0x2n, -0x1234n, 0x1236n); -testSub(0x2n, -0xFEDCBA97n, 0xFEDCBA99n); -testSub(0x2n, -0xFEDCBA98n, 0xFEDCBA9An); -testSub(0x2n, -0xFEDCBA987654320Fn, 0xFEDCBA9876543211n); -testSub(0x2n, -0xFEDCBA9876543210n, 0xFEDCBA9876543212n); -testSub(0x1n, 0xFEDCBA9876543210n, -0xFEDCBA987654320Fn); -testSub(0x1n, 0xFEDCBA987654320Fn, -0xFEDCBA987654320En); -testSub(0x1n, 0xFEDCBA98n, -0xFEDCBA97n); -testSub(0x1n, 0xFEDCBA97n, -0xFEDCBA96n); -testSub(0x1n, 0x1234n, -0x1233n); -testSub(0x1n, 0x3n, -0x2n); -testSub(0x1n, 0x2n, -0x1n); -testSub(0x1n, 0x1n, 0x0n); -testSub(0x1n, 0x0n, 0x1n); -testSub(0x1n, -0x1n, 0x2n); -testSub(0x1n, -0x2n, 0x3n); -testSub(0x1n, -0x3n, 0x4n); -testSub(0x1n, -0x1234n, 0x1235n); -testSub(0x1n, -0xFEDCBA97n, 0xFEDCBA98n); -testSub(0x1n, -0xFEDCBA98n, 0xFEDCBA99n); -testSub(0x1n, -0xFEDCBA987654320Fn, 0xFEDCBA9876543210n); -testSub(0x1n, -0xFEDCBA9876543210n, 0xFEDCBA9876543211n); -testSub(0x0n, 0xFEDCBA9876543210n, -0xFEDCBA9876543210n); -testSub(0x0n, 0xFEDCBA987654320Fn, -0xFEDCBA987654320Fn); -testSub(0x0n, 0xFEDCBA98n, -0xFEDCBA98n); -testSub(0x0n, 0xFEDCBA97n, -0xFEDCBA97n); -testSub(0x0n, 0x1234n, -0x1234n); -testSub(0x0n, 0x3n, -0x3n); -testSub(0x0n, 0x2n, -0x2n); -testSub(0x0n, 0x1n, -0x1n); -testSub(0x0n, 0x0n, 0x0n); -testSub(0x0n, -0x1n, 0x1n); -testSub(0x0n, -0x2n, 0x2n); -testSub(0x0n, -0x3n, 0x3n); -testSub(0x0n, -0x1234n, 0x1234n); -testSub(0x0n, -0xFEDCBA97n, 0xFEDCBA97n); -testSub(0x0n, -0xFEDCBA98n, 0xFEDCBA98n); -testSub(0x0n, -0xFEDCBA987654320Fn, 0xFEDCBA987654320Fn); -testSub(0x0n, -0xFEDCBA9876543210n, 0xFEDCBA9876543210n); -testSub(-0x1n, 0xFEDCBA9876543210n, -0xFEDCBA9876543211n); -testSub(-0x1n, 0xFEDCBA987654320Fn, -0xFEDCBA9876543210n); -testSub(-0x1n, 0xFEDCBA98n, -0xFEDCBA99n); -testSub(-0x1n, 0xFEDCBA97n, -0xFEDCBA98n); -testSub(-0x1n, 0x1234n, -0x1235n); -testSub(-0x1n, 0x3n, -0x4n); -testSub(-0x1n, 0x2n, -0x3n); -testSub(-0x1n, 0x1n, -0x2n); -testSub(-0x1n, 0x0n, -0x1n); -testSub(-0x1n, -0x1n, 0x0n); -testSub(-0x1n, -0x2n, 0x1n); -testSub(-0x1n, -0x3n, 0x2n); -testSub(-0x1n, -0x1234n, 0x1233n); -testSub(-0x1n, -0xFEDCBA97n, 0xFEDCBA96n); -testSub(-0x1n, -0xFEDCBA98n, 0xFEDCBA97n); -testSub(-0x1n, -0xFEDCBA987654320Fn, 0xFEDCBA987654320En); -testSub(-0x1n, -0xFEDCBA9876543210n, 0xFEDCBA987654320Fn); -testSub(-0x2n, 0xFEDCBA9876543210n, -0xFEDCBA9876543212n); -testSub(-0x2n, 0xFEDCBA987654320Fn, -0xFEDCBA9876543211n); -testSub(-0x2n, 0xFEDCBA98n, -0xFEDCBA9An); -testSub(-0x2n, 0xFEDCBA97n, -0xFEDCBA99n); -testSub(-0x2n, 0x1234n, -0x1236n); -testSub(-0x2n, 0x3n, -0x5n); -testSub(-0x2n, 0x2n, -0x4n); -testSub(-0x2n, 0x1n, -0x3n); -testSub(-0x2n, 0x0n, -0x2n); -testSub(-0x2n, -0x1n, -0x1n); -testSub(-0x2n, -0x2n, 0x0n); -testSub(-0x2n, -0x3n, 0x1n); -testSub(-0x2n, -0x1234n, 0x1232n); -testSub(-0x2n, -0xFEDCBA97n, 0xFEDCBA95n); -testSub(-0x2n, -0xFEDCBA98n, 0xFEDCBA96n); -testSub(-0x2n, -0xFEDCBA987654320Fn, 0xFEDCBA987654320Dn); -testSub(-0x2n, -0xFEDCBA9876543210n, 0xFEDCBA987654320En); -testSub(-0x3n, 0xFEDCBA9876543210n, -0xFEDCBA9876543213n); -testSub(-0x3n, 0xFEDCBA987654320Fn, -0xFEDCBA9876543212n); -testSub(-0x3n, 0xFEDCBA98n, -0xFEDCBA9Bn); -testSub(-0x3n, 0xFEDCBA97n, -0xFEDCBA9An); -testSub(-0x3n, 0x1234n, -0x1237n); -testSub(-0x3n, 0x3n, -0x6n); -testSub(-0x3n, 0x2n, -0x5n); -testSub(-0x3n, 0x1n, -0x4n); -testSub(-0x3n, 0x0n, -0x3n); -testSub(-0x3n, -0x1n, -0x2n); -testSub(-0x3n, -0x2n, -0x1n); -testSub(-0x3n, -0x3n, 0x0n); -testSub(-0x3n, -0x1234n, 0x1231n); -testSub(-0x3n, -0xFEDCBA97n, 0xFEDCBA94n); -testSub(-0x3n, -0xFEDCBA98n, 0xFEDCBA95n); -testSub(-0x3n, -0xFEDCBA987654320Fn, 0xFEDCBA987654320Cn); -testSub(-0x3n, -0xFEDCBA9876543210n, 0xFEDCBA987654320Dn); -testSub(-0x1234n, 0xFEDCBA9876543210n, -0xFEDCBA9876544444n); -testSub(-0x1234n, 0xFEDCBA987654320Fn, -0xFEDCBA9876544443n); -testSub(-0x1234n, 0xFEDCBA98n, -0xFEDCCCCCn); -testSub(-0x1234n, 0xFEDCBA97n, -0xFEDCCCCBn); -testSub(-0x1234n, 0x1234n, -0x2468n); -testSub(-0x1234n, 0x3n, -0x1237n); -testSub(-0x1234n, 0x2n, -0x1236n); -testSub(-0x1234n, 0x1n, -0x1235n); -testSub(-0x1234n, 0x0n, -0x1234n); -testSub(-0x1234n, -0x1n, -0x1233n); -testSub(-0x1234n, -0x2n, -0x1232n); -testSub(-0x1234n, -0x3n, -0x1231n); -testSub(-0x1234n, -0x1234n, 0x0n); -testSub(-0x1234n, -0xFEDCBA97n, 0xFEDCA863n); -testSub(-0x1234n, -0xFEDCBA98n, 0xFEDCA864n); -testSub(-0x1234n, -0xFEDCBA987654320Fn, 0xFEDCBA9876541FDBn); -testSub(-0x1234n, -0xFEDCBA9876543210n, 0xFEDCBA9876541FDCn); -testSub(-0xFEDCBA97n, 0xFEDCBA9876543210n, -0xFEDCBA997530ECA7n); -testSub(-0xFEDCBA97n, 0xFEDCBA987654320Fn, -0xFEDCBA997530ECA6n); -testSub(-0xFEDCBA97n, 0xFEDCBA98n, -0x1FDB9752Fn); -testSub(-0xFEDCBA97n, 0xFEDCBA97n, -0x1FDB9752En); -testSub(-0xFEDCBA97n, 0x1234n, -0xFEDCCCCBn); -testSub(-0xFEDCBA97n, 0x3n, -0xFEDCBA9An); -testSub(-0xFEDCBA97n, 0x2n, -0xFEDCBA99n); -testSub(-0xFEDCBA97n, 0x1n, -0xFEDCBA98n); -testSub(-0xFEDCBA97n, 0x0n, -0xFEDCBA97n); -testSub(-0xFEDCBA97n, -0x1n, -0xFEDCBA96n); -testSub(-0xFEDCBA97n, -0x2n, -0xFEDCBA95n); -testSub(-0xFEDCBA97n, -0x3n, -0xFEDCBA94n); -testSub(-0xFEDCBA97n, -0x1234n, -0xFEDCA863n); -testSub(-0xFEDCBA97n, -0xFEDCBA97n, 0x0n); -testSub(-0xFEDCBA97n, -0xFEDCBA98n, 0x1n); -testSub(-0xFEDCBA97n, -0xFEDCBA987654320Fn, 0xFEDCBA9777777778n); -testSub(-0xFEDCBA97n, -0xFEDCBA9876543210n, 0xFEDCBA9777777779n); -testSub(-0xFEDCBA98n, 0xFEDCBA9876543210n, -0xFEDCBA997530ECA8n); -testSub(-0xFEDCBA98n, 0xFEDCBA987654320Fn, -0xFEDCBA997530ECA7n); -testSub(-0xFEDCBA98n, 0xFEDCBA98n, -0x1FDB97530n); -testSub(-0xFEDCBA98n, 0xFEDCBA97n, -0x1FDB9752Fn); -testSub(-0xFEDCBA98n, 0x1234n, -0xFEDCCCCCn); -testSub(-0xFEDCBA98n, 0x3n, -0xFEDCBA9Bn); -testSub(-0xFEDCBA98n, 0x2n, -0xFEDCBA9An); -testSub(-0xFEDCBA98n, 0x1n, -0xFEDCBA99n); -testSub(-0xFEDCBA98n, 0x0n, -0xFEDCBA98n); -testSub(-0xFEDCBA98n, -0x1n, -0xFEDCBA97n); -testSub(-0xFEDCBA98n, -0x2n, -0xFEDCBA96n); -testSub(-0xFEDCBA98n, -0x3n, -0xFEDCBA95n); -testSub(-0xFEDCBA98n, -0x1234n, -0xFEDCA864n); -testSub(-0xFEDCBA98n, -0xFEDCBA97n, -0x1n); -testSub(-0xFEDCBA98n, -0xFEDCBA98n, 0x0n); -testSub(-0xFEDCBA98n, -0xFEDCBA987654320Fn, 0xFEDCBA9777777777n); -testSub(-0xFEDCBA98n, -0xFEDCBA9876543210n, 0xFEDCBA9777777778n); -testSub(-0xFEDCBA987654320Fn, 0xFEDCBA9876543210n, -0x1FDB97530ECA8641Fn); -testSub(-0xFEDCBA987654320Fn, 0xFEDCBA987654320Fn, -0x1FDB97530ECA8641En); -testSub(-0xFEDCBA987654320Fn, 0xFEDCBA98n, -0xFEDCBA997530ECA7n); -testSub(-0xFEDCBA987654320Fn, 0xFEDCBA97n, -0xFEDCBA997530ECA6n); -testSub(-0xFEDCBA987654320Fn, 0x1234n, -0xFEDCBA9876544443n); -testSub(-0xFEDCBA987654320Fn, 0x3n, -0xFEDCBA9876543212n); -testSub(-0xFEDCBA987654320Fn, 0x2n, -0xFEDCBA9876543211n); -testSub(-0xFEDCBA987654320Fn, 0x1n, -0xFEDCBA9876543210n); -testSub(-0xFEDCBA987654320Fn, 0x0n, -0xFEDCBA987654320Fn); -testSub(-0xFEDCBA987654320Fn, -0x1n, -0xFEDCBA987654320En); -testSub(-0xFEDCBA987654320Fn, -0x2n, -0xFEDCBA987654320Dn); -testSub(-0xFEDCBA987654320Fn, -0x3n, -0xFEDCBA987654320Cn); -testSub(-0xFEDCBA987654320Fn, -0x1234n, -0xFEDCBA9876541FDBn); -testSub(-0xFEDCBA987654320Fn, -0xFEDCBA97n, -0xFEDCBA9777777778n); -testSub(-0xFEDCBA987654320Fn, -0xFEDCBA98n, -0xFEDCBA9777777777n); -testSub(-0xFEDCBA987654320Fn, -0xFEDCBA987654320Fn, 0x0n); -testSub(-0xFEDCBA987654320Fn, -0xFEDCBA9876543210n, 0x1n); -testSub(-0xFEDCBA9876543210n, 0xFEDCBA9876543210n, -0x1FDB97530ECA86420n); -testSub(-0xFEDCBA9876543210n, 0xFEDCBA987654320Fn, -0x1FDB97530ECA8641Fn); -testSub(-0xFEDCBA9876543210n, 0xFEDCBA98n, -0xFEDCBA997530ECA8n); -testSub(-0xFEDCBA9876543210n, 0xFEDCBA97n, -0xFEDCBA997530ECA7n); -testSub(-0xFEDCBA9876543210n, 0x1234n, -0xFEDCBA9876544444n); -testSub(-0xFEDCBA9876543210n, 0x3n, -0xFEDCBA9876543213n); -testSub(-0xFEDCBA9876543210n, 0x2n, -0xFEDCBA9876543212n); -testSub(-0xFEDCBA9876543210n, 0x1n, -0xFEDCBA9876543211n); -testSub(-0xFEDCBA9876543210n, 0x0n, -0xFEDCBA9876543210n); -testSub(-0xFEDCBA9876543210n, -0x1n, -0xFEDCBA987654320Fn); -testSub(-0xFEDCBA9876543210n, -0x2n, -0xFEDCBA987654320En); -testSub(-0xFEDCBA9876543210n, -0x3n, -0xFEDCBA987654320Dn); -testSub(-0xFEDCBA9876543210n, -0x1234n, -0xFEDCBA9876541FDCn); -testSub(-0xFEDCBA9876543210n, -0xFEDCBA97n, -0xFEDCBA9777777779n); -testSub(-0xFEDCBA9876543210n, -0xFEDCBA98n, -0xFEDCBA9777777778n); -testSub(-0xFEDCBA9876543210n, -0xFEDCBA987654320Fn, -0x1n); -testSub(-0xFEDCBA9876543210n, -0xFEDCBA9876543210n, 0x0n); +assert.sameValue( + -0xFEDCBA9876543210n - -0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0xFEDCBA9876543210n - -0xFEDCBA9876543210n) is 0x0n' +); \ No newline at end of file diff --git a/test/language/expressions/subtraction/bigint-errors.js b/test/language/expressions/subtraction/bigint-errors.js index b512c78ad5d9f8e38386a68df2f8503a34105b68..5d65a7f6c08ea9209bb98b257a0d0ebb990649b2 100644 --- a/test/language/expressions/subtraction/bigint-errors.js +++ b/test/language/expressions/subtraction/bigint-errors.js @@ -5,58 +5,66 @@ description: subtraction operator ToNumeric with BigInt operands esid: sec-subtraction-operator-minus-runtime-semantics-evaluation features: [BigInt, Symbol, Symbol.toPrimitive, computed-property-names] ---*/ - assert.throws(TypeError, function() { - Symbol("1") - 0n; -}, "ToBigInt: Symbol => TypeError"); + Symbol('1') - 0n; +}, 'Symbol("1") - 0n throws TypeError'); + assert.throws(TypeError, function() { - 0n - Symbol("1"); -}, "ToBigInt: Symbol => TypeError"); + 0n - Symbol('1'); +}, '0n - Symbol("1") throws TypeError'); + assert.throws(TypeError, function() { - Object(Symbol("1")) - 0n; -}, "ToBigInt: unbox object with internal slot => Symbol => TypeError"); + Object(Symbol('1')) - 0n; +}, 'Object(Symbol("1")) - 0n throws TypeError'); + assert.throws(TypeError, function() { - 0n - Object(Symbol("1")); -}, "ToBigInt: unbox object with internal slot => Symbol => TypeError"); + 0n - Object(Symbol('1')); +}, '0n - Object(Symbol("1")) throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { - return Symbol("1"); + return Symbol('1'); } }) - 0n; -}, "ToBigInt: @@toPrimitive => Symbol => TypeError"); +}, '({[Symbol.toPrimitive]: function() {return Symbol("1");}}) - 0n throws TypeError'); + assert.throws(TypeError, function() { 0n - { [Symbol.toPrimitive]: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: @@toPrimitive => Symbol => TypeError"); +}, '0n - {[Symbol.toPrimitive]: function() {return Symbol("1");}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { - return Symbol("1"); + return Symbol('1'); } }) - 0n; -}, "ToBigInt: valueOf => Symbol => TypeError"); +}, '({valueOf: function() {return Symbol("1");}}) - 0n throws TypeError'); + assert.throws(TypeError, function() { 0n - { valueOf: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: valueOf => Symbol => TypeError"); +}, '0n - {valueOf: function() {return Symbol("1");}} throws TypeError'); + assert.throws(TypeError, function() { ({ toString: function() { - return Symbol("1"); + return Symbol('1'); } }) - 0n; -}, "ToBigInt: toString => Symbol => TypeError"); +}, '({toString: function() {return Symbol("1");}}) - 0n throws TypeError'); + assert.throws(TypeError, function() { 0n - { toString: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: toString => Symbol => TypeError"); +}, '0n - {toString: function() {return Symbol("1");}} throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/subtraction/bigint-toprimitive.js b/test/language/expressions/subtraction/bigint-toprimitive.js index 70da440dd22de546cf29c0846e1caf5c02c1b1bb..64247e9c39179e90f6260663bc04746b9de1db55 100644 --- a/test/language/expressions/subtraction/bigint-toprimitive.js +++ b/test/language/expressions/subtraction/bigint-toprimitive.js @@ -5,304 +5,368 @@ description: subtraction operator ToNumeric with BigInt operands esid: sec-subtraction-operator-minus-runtime-semantics-evaluation features: [BigInt, Symbol.toPrimitive, computed-property-names] ---*/ - function err() { throw new Test262Error(); } function MyError() {} -assert.sameValue(({ +assert.sameValue({ [Symbol.toPrimitive]: function() { return 2n; }, + valueOf: err, toString: err -}) - 1n, 1n, "ToPrimitive: @@toPrimitive takes precedence"); +} - 1n, 1n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) - 1n) is 1n'); + assert.sameValue(3n - { [Symbol.toPrimitive]: function() { return 2n; }, + valueOf: err, toString: err -}, 1n, "ToPrimitive: @@toPrimitive takes precedence"); -assert.sameValue(({ +}, 1n, 'The result of (3n - {[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) is 1n'); + +assert.sameValue({ valueOf: function() { return 2n; }, + toString: err -}) - 1n, 1n, "ToPrimitive: valueOf takes precedence over toString"); +} - 1n, 1n, 'The result of (({valueOf: function() {return 2n;}, toString: err}) - 1n) is 1n'); + assert.sameValue(3n - { valueOf: function() { return 2n; }, + toString: err -}, 1n, "ToPrimitive: valueOf takes precedence over toString"); -assert.sameValue(({ +}, 1n, 'The result of (3n - {valueOf: function() {return 2n;}, toString: err}) is 1n'); + +assert.sameValue({ toString: function() { return 2n; } -}) - 1n, 1n, "ToPrimitive: toString with no valueOf"); +} - 1n, 1n, 'The result of (({toString: function() {return 2n;}}) - 1n) is 1n'); + assert.sameValue(3n - { toString: function() { return 2n; } -}, 1n, "ToPrimitive: toString with no valueOf"); -assert.sameValue(({ +}, 1n, 'The result of (3n - {toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ [Symbol.toPrimitive]: undefined, + valueOf: function() { return 2n; } -}) - 1n, 1n, "ToPrimitive: skip @@toPrimitive when it's undefined"); +} - 1n, 1n, 'The result of (({[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) - 1n) is 1n'); + assert.sameValue(3n - { [Symbol.toPrimitive]: undefined, + valueOf: function() { return 2n; } -}, 1n, "ToPrimitive: skip @@toPrimitive when it's undefined"); -assert.sameValue(({ +}, 1n, 'The result of (3n - {[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ [Symbol.toPrimitive]: null, + valueOf: function() { return 2n; } -}) - 1n, 1n, "ToPrimitive: skip @@toPrimitive when it's null"); +} - 1n, 1n, 'The result of (({[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) - 1n) is 1n'); + assert.sameValue(3n - { [Symbol.toPrimitive]: null, + valueOf: function() { return 2n; } -}, 1n, "ToPrimitive: skip @@toPrimitive when it's null"); -assert.sameValue(({ +}, 1n, 'The result of (3n - {[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: null, + toString: function() { return 2n; } -}) - 1n, 1n, "ToPrimitive: skip valueOf when it's not callable"); +} - 1n, 1n, 'The result of (({valueOf: null, toString: function() {return 2n;}}) - 1n) is 1n'); + assert.sameValue(3n - { valueOf: null, + toString: function() { return 2n; } -}, 1n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 1n, 'The result of (3n - {valueOf: null, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: 1, + toString: function() { return 2n; } -}) - 1n, 1n, "ToPrimitive: skip valueOf when it's not callable"); +} - 1n, 1n, 'The result of (({valueOf: 1, toString: function() {return 2n;}}) - 1n) is 1n'); + assert.sameValue(3n - { valueOf: 1, + toString: function() { return 2n; } -}, 1n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 1n, 'The result of (3n - {valueOf: 1, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: {}, + toString: function() { return 2n; } -}) - 1n, 1n, "ToPrimitive: skip valueOf when it's not callable"); +} - 1n, 1n, 'The result of (({valueOf: {}, toString: function() {return 2n;}}) - 1n) is 1n'); + assert.sameValue(3n - { valueOf: {}, + toString: function() { return 2n; } -}, 1n, "ToPrimitive: skip valueOf when it's not callable"); -assert.sameValue(({ +}, 1n, 'The result of (3n - {valueOf: {}, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: function() { return {}; }, + toString: function() { return 2n; } -}) - 1n, 1n, "ToPrimitive: skip valueOf when it returns an object"); +} - 1n, 1n, 'The result of (({valueOf: function() {return {};}, toString: function() {return 2n;}}) - 1n) is 1n'); + assert.sameValue(3n - { valueOf: function() { return {}; }, + toString: function() { return 2n; } -}, 1n, "ToPrimitive: skip valueOf when it returns an object"); -assert.sameValue(({ +}, 1n, 'The result of (3n - {valueOf: function() {return {};}, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: function() { return Object(12345); }, + toString: function() { return 2n; } -}) - 1n, 1n, "ToPrimitive: skip valueOf when it returns an object"); +} - 1n, 1n, 'The result of (({valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) - 1n) is 1n'); + assert.sameValue(3n - { valueOf: function() { return Object(12345); }, + toString: function() { return 2n; } -}, 1n, "ToPrimitive: skip valueOf when it returns an object"); +}, 1n, 'The result of (3n - {valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) is 1n'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: 1 }) - 0n; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '({[Symbol.toPrimitive]: 1}) - 0n throws TypeError'); + assert.throws(TypeError, function() { 0n - { [Symbol.toPrimitive]: 1 }; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '0n - {[Symbol.toPrimitive]: 1} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: {} }) - 0n; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '({[Symbol.toPrimitive]: {}}) - 0n throws TypeError'); + assert.throws(TypeError, function() { 0n - { [Symbol.toPrimitive]: {} }; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '0n - {[Symbol.toPrimitive]: {}} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { return Object(1); } }) - 0n; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '({[Symbol.toPrimitive]: function() {return Object(1);}}) - 0n throws TypeError'); + assert.throws(TypeError, function() { 0n - { [Symbol.toPrimitive]: function() { return Object(1); } }; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '0n - {[Symbol.toPrimitive]: function() {return Object(1);}} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { return {}; } }) - 0n; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '({[Symbol.toPrimitive]: function() {return {};}}) - 0n throws TypeError'); + assert.throws(TypeError, function() { 0n - { [Symbol.toPrimitive]: function() { return {}; } }; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '0n - {[Symbol.toPrimitive]: function() {return {};}} throws TypeError'); + assert.throws(MyError, function() { ({ [Symbol.toPrimitive]: function() { throw new MyError(); } }) - 0n; -}, "ToPrimitive: propagate errors from @@toPrimitive"); +}, '({[Symbol.toPrimitive]: function() {throw new MyError();}}) - 0n throws MyError'); + assert.throws(MyError, function() { 0n - { [Symbol.toPrimitive]: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from @@toPrimitive"); +}, '0n - {[Symbol.toPrimitive]: function() {throw new MyError();}} throws MyError'); + assert.throws(MyError, function() { ({ valueOf: function() { throw new MyError(); } }) - 0n; -}, "ToPrimitive: propagate errors from valueOf"); +}, '({valueOf: function() {throw new MyError();}}) - 0n throws MyError'); + assert.throws(MyError, function() { 0n - { valueOf: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from valueOf"); +}, '0n - {valueOf: function() {throw new MyError();}} throws MyError'); + assert.throws(MyError, function() { ({ toString: function() { throw new MyError(); } }) - 0n; -}, "ToPrimitive: propagate errors from toString"); +}, '({toString: function() {throw new MyError();}}) - 0n throws MyError'); + assert.throws(MyError, function() { 0n - { toString: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from toString"); +}, '0n - {toString: function() {throw new MyError();}} throws MyError'); + assert.throws(TypeError, function() { ({ valueOf: null, toString: null }) - 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: null, toString: null}) - 0n throws TypeError'); + assert.throws(TypeError, function() { 0n - { valueOf: null, toString: null }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n - {valueOf: null, toString: null} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: 1, toString: 1 }) - 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: 1, toString: 1}) - 0n throws TypeError'); + assert.throws(TypeError, function() { 0n - { valueOf: 1, toString: 1 }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n - {valueOf: 1, toString: 1} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: {}, toString: {} }) - 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: {}, toString: {}}) - 0n throws TypeError'); + assert.throws(TypeError, function() { 0n - { valueOf: {}, toString: {} }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n - {valueOf: {}, toString: {}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { return Object(1); }, + toString: function() { return Object(1); } }) - 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: function() {return Object(1);}, toString: function() {return Object(1);}}) - 0n throws TypeError'); + assert.throws(TypeError, function() { 0n - { valueOf: function() { return Object(1); }, + toString: function() { return Object(1); } }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n - {valueOf: function() {return Object(1);}, toString: function() {return Object(1);}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { return {}; }, + toString: function() { return {}; } }) - 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: function() {return {};}, toString: function() {return {};}}) - 0n throws TypeError'); + assert.throws(TypeError, function() { 0n - { valueOf: function() { return {}; }, + toString: function() { return {}; } }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n - {valueOf: function() {return {};}, toString: function() {return {};}} throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/subtraction/bigint-wrapped-values.js b/test/language/expressions/subtraction/bigint-wrapped-values.js index f75ea687fad244792b34d423174c39c123244e36..fde9ae639e3dfbe89c40086b3e94b4aeb8bb62f9 100644 --- a/test/language/expressions/subtraction/bigint-wrapped-values.js +++ b/test/language/expressions/subtraction/bigint-wrapped-values.js @@ -5,36 +5,41 @@ description: subtraction operator ToNumeric with BigInt operands esid: sec-subtraction-operator-minus-runtime-semantics-evaluation features: [BigInt, Symbol.toPrimitive, computed-property-names] ---*/ +assert.sameValue(Object(2n) - 1n, 1n, 'The result of (Object(2n) - 1n) is 1n'); +assert.sameValue(3n - Object(2n), 1n, 'The result of (3n - Object(2n)) is 1n'); -assert.sameValue(Object(2n) - 1n, 1n, "ToPrimitive: unbox object with internal slot"); -assert.sameValue(3n - Object(2n), 1n, "ToPrimitive: unbox object with internal slot"); -assert.sameValue(({ +assert.sameValue({ [Symbol.toPrimitive]: function() { return 2n; } -}) - 1n, 1n, "ToPrimitive: @@toPrimitive"); +} - 1n, 1n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}}) - 1n) is 1n'); + assert.sameValue(3n - { [Symbol.toPrimitive]: function() { return 2n; } -}, 1n, "ToPrimitive: @@toPrimitive"); -assert.sameValue(({ +}, 1n, 'The result of (3n - {[Symbol.toPrimitive]: function() {return 2n;}}) is 1n'); + +assert.sameValue({ valueOf: function() { return 2n; } -}) - 1n, 1n, "ToPrimitive: valueOf"); +} - 1n, 1n, 'The result of (({valueOf: function() {return 2n;}}) - 1n) is 1n'); + assert.sameValue(3n - { valueOf: function() { return 2n; } -}, 1n, "ToPrimitive: valueOf"); -assert.sameValue(({ +}, 1n, 'The result of (3n - {valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ toString: function() { return 2n; } -}) - 1n, 1n, "ToPrimitive: toString"); +} - 1n, 1n, 'The result of (({toString: function() {return 2n;}}) - 1n) is 1n'); + assert.sameValue(3n - { toString: function() { return 2n; } -}, 1n, "ToPrimitive: toString"); +}, 1n, 'The result of (3n - {toString: function() {return 2n;}}) is 1n'); \ No newline at end of file diff --git a/test/language/expressions/unary-minus/bigint-non-primitive.js b/test/language/expressions/unary-minus/bigint-non-primitive.js index 02587c5d56ede7484de1ca55fd698c6df0adf293..2d35b64203eaa8d32c6d6896ec84a745957b72a7 100644 --- a/test/language/expressions/unary-minus/bigint-non-primitive.js +++ b/test/language/expressions/unary-minus/bigint-non-primitive.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Unary minus for BigInt object wrappers esid: sec-unary-minus-operator-runtime-semantics-evaluation @@ -15,19 +14,39 @@ info: | features: [BigInt, Symbol.toPrimitive] ---*/ +assert.sameValue(-Object(1n), -1n, 'The value of -Object(1n) is -1n'); +assert.notSameValue(-Object(1n), 1n, 'The value of -Object(1n) is not 1n'); +assert.notSameValue(-Object(1n), Object(-1n), 'The value of -Object(1n) is not Object(-1n)'); +assert.sameValue(-Object(-1n), 1n, 'The value of -Object(-1n) is 1n'); +assert.notSameValue(-Object(-1n), -1n, 'The value of -Object(-1n) is not -1n'); +assert.notSameValue(-Object(-1n), Object(1n), 'The value of -Object(-1n) is not Object(1n)'); + +assert.sameValue(-{ + [Symbol.toPrimitive]: function() { + return 1n; + }, + + valueOf: function() { + $ERROR(); + }, + + toString: function() { + $ERROR(); + } +}, -1n, 'The value of -{[Symbol.toPrimitive]: function() {return 1n;}, valueOf: function() {$ERROR();}, toString: function() {$ERROR();}} is -1n'); + +assert.sameValue(-{ + valueOf: function() { + return 1n; + }, + + toString: function() { + $ERROR(); + } +}, -1n, 'The value of -{valueOf: function() {return 1n;}, toString: function() {$ERROR();}} is -1n'); -assert.sameValue(-Object(1n), -1n, "-Object(1n) === -1n"); -assert.notSameValue(-Object(1n), 1n, "-Object(1n) !== 1n"); -assert.notSameValue(-Object(1n), Object(-1n), "-Object(1n) !== Object(-1n)"); -assert.sameValue(-Object(-1n), 1n, "-Object(-1n) === 1n"); -assert.notSameValue(-Object(-1n), -1n, "-Object(-1n) !== -1n"); -assert.notSameValue(-Object(-1n), Object(1n), "-Object(-1n) !== Object(1n)"); -assert.sameValue( - -{[Symbol.toPrimitive]: function() { return 1n; }, valueOf: function() { $ERROR(); }, toString: function() { $ERROR(); }}, -1n, - "-{[Symbol.toPrimitive]: function() { return 1n; }, valueOf: function() { $ERROR(); }, toString: function() { $ERROR(); }} === -1n"); -assert.sameValue( - -{valueOf: function() { return 1n; }, toString: function() { $ERROR(); }}, -1n, - "-{valueOf: function() { return 1n; }, toString: function() { $ERROR(); }} === -1n"); -assert.sameValue( - -{toString: function() { return 1n; }}, -1n, - "-{toString: function() { return 1n; }} === -1n"); +assert.sameValue(-{ + toString: function() { + return 1n; + } +}, -1n, 'The value of -{toString: function() {return 1n;}} is -1n'); \ No newline at end of file diff --git a/test/language/expressions/unary-plus/bigint-throws.js b/test/language/expressions/unary-plus/bigint-throws.js index f3960c740e6567ba5f77d05a6594fa1c2a1bee34..72f0442318d311335dab18921b1d75b7021fe434 100644 --- a/test/language/expressions/unary-plus/bigint-throws.js +++ b/test/language/expressions/unary-plus/bigint-throws.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Robin Templeton. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: The Unary + Operator throws a TypeError on BigInt numbers esid: sec-unary-plus-operator-runtime-semantics-evaluation @@ -15,8 +14,18 @@ info: | BigInt: Throw a TypeError exception features: [BigInt] ---*/ +assert.throws(TypeError, function() { + +0n; +}, '+0n throws TypeError'); + +assert.throws(TypeError, function() { + +1n; +}, '+1n throws TypeError'); + +assert.throws(TypeError, function() { + +-1n; +}, '+-1n throws TypeError'); -assert.throws(TypeError, function() { +0n }); -assert.throws(TypeError, function() { +1n }); -assert.throws(TypeError, function() { +-1n }); -assert.throws(TypeError, function() { +1000000000000000n }); +assert.throws(TypeError, function() { + +1000000000000000n; +}, '+1000000000000000n throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/unsigned-right-shift/bigint-and-number.js b/test/language/expressions/unsigned-right-shift/bigint-and-number.js index d60cdcff74b8b0b44f004fbe39c50109ca4eeceb..18ed19422ed3c1d392427df0f12ec81b1696e682 100644 --- a/test/language/expressions/unsigned-right-shift/bigint-and-number.js +++ b/test/language/expressions/unsigned-right-shift/bigint-and-number.js @@ -9,24 +9,82 @@ info: | Let rnum be ? ToNumeric(rightValue). If Type(lnum) does not equal Type(rnum), throw a TypeError exception. ---*/ +assert.throws(TypeError, function() { + 1n >>> 1; +}, '1n >>> 1 throws TypeError'); -assert.throws(TypeError, function() { 1n >>> 1; }, "1n >>> 1 throws TypeError"); -assert.throws(TypeError, function() { 1 >>> 1n; }, "1 >>> 1n throws TypeError"); -assert.throws(TypeError, function() { Object(1n) >>> 1; }, "Object(1n) >>> 1 throws TypeError"); -assert.throws(TypeError, function() { 1 >>> Object(1n); }, "1 >>> Object(1n) throws TypeError"); -assert.throws(TypeError, function() { 1n >>> Object(1); }, "1n >>> Object(1) throws TypeError"); -assert.throws(TypeError, function() { Object(1) >>> 1n; }, "Object(1) >>> 1n throws TypeError"); -assert.throws(TypeError, function() { Object(1n) >>> Object(1); }, "Object(1n) >>> Object(1) throws TypeError"); -assert.throws(TypeError, function() { Object(1) >>> Object(1n); }, "Object(1) >>> Object(1n) throws TypeError"); -assert.throws(TypeError, function() { 1n >>> NaN; }, "1n >>> NaN throws TypeError"); -assert.throws(TypeError, function() { NaN >>> 1n; }, "NaN >>> 1n throws TypeError"); -assert.throws(TypeError, function() { 1n >>> Infinity; }, "1n >>> Infinity throws TypeError"); -assert.throws(TypeError, function() { Infinity >>> 1n; }, "Infinity >>> 1n throws TypeError"); -assert.throws(TypeError, function() { 1n >>> true; }, "1n >>> true throws TypeError"); -assert.throws(TypeError, function() { true >>> 1n; }, "true >>> 1n throws TypeError"); -assert.throws(TypeError, function() { 1n >>> "1"; }, '1n >>> "1" throws TypeError'); -assert.throws(TypeError, function() { "1" >>> 1n; }, '"1" >>> 1n throws TypeError'); -assert.throws(TypeError, function() { 1n >>> null; }, "1n >>> null throws TypeError"); -assert.throws(TypeError, function() { null >>> 1n; }, "null >>> 1n throws TypeError"); -assert.throws(TypeError, function() { 1n >>> undefined; }, "1n >>> undefined throws TypeError"); -assert.throws(TypeError, function() { undefined >>> 1n; }, "undefined >>> 1n throws TypeError"); +assert.throws(TypeError, function() { + 1 >>> 1n; +}, '1 >>> 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) >>> 1; +}, 'Object(1n) >>> 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 >>> Object(1n); +}, '1 >>> Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n >>> Object(1); +}, '1n >>> Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) >>> 1n; +}, 'Object(1) >>> 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) >>> Object(1); +}, 'Object(1n) >>> Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) >>> Object(1n); +}, 'Object(1) >>> Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n >>> NaN; +}, '1n >>> NaN throws TypeError'); + +assert.throws(TypeError, function() { + NaN >>> 1n; +}, 'NaN >>> 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n >>> Infinity; +}, '1n >>> Infinity throws TypeError'); + +assert.throws(TypeError, function() { + Infinity >>> 1n; +}, 'Infinity >>> 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n >>> true; +}, '1n >>> true throws TypeError'); + +assert.throws(TypeError, function() { + true >>> 1n; +}, 'true >>> 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n >>> '1'; +}, '1n >>> "1" throws TypeError'); + +assert.throws(TypeError, function() { + '1' >>> 1n; +}, '"1" >>> 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n >>> null; +}, '1n >>> null throws TypeError'); + +assert.throws(TypeError, function() { + null >>> 1n; +}, 'null >>> 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n >>> undefined; +}, '1n >>> undefined throws TypeError'); + +assert.throws(TypeError, function() { + undefined >>> 1n; +}, 'undefined >>> 1n throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/unsigned-right-shift/bigint-errors.js b/test/language/expressions/unsigned-right-shift/bigint-errors.js index 47d9db06419e990367f8fe9c87dcb28c5b6b2742..6aa73c03531160062f3a443f82cb56e2c260f2ce 100644 --- a/test/language/expressions/unsigned-right-shift/bigint-errors.js +++ b/test/language/expressions/unsigned-right-shift/bigint-errors.js @@ -6,58 +6,66 @@ esid: sec-unsigned-right-shift-operator-runtime-semantics-evaluation info: After ToNumeric type coercion, unsigned-right-shift always throws for BigInt operands features: [BigInt, Symbol, Symbol.toPrimitive, computed-property-names] ---*/ - assert.throws(TypeError, function() { - Symbol("1") >>> 0n; -}, "ToBigInt: Symbol => TypeError"); + Symbol('1') >>> 0n; +}, 'Symbol("1") >>> 0n throws TypeError'); + assert.throws(TypeError, function() { - 0n >>> Symbol("1"); -}, "ToBigInt: Symbol => TypeError"); + 0n >>> Symbol('1'); +}, '0n >>> Symbol("1") throws TypeError'); + assert.throws(TypeError, function() { - Object(Symbol("1")) >>> 0n; -}, "ToBigInt: unbox object with internal slot => Symbol => TypeError"); + Object(Symbol('1')) >>> 0n; +}, 'Object(Symbol("1")) >>> 0n throws TypeError'); + assert.throws(TypeError, function() { - 0n >>> Object(Symbol("1")); -}, "ToBigInt: unbox object with internal slot => Symbol => TypeError"); + 0n >>> Object(Symbol('1')); +}, '0n >>> Object(Symbol("1")) throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { - return Symbol("1"); + return Symbol('1'); } }) >>> 0n; -}, "ToBigInt: @@toPrimitive => Symbol => TypeError"); +}, '({[Symbol.toPrimitive]: function() {return Symbol("1");}}) >>> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >>> { [Symbol.toPrimitive]: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: @@toPrimitive => Symbol => TypeError"); +}, '0n >>> {[Symbol.toPrimitive]: function() {return Symbol("1");}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { - return Symbol("1"); + return Symbol('1'); } }) >>> 0n; -}, "ToBigInt: valueOf => Symbol => TypeError"); +}, '({valueOf: function() {return Symbol("1");}}) >>> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >>> { valueOf: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: valueOf => Symbol => TypeError"); +}, '0n >>> {valueOf: function() {return Symbol("1");}} throws TypeError'); + assert.throws(TypeError, function() { ({ toString: function() { - return Symbol("1"); + return Symbol('1'); } }) >>> 0n; -}, "ToBigInt: toString => Symbol => TypeError"); +}, '({toString: function() {return Symbol("1");}}) >>> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >>> { toString: function() { - return Symbol("1"); + return Symbol('1'); } }; -}, "ToBigInt: toString => Symbol => TypeError"); +}, '0n >>> {toString: function() {return Symbol("1");}} throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/unsigned-right-shift/bigint-non-primitive.js b/test/language/expressions/unsigned-right-shift/bigint-non-primitive.js index af88a121f76938368fdfa1bb36a658d474447b0b..aa955c7e1b878731ca41191d8e9d064ba83578ec 100644 --- a/test/language/expressions/unsigned-right-shift/bigint-non-primitive.js +++ b/test/language/expressions/unsigned-right-shift/bigint-non-primitive.js @@ -1,6 +1,5 @@ // Copyright (C) 2017 Josh Wolfe. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- description: Unsigned right shift always throws for non-primitive BigInt values esid: sec-unsigned-right-shift-operator-runtime-semantics-evaluation @@ -21,36 +20,84 @@ info: | features: [BigInt, Symbol.toPrimitive] ---*/ +assert.throws(TypeError, function() { + Object(0b101n) >>> 1n; +}, 'Object(0b101n) >>> 1n throws TypeError'); -assert.throws(TypeError, - function() { Object(0b101n) >>> 1n; }, - "bigint >>> bigint throws a TypeError for Object(0b101n) >>> 1n"); -assert.throws(TypeError, - function() { Object(0b101n) >>> Object(1n); }, - "bigint >>> bigint throws a TypeError for Object(0b101n) >>> Object(1n)"); +assert.throws(TypeError, function() { + Object(0b101n) >>> Object(1n); +}, 'Object(0b101n) >>> Object(1n) throws TypeError'); function err() { throw new Test262Error(); } -assert.throws(TypeError, - function() { ({[Symbol.toPrimitive]: function() { return 0b101n; }, valueOf: err, toString: err} >>> 1n); }, - "bigint >>> bigint throws a TypeError for primitive from @@toPrimitive"); -assert.throws(TypeError, - function() { ({valueOf: function() { return 0b101n; }, toString: err} >>> 1n); }, - "bigint >>> bigint throws a TypeError for primitive from {}.valueOf"); -assert.throws(TypeError, - function() { ({toString: function() { return 0b101n; }} >>> 1n); }, - "bigint >>> bigint throws a TypeError for primitive from {}.toString"); -assert.throws(TypeError, - function() { 0b101n >>> {[Symbol.toPrimitive]: function() { return 1n; }, valueOf: err, toString: err}; }, - "bigint >>> bigint throws a TypeError for primitive from @@toPrimitive"); -assert.throws(TypeError, - function() { 0b101n >>> {valueOf: function() { return 1n; }, toString: err}; }, - "bigint >>> bigint throws a TypeError for primitive from {}.valueOf"); -assert.throws(TypeError, - function() { 0b101n >>> {toString: function() { return 1n; }}; }, - "bigint >>> bigint throws a TypeError for primitive from {}.toString"); -assert.throws(TypeError, - function() { ({valueOf: function() { return 0b101n; }} >>> {valueOf: function() { return 1n; }}); }, - "bigint >>> bigint throws a TypeError for primitive from {}.valueOf"); +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return 0b101n; + }, + + valueOf: err, + toString: err + }) >>> 1n; +}, '({[Symbol.toPrimitive]: function() {return 0b101n;}, valueOf: err, toString: err}) >>> 1n throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return 0b101n; + }, + + toString: err + }) >>> 1n; +}, '({valueOf: function() {return 0b101n;}, toString: err}) >>> 1n throws TypeError'); + +assert.throws(TypeError, function() { + ({ + toString: function() { + return 0b101n; + } + }) >>> 1n; +}, '({toString: function() {return 0b101n;}}) >>> 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0b101n >>> { + [Symbol.toPrimitive]: function() { + return 1n; + }, + + valueOf: err, + toString: err + }; +}, '0b101n >>> {[Symbol.toPrimitive]: function() {return 1n;}, valueOf: err, toString: err} throws TypeError'); + +assert.throws(TypeError, function() { + 0b101n >>> { + valueOf: function() { + return 1n; + }, + + toString: err + }; +}, '0b101n >>> {valueOf: function() {return 1n;}, toString: err} throws TypeError'); + +assert.throws(TypeError, function() { + 0b101n >>> { + toString: function() { + return 1n; + } + }; +}, '0b101n >>> {toString: function() {return 1n;}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return 0b101n; + } + }) >>> { + valueOf: function() { + return 1n; + } + }; +}, '({valueOf: function() {return 0b101n;}}) >>> {valueOf: function() {return 1n;}} throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/unsigned-right-shift/bigint-toprimitive.js b/test/language/expressions/unsigned-right-shift/bigint-toprimitive.js index 5d8c00d776af3b4a1f4a8dfb0c4cf7352143bc73..6f6aca011e4a2785e9723a1ba2e8798378d0956c 100644 --- a/test/language/expressions/unsigned-right-shift/bigint-toprimitive.js +++ b/test/language/expressions/unsigned-right-shift/bigint-toprimitive.js @@ -6,7 +6,6 @@ esid: sec-unsigned-right-shift-operator-runtime-semantics-evaluation info: After ToNumeric type coercion, unsigned-right-shift always throws for BigInt operands features: [BigInt, Symbol.toPrimitive, computed-property-names] ---*/ - function err() { throw new Test262Error(); } @@ -18,332 +17,397 @@ assert.throws(TypeError, function() { [Symbol.toPrimitive]: function() { return 2n; }, + valueOf: err, toString: err }) >>> 0n; -}, "ToPrimitive: @@toPrimitive takes precedence"); +}, '({[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) >>> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >>> { [Symbol.toPrimitive]: function() { return 2n; }, + valueOf: err, toString: err }; -}, "ToPrimitive: @@toPrimitive takes precedence"); +}, '0n >>> {[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { return 2n; }, + toString: err }) >>> 0n; -}, "ToPrimitive: valueOf takes precedence over toString"); +}, '({valueOf: function() {return 2n;}, toString: err}) >>> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >>> { valueOf: function() { return 2n; }, + toString: err }; -}, "ToPrimitive: valueOf takes precedence over toString"); +}, '0n >>> {valueOf: function() {return 2n;}, toString: err} throws TypeError'); + assert.throws(TypeError, function() { ({ toString: function() { return 2n; } }) >>> 0n; -}, "ToPrimitive: toString with no valueOf"); +}, '({toString: function() {return 2n;}}) >>> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >>> { toString: function() { return 2n; } }; -}, "ToPrimitive: toString with no valueOf"); +}, '0n >>> {toString: function() {return 2n;}} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: undefined, + valueOf: function() { return 2n; } }) >>> 0n; -}, "ToPrimitive: skip @@toPrimitive when it's undefined"); +}, '({[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) >>> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >>> { [Symbol.toPrimitive]: undefined, + valueOf: function() { return 2n; } }; -}, "ToPrimitive: skip @@toPrimitive when it's undefined"); +}, '0n >>> {[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: null, + valueOf: function() { return 2n; } }) >>> 0n; -}, "ToPrimitive: skip @@toPrimitive when it's null"); +}, '({[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) >>> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >>> { [Symbol.toPrimitive]: null, + valueOf: function() { return 2n; } }; -}, "ToPrimitive: skip @@toPrimitive when it's null"); +}, '0n >>> {[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: null, + toString: function() { return 2n; } }) >>> 0n; -}, "ToPrimitive: skip valueOf when it's not callable"); +}, '({valueOf: null, toString: function() {return 2n;}}) >>> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >>> { valueOf: null, + toString: function() { return 2n; } }; -}, "ToPrimitive: skip valueOf when it's not callable"); +}, '0n >>> {valueOf: null, toString: function() {return 2n;}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: 1, + toString: function() { return 2n; } }) >>> 0n; -}, "ToPrimitive: skip valueOf when it's not callable"); +}, '({valueOf: 1, toString: function() {return 2n;}}) >>> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >>> { valueOf: 1, + toString: function() { return 2n; } }; -}, "ToPrimitive: skip valueOf when it's not callable"); +}, '0n >>> {valueOf: 1, toString: function() {return 2n;}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: {}, + toString: function() { return 2n; } }) >>> 0n; -}, "ToPrimitive: skip valueOf when it's not callable"); +}, '({valueOf: {}, toString: function() {return 2n;}}) >>> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >>> { valueOf: {}, + toString: function() { return 2n; } }; -}, "ToPrimitive: skip valueOf when it's not callable"); +}, '0n >>> {valueOf: {}, toString: function() {return 2n;}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { return {}; }, + toString: function() { return 2n; } }) >>> 0n; -}, "ToPrimitive: skip valueOf when it returns an object"); +}, '({valueOf: function() {return {};}, toString: function() {return 2n;}}) >>> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >>> { valueOf: function() { return {}; }, + toString: function() { return 2n; } }; -}, "ToPrimitive: skip valueOf when it returns an object"); +}, '0n >>> {valueOf: function() {return {};}, toString: function() {return 2n;}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { return Object(12345); }, + toString: function() { return 2n; } }) >>> 0n; -}, "ToPrimitive: skip valueOf when it returns an object"); +}, '({valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) >>> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >>> { valueOf: function() { return Object(12345); }, + toString: function() { return 2n; } }; -}, "ToPrimitive: skip valueOf when it returns an object"); +}, '0n >>> {valueOf: function() {return Object(12345);}, toString: function() {return 2n;}} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: 1 }) >>> 0n; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '({[Symbol.toPrimitive]: 1}) >>> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >>> { [Symbol.toPrimitive]: 1 }; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '0n >>> {[Symbol.toPrimitive]: 1} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: {} }) >>> 0n; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '({[Symbol.toPrimitive]: {}}) >>> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >>> { [Symbol.toPrimitive]: {} }; -}, "ToPrimitive: throw when @@toPrimitive is not callable"); +}, '0n >>> {[Symbol.toPrimitive]: {}} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { return Object(1); } }) >>> 0n; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '({[Symbol.toPrimitive]: function() {return Object(1);}}) >>> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >>> { [Symbol.toPrimitive]: function() { return Object(1); } }; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '0n >>> {[Symbol.toPrimitive]: function() {return Object(1);}} throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { return {}; } }) >>> 0n; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '({[Symbol.toPrimitive]: function() {return {};}}) >>> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >>> { [Symbol.toPrimitive]: function() { return {}; } }; -}, "ToPrimitive: throw when @@toPrimitive returns an object"); +}, '0n >>> {[Symbol.toPrimitive]: function() {return {};}} throws TypeError'); + assert.throws(MyError, function() { ({ [Symbol.toPrimitive]: function() { throw new MyError(); } }) >>> 0n; -}, "ToPrimitive: propagate errors from @@toPrimitive"); +}, '({[Symbol.toPrimitive]: function() {throw new MyError();}}) >>> 0n throws MyError'); + assert.throws(MyError, function() { 0n >>> { [Symbol.toPrimitive]: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from @@toPrimitive"); +}, '0n >>> {[Symbol.toPrimitive]: function() {throw new MyError();}} throws MyError'); + assert.throws(MyError, function() { ({ valueOf: function() { throw new MyError(); } }) >>> 0n; -}, "ToPrimitive: propagate errors from valueOf"); +}, '({valueOf: function() {throw new MyError();}}) >>> 0n throws MyError'); + assert.throws(MyError, function() { 0n >>> { valueOf: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from valueOf"); +}, '0n >>> {valueOf: function() {throw new MyError();}} throws MyError'); + assert.throws(MyError, function() { ({ toString: function() { throw new MyError(); } }) >>> 0n; -}, "ToPrimitive: propagate errors from toString"); +}, '({toString: function() {throw new MyError();}}) >>> 0n throws MyError'); + assert.throws(MyError, function() { 0n >>> { toString: function() { throw new MyError(); } }; -}, "ToPrimitive: propagate errors from toString"); +}, '0n >>> {toString: function() {throw new MyError();}} throws MyError'); + assert.throws(TypeError, function() { ({ valueOf: null, toString: null }) >>> 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: null, toString: null}) >>> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >>> { valueOf: null, toString: null }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n >>> {valueOf: null, toString: null} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: 1, toString: 1 }) >>> 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: 1, toString: 1}) >>> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >>> { valueOf: 1, toString: 1 }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n >>> {valueOf: 1, toString: 1} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: {}, toString: {} }) >>> 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: {}, toString: {}}) >>> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >>> { valueOf: {}, toString: {} }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n >>> {valueOf: {}, toString: {}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { return Object(1); }, + toString: function() { return Object(1); } }) >>> 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: function() {return Object(1);}, toString: function() {return Object(1);}}) >>> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >>> { valueOf: function() { return Object(1); }, + toString: function() { return Object(1); } }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n >>> {valueOf: function() {return Object(1);}, toString: function() {return Object(1);}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { return {}; }, + toString: function() { return {}; } }) >>> 0n; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '({valueOf: function() {return {};}, toString: function() {return {};}}) >>> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >>> { valueOf: function() { return {}; }, + toString: function() { return {}; } }; -}, "ToPrimitive: throw when skipping both valueOf and toString"); +}, '0n >>> {valueOf: function() {return {};}, toString: function() {return {};}} throws TypeError'); \ No newline at end of file diff --git a/test/language/expressions/unsigned-right-shift/bigint-wrapped-values.js b/test/language/expressions/unsigned-right-shift/bigint-wrapped-values.js index 526bce637353d9186763e6107c746a4d856aa0f3..46fe1027b4799d359a428e7d33e45baf16d6be24 100644 --- a/test/language/expressions/unsigned-right-shift/bigint-wrapped-values.js +++ b/test/language/expressions/unsigned-right-shift/bigint-wrapped-values.js @@ -6,52 +6,58 @@ esid: sec-unsigned-right-shift-operator-runtime-semantics-evaluation info: After ToNumeric type coercion, unsigned-right-shift always throws for BigInt operands features: [BigInt, Symbol.toPrimitive, computed-property-names] ---*/ - assert.throws(TypeError, function() { Object(2n) >>> 0n; -}, "ToPrimitive: unbox object with internal slot"); +}, 'Object(2n) >>> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >>> Object(2n); -}, "ToPrimitive: unbox object with internal slot"); +}, '0n >>> Object(2n) throws TypeError'); + assert.throws(TypeError, function() { ({ [Symbol.toPrimitive]: function() { return 2n; } }) >>> 0n; -}, "ToPrimitive: @@toPrimitive"); +}, '({[Symbol.toPrimitive]: function() {return 2n;}}) >>> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >>> { [Symbol.toPrimitive]: function() { return 2n; } }; -}, "ToPrimitive: @@toPrimitive"); +}, '0n >>> {[Symbol.toPrimitive]: function() {return 2n;}} throws TypeError'); + assert.throws(TypeError, function() { ({ valueOf: function() { return 2n; } }) >>> 0n; -}, "ToPrimitive: valueOf"); +}, '({valueOf: function() {return 2n;}}) >>> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >>> { valueOf: function() { return 2n; } }; -}, "ToPrimitive: valueOf"); +}, '0n >>> {valueOf: function() {return 2n;}} throws TypeError'); + assert.throws(TypeError, function() { ({ toString: function() { return 2n; } }) >>> 0n; -}, "ToPrimitive: toString"); +}, '({toString: function() {return 2n;}}) >>> 0n throws TypeError'); + assert.throws(TypeError, function() { 0n >>> { toString: function() { return 2n; } }; -}, "ToPrimitive: toString"); +}, '0n >>> {toString: function() {return 2n;}} throws TypeError'); \ No newline at end of file