Skip to content

Commit

Permalink
switch small values to 0b notation
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Wolfe committed Oct 24, 2017
1 parent 96ba34c commit 035e796
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 72 deletions.
18 changes: 9 additions & 9 deletions test/language/expressions/bitwise-and/bigint-non-primitive.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,29 @@ info: |
features: [BigInt]
---*/

assert.sameValue(Object(5n) & 3n, 1n, "Object(5n) & 3n === 1n");
assert.sameValue(3n & Object(5n), 1n, "3n & Object(5n) === 1n");
assert.sameValue(Object(5n) & Object(3n), 1n, "Object(5n) & Object(3n) === 1n");
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");

function err() {
throw new Test262Error();
}

assert.sameValue(
{[Symbol.toPrimitive]: function() { return 5n; }, valueOf: err, toString: err} & 3n, 1n,
{[Symbol.toPrimitive]: function() { return 0b101n; }, valueOf: err, toString: err} & 0b011n, 0b001n,
"primitive from @@toPrimitive");
assert.sameValue(
3n & {[Symbol.toPrimitive]: function() { return 5n; }, valueOf: err, toString: err}, 1n,
0b011n & {[Symbol.toPrimitive]: function() { return 0b101n; }, valueOf: err, toString: err}, 0b001n,
"primitive from @@toPrimitive");
assert.sameValue(
{valueOf: function() { return 5n; }, toString: err} & 3n, 1n,
{valueOf: function() { return 0b101n; }, toString: err} & 0b011n, 0b001n,
"primitive from {}.valueOf");
assert.sameValue(
3n & {valueOf: function() { return 5n; }, toString: err}, 1n,
0b011n & {valueOf: function() { return 0b101n; }, toString: err}, 0b001n,
"primitive from {}.valueOf");
assert.sameValue(
{toString: function() { return 5n; }} & 3n, 1n,
{toString: function() { return 0b101n; }} & 0b011n, 0b001n,
"primitive from {}.toString");
assert.sameValue(
3n & {toString: function() { return 5n; }}, 1n,
0b011n & {toString: function() { return 0b101n; }}, 0b001n,
"primitive from {}.toString");
30 changes: 15 additions & 15 deletions test/language/expressions/bitwise-and/bigint.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ info: |
features: [BigInt]
---*/

assert.sameValue(0n & 0n, 0n, "0n & 0n === 0n");
assert.sameValue(0n & 1n, 0n, "0n & 1n === 0n");
assert.sameValue(1n & 0n, 0n, "1n & 0n === 0n");
assert.sameValue(0n & 2n, 0n, "0n & 2n === 0n");
assert.sameValue(2n & 0n, 0n, "2n & 0n === 0n");
assert.sameValue(0n & 3n, 0n, "0n & 3n === 0n");
assert.sameValue(3n & 0n, 0n, "3n & 0n === 0n");
assert.sameValue(1n & 1n, 1n, "1n & 1n === 1n");
assert.sameValue(1n & 2n, 0n, "1n & 2n === 0n");
assert.sameValue(2n & 1n, 0n, "2n & 1n === 0n");
assert.sameValue(1n & 3n, 1n, "1n & 3n === 1n");
assert.sameValue(3n & 1n, 1n, "3n & 1n === 1n");
assert.sameValue(2n & 2n, 2n, "2n & 2n === 2n");
assert.sameValue(2n & 3n, 2n, "2n & 3n === 2n");
assert.sameValue(3n & 2n, 2n, "3n & 2n === 2n");
assert.sameValue(0b00n & 0b00n, 0b00n, "0b00n & 0b00n === 0b00n");
assert.sameValue(0b00n & 0b01n, 0b00n, "0b00n & 0b01n === 0b00n");
assert.sameValue(0b01n & 0b00n, 0b00n, "0b01n & 0b00n === 0b00n");
assert.sameValue(0b00n & 0b10n, 0b00n, "0b00n & 0b10n === 0b00n");
assert.sameValue(0b10n & 0b00n, 0b00n, "0b10n & 0b00n === 0b00n");
assert.sameValue(0b00n & 0b11n, 0b00n, "0b00n & 0b11n === 0b00n");
assert.sameValue(0b11n & 0b00n, 0b00n, "0b11n & 0b00n === 0b00n");
assert.sameValue(0b01n & 0b01n, 0b01n, "0b01n & 0b01n === 0b01n");
assert.sameValue(0b01n & 0b10n, 0b00n, "0b01n & 0b10n === 0b00n");
assert.sameValue(0b10n & 0b01n, 0b00n, "0b10n & 0b01n === 0b00n");
assert.sameValue(0b01n & 0b11n, 0b01n, "0b01n & 0b11n === 0b01n");
assert.sameValue(0b11n & 0b01n, 0b01n, "0b11n & 0b01n === 0b01n");
assert.sameValue(0b10n & 0b10n, 0b10n, "0b10n & 0b10n === 0b10n");
assert.sameValue(0b10n & 0b11n, 0b10n, "0b10n & 0b11n === 0b10n");
assert.sameValue(0b11n & 0b10n, 0b10n, "0b11n & 0b10n === 0b10n");
assert.sameValue(0xffffffffn & 0n, 0n, "0xffffffffn & 0n === 0n");
assert.sameValue(0n & 0xffffffffn, 0n, "0n & 0xffffffffn === 0n");
assert.sameValue(0xffffffffn & 0xffffffffn, 0xffffffffn, "0xffffffffn & 0xffffffffn === 0xffffffffn");
Expand Down
18 changes: 9 additions & 9 deletions test/language/expressions/bitwise-or/bigint-non-primitive.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,29 @@ info: |
features: [BigInt]
---*/

assert.sameValue(Object(5n) | 3n, 7n, "Object(5n) | 3n === 7n");
assert.sameValue(3n | Object(5n), 7n, "3n | Object(5n) === 7n");
assert.sameValue(Object(5n) | Object(3n), 7n, "Object(5n) | Object(3n) === 7n");
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");

function err() {
throw new Test262Error();
}

assert.sameValue(
{[Symbol.toPrimitive]: function() { return 5n; }, valueOf: err, toString: err} | 3n, 7n,
{[Symbol.toPrimitive]: function() { return 0b101n; }, valueOf: err, toString: err} | 0b011n, 0b111n,
"primitive from @@toPrimitive");
assert.sameValue(
3n | {[Symbol.toPrimitive]: function() { return 5n; }, valueOf: err, toString: err}, 7n,
0b011n | {[Symbol.toPrimitive]: function() { return 0b101n; }, valueOf: err, toString: err}, 0b111n,
"primitive from @@toPrimitive");
assert.sameValue(
{valueOf: function() { return 5n; }, toString: err} | 3n, 7n,
{valueOf: function() { return 0b101n; }, toString: err} | 0b011n, 0b111n,
"primitive from {}.valueOf");
assert.sameValue(
3n | {valueOf: function() { return 5n; }, toString: err}, 7n,
0b011n | {valueOf: function() { return 0b101n; }, toString: err}, 0b111n,
"primitive from {}.valueOf");
assert.sameValue(
{toString: function() { return 5n; }} | 3n, 7n,
{toString: function() { return 0b101n; }} | 0b011n, 0b111n,
"primitive from {}.toString");
assert.sameValue(
3n | {toString: function() { return 5n; }}, 7n,
0b011n | {toString: function() { return 0b101n; }}, 0b111n,
"primitive from {}.toString");
30 changes: 15 additions & 15 deletions test/language/expressions/bitwise-or/bigint.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ info: |
features: [BigInt]
---*/

assert.sameValue(0n | 0n, 0n, "0n | 0n === 0n");
assert.sameValue(0n | 1n, 1n, "0n | 1n === 1n");
assert.sameValue(1n | 0n, 1n, "1n | 0n === 1n");
assert.sameValue(0n | 2n, 2n, "0n | 2n === 2n");
assert.sameValue(2n | 0n, 2n, "2n | 0n === 2n");
assert.sameValue(0n | 3n, 3n, "0n | 3n === 3n");
assert.sameValue(3n | 0n, 3n, "3n | 0n === 3n");
assert.sameValue(1n | 1n, 1n, "1n | 1n === 1n");
assert.sameValue(1n | 2n, 3n, "1n | 2n === 3n");
assert.sameValue(2n | 1n, 3n, "2n | 1n === 3n");
assert.sameValue(1n | 3n, 3n, "1n | 3n === 3n");
assert.sameValue(3n | 1n, 3n, "3n | 1n === 3n");
assert.sameValue(2n | 2n, 2n, "2n | 2n === 2n");
assert.sameValue(2n | 3n, 3n, "2n | 3n === 3n");
assert.sameValue(3n | 2n, 3n, "3n | 2n === 3n");
assert.sameValue(0b00n | 0b00n, 0b00n, "0b00n | 0b00n === 0b00n");
assert.sameValue(0b00n | 0b01n, 0b01n, "0b00n | 0b01n === 0b01n");
assert.sameValue(0b01n | 0b00n, 0b01n, "0b01n | 0b00n === 0b01n");
assert.sameValue(0b00n | 0b10n, 0b10n, "0b00n | 0b10n === 0b10n");
assert.sameValue(0b10n | 0b00n, 0b10n, "0b10n | 0b00n === 0b10n");
assert.sameValue(0b00n | 0b11n, 0b11n, "0b00n | 0b11n === 0b11n");
assert.sameValue(0b11n | 0b00n, 0b11n, "0b11n | 0b00n === 0b11n");
assert.sameValue(0b01n | 0b01n, 0b01n, "0b01n | 0b01n === 0b01n");
assert.sameValue(0b01n | 0b10n, 0b11n, "0b01n | 0b10n === 0b11n");
assert.sameValue(0b10n | 0b01n, 0b11n, "0b10n | 0b01n === 0b11n");
assert.sameValue(0b01n | 0b11n, 0b11n, "0b01n | 0b11n === 0b11n");
assert.sameValue(0b11n | 0b01n, 0b11n, "0b11n | 0b01n === 0b11n");
assert.sameValue(0b10n | 0b10n, 0b10n, "0b10n | 0b10n === 0b10n");
assert.sameValue(0b10n | 0b11n, 0b11n, "0b10n | 0b11n === 0b11n");
assert.sameValue(0b11n | 0b10n, 0b11n, "0b11n | 0b10n === 0b11n");
assert.sameValue(0xffffffffn | 0n, 0xffffffffn, "0xffffffffn | 0n === 0xffffffffn");
assert.sameValue(0n | 0xffffffffn, 0xffffffffn, "0n | 0xffffffffn === 0xffffffffn");
assert.sameValue(0xffffffffn | 0xffffffffn, 0xffffffffn, "0xffffffffn | 0xffffffffn === 0xffffffffn");
Expand Down
18 changes: 9 additions & 9 deletions test/language/expressions/bitwise-xor/bigint-non-primitive.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,29 @@ info: |
features: [BigInt]
---*/

assert.sameValue(Object(5n) ^ 3n, 6n, "Object(5n) ^ 3n === 6n");
assert.sameValue(3n ^ Object(5n), 6n, "3n ^ Object(5n) === 6n");
assert.sameValue(Object(5n) ^ Object(3n), 6n, "Object(5n) ^ Object(3n) === 6n");
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");

function err() {
throw new Test262Error();
}

assert.sameValue(
{[Symbol.toPrimitive]: function() { return 5n; }, valueOf: err, toString: err} ^ 3n, 6n,
{[Symbol.toPrimitive]: function() { return 0b101n; }, valueOf: err, toString: err} ^ 0b011n, 0b110n,
"primitive from @@toPrimitive");
assert.sameValue(
3n ^ {[Symbol.toPrimitive]: function() { return 5n; }, valueOf: err, toString: err}, 6n,
0b011n ^ {[Symbol.toPrimitive]: function() { return 0b101n; }, valueOf: err, toString: err}, 0b110n,
"primitive from @@toPrimitive");
assert.sameValue(
{valueOf: function() { return 5n; }, toString: err} ^ 3n, 6n,
{valueOf: function() { return 0b101n; }, toString: err} ^ 0b011n, 0b110n,
"primitive from {}.valueOf");
assert.sameValue(
3n ^ {valueOf: function() { return 5n; }, toString: err}, 6n,
0b011n ^ {valueOf: function() { return 0b101n; }, toString: err}, 0b110n,
"primitive from {}.valueOf");
assert.sameValue(
{toString: function() { return 5n; }} ^ 3n, 6n,
{toString: function() { return 0b101n; }} ^ 0b011n, 0b110n,
"primitive from {}.toString");
assert.sameValue(
3n ^ {toString: function() { return 5n; }}, 6n,
0b011n ^ {toString: function() { return 0b101n; }}, 0b110n,
"primitive from {}.toString");
30 changes: 15 additions & 15 deletions test/language/expressions/bitwise-xor/bigint.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ info: |
features: [BigInt]
---*/

assert.sameValue(0n ^ 0n, 0n, "0n ^ 0n === 0n");
assert.sameValue(0n ^ 1n, 1n, "0n ^ 1n === 1n");
assert.sameValue(1n ^ 0n, 1n, "1n ^ 0n === 1n");
assert.sameValue(0n ^ 2n, 2n, "0n ^ 2n === 2n");
assert.sameValue(2n ^ 0n, 2n, "2n ^ 0n === 2n");
assert.sameValue(0n ^ 3n, 3n, "0n ^ 3n === 3n");
assert.sameValue(3n ^ 0n, 3n, "3n ^ 0n === 3n");
assert.sameValue(1n ^ 1n, 0n, "1n ^ 1n === 0n");
assert.sameValue(1n ^ 2n, 3n, "1n ^ 2n === 3n");
assert.sameValue(2n ^ 1n, 3n, "2n ^ 1n === 3n");
assert.sameValue(1n ^ 3n, 2n, "1n ^ 3n === 2n");
assert.sameValue(3n ^ 1n, 2n, "3n ^ 1n === 2n");
assert.sameValue(2n ^ 2n, 0n, "2n ^ 2n === 0n");
assert.sameValue(2n ^ 3n, 1n, "2n ^ 3n === 1n");
assert.sameValue(3n ^ 2n, 1n, "3n ^ 2n === 1n");
assert.sameValue(0b00n ^ 0b00n, 0b00n, "0b00n ^ 0b00n === 0b00n");
assert.sameValue(0b00n ^ 0b01n, 0b01n, "0b00n ^ 0b01n === 0b01n");
assert.sameValue(0b01n ^ 0b00n, 0b01n, "0b01n ^ 0b00n === 0b01n");
assert.sameValue(0b00n ^ 0b10n, 0b10n, "0b00n ^ 0b10n === 0b10n");
assert.sameValue(0b10n ^ 0b00n, 0b10n, "0b10n ^ 0b00n === 0b10n");
assert.sameValue(0b00n ^ 0b11n, 0b11n, "0b00n ^ 0b11n === 0b11n");
assert.sameValue(0b11n ^ 0b00n, 0b11n, "0b11n ^ 0b00n === 0b11n");
assert.sameValue(0b01n ^ 0b01n, 0b00n, "0b01n ^ 0b01n === 0b00n");
assert.sameValue(0b01n ^ 0b10n, 0b11n, "0b01n ^ 0b10n === 0b11n");
assert.sameValue(0b10n ^ 0b01n, 0b11n, "0b10n ^ 0b01n === 0b11n");
assert.sameValue(0b01n ^ 0b11n, 0b10n, "0b01n ^ 0b11n === 0b10n");
assert.sameValue(0b11n ^ 0b01n, 0b10n, "0b11n ^ 0b01n === 0b10n");
assert.sameValue(0b10n ^ 0b10n, 0b00n, "0b10n ^ 0b10n === 0b00n");
assert.sameValue(0b10n ^ 0b11n, 0b01n, "0b10n ^ 0b11n === 0b01n");
assert.sameValue(0b11n ^ 0b10n, 0b01n, "0b11n ^ 0b10n === 0b01n");
assert.sameValue(0xffffffffn ^ 0n, 0xffffffffn, "0xffffffffn ^ 0n === 0xffffffffn");
assert.sameValue(0n ^ 0xffffffffn, 0xffffffffn, "0n ^ 0xffffffffn === 0xffffffffn");
assert.sameValue(0xffffffffn ^ 0xffffffffn, 0n, "0xffffffffn ^ 0xffffffffn === 0n");
Expand Down

0 comments on commit 035e796

Please sign in to comment.