From eff5ba2c98c18d164234b28c3ccb74b3027b71fa Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Thu, 7 May 2020 22:03:47 -0400 Subject: [PATCH] BigInt/Number.prototype.toString(...), Step 6 --- .../BigInt/prototype/toString/a-z.js | 21 +++++++++++++++++++ .../Number/prototype/toString/a-z.js | 20 ++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 test/built-ins/BigInt/prototype/toString/a-z.js create mode 100644 test/built-ins/Number/prototype/toString/a-z.js diff --git a/test/built-ins/BigInt/prototype/toString/a-z.js b/test/built-ins/BigInt/prototype/toString/a-z.js new file mode 100644 index 0000000000..9860f96be3 --- /dev/null +++ b/test/built-ins/BigInt/prototype/toString/a-z.js @@ -0,0 +1,21 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-bigint.prototype.tostring +description: > + Letters a-z are used for digits with values 10 through 35 +info: | + 6. 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-dependent, however the algorithm should be a + generalization of that specified in 6.1.6.2.23. +features: [BigInt] +---*/ + +for (let radix = 11; radix < 36; radix++) { + for (let i = 10n; i < radix; i++) { + assert.sameValue(i.toString(radix), String.fromCharCode(Number(i + 87n))); + } +} diff --git a/test/built-ins/Number/prototype/toString/a-z.js b/test/built-ins/Number/prototype/toString/a-z.js new file mode 100644 index 0000000000..e5fac6528e --- /dev/null +++ b/test/built-ins/Number/prototype/toString/a-z.js @@ -0,0 +1,20 @@ +// Copyright (C) 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: > + Letters a-z are used for digits with values 10 through 35 +info: | + 6. 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-dependent, however the algorithm should be a + generalization of that specified in 6.1.6.1.20. +---*/ + +for (let radix = 11; radix < 36; radix++) { + for (let i = 10; i < radix; i++) { + assert.sameValue(i.toString(radix), String.fromCharCode(i + 87)); + } +}