From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- .../test262/language/literals/numeric/binary.js | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 js/src/tests/test262/language/literals/numeric/binary.js (limited to 'js/src/tests/test262/language/literals/numeric/binary.js') diff --git a/js/src/tests/test262/language/literals/numeric/binary.js b/js/src/tests/test262/language/literals/numeric/binary.js new file mode 100644 index 0000000000..703e64bd14 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/binary.js @@ -0,0 +1,37 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 11.8.3.1 +description: Mathematical value of valid binary integer literals +info: | + The MV of BinaryIntegerLiteral :: 0b BinaryDigits is the MV of + BinaryDigits. + The MV of BinaryIntegerLiteral :: 0B BinaryDigits is the MV of + BinaryDigits. + The MV of BinaryDigits :: BinaryDigit is the MV of BinaryDigit. + The MV of BinaryDigits :: BinaryDigits BinaryDigit is (the MV of + BinaryDigits × 2) plus the MV of BinaryDigit. +---*/ + +assert.sameValue(0b0, 0, 'lower-case head'); +assert.sameValue(0B0, 0, 'upper-case head'); +assert.sameValue(0b00, 0, 'lower-case head with leading zeros'); +assert.sameValue(0B00, 0, 'upper-case head with leading zeros'); + +assert.sameValue(0b1, 1, 'lower-case head'); +assert.sameValue(0B1, 1, 'upper-case head'); +assert.sameValue(0b01, 1, 'lower-case head with leading zeros'); +assert.sameValue(0B01, 1, 'upper-case head with leading zeros'); + +assert.sameValue(0b10, 2, 'lower-case head'); +assert.sameValue(0B10, 2, 'upper-case head'); +assert.sameValue(0b010, 2, 'lower-case head with leading zeros'); +assert.sameValue(0B010, 2, 'upper-case head with leading zeros'); + +assert.sameValue(0b11, 3, 'lower-case head'); +assert.sameValue(0B11, 3, 'upper-case head'); +assert.sameValue(0b011, 3, 'lower-case head with leading zeros'); +assert.sameValue(0B011, 3, 'upper-case head with leading zeros'); + +reportCompare(0, 0); -- cgit v1.2.3