Skip to content
Snippets Groups Projects
Commit 422f91e8 authored by Daniel Ehrenberg's avatar Daniel Ehrenberg Committed by Rick Waldron
Browse files

Remove BigInt.parseInt tests

BigInt.parseInt will be removed in
https://github.com/tc39/proposal-bigint/pull/101

This patch removes the associated test262 tests.
parent 7446e885
No related branches found
No related tags found
No related merge requests found
Showing with 0 additions and 483 deletions
// Copyright (C) 2017 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-bigint-parseint-string-radix
description: String radix
info: >
BigInt.parseInt ( string, radix )
The parseInt function produces a BigInt value dictated by
interpretation of the contents of the string argument according to
the specified radix.
The algorithm is the same as 18.2.5 but with the following edits:
* For all cases which result in returning NaN, throw a SyntaxError
exception.
* For all cases which result in returning -0, return 0n.
* Replace the second to last step, which casts mathInt to a Number,
with casting mathInt to a BigInt.
18.2.5 parseInt ( string, radix )
[...]
6. Let R be ? ToInt32(radix).
features: [BigInt]
---*/
assert.sameValue(BigInt.parseInt("11", "2"), 0b11n);
assert.sameValue(BigInt.parseInt("11", "0"), 11n);
assert.sameValue(BigInt.parseInt("11", ""), 11n);
assert.sameValue(BigInt.parseInt("11", new String("2")), 0b11n);
assert.sameValue(BigInt.parseInt("11", new String("Infinity")), 11n);
assert.sameValue(BigInt.parseInt("11", new String("")), 11n);
// Copyright (C) 2017 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-bigint-parseint-string-radix
description: Radix is undefined or null
info: >
BigInt.parseInt ( string, radix )
The parseInt function produces a BigInt value dictated by
interpretation of the contents of the string argument according to
the specified radix.
The algorithm is the same as 18.2.5 but with the following edits:
* For all cases which result in returning NaN, throw a SyntaxError
exception.
* For all cases which result in returning -0, return 0n.
* Replace the second to last step, which casts mathInt to a Number,
with casting mathInt to a BigInt.
18.2.5 parseInt ( string, radix )
[...]
6. Let R be ? ToInt32(radix).
[...]
9. Else R = 0,
a. Let R be 10.
features: [BigInt]
---*/
assert.sameValue(BigInt.parseInt("11", undefined), 11n);
assert.sameValue(BigInt.parseInt("11", null), 11n);
// Copyright (C) 2017 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-bigint-parseint-string-radix
description: Radix is undefined
info: >
BigInt.parseInt ( string, radix )
The parseInt function produces a BigInt value dictated by
interpretation of the contents of the string argument according to
the specified radix.
The algorithm is the same as 18.2.5 but with the following edits:
* For all cases which result in returning NaN, throw a SyntaxError
exception.
* For all cases which result in returning -0, return 0n.
* Replace the second to last step, which casts mathInt to a Number,
with casting mathInt to a BigInt.
18.2.5 parseInt ( string, radix )
[...]
6. Let R be ? ToInt32(radix).
[...]
9. Else R = 0,
a. Let R be 10.
features: [BigInt]
---*/
assert.sameValue(BigInt.parseInt("0"), 0n);
assert.sameValue(BigInt.parseInt("1"), 1n);
assert.sameValue(BigInt.parseInt("2"), 2n);
assert.sameValue(BigInt.parseInt("3"), 3n);
assert.sameValue(BigInt.parseInt("4"), 4n);
assert.sameValue(BigInt.parseInt("5"), 5n);
assert.sameValue(BigInt.parseInt("6"), 6n);
assert.sameValue(BigInt.parseInt("7"), 7n);
assert.sameValue(BigInt.parseInt("8"), 8n);
assert.sameValue(BigInt.parseInt("9"), 9n);
assert.sameValue(BigInt.parseInt("10"), 10n);
assert.sameValue(BigInt.parseInt("11"), 11n);
assert.sameValue(BigInt.parseInt("9999"), 9999n);
// Copyright (C) 2017 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-bigint-parseint-string-radix
description: Radix is zero
info: >
BigInt.parseInt ( string, radix )
The parseInt function produces a BigInt value dictated by
interpretation of the contents of the string argument according to
the specified radix.
The algorithm is the same as 18.2.5 but with the following edits:
* For all cases which result in returning NaN, throw a SyntaxError
exception.
* For all cases which result in returning -0, return 0n.
* Replace the second to last step, which casts mathInt to a Number,
with casting mathInt to a BigInt.
18.2.5 parseInt ( string, radix )
[...]
6. Let R be ? ToInt32(radix).
[...]
9. Else R = 0,
a. Let R be 10.
features: [BigInt]
---*/
assert.sameValue(BigInt.parseInt("0", 0), 0n);
assert.sameValue(BigInt.parseInt("1", 0), 1n);
assert.sameValue(BigInt.parseInt("2", 0), 2n);
assert.sameValue(BigInt.parseInt("3", 0), 3n);
assert.sameValue(BigInt.parseInt("4", 0), 4n);
assert.sameValue(BigInt.parseInt("5", 0), 5n);
assert.sameValue(BigInt.parseInt("6", 0), 6n);
assert.sameValue(BigInt.parseInt("7", 0), 7n);
assert.sameValue(BigInt.parseInt("8", 0), 8n);
assert.sameValue(BigInt.parseInt("9", 0), 9n);
assert.sameValue(BigInt.parseInt("10", 0), 10n);
assert.sameValue(BigInt.parseInt("11", 0), 11n);
assert.sameValue(BigInt.parseInt("9999", 0), 9999n);
// Copyright (C) 2017 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-bigint-parseint-string-radix
description: Trailing non-digit UTF-16 code point
info: >
BigInt.parseInt ( string, radix )
The parseInt function produces a BigInt value dictated by
interpretation of the contents of the string argument according to
the specified radix.
The algorithm is the same as 18.2.5 but with the following edits:
* For all cases which result in returning NaN, throw a SyntaxError
exception.
* For all cases which result in returning -0, return 0n.
* Replace the second to last step, which casts mathInt to a Number,
with casting mathInt to a BigInt.
18.2.5 parseInt ( string, radix )
The parseInt function produces an integer value dictated by
interpretation of the contents of the string argument according to the
specified radix. Leading white space in string is ignored. If radix is
undefined or 0, it is assumed to be 10 except when the number begins
with the code unit pairs 0x or 0X, in which case a radix of 16 is
assumed. If radix is 16, the number may also optionally begin with the
code unit pairs 0x or 0X.
[...]
NOTE: parseInt may interpret only a leading portion of string as an
integer value; it ignores any code units that cannot be interpreted as
part of the notation of an integer, and no indication is given that
any such code units were ignored.
includes: [decimalToHexString.js]
features: [BigInt]
---*/
var errorCount = 0;
var count = 0;
var indexP;
var indexO = 0;
for (var index = 0; index <= 65535; index++) {
if ((index < 0x0030) || (index > 0x0039) &&
(index < 0x0041) || (index > 0x005A) &&
(index < 0x0061) || (index > 0x007A)) {
var hex = decimalToHexString(index);
if (BigInt.parseInt("1Z" + String.fromCharCode(index), 36) !== 71n) {
if (indexO === 0) {
indexO = index;
} else {
if ((index - indexP) !== 1) {
if ((indexP - indexO) !== 0) {
var hexP = decimalToHexString(indexP);
var hexO = decimalToHexString(indexO);
$ERROR('#' + hexO + '-' + hexP + ' ');
}
else {
var hexP = decimalToHexString(indexP);
$ERROR('#' + hexP + ' ');
}
indexO = index;
}
}
indexP = index;
errorCount++;
}
count++;
}
}
if (errorCount > 0) {
if ((indexP - indexO) !== 0) {
var hexP = decimalToHexString(indexP);
var hexO = decimalToHexString(indexO);
$ERROR('#' + hexO + '-' + hexP + ' ');
} else {
var hexP = decimalToHexString(indexP);
$ERROR('#' + hexP + ' ');
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
// Copyright (C) 2017 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-bigint-parseint-string-radix
description: Single digit and invalid trailing digit (lowercase)
info: >
BigInt.parseInt ( string, radix )
The parseInt function produces a BigInt value dictated by
interpretation of the contents of the string argument according to
the specified radix.
The algorithm is the same as 18.2.5 but with the following edits:
* For all cases which result in returning NaN, throw a SyntaxError
exception.
* For all cases which result in returning -0, return 0n.
* Replace the second to last step, which casts mathInt to a Number,
with casting mathInt to a BigInt.
18.2.5 parseInt ( string, radix )
The parseInt function produces an integer value dictated by
interpretation of the contents of the string argument according to the
specified radix. Leading white space in string is ignored. If radix is
undefined or 0, it is assumed to be 10 except when the number begins
with the code unit pairs 0x or 0X, in which case a radix of 16 is
assumed. If radix is 16, the number may also optionally begin with the
code unit pairs 0x or 0X.
[...]
NOTE: parseInt may interpret only a leading portion of string as an
integer value; it ignores any code units that cannot be interpreted as
part of the notation of an integer, and no indication is given that
any such code units were ignored.
features: [BigInt]
---*/
var R_digit = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];
for (var i = 2; i <= 35; i++) {
assert.sameValue(BigInt.parseInt(R_digit[i - 2] + R_digit[i - 1], i), BigInt(i - 1));
}
// Copyright (C) 2017 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-bigint-parseint-string-radix
description: Single digit with trailing invalid digit (uppercase)
info: >
BigInt.parseInt ( string, radix )
The parseInt function produces a BigInt value dictated by
interpretation of the contents of the string argument according to
the specified radix.
The algorithm is the same as 18.2.5 but with the following edits:
* For all cases which result in returning NaN, throw a SyntaxError
exception.
* For all cases which result in returning -0, return 0n.
* Replace the second to last step, which casts mathInt to a Number,
with casting mathInt to a BigInt.
18.2.5 parseInt ( string, radix )
The parseInt function produces an integer value dictated by
interpretation of the contents of the string argument according to the
specified radix. Leading white space in string is ignored. If radix is
undefined or 0, it is assumed to be 10 except when the number begins
with the code unit pairs 0x or 0X, in which case a radix of 16 is
assumed. If radix is 16, the number may also optionally begin with the
code unit pairs 0x or 0X.
[...]
NOTE: parseInt may interpret only a leading portion of string as an
integer value; it ignores any code units that cannot be interpreted as
part of the notation of an integer, and no indication is given that
any such code units were ignored.
features: [BigInt]
---*/
var R_digit = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"];
for (var i = 2; i <= 35; i++) {
assert.sameValue(BigInt.parseInt(R_digit[i - 2] + R_digit[i - 1], i), BigInt(i - 1));
}
// Copyright (C) 2017 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-bigint-parseint-string-radix
description: 10 with trailing non-digit
info: >
BigInt.parseInt ( string, radix )
The parseInt function produces a BigInt value dictated by
interpretation of the contents of the string argument according to
the specified radix.
The algorithm is the same as 18.2.5 but with the following edits:
* For all cases which result in returning NaN, throw a SyntaxError
exception.
* For all cases which result in returning -0, return 0n.
* Replace the second to last step, which casts mathInt to a Number,
with casting mathInt to a BigInt.
18.2.5 parseInt ( string, radix )
The parseInt function produces an integer value dictated by
interpretation of the contents of the string argument according to the
specified radix. Leading white space in string is ignored. If radix is
undefined or 0, it is assumed to be 10 except when the number begins
with the code unit pairs 0x or 0X, in which case a radix of 16 is
assumed. If radix is 16, the number may also optionally begin with the
code unit pairs 0x or 0X.
[...]
NOTE: parseInt may interpret only a leading portion of string as an
integer value; it ignores any code units that cannot be interpreted as
part of the notation of an integer, and no indication is given that
any such code units were ignored.
features: [BigInt]
---*/
for (var i = 2; i <= 36; i++) {
assert.sameValue(BigInt.parseInt("10$1", i), BigInt(i));
}
// Copyright (C) 2017 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-bigint-parseint-string-radix
description: Single digit with trailing non-digit (lowercase)
info: >
BigInt.parseInt ( string, radix )
The parseInt function produces a BigInt value dictated by
interpretation of the contents of the string argument according to
the specified radix.
The algorithm is the same as 18.2.5 but with the following edits:
* For all cases which result in returning NaN, throw a SyntaxError
exception.
* For all cases which result in returning -0, return 0n.
* Replace the second to last step, which casts mathInt to a Number,
with casting mathInt to a BigInt.
18.2.5 parseInt ( string, radix )
The parseInt function produces an integer value dictated by
interpretation of the contents of the string argument according to the
specified radix. Leading white space in string is ignored. If radix is
undefined or 0, it is assumed to be 10 except when the number begins
with the code unit pairs 0x or 0X, in which case a radix of 16 is
assumed. If radix is 16, the number may also optionally begin with the
code unit pairs 0x or 0X.
[...]
NOTE: parseInt may interpret only a leading portion of string as an
integer value; it ignores any code units that cannot be interpreted as
part of the notation of an integer, and no indication is given that
any such code units were ignored.
features: [BigInt]
---*/
var R_digit = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];
for (var i = 2; i <= 36; i++) {
assert.sameValue(BigInt.parseInt(R_digit[i - 2] + "$", i), BigInt(i - 1));
}
// Copyright (C) 2017 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-bigint-parseint-string-radix
description: Single digit with trailing non-digit (uppercase)
info: >
BigInt.parseInt ( string, radix )
The parseInt function produces a BigInt value dictated by
interpretation of the contents of the string argument according to
the specified radix.
The algorithm is the same as 18.2.5 but with the following edits:
* For all cases which result in returning NaN, throw a SyntaxError
exception.
* For all cases which result in returning -0, return 0n.
* Replace the second to last step, which casts mathInt to a Number,
with casting mathInt to a BigInt.
18.2.5 parseInt ( string, radix )
The parseInt function produces an integer value dictated by
interpretation of the contents of the string argument according to the
specified radix. Leading white space in string is ignored. If radix is
undefined or 0, it is assumed to be 10 except when the number begins
with the code unit pairs 0x or 0X, in which case a radix of 16 is
assumed. If radix is 16, the number may also optionally begin with the
code unit pairs 0x or 0X.
[...]
NOTE: parseInt may interpret only a leading portion of string as an
integer value; it ignores any code units that cannot be interpreted as
part of the notation of an integer, and no indication is given that
any such code units were ignored.
features: [BigInt]
---*/
var R_digit = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"];
for (var i = 2; i <= 36; i++) {
assert.sameValue(BigInt.parseInt(R_digit[i - 2] + "$", i), BigInt(i - 1));
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment