Skip to content
Snippets Groups Projects
Commit 6c50d46b authored by Rick Waldron's avatar Rick Waldron Committed by Leo Balter
Browse files

built-ins/BigInt/*: make all indentation consistent (depth & character) (#1418)

parent 4b5f07a9
No related branches found
No related tags found
No related merge requests found
Showing
with 70 additions and 68 deletions
...@@ -14,57 +14,53 @@ features: [BigInt] ...@@ -14,57 +14,53 @@ features: [BigInt]
assert.sameValue(BigInt.asIntN(0, -2n), 0n); assert.sameValue(BigInt.asIntN(0, -2n), 0n);
assert.sameValue(BigInt.asIntN(0, -1n), 0n); assert.sameValue(BigInt.asIntN(0, -1n), 0n);
assert.sameValue(BigInt.asIntN(0, 0n), 0n); assert.sameValue(BigInt.asIntN(0, 0n), 0n);
assert.sameValue(BigInt.asIntN(0, 1n), 0n); assert.sameValue(BigInt.asIntN(0, 1n), 0n);
assert.sameValue(BigInt.asIntN(0, 2n), 0n); assert.sameValue(BigInt.asIntN(0, 2n), 0n);
assert.sameValue(BigInt.asIntN(1, -3n), -1n); assert.sameValue(BigInt.asIntN(1, -3n), -1n);
assert.sameValue(BigInt.asIntN(1, -2n), 0n); assert.sameValue(BigInt.asIntN(1, -2n), 0n);
assert.sameValue(BigInt.asIntN(1, -1n), -1n); assert.sameValue(BigInt.asIntN(1, -1n), -1n);
assert.sameValue(BigInt.asIntN(1, 0n), 0n); assert.sameValue(BigInt.asIntN(1, 0n), 0n);
assert.sameValue(BigInt.asIntN(1, 1n), -1n); assert.sameValue(BigInt.asIntN(1, 1n), -1n);
assert.sameValue(BigInt.asIntN(1, 2n), 0n); assert.sameValue(BigInt.asIntN(1, 2n), 0n);
assert.sameValue(BigInt.asIntN(1, 3n), -1n); assert.sameValue(BigInt.asIntN(1, 3n), -1n);
assert.sameValue(BigInt.asIntN(1, -123456789012345678901n), -1n); assert.sameValue(BigInt.asIntN(1, -123456789012345678901n), -1n);
assert.sameValue(BigInt.asIntN(1, -123456789012345678900n), 0n); assert.sameValue(BigInt.asIntN(1, -123456789012345678900n), 0n);
assert.sameValue(BigInt.asIntN(1, 123456789012345678900n), 0n); assert.sameValue(BigInt.asIntN(1, 123456789012345678900n), 0n);
assert.sameValue(BigInt.asIntN(1, 123456789012345678901n), -1n); assert.sameValue(BigInt.asIntN(1, 123456789012345678901n), -1n);
assert.sameValue(BigInt.asIntN(2, -3n), 1n); assert.sameValue(BigInt.asIntN(2, -3n), 1n);
assert.sameValue(BigInt.asIntN(2, -2n), -2n); assert.sameValue(BigInt.asIntN(2, -2n), -2n);
assert.sameValue(BigInt.asIntN(2, -1n), -1n); assert.sameValue(BigInt.asIntN(2, -1n), -1n);
assert.sameValue(BigInt.asIntN(2, 0n), 0n); assert.sameValue(BigInt.asIntN(2, 0n), 0n);
assert.sameValue(BigInt.asIntN(2, 1n), 1n); assert.sameValue(BigInt.asIntN(2, 1n), 1n);
assert.sameValue(BigInt.asIntN(2, 2n), -2n); assert.sameValue(BigInt.asIntN(2, 2n), -2n);
assert.sameValue(BigInt.asIntN(2, 3n), -1n); assert.sameValue(BigInt.asIntN(2, 3n), -1n);
assert.sameValue(BigInt.asIntN(2, -123456789012345678901n), -1n); assert.sameValue(BigInt.asIntN(2, -123456789012345678901n), -1n);
assert.sameValue(BigInt.asIntN(2, -123456789012345678900n), 0n); assert.sameValue(BigInt.asIntN(2, -123456789012345678900n), 0n);
assert.sameValue(BigInt.asIntN(2, 123456789012345678900n), 0n); assert.sameValue(BigInt.asIntN(2, 123456789012345678900n), 0n);
assert.sameValue(BigInt.asIntN(2, 123456789012345678901n), 1n); assert.sameValue(BigInt.asIntN(2, 123456789012345678901n), 1n);
assert.sameValue(BigInt.asIntN(8, 0xabn), -0x55n); assert.sameValue(BigInt.asIntN(8, 0xabn), -0x55n);
assert.sameValue(BigInt.asIntN(8, 0xabcdn), -0x33n); assert.sameValue(BigInt.asIntN(8, 0xabcdn), -0x33n);
assert.sameValue(BigInt.asIntN(8, 0xabcdef01n), 0x01n); assert.sameValue(BigInt.asIntN(8, 0xabcdef01n), 0x01n);
assert.sameValue(BigInt.asIntN(8, 0xabcdef0123456789abcdef0123n), 0x23n); assert.sameValue(BigInt.asIntN(8, 0xabcdef0123456789abcdef0123n), 0x23n);
assert.sameValue(BigInt.asIntN(8, 0xabcdef0123456789abcdef0183n), -0x7dn); assert.sameValue(BigInt.asIntN(8, 0xabcdef0123456789abcdef0183n), -0x7dn);
assert.sameValue(BigInt.asIntN(64, 0xabcdef0123456789abcdefn), 0x0123456789abcdefn); assert.sameValue(BigInt.asIntN(64, 0xabcdef0123456789abcdefn), 0x0123456789abcdefn);
assert.sameValue(BigInt.asIntN(65, 0xabcdef0123456789abcdefn), -0xfedcba9876543211n); assert.sameValue(BigInt.asIntN(65, 0xabcdef0123456789abcdefn), -0xfedcba9876543211n);
assert.sameValue(BigInt.asIntN(200, assert.sameValue(BigInt.asIntN(200,
0xcffffffffffffffffffffffffffffffffffffffffffffffffffn), 0xcffffffffffffffffffffffffffffffffffffffffffffffffffn), -0x00000000000000000000000000000000000000000000000001n);
-0x00000000000000000000000000000000000000000000000001n
);
assert.sameValue(BigInt.asIntN(201, assert.sameValue(BigInt.asIntN(201,
0xcffffffffffffffffffffffffffffffffffffffffffffffffffn), 0xcffffffffffffffffffffffffffffffffffffffffffffffffffn),
0xffffffffffffffffffffffffffffffffffffffffffffffffffn 0xffffffffffffffffffffffffffffffffffffffffffffffffffn
); );
assert.sameValue(BigInt.asIntN(200, assert.sameValue(BigInt.asIntN(200,
0xc89e081df68b65fedb32cffea660e55df9605650a603ad5fc54n), 0xc89e081df68b65fedb32cffea660e55df9605650a603ad5fc54n), -0x761f7e209749a0124cd3001599f1aa2069fa9af59fc52a03acn);
-0x761f7e209749a0124cd3001599f1aa2069fa9af59fc52a03acn
);
assert.sameValue(BigInt.asIntN(201, assert.sameValue(BigInt.asIntN(201,
0xc89e081df68b65fedb32cffea660e55df9605650a603ad5fc54n), 0xc89e081df68b65fedb32cffea660e55df9605650a603ad5fc54n),
0x89e081df68b65fedb32cffea660e55df9605650a603ad5fc54n 0x89e081df68b65fedb32cffea660e55df9605650a603ad5fc54n
); );
...@@ -13,33 +13,33 @@ features: [BigInt] ...@@ -13,33 +13,33 @@ features: [BigInt]
assert.sameValue(BigInt.asUintN(0, -2n), 0n); assert.sameValue(BigInt.asUintN(0, -2n), 0n);
assert.sameValue(BigInt.asUintN(0, -1n), 0n); assert.sameValue(BigInt.asUintN(0, -1n), 0n);
assert.sameValue(BigInt.asUintN(0, 0n), 0n); assert.sameValue(BigInt.asUintN(0, 0n), 0n);
assert.sameValue(BigInt.asUintN(0, 1n), 0n); assert.sameValue(BigInt.asUintN(0, 1n), 0n);
assert.sameValue(BigInt.asUintN(0, 2n), 0n); assert.sameValue(BigInt.asUintN(0, 2n), 0n);
assert.sameValue(BigInt.asUintN(1, -3n), 1n); assert.sameValue(BigInt.asUintN(1, -3n), 1n);
assert.sameValue(BigInt.asUintN(1, -2n), 0n); assert.sameValue(BigInt.asUintN(1, -2n), 0n);
assert.sameValue(BigInt.asUintN(1, -1n), 1n); assert.sameValue(BigInt.asUintN(1, -1n), 1n);
assert.sameValue(BigInt.asUintN(1, 0n), 0n); assert.sameValue(BigInt.asUintN(1, 0n), 0n);
assert.sameValue(BigInt.asUintN(1, 1n), 1n); assert.sameValue(BigInt.asUintN(1, 1n), 1n);
assert.sameValue(BigInt.asUintN(1, 2n), 0n); assert.sameValue(BigInt.asUintN(1, 2n), 0n);
assert.sameValue(BigInt.asUintN(1, 3n), 1n); assert.sameValue(BigInt.asUintN(1, 3n), 1n);
assert.sameValue(BigInt.asUintN(1, -123456789012345678901n), 1n); assert.sameValue(BigInt.asUintN(1, -123456789012345678901n), 1n);
assert.sameValue(BigInt.asUintN(1, -123456789012345678900n), 0n); assert.sameValue(BigInt.asUintN(1, -123456789012345678900n), 0n);
assert.sameValue(BigInt.asUintN(1, 123456789012345678900n), 0n); assert.sameValue(BigInt.asUintN(1, 123456789012345678900n), 0n);
assert.sameValue(BigInt.asUintN(1, 123456789012345678901n), 1n); assert.sameValue(BigInt.asUintN(1, 123456789012345678901n), 1n);
assert.sameValue(BigInt.asUintN(2, -3n), 1n); assert.sameValue(BigInt.asUintN(2, -3n), 1n);
assert.sameValue(BigInt.asUintN(2, -2n), 2n); assert.sameValue(BigInt.asUintN(2, -2n), 2n);
assert.sameValue(BigInt.asUintN(2, -1n), 3n); assert.sameValue(BigInt.asUintN(2, -1n), 3n);
assert.sameValue(BigInt.asUintN(2, 0n), 0n); assert.sameValue(BigInt.asUintN(2, 0n), 0n);
assert.sameValue(BigInt.asUintN(2, 1n), 1n); assert.sameValue(BigInt.asUintN(2, 1n), 1n);
assert.sameValue(BigInt.asUintN(2, 2n), 2n); assert.sameValue(BigInt.asUintN(2, 2n), 2n);
assert.sameValue(BigInt.asUintN(2, 3n), 3n); assert.sameValue(BigInt.asUintN(2, 3n), 3n);
assert.sameValue(BigInt.asUintN(2, -123456789012345678901n), 3n); assert.sameValue(BigInt.asUintN(2, -123456789012345678901n), 3n);
assert.sameValue(BigInt.asUintN(2, -123456789012345678900n), 0n); assert.sameValue(BigInt.asUintN(2, -123456789012345678900n), 0n);
assert.sameValue(BigInt.asUintN(2, 123456789012345678900n), 0n); assert.sameValue(BigInt.asUintN(2, 123456789012345678900n), 0n);
assert.sameValue(BigInt.asUintN(2, 123456789012345678901n), 1n); assert.sameValue(BigInt.asUintN(2, 123456789012345678901n), 1n);
assert.sameValue(BigInt.asUintN(8, 0xabn), 0xabn); assert.sameValue(BigInt.asUintN(8, 0xabn), 0xabn);
assert.sameValue(BigInt.asUintN(8, 0xabcdn), 0xcdn); assert.sameValue(BigInt.asUintN(8, 0xabcdn), 0xcdn);
...@@ -47,23 +47,23 @@ assert.sameValue(BigInt.asUintN(8, 0xabcdef01n), 0x01n); ...@@ -47,23 +47,23 @@ assert.sameValue(BigInt.asUintN(8, 0xabcdef01n), 0x01n);
assert.sameValue(BigInt.asUintN(8, 0xabcdef0123456789abcdef0123n), 0x23n); assert.sameValue(BigInt.asUintN(8, 0xabcdef0123456789abcdef0123n), 0x23n);
assert.sameValue(BigInt.asUintN(8, 0xabcdef0123456789abcdef0183n), 0x83n); assert.sameValue(BigInt.asUintN(8, 0xabcdef0123456789abcdef0183n), 0x83n);
assert.sameValue(BigInt.asUintN(64, 0xabcdef0123456789abcdefn), 0x0123456789abcdefn); assert.sameValue(BigInt.asUintN(64, 0xabcdef0123456789abcdefn), 0x0123456789abcdefn);
assert.sameValue(BigInt.asUintN(65, 0xabcdef0123456789abcdefn), 0x10123456789abcdefn); assert.sameValue(BigInt.asUintN(65, 0xabcdef0123456789abcdefn), 0x10123456789abcdefn);
assert.sameValue(BigInt.asUintN(200, assert.sameValue(BigInt.asUintN(200,
0xbffffffffffffffffffffffffffffffffffffffffffffffffffn), 0xbffffffffffffffffffffffffffffffffffffffffffffffffffn),
0x0ffffffffffffffffffffffffffffffffffffffffffffffffffn 0x0ffffffffffffffffffffffffffffffffffffffffffffffffffn
); );
assert.sameValue(BigInt.asUintN(201, assert.sameValue(BigInt.asUintN(201,
0xbffffffffffffffffffffffffffffffffffffffffffffffffffn), 0xbffffffffffffffffffffffffffffffffffffffffffffffffffn),
0x1ffffffffffffffffffffffffffffffffffffffffffffffffffn 0x1ffffffffffffffffffffffffffffffffffffffffffffffffffn
); );
assert.sameValue(BigInt.asUintN(200, assert.sameValue(BigInt.asUintN(200,
0xb89e081df68b65fedb32cffea660e55df9605650a603ad5fc54n), 0xb89e081df68b65fedb32cffea660e55df9605650a603ad5fc54n),
0x089e081df68b65fedb32cffea660e55df9605650a603ad5fc54n 0x089e081df68b65fedb32cffea660e55df9605650a603ad5fc54n
); );
assert.sameValue(BigInt.asUintN(201, assert.sameValue(BigInt.asUintN(201,
0xb89e081df68b65fedb32cffea660e55df9605650a603ad5fc54n), 0xb89e081df68b65fedb32cffea660e55df9605650a603ad5fc54n),
0x189e081df68b65fedb32cffea660e55df9605650a603ad5fc54n 0x189e081df68b65fedb32cffea660e55df9605650a603ad5fc54n
); );
...@@ -22,4 +22,3 @@ let o = { ...@@ -22,4 +22,3 @@ let o = {
} }
assert.sameValue(BigInt(o), 44n); assert.sameValue(BigInt(o), 44n);
...@@ -14,4 +14,3 @@ features: [BigInt] ...@@ -14,4 +14,3 @@ features: [BigInt]
assert.sameValue(BigInt(""), 0n); assert.sameValue(BigInt(""), 0n);
assert.sameValue(BigInt(" "), 0n); assert.sameValue(BigInt(" "), 0n);
...@@ -20,7 +20,7 @@ assert.sameValue(BigInt("0b1"), 1n); ...@@ -20,7 +20,7 @@ assert.sameValue(BigInt("0b1"), 1n);
let binaryString = "0b1"; let binaryString = "0b1";
for (let i = 0; i < 128; i++) for (let i = 0; i < 128; i++)
binaryString += "0"; binaryString += "0";
assert.sameValue(BigInt(binaryString), 340282366920938463463374607431768211456n); assert.sameValue(BigInt(binaryString), 340282366920938463463374607431768211456n);
...@@ -31,7 +31,6 @@ assert.sameValue(BigInt("0B1"), 1n); ...@@ -31,7 +31,6 @@ assert.sameValue(BigInt("0B1"), 1n);
binaryString = "0B1"; binaryString = "0B1";
for (let i = 0; i < 128; i++) for (let i = 0; i < 128; i++)
binaryString += "0"; binaryString += "0";
assert.sameValue(BigInt(binaryString), 340282366920938463463374607431768211456n); assert.sameValue(BigInt(binaryString), 340282366920938463463374607431768211456n);
...@@ -24,4 +24,3 @@ assert.sameValue(BigInt("-18446744073709551616"), -18446744073709551616n); ...@@ -24,4 +24,3 @@ assert.sameValue(BigInt("-18446744073709551616"), -18446744073709551616n);
assert.sameValue(BigInt("-7"), -7n); assert.sameValue(BigInt("-7"), -7n);
assert.sameValue(BigInt("-88"), -88n); assert.sameValue(BigInt("-88"), -88n);
assert.sameValue(BigInt("-900"), -900n); assert.sameValue(BigInt("-900"), -900n);
...@@ -22,4 +22,3 @@ assert.sameValue(BigInt("0Xa"), 10n); ...@@ -22,4 +22,3 @@ assert.sameValue(BigInt("0Xa"), 10n);
assert.sameValue(BigInt("0Xff"), 255n); assert.sameValue(BigInt("0Xff"), 255n);
assert.sameValue(BigInt("0Xfabc"), 64188n); assert.sameValue(BigInt("0Xfabc"), 64188n);
assert.sameValue(BigInt("0Xfffffffffffffffffff"), 75557863725914323419135n); assert.sameValue(BigInt("0Xfffffffffffffffffff"), 75557863725914323419135n);
...@@ -20,4 +20,3 @@ assert.sameValue(BigInt("0o20"), 16n); ...@@ -20,4 +20,3 @@ assert.sameValue(BigInt("0o20"), 16n);
assert.sameValue(BigInt("0O7"), 7n); assert.sameValue(BigInt("0O7"), 7n);
assert.sameValue(BigInt("0O10"), 8n); assert.sameValue(BigInt("0O10"), 8n);
assert.sameValue(BigInt("0O20"), 16n); assert.sameValue(BigInt("0O20"), 16n);
...@@ -18,4 +18,3 @@ assert.sameValue(BigInt("18446744073709551616 "), 18446744073709551616n); ...@@ -18,4 +18,3 @@ assert.sameValue(BigInt("18446744073709551616 "), 18446744073709551616n);
assert.sameValue(BigInt(" 7 "), 7n); assert.sameValue(BigInt(" 7 "), 7n);
assert.sameValue(BigInt(" -197 "), -197n); assert.sameValue(BigInt(" -197 "), -197n);
assert.sameValue(BigInt(" "), 0n); assert.sameValue(BigInt(" "), 0n);
...@@ -16,6 +16,8 @@ assert.throws(TypeError, function() { ...@@ -16,6 +16,8 @@ assert.throws(TypeError, function() {
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
new BigInt({ new BigInt({
valueOf: function() { throw new Test262Error("unreachable"); } valueOf: function() {
throw new Test262Error("unreachable");
}
}); });
}); });
...@@ -22,7 +22,9 @@ features: [BigInt, Symbol.toPrimitive] ...@@ -22,7 +22,9 @@ features: [BigInt, Symbol.toPrimitive]
var toString = BigInt.prototype.toString; var toString = BigInt.prototype.toString;
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
toString.call({x: 1n}); toString.call({
x: 1n
});
}, '{x: 1n}'); }, '{x: 1n}');
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
...@@ -30,9 +32,15 @@ assert.throws(TypeError, function() { ...@@ -30,9 +32,15 @@ assert.throws(TypeError, function() {
}, '[1n]'); }, '[1n]');
var obj = { var obj = {
valueOf: function() { throw new Test262Error('no [[BigIntData]]') }, valueOf: function() {
toString: function() { throw new Test262Error('no [[BigIntData]]') }, throw new Test262Error('no [[BigIntData]]')
[Symbol.toPrimitive]: function() { throw new Test262Error('no [[BigIntData]]') } },
toString: function() {
throw new Test262Error('no [[BigIntData]]')
},
[Symbol.toPrimitive]: function() {
throw new Test262Error('no [[BigIntData]]')
}
}; };
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
toString.call(obj); toString.call(obj);
......
...@@ -8,7 +8,7 @@ description: > ...@@ -8,7 +8,7 @@ description: >
info: | info: |
BigInt.prototype.valueOf ( ) BigInt.prototype.valueOf ( )
Return ? thisBigIntValue(this value). Return ? thisBigIntValue(this value).
features: [BigInt] features: [BigInt]
---*/ ---*/
......
...@@ -14,13 +14,16 @@ features: [BigInt] ...@@ -14,13 +14,16 @@ features: [BigInt]
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
BigInt({ BigInt({
valueOf: function() { throw new Test262Error(); } valueOf: function() {
throw new Test262Error();
}
}); });
}); });
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
BigInt({ BigInt({
toString: function() { throw new Test262Error(); } toString: function() {
throw new Test262Error();
}
}); });
}); });
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment