octal.js (2033B)
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 octal integer literals 7 info: | 8 The MV of StrNumericLiteral ::: OctalIntegerLiteral is the MV of 9 OctalIntegerLiteral. 10 The MV of OctalIntegerLiteral :: 0o OctalDigits is the MV of OctalDigits. 11 The MV of OctalIntegerLiteral :: 0O OctalDigits is the MV of OctalDigits. 12 The MV of OctalDigits :: OctalDigit is the MV of OctalDigit. 13 The MV of OctalDigits :: OctalDigits OctalDigit is (the MV of OctalDigits × 14 8) plus the MV of OctalDigit. 15 ---*/ 16 17 assert.sameValue(0o0, 0, 'lower-case head'); 18 assert.sameValue(0O0, 0, 'upper-case head'); 19 assert.sameValue(0o00, 0, 'lower-case head with leading zeros'); 20 assert.sameValue(0O00, 0, 'upper-case head with leading zeros'); 21 22 assert.sameValue(0o1, 1, 'lower-case head'); 23 assert.sameValue(0O1, 1, 'upper-case head'); 24 assert.sameValue(0o01, 1, 'lower-case head with leading zeros'); 25 assert.sameValue(0O01, 1, 'upper-case head with leading zeros'); 26 27 assert.sameValue(0o7, 7, 'lower-case head'); 28 assert.sameValue(0O7, 7, 'upper-case head'); 29 assert.sameValue(0o07, 7, 'lower-case head with leading zeros'); 30 assert.sameValue(0O07, 7, 'upper-case head with leading zeros'); 31 32 assert.sameValue(0o10, 8, 'lower-case head'); 33 assert.sameValue(0O10, 8, 'upper-case head'); 34 assert.sameValue(0o010, 8, 'lower-case head with leading zeros'); 35 assert.sameValue(0O010, 8, 'upper-case head with leading zeros'); 36 37 assert.sameValue(0o11, 9, 'lower-case head'); 38 assert.sameValue(0O11, 9, 'upper-case head'); 39 assert.sameValue(0o011, 9, 'lower-case head with leading zeros'); 40 assert.sameValue(0O011, 9, 'upper-case head with leading zeros'); 41 42 assert.sameValue(0o77, 63, 'lower-case head'); 43 assert.sameValue(0O77, 63, 'upper-case head'); 44 assert.sameValue(0o077, 63, 'lower-case head with leading zeros'); 45 assert.sameValue(0O077, 63, 'upper-case head with leading zeros'); 46 47 reportCompare(0, 0);