mirror of https://github.com/tc39/test262.git
Cover NumericLiteral..toString, NaN.toString, Infinity.toString. Fixes gh-1732
This commit is contained in:
parent
1ab47810d1
commit
81db9994c9
20
test/built-ins/Number/prototype/toString/numeric-literal-tostring-default-radix.js
vendored
Normal file
20
test/built-ins/Number/prototype/toString/numeric-literal-tostring-default-radix.js
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
If radix is undefined the Number 10 is used as the value of radix.
|
||||
info: |
|
||||
If radix is undefined, let radixNumber be 10.
|
||||
...
|
||||
If radixNumber = 10, return ! ToString(x).
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in 6.1.6.1.20.
|
||||
|
||||
The optional radix should be an integer value in the inclusive range 2 to 36. If radix is undefined the Number 10 is used as the value of radix.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(), "0");
|
||||
assert.sameValue(1..toString(), "1");
|
||||
assert.sameValue(NaN.toString(), "NaN");
|
||||
assert.sameValue(Infinity.toString(), "Infinity");
|
21
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-1.js
vendored
Normal file
21
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-1.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
If radixNumber < 2 or radixNumber > 36, throw a RangeError exception.
|
||||
---*/
|
||||
|
||||
assert.throws(RangeError, () => {
|
||||
0..toString(1);
|
||||
});
|
||||
assert.throws(RangeError, () => {
|
||||
1..toString(1);
|
||||
});
|
||||
assert.throws(RangeError, () => {
|
||||
NaN.toString(1);
|
||||
});
|
||||
assert.throws(RangeError, () => {
|
||||
Infinity.toString(1);
|
||||
});
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-10.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-10.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (10)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(10), "0");
|
||||
assert.sameValue(1..toString(10), "1");
|
||||
assert.sameValue(NaN.toString(10), "NaN");
|
||||
assert.sameValue(Infinity.toString(10), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-11.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-11.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (11)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(11), "0");
|
||||
assert.sameValue(1..toString(11), "1");
|
||||
assert.sameValue(NaN.toString(11), "NaN");
|
||||
assert.sameValue(Infinity.toString(11), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-12.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-12.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (12)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(12), "0");
|
||||
assert.sameValue(1..toString(12), "1");
|
||||
assert.sameValue(NaN.toString(12), "NaN");
|
||||
assert.sameValue(Infinity.toString(12), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-13.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-13.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (13)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(13), "0");
|
||||
assert.sameValue(1..toString(13), "1");
|
||||
assert.sameValue(NaN.toString(13), "NaN");
|
||||
assert.sameValue(Infinity.toString(13), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-14.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-14.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (14)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(14), "0");
|
||||
assert.sameValue(1..toString(14), "1");
|
||||
assert.sameValue(NaN.toString(14), "NaN");
|
||||
assert.sameValue(Infinity.toString(14), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-15.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-15.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (15)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(15), "0");
|
||||
assert.sameValue(1..toString(15), "1");
|
||||
assert.sameValue(NaN.toString(15), "NaN");
|
||||
assert.sameValue(Infinity.toString(15), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-16.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-16.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (16)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(16), "0");
|
||||
assert.sameValue(1..toString(16), "1");
|
||||
assert.sameValue(NaN.toString(16), "NaN");
|
||||
assert.sameValue(Infinity.toString(16), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-17.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-17.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (17)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(17), "0");
|
||||
assert.sameValue(1..toString(17), "1");
|
||||
assert.sameValue(NaN.toString(17), "NaN");
|
||||
assert.sameValue(Infinity.toString(17), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-18.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-18.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (18)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(18), "0");
|
||||
assert.sameValue(1..toString(18), "1");
|
||||
assert.sameValue(NaN.toString(18), "NaN");
|
||||
assert.sameValue(Infinity.toString(18), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-19.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-19.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (19)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(19), "0");
|
||||
assert.sameValue(1..toString(19), "1");
|
||||
assert.sameValue(NaN.toString(19), "NaN");
|
||||
assert.sameValue(Infinity.toString(19), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-2.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-2.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (2)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(2), "0");
|
||||
assert.sameValue(1..toString(2), "1");
|
||||
assert.sameValue(NaN.toString(2), "NaN");
|
||||
assert.sameValue(Infinity.toString(2), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-20.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-20.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (20)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(20), "0");
|
||||
assert.sameValue(1..toString(20), "1");
|
||||
assert.sameValue(NaN.toString(20), "NaN");
|
||||
assert.sameValue(Infinity.toString(20), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-21.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-21.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (21)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(21), "0");
|
||||
assert.sameValue(1..toString(21), "1");
|
||||
assert.sameValue(NaN.toString(21), "NaN");
|
||||
assert.sameValue(Infinity.toString(21), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-22.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-22.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (22)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(22), "0");
|
||||
assert.sameValue(1..toString(22), "1");
|
||||
assert.sameValue(NaN.toString(22), "NaN");
|
||||
assert.sameValue(Infinity.toString(22), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-23.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-23.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (23)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(23), "0");
|
||||
assert.sameValue(1..toString(23), "1");
|
||||
assert.sameValue(NaN.toString(23), "NaN");
|
||||
assert.sameValue(Infinity.toString(23), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-24.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-24.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (24)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(24), "0");
|
||||
assert.sameValue(1..toString(24), "1");
|
||||
assert.sameValue(NaN.toString(24), "NaN");
|
||||
assert.sameValue(Infinity.toString(24), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-25.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-25.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (25)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(25), "0");
|
||||
assert.sameValue(1..toString(25), "1");
|
||||
assert.sameValue(NaN.toString(25), "NaN");
|
||||
assert.sameValue(Infinity.toString(25), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-26.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-26.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (26)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(26), "0");
|
||||
assert.sameValue(1..toString(26), "1");
|
||||
assert.sameValue(NaN.toString(26), "NaN");
|
||||
assert.sameValue(Infinity.toString(26), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-27.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-27.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (27)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(27), "0");
|
||||
assert.sameValue(1..toString(27), "1");
|
||||
assert.sameValue(NaN.toString(27), "NaN");
|
||||
assert.sameValue(Infinity.toString(27), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-28.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-28.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (28)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(28), "0");
|
||||
assert.sameValue(1..toString(28), "1");
|
||||
assert.sameValue(NaN.toString(28), "NaN");
|
||||
assert.sameValue(Infinity.toString(28), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-29.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-29.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (29)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(29), "0");
|
||||
assert.sameValue(1..toString(29), "1");
|
||||
assert.sameValue(NaN.toString(29), "NaN");
|
||||
assert.sameValue(Infinity.toString(29), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-3.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-3.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (3)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(3), "0");
|
||||
assert.sameValue(1..toString(3), "1");
|
||||
assert.sameValue(NaN.toString(3), "NaN");
|
||||
assert.sameValue(Infinity.toString(3), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-30.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-30.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (30)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(30), "0");
|
||||
assert.sameValue(1..toString(30), "1");
|
||||
assert.sameValue(NaN.toString(30), "NaN");
|
||||
assert.sameValue(Infinity.toString(30), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-31.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-31.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (31)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(31), "0");
|
||||
assert.sameValue(1..toString(31), "1");
|
||||
assert.sameValue(NaN.toString(31), "NaN");
|
||||
assert.sameValue(Infinity.toString(31), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-32.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-32.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (32)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(32), "0");
|
||||
assert.sameValue(1..toString(32), "1");
|
||||
assert.sameValue(NaN.toString(32), "NaN");
|
||||
assert.sameValue(Infinity.toString(32), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-33.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-33.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (33)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(33), "0");
|
||||
assert.sameValue(1..toString(33), "1");
|
||||
assert.sameValue(NaN.toString(33), "NaN");
|
||||
assert.sameValue(Infinity.toString(33), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-34.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-34.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (34)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(34), "0");
|
||||
assert.sameValue(1..toString(34), "1");
|
||||
assert.sameValue(NaN.toString(34), "NaN");
|
||||
assert.sameValue(Infinity.toString(34), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-35.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-35.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (35)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(35), "0");
|
||||
assert.sameValue(1..toString(35), "1");
|
||||
assert.sameValue(NaN.toString(35), "NaN");
|
||||
assert.sameValue(Infinity.toString(35), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-36.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-36.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (36)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(36), "0");
|
||||
assert.sameValue(1..toString(36), "1");
|
||||
assert.sameValue(NaN.toString(36), "NaN");
|
||||
assert.sameValue(Infinity.toString(36), "Infinity");
|
21
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-37.js
vendored
Normal file
21
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-37.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
If radixNumber < 2 or radixNumber > 36, throw a RangeError exception.
|
||||
---*/
|
||||
|
||||
assert.throws(RangeError, () => {
|
||||
0..toString(37);
|
||||
});
|
||||
assert.throws(RangeError, () => {
|
||||
1..toString(37);
|
||||
});
|
||||
assert.throws(RangeError, () => {
|
||||
NaN.toString(37);
|
||||
});
|
||||
assert.throws(RangeError, () => {
|
||||
Infinity.toString(37);
|
||||
});
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-4.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-4.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (4)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(4), "0");
|
||||
assert.sameValue(1..toString(4), "1");
|
||||
assert.sameValue(NaN.toString(4), "NaN");
|
||||
assert.sameValue(Infinity.toString(4), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-5.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-5.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (5)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(5), "0");
|
||||
assert.sameValue(1..toString(5), "1");
|
||||
assert.sameValue(NaN.toString(5), "NaN");
|
||||
assert.sameValue(Infinity.toString(5), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-6.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-6.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (6)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(6), "0");
|
||||
assert.sameValue(1..toString(6), "1");
|
||||
assert.sameValue(NaN.toString(6), "NaN");
|
||||
assert.sameValue(Infinity.toString(6), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-7.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-7.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (7)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(7), "0");
|
||||
assert.sameValue(1..toString(7), "1");
|
||||
assert.sameValue(NaN.toString(7), "NaN");
|
||||
assert.sameValue(Infinity.toString(7), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-8.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-8.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (8)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(8), "0");
|
||||
assert.sameValue(1..toString(8), "1");
|
||||
assert.sameValue(NaN.toString(8), "NaN");
|
||||
assert.sameValue(Infinity.toString(8), "Infinity");
|
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-9.js
vendored
Normal file
15
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-9.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Calling toString(radix) (9)
|
||||
info: |
|
||||
Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-defined, however the algorithm should be a generalization of that specified in sec-numeric-types-number-tostring.
|
||||
---*/
|
||||
|
||||
assert.sameValue(0..toString(9), "0");
|
||||
assert.sameValue(1..toString(9), "1");
|
||||
assert.sameValue(NaN.toString(9), "NaN");
|
||||
assert.sameValue(Infinity.toString(9), "Infinity");
|
26
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-poisoned.js
vendored
Normal file
26
test/built-ins/Number/prototype/toString/numeric-literal-tostring-radix-poisoned.js
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
// Copyright 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-number.prototype.tostring
|
||||
description: >
|
||||
Else, let radixNumber be ? ToInteger(radix).
|
||||
---*/
|
||||
|
||||
var poisoned = {
|
||||
valueOf() {
|
||||
throw new Test262Error();
|
||||
}
|
||||
};
|
||||
assert.throws(Test262Error, () => {
|
||||
0..toString(poisoned);
|
||||
});
|
||||
assert.throws(Test262Error, () => {
|
||||
1..toString(poisoned);
|
||||
});
|
||||
assert.throws(Test262Error, () => {
|
||||
NaN.toString(poisoned);
|
||||
});
|
||||
assert.throws(Test262Error, () => {
|
||||
Infinity.toString(poisoned);
|
||||
});
|
Loading…
Reference in New Issue