Debian Codegraph @

js/src/tests/test262/built-ins/parseInt/S15.1.2.2_A5.2_T2.js

raw
1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 info: |
6 If the length of S is at least 2 and the first two characters of S
7 are either 0x or 0X, then remove the first two characters from S and let R = 16
8 esid: sec-parseint-string-radix
9 description: ": 0X"
10 ---*/
11
12 assert.sameValue(parseInt("0X0", 0), parseInt("0", 16), 'parseInt("0X0", 0) must return the same value returned by parseInt("0", 16)');
13 assert.sameValue(parseInt("0X1"), parseInt("1", 16), 'parseInt("0X1") must return the same value returned by parseInt("1", 16)');
14 assert.sameValue(parseInt("0X2"), parseInt("2", 16), 'parseInt("0X2") must return the same value returned by parseInt("2", 16)');
15 assert.sameValue(parseInt("0X3"), parseInt("3", 16), 'parseInt("0X3") must return the same value returned by parseInt("3", 16)');
16 assert.sameValue(parseInt("0X4"), parseInt("4", 16), 'parseInt("0X4") must return the same value returned by parseInt("4", 16)');
17 assert.sameValue(parseInt("0X5"), parseInt("5", 16), 'parseInt("0X5") must return the same value returned by parseInt("5", 16)');
18 assert.sameValue(parseInt("0X6"), parseInt("6", 16), 'parseInt("0X6") must return the same value returned by parseInt("6", 16)');
19 assert.sameValue(parseInt("0X7"), parseInt("7", 16), 'parseInt("0X7") must return the same value returned by parseInt("7", 16)');
20 assert.sameValue(parseInt("0X8"), parseInt("8", 16), 'parseInt("0X8") must return the same value returned by parseInt("8", 16)');
21 assert.sameValue(parseInt("0X9"), parseInt("9", 16), 'parseInt("0X9") must return the same value returned by parseInt("9", 16)');
22 assert.sameValue(parseInt("0XA"), parseInt("A", 16), 'parseInt("0XA") must return the same value returned by parseInt("A", 16)');
23 assert.sameValue(parseInt("0XB"), parseInt("B", 16), 'parseInt("0XB") must return the same value returned by parseInt("B", 16)');
24 assert.sameValue(parseInt("0XC"), parseInt("C", 16), 'parseInt("0XC") must return the same value returned by parseInt("C", 16)');
25 assert.sameValue(parseInt("0XD"), parseInt("D", 16), 'parseInt("0XD") must return the same value returned by parseInt("D", 16)');
26 assert.sameValue(parseInt("0XE"), parseInt("E", 16), 'parseInt("0XE") must return the same value returned by parseInt("E", 16)');
27 assert.sameValue(parseInt("0XF"), parseInt("F", 16), 'parseInt("0XF") must return the same value returned by parseInt("F", 16)');
28 assert.sameValue(parseInt("0XE"), parseInt("E", 16), 'parseInt("0XE") must return the same value returned by parseInt("E", 16)');
29 assert.sameValue(parseInt("0XABCDEF"), parseInt("ABCDEF", 16), 'parseInt("0XABCDEF") must return the same value returned by parseInt("ABCDEF", 16)');
30
31 reportCompare(0, 0);