diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/parseInt/S15.1.2.2_A6.1_T6.js')
-rw-r--r-- | js/src/tests/test262/built-ins/parseInt/S15.1.2.2_A6.1_T6.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/parseInt/S15.1.2.2_A6.1_T6.js b/js/src/tests/test262/built-ins/parseInt/S15.1.2.2_A6.1_T6.js new file mode 100644 index 0000000000..3942540f0e --- /dev/null +++ b/js/src/tests/test262/built-ins/parseInt/S15.1.2.2_A6.1_T6.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If S contains any character that is not a radix-R digit, + then let Z be the substring of S consisting of all characters before + the first such character; otherwise, let Z be S +esid: sec-parseint-string-radix +description: Complex test. Radix-R notation in [0..9] +---*/ + +assert.sameValue(parseInt("0123456789", 2), 1, 'parseInt("0123456789", 2) must return 1'); +assert.sameValue(parseInt("01234567890", 3), 5, 'parseInt("01234567890", 3) must return 5'); +assert.sameValue(parseInt("01234567890", 4), 27, 'parseInt("01234567890", 4) must return 27'); +assert.sameValue(parseInt("01234567890", 5), 194, 'parseInt("01234567890", 5) must return 194'); +assert.sameValue(parseInt("01234567890", 6), 1865, 'parseInt("01234567890", 6) must return 1865'); +assert.sameValue(parseInt("01234567890", 7), 22875, 'parseInt("01234567890", 7) must return 22875'); +assert.sameValue(parseInt("01234567890", 8), 342391, 'parseInt("01234567890", 8) must return 342391'); +assert.sameValue(parseInt("01234567890", 9), 6053444, 'parseInt("01234567890", 9) must return 6053444'); + +assert.sameValue( + parseInt("01234567890", 10), + Number(1234567890), + 'parseInt("01234567890", 10) must return the same value returned by Number(1234567890)' +); + +reportCompare(0, 0); |