| 1 |
// Copyright (C) 2017 Caio Lima. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
description: Hexdecimal prefixed String should be parsed to BigInt according StringToBigInt |
| 6 |
esid: sec-string-to-bigint |
| 7 |
info: | |
| 8 |
Apply the algorithm in 3.1.3.1 with the following changes: |
| 9 |
|
| 10 |
- Replace the StrUnsignedDecimalLiteral production with DecimalDigits |
| 11 |
to not allow decimal points or exponents. |
| 12 |
|
| 13 |
features: [BigInt] |
| 14 |
---*/ |
| 15 |
|
| 16 |
assert.sameValue(BigInt("0xa"), 10n); |
| 17 |
assert.sameValue(BigInt("0xff"), 255n); |
| 18 |
assert.sameValue(BigInt("0xfabc"), 64188n); |
| 19 |
assert.sameValue(BigInt("0xfffffffffffffffffff"), 75557863725914323419135n); |
| 20 |
|
| 21 |
assert.sameValue(BigInt("0Xa"), 10n); |
| 22 |
assert.sameValue(BigInt("0Xff"), 255n); |
| 23 |
assert.sameValue(BigInt("0Xfabc"), 64188n); |
| 24 |
assert.sameValue(BigInt("0Xfffffffffffffffffff"), 75557863725914323419135n); |