| 1 |
// Copyright (C) 2015 the V8 project authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
es6id: 11.8.3.1 |
| 6 |
description: Mathematical value of valid binary integer literals |
| 7 |
info: | |
| 8 |
The MV of BinaryIntegerLiteral :: 0b BinaryDigits is the MV of |
| 9 |
BinaryDigits. |
| 10 |
The MV of BinaryIntegerLiteral :: 0B BinaryDigits is the MV of |
| 11 |
BinaryDigits. |
| 12 |
The MV of BinaryDigits :: BinaryDigit is the MV of BinaryDigit. |
| 13 |
The MV of BinaryDigits :: BinaryDigits BinaryDigit is (the MV of |
| 14 |
BinaryDigits × 2) plus the MV of BinaryDigit. |
| 15 |
---*/ |
| 16 |
|
| 17 |
assert.sameValue(0b0, 0, 'lower-case head'); |
| 18 |
assert.sameValue(0B0, 0, 'upper-case head'); |
| 19 |
assert.sameValue(0b00, 0, 'lower-case head with leading zeros'); |
| 20 |
assert.sameValue(0B00, 0, 'upper-case head with leading zeros'); |
| 21 |
|
| 22 |
assert.sameValue(0b1, 1, 'lower-case head'); |
| 23 |
assert.sameValue(0B1, 1, 'upper-case head'); |
| 24 |
assert.sameValue(0b01, 1, 'lower-case head with leading zeros'); |
| 25 |
assert.sameValue(0B01, 1, 'upper-case head with leading zeros'); |
| 26 |
|
| 27 |
assert.sameValue(0b10, 2, 'lower-case head'); |
| 28 |
assert.sameValue(0B10, 2, 'upper-case head'); |
| 29 |
assert.sameValue(0b010, 2, 'lower-case head with leading zeros'); |
| 30 |
assert.sameValue(0B010, 2, 'upper-case head with leading zeros'); |
| 31 |
|
| 32 |
assert.sameValue(0b11, 3, 'lower-case head'); |
| 33 |
assert.sameValue(0B11, 3, 'upper-case head'); |
| 34 |
assert.sameValue(0b011, 3, 'lower-case head with leading zeros'); |
| 35 |
assert.sameValue(0B011, 3, 'upper-case head with leading zeros'); |