summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/latin1/parseInt-parseFloat.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/src/jit-test/tests/latin1/parseInt-parseFloat.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/jit-test/tests/latin1/parseInt-parseFloat.js')
-rw-r--r--js/src/jit-test/tests/latin1/parseInt-parseFloat.js43
1 files changed, 43 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/latin1/parseInt-parseFloat.js b/js/src/jit-test/tests/latin1/parseInt-parseFloat.js
new file mode 100644
index 000000000..7240224d1
--- /dev/null
+++ b/js/src/jit-test/tests/latin1/parseInt-parseFloat.js
@@ -0,0 +1,43 @@
+function toLatin1(s) {
+ assertEq(isLatin1(s), true);
+ return s;
+}
+function testParseInt() {
+ // Latin1
+ assertEq(parseInt(toLatin1("12345abc")), 12345);
+ assertEq(parseInt(toLatin1("0x5")), 0x5);
+ assertEq(parseInt(toLatin1("-123")), -123);
+ assertEq(parseInt(toLatin1("xyz")), NaN);
+ assertEq(parseInt(toLatin1("1234GHI"), 17), 94298);
+ assertEq(parseInt(toLatin1("9007199254749999")), 9007199254750000);
+ assertEq(parseInt(toLatin1(" 9007199254749998"), 16), 10378291982571444000);
+
+ // TwoByte
+ assertEq(parseInt("12345abc\u1200"), 12345);
+ assertEq(parseInt("0x5\u1200"), 0x5);
+ assertEq(parseInt(" -123\u1200"), -123);
+ assertEq(parseInt("\u1200"), NaN);
+ assertEq(parseInt("1234GHI\u1200", 17), 94298);
+ assertEq(parseInt("9007199254749999\u1200"), 9007199254750000);
+ assertEq(parseInt(" 9007199254749998\u1200", 16), 10378291982571444000);
+}
+testParseInt();
+
+function testParseFloat() {
+ // Latin1
+ assertEq(parseFloat(toLatin1("3.1415")), 3.1415);
+ assertEq(parseFloat(toLatin1(" -1234")), -1234);
+ assertEq(parseFloat(toLatin1("\u00AA")), NaN);
+ assertEq(parseFloat(toLatin1("Infinityabc")), Infinity);
+ assertEq(parseFloat(toLatin1("-Infinity")), -Infinity);
+ assertEq(parseFloat(toLatin1("\t\t\t+Infinity")), Infinity);
+
+ // TwoByte
+ assertEq(parseFloat("3.1415\u0FFF"), 3.1415);
+ assertEq(parseFloat(" -1234\u0FFF"), -1234);
+ assertEq(parseFloat("\u00AA\u0FFF"), NaN);
+ assertEq(parseFloat("Infinityabc\u0FFF"), Infinity);
+ assertEq(parseFloat("-Infinity\u0FFF"), -Infinity);
+ assertEq(parseFloat("\t\t\t+Infinity\u0FFF"), Infinity);
+}
+testParseFloat();