diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/built-ins/parseFloat | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/parseFloat')
61 files changed, 1829 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/parseFloat/15.1.2.3-2-1.js b/js/src/tests/test262/built-ins/parseFloat/15.1.2.3-2-1.js new file mode 100644 index 0000000000..06fa71941f --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/15.1.2.3-2-1.js @@ -0,0 +1,13 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-parsefloat-string +description: > + pareseFloat - 'trimmedString' is the empty string when inputString + does not contain any such characters +---*/ + +assert.sameValue(parseFloat(""), NaN, 'parseFloat("")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A1_T1.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A1_T1.js new file mode 100644 index 0000000000..0d12df1ebd --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A1_T1.js @@ -0,0 +1,13 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator use ToString +esid: sec-parsefloat-string +description: Checking for boolean primitive +---*/ + +assert.sameValue(parseFloat(true), NaN, "true"); +assert.sameValue(parseFloat(false), NaN, "false"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A1_T2.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A1_T2.js new file mode 100644 index 0000000000..731963f0c5 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A1_T2.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator use ToString +esid: sec-parsefloat-string +description: Checking for number primitive +---*/ + +//CHECK#1 +if (parseFloat(-1.1) !== parseFloat("-1.1")) { + throw new Test262Error('#1: parseFloat(-1.1) === parseFloat("-1.1"). Actual: ' + (parseFloat(-1.1))); +} + +//CHECK#2 +if (parseFloat(Infinity) !== parseFloat("Infinity")) { + throw new Test262Error('#2: parseFloat(Infinity) === parseFloat("Infinity"). Actual: ' + (parseFloat(Infinity))); +} + +//CHECK#3 +if (String(parseFloat(NaN)) !== "NaN") { + throw new Test262Error('#3: String(parseFloat(NaN)) === "NaN". Actual: ' + (String(parseFloat(NaN)))); +} + +//CHECK#4 +if (parseFloat(.01e+2) !== parseFloat(".01e+2")) { + throw new Test262Error('#4: parseFloat(.01e+2) === parseFloat(".01e+2"). Actual: ' + (parseFloat(.01e+2))); +} + +//CHECK#5 +if (parseFloat(-0) !== 0) { + throw new Test262Error('#5: parseFloat(-0) === 0. Actual: ' + (parseFloat(-0))); +} else { + if (1 / parseFloat(-0) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#5: parseFloat(-0) === +0. Actual: ' + (parseFloat(-0))); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A1_T3.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A1_T3.js new file mode 100644 index 0000000000..fb3d33c76a --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A1_T3.js @@ -0,0 +1,13 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator use ToString +esid: sec-parsefloat-string +description: Checking for undefined and null +---*/ + +assert.sameValue(parseFloat(undefined), NaN, "undefined"); +assert.sameValue(parseFloat(null), NaN, "null"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A1_T4.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A1_T4.js new file mode 100644 index 0000000000..3975eef777 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A1_T4.js @@ -0,0 +1,13 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator use ToString +esid: sec-parsefloat-string +description: Checking for Boolean object +---*/ + +assert.sameValue(parseFloat(new Boolean(true)), NaN, "new Boolean(true)"); +assert.sameValue(parseFloat(new Boolean(false)), NaN, "new Boolean(false)"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A1_T5.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A1_T5.js new file mode 100644 index 0000000000..e8af41a386 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A1_T5.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator use ToString +esid: sec-parsefloat-string +description: Checking for Number object +---*/ + +//CHECK#1 +if (parseFloat(new Number(-1.1)) !== parseFloat("-1.1")) { + throw new Test262Error('#1: parseFloat(new Number(-1.1)) === parseFloat("-1.1"). Actual: ' + (parseFloat(new Number(-1.1)))); +} + +//CHECK#2 +if (parseFloat(new Number(Infinity)) !== parseFloat("Infinity")) { + throw new Test262Error('#2: parseFloat(new Number(Infinity)) === parseFloat("Infinity"). Actual: ' + (parseFloat(new Number(Infinity)))); +} + +//CHECK#3 +if (String(parseFloat(new Number(NaN))) !== "NaN") { + throw new Test262Error('#3: String(parseFloat(new Number(NaN))) === "NaN". Actual: ' + (String(parseFloat(new Number(NaN))))); +} + +//CHECK#4 +if (parseFloat(new Number(.01e+2)) !== parseFloat(".01e+2")) { + throw new Test262Error('#4: parseFloat(new Number(.01e+2)) === parseFloat(".01e+2"). Actual: ' + (parseFloat(new Number(.01e+2)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A1_T6.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A1_T6.js new file mode 100644 index 0000000000..47282fe4d0 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A1_T6.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator use ToString +esid: sec-parsefloat-string +description: Checking for String object +---*/ + +//CHECK#1 +if (parseFloat(new String("-1.1")) !== parseFloat("-1.1")) { + throw new Test262Error('#1: parseFloat(new String("-1.1")) === parseFloat("-1.1"). Actual: ' + (parseFloat(new String("-1.1")))); +} + +//CHECK#2 +if (parseFloat(new String("Infinity")) !== parseFloat("Infinity")) { + throw new Test262Error('#2: parseFloat(new String("Infinity")) === parseFloat("Infinity"). Actual: ' + (parseFloat(new String("Infinity")))); +} + +//CHECK#3 +if (String(parseFloat(new String("NaN"))) !== "NaN") { + throw new Test262Error('#3: String(parseFloat(new String("NaN"))) === "NaN". Actual: ' + (String(parseFloat(new String("NaN"))))); +} + +//CHECK#4 +if (parseFloat(new String(".01e+2")) !== parseFloat(".01e+2")) { + throw new Test262Error('#4: parseFloat(new String(".01e+2")) === parseFloat(".01e+2"). Actual: ' + (parseFloat(new String(".01e+2")))); +} + +//CHECK#5 +if (String(parseFloat(new String("false"))) !== "NaN") { + throw new Test262Error('#5: String(parseFloat(new String("false"))) === "NaN". Actual: ' + (String(parseFloat(new String("false"))))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A1_T7.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A1_T7.js new file mode 100644 index 0000000000..e2d332b758 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A1_T7.js @@ -0,0 +1,127 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator use ToString +esid: sec-parsefloat-string +description: If Type(value) is Object, evaluate ToPrimitive(value, String) +---*/ + +//CHECK#1 +var object = { + valueOf: function() { + return 1 + } +}; +assert.sameValue(parseFloat(object), NaN, "{valueOf: function() {return 1}}"); + +//CHECK#2 +var object = { + valueOf: function() { + return 1 + }, + toString: function() { + return 0 + } +}; +if (parseFloat(object) !== 0) { + throw new Test262Error('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; parseFloat(object) === 0. Actual: ' + (parseFloat(object))); +} + +//CHECK#3 +var object = { + valueOf: function() { + return 1 + }, + toString: function() { + return {} + } +}; +if (parseFloat(object) !== 1) { + throw new Test262Error('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; parseFloat(object) === 1. Actual: ' + (parseFloat(object))); +} + +//CHECK#4 +try { + var object = { + valueOf: function() { + throw "error" + }, + toString: function() { + return 1 + } + }; + if (parseFloat(object) !== 1) { + throw new Test262Error('#4.1: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; parseFloat(object) === 1. Actual: ' + (parseFloat(object))); + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; parseFloat(object) not throw "error"'); + } else { + throw new Test262Error('#4.3: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; parseFloat(object) not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = { + toString: function() { + return 1 + } +}; +if (parseFloat(object) !== 1) { + throw new Test262Error('#5: var object = {toString: function() {return 1}}; parseFloat(object) === 1. Actual: ' + (parseFloat(object))); +} + +//CHECK#6 +var object = { + valueOf: function() { + return {} + }, + toString: function() { + return 1 + } +} +if (parseFloat(object) !== 1) { + throw new Test262Error('#6: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; parseFloat(object) === 1. Actual: ' + (parseFloat(object))); +} + +//CHECK#7 +try { + var object = { + valueOf: function() { + return 1 + }, + toString: function() { + throw "error" + } + }; + parseFloat(object); + throw new Test262Error('#7.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; parseFloat(object) throw "error". Actual: ' + (parseFloat(object))); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; parseFloat(object) throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = { + valueOf: function() { + return {} + }, + toString: function() { + return {} + } + }; + parseFloat(object); + throw new Test262Error('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; parseFloat(object) throw TypeError. Actual: ' + (parseFloat(object))); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; parseFloat(object) throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T1.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T1.js new file mode 100644 index 0000000000..8208fe2d4c --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T1.js @@ -0,0 +1,38 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator remove leading StrWhiteSpaceChar +esid: sec-parsefloat-string +description: "StrWhiteSpaceChar :: TAB (U+0009)" +---*/ + +//CHECK#1 +if (parseFloat("\u00091.1") !== parseFloat("1.1")) { + throw new Test262Error('#1: parseFloat("\\u00091.1") === parseFloat("1.1"). Actual: ' + (parseFloat("\u00091.1"))); +} + +//CHECK#2 +if (parseFloat("\u0009\u0009-1.1") !== parseFloat("-1.1")) { + throw new Test262Error('#2: parseFloat("\\u0009\\u0009-1.1") === parseFloat("-1.1"). Actual: ' + (parseFloat("\u0009\u0009-1.1"))); +} + +//CHECK#3 +if (parseFloat(" 1.1") !== parseFloat("1.1")) { + throw new Test262Error('#3: parseFloat(" 1.1") === parseFloat("1.1"). Actual: ' + (parseFloat(" 1.1"))); +} + +//CHECK#4 +if (parseFloat(" 1.1") !== parseFloat("1.1")) { + throw new Test262Error('#4: parseFloat(" 1.1") === parseFloat("1.1"). Actual: ' + (parseFloat(" 1.1"))); +} + +//CHECK#5 +if (parseFloat(" \u0009 \u0009-1.1") !== parseFloat("-1.1")) { + throw new Test262Error('#5: parseFloat(" \\u0009 \\u0009-1.1") === parseFloat("-1.1"). Actual: ' + (parseFloat(" \u0009 \u0009-1.1"))); +} + +//CHECK#6 +assert.sameValue(parseFloat("\u0009"), NaN, "'\u0009'"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T10.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T10.js new file mode 100644 index 0000000000..d084a46b1a --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T10.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator remove leading StrWhiteSpaceChar +esid: sec-parsefloat-string +description: "StrWhiteSpaceChar :: USP" +---*/ + +//CHECK# +var n; +var uspU = ["\u1680", "\u2000", "\u2001", "\u2002", "\u2003", "\u2004", "\u2005", "\u2006", "\u2007", "\u2008", "\u2009", "\u200A", "\u202F", "\u205F", "\u3000"]; +var uspS = ["1680", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "200A", "202F", "205F", "3000"]; +for (var index = 0; index < uspU.length; index++) { + if (parseFloat(uspU[index] + "1.1") !== parseFloat("1.1")) { + throw new Test262Error('#1.' + uspS[index] + ' '); + } + if (parseFloat(uspU[index] + uspU[index] + uspU[index] + "1.1") !== parseFloat("1.1")) { + throw new Test262Error('#2.' + uspS[index] + ' '); + } + n = parseFloat(uspU[index]); + if (!(n !== n)) { + throw new Test262Error('#3.' + uspS[index] + ' '); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T10_U180E.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T10_U180E.js new file mode 100644 index 0000000000..a687528aab --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T10_U180E.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-parsefloat-string +description: > + Leading U+180E is not recognized as whitespace +info: | + 18.2.4 parseFloat (string) + + ... + 3. Let trimmedString be a substring of inputString consisting of the + leftmost code unit that is not a StrWhiteSpaceChar and all code units + to the right of that code unit. (In other words, remove leading white + space.) If inputString does not contain any such code units, let + trimmedString be the empty string. + 4. If neither trimmedString nor any prefix of trimmedString satisfies the + syntax of a StrDecimalLiteral (see 7.1.3.1), return NaN. + ... +features: [u180e] +---*/ + +var mongolianVowelSeparator = "\u180E"; + +assert.sameValue(parseFloat(mongolianVowelSeparator + "1.1"), NaN, "Single leading U+180E"); +assert.sameValue(parseFloat(mongolianVowelSeparator + mongolianVowelSeparator + mongolianVowelSeparator + "1.1"), NaN, "Multiple leading U+180E"); +assert.sameValue(parseFloat(mongolianVowelSeparator), NaN, "Only U+180E"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T2.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T2.js new file mode 100644 index 0000000000..68742bb353 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T2.js @@ -0,0 +1,38 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator remove leading StrWhiteSpaceChar +esid: sec-parsefloat-string +description: "StrWhiteSpaceChar :: SP (U+0020)" +---*/ + +//CHECK#1 +if (parseFloat("\u00201.1") !== parseFloat("1.1")) { + throw new Test262Error('#1: parseFloat("\\u00201.1") === parseFloat("1.1"). Actual: ' + (parseFloat("\u00201.1"))); +} + +//CHECK#2 +if (parseFloat("\u0020\u0020-1.1") !== parseFloat("-1.1")) { + throw new Test262Error('#2: parseFloat("\\u0020\\u0020-1.1") === parseFloat("-1.1"). Actual: ' + (parseFloat("\u0020\u0020-1.1"))); +} + +//CHECK#3 +if (parseFloat(" 1.1") !== parseFloat("1.1")) { + throw new Test262Error('#3: parseFloat(" 1.1") === parseFloat("1.1"). Actual: ' + (parseFloat(" 1.1"))); +} + +//CHECK#4 +if (parseFloat(" 1.1") !== parseFloat("1.1")) { + throw new Test262Error('#4: parseFloat(" 1.1") === parseFloat("1.1"). Actual: ' + (parseFloat(" 1.1"))); +} + +//CHECK#5 +if (parseFloat(" \u0020 \u0020-1.1") !== parseFloat("-1.1")) { + throw new Test262Error('#5: parseFloat(" \\u0020 \\u0020-1.1") === parseFloat("-1.1"). Actual: ' + (parseFloat(" \u0020 \u0020-1.1"))); +} + +//CHECK#6 +assert.sameValue(parseFloat("\u0020"), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T3.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T3.js new file mode 100644 index 0000000000..214e43ef69 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T3.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator remove leading StrWhiteSpaceChar +esid: sec-parsefloat-string +description: "StrWhiteSpaceChar :: NBSB (U+00A0)" +---*/ + +//CHECK#1 +if (parseFloat("\u00A01.1") !== parseFloat("1.1")) { + throw new Test262Error('#1: parseFloat("\\u00A01.1") === parseFloat("1.1"). Actual: ' + (parseFloat("\u00A01.1"))); +} + +//CHECK#2 +if (parseFloat("\u00A0\u00A0-1.1") !== parseFloat("-1.1")) { + throw new Test262Error('#2: parseFloat("\\u00A0\\u00A0-1.1") === parseFloat("-1.1"). Actual: ' + (parseFloat("\u00A0\u00A0-1.1"))); +} + +//CHECK#3 +assert.sameValue(parseFloat("\u00A0"), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T4.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T4.js new file mode 100644 index 0000000000..73dd7ee47d --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T4.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator remove leading StrWhiteSpaceChar +esid: sec-parsefloat-string +description: "StrWhiteSpaceChar :: FF (U+000C)" +---*/ + +//CHECK#1 +if (parseFloat("\u000C1.1") !== parseFloat("1.1")) { + throw new Test262Error('#1: parseFloat("\\u000C1.1") === parseFloat("1.1"). Actual: ' + (parseFloat("\u000C1.1"))); +} + +//CHECK#2 +if (parseFloat("\u000C\u000C-1.1") !== parseFloat("-1.1")) { + throw new Test262Error('#2: parseFloat("\\u000C\\u000C-1.1") === parseFloat("-1.1"). Actual: ' + (parseFloat("\u000C\u000C-1.1"))); +} + +//CHECK#3 +assert.sameValue(parseFloat("\u000C"), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T5.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T5.js new file mode 100644 index 0000000000..fdd684485e --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T5.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator remove leading StrWhiteSpaceChar +esid: sec-parsefloat-string +description: "StrWhiteSpaceChar :: VT (U+000B)" +---*/ + +//CHECK#1 +if (parseFloat("\u000B1.1") !== parseFloat("1.1")) { + throw new Test262Error('#1: parseFloat("\\u000B1.1") === parseFloat("1.1"). Actual: ' + (parseFloat("\u000B1.1"))); +} + +//CHECK#2 +if (parseFloat("\u000B\u000B-1.1") !== parseFloat("-1.1")) { + throw new Test262Error('#2: parseFloat("\\u000B\\u000B-1.1") === parseFloat("-1.1"). Actual: ' + (parseFloat("\u000B\u000B-1.1"))); +} + +//CHECK#3 +assert.sameValue(parseFloat("\u000B"), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T6.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T6.js new file mode 100644 index 0000000000..6baa99df24 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T6.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator remove leading StrWhiteSpaceChar +esid: sec-parsefloat-string +description: "StrWhiteSpaceChar :: CR (U+000D)" +---*/ + +//CHECK#1 +if (parseFloat("\u000D1.1") !== parseFloat("1.1")) { + throw new Test262Error('#1: parseFloat("\\u000D1.1") === parseFloat("1.1"). Actual: ' + (parseFloat("\u000D1.1"))); +} + +//CHECK#2 +if (parseFloat("\u000D\u000D-1.1") !== parseFloat("-1.1")) { + throw new Test262Error('#2: parseFloat("\\u000D\\u000D-1.1") === parseFloat("-1.1"). Actual: ' + (parseFloat("\u000D\u000D-1.1"))); +} + +//CHECK#3 +assert.sameValue(parseFloat("\u000D"), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T7.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T7.js new file mode 100644 index 0000000000..5f5312cd9b --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T7.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator remove leading StrWhiteSpaceChar +esid: sec-parsefloat-string +description: "StrWhiteSpaceChar :: LF (U+000A)" +---*/ + +//CHECK#1 +if (parseFloat("\u000A1.1") !== parseFloat("1.1")) { + throw new Test262Error('#1: parseFloat("\\u000A1.1") === parseFloat("1.1"). Actual: ' + (parseFloat("\u000A1.1"))); +} + +//CHECK#2 +if (parseFloat("\u000A\u000A-1.1") !== parseFloat("-1.1")) { + throw new Test262Error('#2: parseFloat("\\u000A\\u000A-1.1") === parseFloat("-1.1"). Actual: ' + (parseFloat("\u000A\u000A-1.1"))); +} + +//CHECK#3 +assert.sameValue(parseFloat("\u000A"), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T8.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T8.js new file mode 100644 index 0000000000..d4a43ee11f --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T8.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator remove leading StrWhiteSpaceChar +esid: sec-parsefloat-string +description: "StrWhiteSpaceChar :: LS (U+2028)" +---*/ + +//CHECK#1 +if (parseFloat("\u20281.1") !== parseFloat("1.1")) { + throw new Test262Error('#1: parseFloat("\\u20281.1") === parseFloat("1.1"). Actual: ' + (parseFloat("\u20281.1"))); +} + +//CHECK#2 +if (parseFloat("\u2028\u2028-1.1") !== parseFloat("-1.1")) { + throw new Test262Error('#2: parseFloat("\\u2028\\u2028-1.1") === parseFloat("-1.1"). Actual: ' + (parseFloat("\u2028\u2028-1.1"))); +} + +//CHECK#3 +assert.sameValue(parseFloat("\u2028"), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T9.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T9.js new file mode 100644 index 0000000000..7b6b761c74 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A2_T9.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator remove leading StrWhiteSpaceChar +esid: sec-parsefloat-string +description: "StrWhiteSpaceChar :: PS (U+2029)" +---*/ + +//CHECK#1 +if (parseFloat("\u20291.1") !== parseFloat("1.1")) { + throw new Test262Error('#1: parseFloat("\\u20291.1") === parseFloat("1.1"). Actual: ' + (parseFloat("\u20291.1"))); +} + +//CHECK#2 +if (parseFloat("\u2029\u2029-1.1") !== parseFloat("-1.1")) { + throw new Test262Error('#2: parseFloat("\\u2029\\u2029-1.1") === parseFloat("-1.1"). Actual: ' + (parseFloat("\u2029\u2029-1.1"))); +} + +//CHECK#3 +assert.sameValue(parseFloat("\u2029"), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A3_T1.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A3_T1.js new file mode 100644 index 0000000000..98fc07e9b2 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A3_T1.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If neither Result(2) nor any prefix of Result(2) satisfies the syntax of a + StrDecimalLiteral (see 9.3.1), return NaN +esid: sec-parsefloat-string +description: parseFloat("some string") return NaN +---*/ + +assert.sameValue(parseFloat("str"), NaN, "str"); +assert.sameValue(parseFloat("s1"), NaN, "s1"); +assert.sameValue(parseFloat(""), NaN, ""); +assert.sameValue(parseFloat("+"), NaN, "+"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A3_T2.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A3_T2.js new file mode 100644 index 0000000000..4c0cf2cde7 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A3_T2.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If neither Result(2) nor any prefix of Result(2) satisfies the syntax of a + StrDecimalLiteral (see 9.3.1), return NaN +esid: sec-parsefloat-string +description: parseFloat("wrong number format with ExponentIndicator") return NaN +---*/ + +assert.sameValue(parseFloat("e1"), NaN, "e1"); +assert.sameValue(parseFloat("e-1"), NaN, "e-1"); +assert.sameValue(parseFloat("E+1"), NaN, "E+1"); +assert.sameValue(parseFloat("E0"), NaN, "E0"); +assert.sameValue(parseFloat("-.e-1"), NaN, "-.e-1"); +assert.sameValue(parseFloat(".e1"), NaN, ".e1"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A3_T3.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A3_T3.js new file mode 100644 index 0000000000..e6a1358041 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A3_T3.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If neither Result(2) nor any prefix of Result(2) satisfies the syntax of a + StrDecimalLiteral (see 9.3.1), return NaN +esid: sec-parsefloat-string +description: parseFloat("wrong numbr format") return NaN +---*/ + +assert.sameValue(parseFloat(".x"), NaN, ".x"); +assert.sameValue(parseFloat("+x"), NaN, "+x"); +assert.sameValue(parseFloat("infinity"), NaN, "infinity"); +assert.sameValue(parseFloat("A"), NaN, "A"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A4_T1.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A4_T1.js new file mode 100644 index 0000000000..d14624f99b --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A4_T1.js @@ -0,0 +1,57 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Compute the longest prefix of Result(2), which might be Result(2) itself, + which satisfies the syntax of a StrDecimalLiteral +esid: sec-parsefloat-string +description: Some wrong number +---*/ + +//CHECK#1 +if (parseFloat("0x") !== 0) { + throw new Test262Error('#1: parseFloat("0x") === 0. Actual: ' + (parseFloat("0x"))); +} + +//CHECK#2 +if (parseFloat("11x") !== 11) { + throw new Test262Error('#2: parseFloat("11x") === 11. Actual: ' + (parseFloat("11x"))); +} + +//CHECK#3 +if (parseFloat("11s1") !== 11) { + throw new Test262Error('#3: parseFloat("11s1") === 11. Actual: ' + (parseFloat("11s1"))); +} + +//CHECK#4 +if (parseFloat("11.s1") !== 11) { + throw new Test262Error('#4: parseFloat("11.s1") === 11. Actual: ' + (parseFloat("11.s1"))); +} + +//CHECK#5 +if (parseFloat(".0s1") !== 0) { + throw new Test262Error('#5: parseFloat(".0s1") === 0. Actual: ' + (parseFloat(".0s1"))); +} + +//CHECK#6 +if (parseFloat("1.s1") !== 1) { + throw new Test262Error('#6: parseFloat("1.s1") === 1. Actual: ' + (parseFloat("1.s1"))); +} + +//CHECK#7 +if (parseFloat("1..1") !== 1) { + throw new Test262Error('#7: parseFloat("1..1") === 1. Actual: ' + (parseFloat("1..1"))); +} + +//CHECK#8 +if (parseFloat("0.1.1") !== 0.1) { + throw new Test262Error('#8: parseFloat("0.1.1") === 0.1. Actual: ' + (parseFloat("0.1.1"))); +} + +//CHECK#9 +if (parseFloat("0. 1") !== 0) { + throw new Test262Error('#9: parseFloat("0. 1") === 0. Actual: ' + (parseFloat("0. 1"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A4_T2.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A4_T2.js new file mode 100644 index 0000000000..ab423fff7d --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A4_T2.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Compute the longest prefix of Result(2), which might be Result(2) itself, + which satisfies the syntax of a StrDecimalLiteral +esid: sec-parsefloat-string +description: With ExponentIndicator +---*/ + +//CHECK#1 +if (parseFloat("1ex") !== 1) { + throw new Test262Error('#1: parseFloat("1ex") === 1. Actual: ' + (parseFloat("1ex"))); +} + +//CHECK#2 +if (parseFloat("1e-x") !== 1) { + throw new Test262Error('#2: parseFloat("1e-x") === 1. Actual: ' + (parseFloat("1e-x"))); +} + +//CHECK#3 +if (parseFloat("1e1x") !== 10) { + throw new Test262Error('#3: parseFloat("1e1x") === 10. Actual: ' + (parseFloat("1e1x"))); +} + +//CHECK#4 +if (parseFloat("1e-1x") !== 0.1) { + throw new Test262Error('#4: parseFloat("1e-1x") === 0.1. Actual: ' + (parseFloat("1e-1x"))); +} + +//CHECK#5 +if (parseFloat("0.1e-1x") !== 0.01) { + throw new Test262Error('#5: parseFloat("0.1e-1x") === 0.01. Actual: ' + (parseFloat("0.1e-1x"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A4_T3.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A4_T3.js new file mode 100644 index 0000000000..d79b75f0b7 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A4_T3.js @@ -0,0 +1,92 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Compute the longest prefix of Result(2), which might be Result(2) itself, + which satisfies the syntax of a StrDecimalLiteral +esid: sec-parsefloat-string +description: StrDecimalLiteral not contain HexIntegerLiteral +---*/ + +//CHECK#0 +if (parseFloat("0x0") !== 0) { + throw new Test262Error('#0: parseFloat("0x0") === 0. Actual: ' + (parseFloat("0x0"))); +} + +//CHECK#1 +if (parseFloat("0x1") !== 0) { + throw new Test262Error('#1: parseFloat("0x1") === 0. Actual: ' + (parseFloat("0x1"))); +} + +//CHECK#2 +if (parseFloat("0x2") !== 0) { + throw new Test262Error('#2: parseFloat("0x2") === 0. Actual: ' + (parseFloat("0x2"))); +} + +//CHECK#3 +if (parseFloat("0x3") !== 0) { + throw new Test262Error('#3: parseFloat("0x3") === 0. Actual: ' + (parseFloat("0x3"))); +} + +//CHECK#4 +if (parseFloat("0x4") !== 0) { + throw new Test262Error('#4: parseFloat("0x4") === 0. Actual: ' + (parseFloat("0x4"))); +} + +//CHECK#5 +if (parseFloat("0x5") !== 0) { + throw new Test262Error('#5: parseFloat("0x5") === 0. Actual: ' + (parseFloat("0x5"))); +} + +//CHECK#6 +if (parseFloat("0x6") !== 0) { + throw new Test262Error('#6: parseFloat("0x6") === 0. Actual: ' + (parseFloat("0x6"))); +} + +//CHECK#7 +if (parseFloat("0x7") !== 0) { + throw new Test262Error('#7: parseFloat("0x7") === 0. Actual: ' + (parseFloat("0x7"))); +} + +//CHECK#8 +if (parseFloat("0x8") !== 0) { + throw new Test262Error('#8: parseFloat("0x8") === 0. Actual: ' + (parseFloat("0x8"))); +} + +//CHECK#9 +if (parseFloat("0x9") !== 0) { + throw new Test262Error('#9: parseFloat("0x9") === 0. Actual: ' + (parseFloat("0x9"))); +} + +//CHECK#A +if (parseFloat("0xA") !== 0) { + throw new Test262Error('#A: parseFloat("0xA") === 0. Actual: ' + (parseFloat("0xA"))); +} + +//CHECK#B +if (parseFloat("0xB") !== 0) { + throw new Test262Error('#B: parseFloat("0xB") === 0. Actual: ' + (parseFloat("0xB"))); +} + +//CHECK#C +if (parseFloat("0xC") !== 0) { + throw new Test262Error('#C: parseFloat("0xC") === 0. Actual: ' + (parseFloat("0xC"))); +} + +//CHECK#D +if (parseFloat("0xD") !== 0) { + throw new Test262Error('#D: parseFloat("0xD") === 0. Actual: ' + (parseFloat("0xD"))); +} + +//CHECK#E +if (parseFloat("0xE") !== 0) { + throw new Test262Error('#E: parseFloat("0xE") === 0. Actual: ' + (parseFloat("0xE"))); +} + +//CHECK#F +if (parseFloat("0xF") !== 0) { + throw new Test262Error('#F: parseFloat("0xF") === 0. Actual: ' + (parseFloat("0xF"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A4_T4.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A4_T4.js new file mode 100644 index 0000000000..22db18f194 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A4_T4.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Compute the longest prefix of Result(2), which might be Result(2) itself, + which satisfies the syntax of a StrDecimalLiteral +esid: sec-parsefloat-string +description: "\"Infinity\"+\"some string\"" +---*/ + +//CHECK#1 +if (parseFloat("Infinity1") !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1: parseFloat("Infinity1") === Number.POSITIVE_INFINITY. Actual: ' + (parseFloat("Infinity1"))); +} + +//CHECK#2 +if (parseFloat("Infinityx") !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#2: parseFloat("Infinityx") === Number.POSITIVE_INFINITY. Actual: ' + (parseFloat("Infinityx"))); +} + +//CHECK#3 +if (parseFloat("Infinity+1") !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#3: parseFloat("Infinity+1") === Number.POSITIVE_INFINITY. Actual: ' + (parseFloat("Infinity+1"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A4_T5.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A4_T5.js new file mode 100644 index 0000000000..8bc1274b51 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A4_T5.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Compute the longest prefix of Result(2), which might be Result(2) itself, + which satisfies the syntax of a StrDecimalLiteral +esid: sec-parsefloat-string +description: Checking DecimalDigits . DecimalDigits_opt ExponentPart_opt +---*/ + +//CHECK#1 +if (parseFloat("-11.string") !== -11) { + throw new Test262Error('#1: parseFloat("-11.string") === -11. Actual: ' + (parseFloat("-11.string"))); +} + +//CHECK#2 +if (parseFloat("01.string") !== 1) { + throw new Test262Error('#2: parseFloat("01.string") === 1. Actual: ' + (parseFloat("01.string"))); +} + +//CHECK#3 +if (parseFloat("+11.1string") !== 11.1) { + throw new Test262Error('#3: parseFloat("+11.1string") === 11.1. Actual: ' + (parseFloat("+11.1string"))); +} + +//CHECK#4 +if (parseFloat("01.1string") !== 1.1) { + throw new Test262Error('#4: parseFloat("01.1string") === 1.1. Actual: ' + (parseFloat("01.1string"))); +} + +//CHECK#5 +if (parseFloat("-11.e-1string") !== -1.1) { + throw new Test262Error('#5: parseFloat("-11.e-1string") === -1.1. Actual: ' + (parseFloat("-11.e-1string"))); +} + +//CHECK#6 +if (parseFloat("01.e1string") !== 10) { + throw new Test262Error('#6: parseFloat("01.e1string") === 10. Actual: ' + (parseFloat("01.e1string"))); +} + +//CHECK#7 +if (parseFloat("+11.22e-1string") !== 1.122) { + throw new Test262Error('#7: parseFloat("+11.22e-1string") === 1.122. Actual: ' + (parseFloat("+11.22e-1string"))); +} + +//CHECK#8 +if (parseFloat("01.01e1string") !== 10.1) { + throw new Test262Error('#8: parseFloat("01.01e1string") === 10.1. Actual: ' + (parseFloat("01.01e1string"))); +} + +//CHECK#9 +if (parseFloat("001.string") !== 1) { + throw new Test262Error('#9: parseFloat("001.string") === 1. Actual: ' + (parseFloat("001.string"))); +} + +//CHECK#10 +if (parseFloat("010.string") !== 10) { + throw new Test262Error('#10: parseFloat("010.string") === 10. Actual: ' + (parseFloat("010.string"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A4_T6.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A4_T6.js new file mode 100644 index 0000000000..50bf94883e --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A4_T6.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Compute the longest prefix of Result(2), which might be Result(2) itself, + which satisfies the syntax of a StrDecimalLiteral +esid: sec-parsefloat-string +description: Checking . DecimalDigits ExponentPart_opt +---*/ + +//CHECK#1 +if (parseFloat("+.1string") !== 0.1) { + throw new Test262Error('#1: parseFloat("+.1string") === 0.1. Actual: ' + (parseFloat("+.1string"))); +} + +//CHECK#2 +if (parseFloat(".01string") !== 0.01) { + throw new Test262Error('#2: parseFloat(".01string") === 0.01. Actual: ' + (parseFloat(".01string"))); +} + +//CHECK#3 +if (parseFloat("+.22e-1string") !== 0.022) { + throw new Test262Error('#3: parseFloat("+.22e-1string") === 0.022. Actual: ' + (parseFloat("+.22e-1string"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A4_T7.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A4_T7.js new file mode 100644 index 0000000000..e69508dcd0 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A4_T7.js @@ -0,0 +1,47 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Compute the longest prefix of Result(2), which might be Result(2) itself, + which satisfies the syntax of a StrDecimalLiteral +esid: sec-parsefloat-string +description: Checking DecimalDigits ExponentPart_opt +---*/ + +//CHECK#1 +if (parseFloat("-11string") !== -11) { + throw new Test262Error('#1: parseFloat("-11string") === -11. Actual: ' + (parseFloat("-11string"))); +} + +//CHECK#2 +if (parseFloat("01string") !== 1) { + throw new Test262Error('#2: parseFloat("01string") === 1. Actual: ' + (parseFloat("01string"))); +} + +//CHECK#3 +if (parseFloat("-11e-1string") !== -1.1) { + throw new Test262Error('#3: parseFloat("-11e-1string") === -1.1. Actual: ' + (parseFloat("-11e-1string"))); +} + +//CHECK#4 +if (parseFloat("01e1string") !== 10) { + throw new Test262Error('#4: parseFloat("01e1string") === 10. Actual: ' + (parseFloat("01e1string"))); +} + +//CHECK#5 +if (parseFloat("001string") !== 1) { + throw new Test262Error('#5: parseFloat("001string") === 1. Actual: ' + (parseFloat("001string"))); +} + +//CHECK#6 +if (parseFloat("1e001string") !== 10) { + throw new Test262Error('#6: parseFloat("1e001string") === 10. Actual: ' + (parseFloat("1e001string"))); +} + +//CHECK#7 +if (parseFloat("010string") !== 10) { + throw new Test262Error('#7: parseFloat("010string") === 10. Actual: ' + (parseFloat("010string"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A5_T1.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A5_T1.js new file mode 100644 index 0000000000..73ca96cce1 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A5_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Return the number value for the MV of Result(4) +esid: sec-parsefloat-string +description: Checking Infinity +---*/ + +//CHECK#1 +if (parseFloat("Infinity") !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1: parseFloat("Infinity") === Number.POSITIVE_INFINITY. Actual: ' + (parseFloat("Infinity"))); +} + +//CHECK#2 +if (parseFloat("+Infinity") !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#2: parseFloat("+Infinity") === Number.POSITIVE_INFINITY. Actual: ' + (parseFloat("+Infinity"))); +} + +//CHECK#3 +if (parseFloat("-Infinity") !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#3: parseFloat("-Infinity") === Number.NEGATIVE_INFINITY. Actual: ' + (parseFloat("-Infinity"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A5_T2.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A5_T2.js new file mode 100644 index 0000000000..4d54486664 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A5_T2.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Return the number value for the MV of Result(4) +esid: sec-parsefloat-string +description: Checking DecimalDigits . DecimalDigits_opt ExponentPart_opt +---*/ + +//CHECK#1 +if (parseFloat("-11.") !== -11) { + throw new Test262Error('#1: parseFloat("-11.") === -11. Actual: ' + (parseFloat("-11."))); +} + +//CHECK#2 +if (parseFloat("01.") !== 1) { + throw new Test262Error('#2: parseFloat("01.") === 1. Actual: ' + (parseFloat("01."))); +} + +//CHECK#3 +if (parseFloat("+11.1") !== 11.1) { + throw new Test262Error('#3: parseFloat("+11.1") === 11.1. Actual: ' + (parseFloat("+11.1"))); +} + +//CHECK#4 +if (parseFloat("01.1") !== 1.1) { + throw new Test262Error('#4: parseFloat("01.1") === 1.1. Actual: ' + (parseFloat("01.1"))); +} + +//CHECK#5 +if (parseFloat("-11.e-1") !== -1.1) { + throw new Test262Error('#5: parseFloat("-11.e-1") === -1.1. Actual: ' + (parseFloat("-11.e-1"))); +} + +//CHECK#6 +if (parseFloat("01.e1") !== 10) { + throw new Test262Error('#6: parseFloat("01.e1") === 10. Actual: ' + (parseFloat("01.e1"))); +} + +//CHECK#7 +if (parseFloat("+11.22e-1") !== 1.122) { + throw new Test262Error('#7: parseFloat("+11.22e-1") === 1.122. Actual: ' + (parseFloat("+11.22e-1"))); +} + +//CHECK#8 +if (parseFloat("01.01e1") !== 10.1) { + throw new Test262Error('#8: parseFloat("01.01e1") === 10.1. Actual: ' + (parseFloat("01.01e1"))); +} + +//CHECK#9 +if (parseFloat("001.") !== 1) { + throw new Test262Error('#9: parseFloat("001.") === 1. Actual: ' + (parseFloat("001."))); +} + +//CHECK#10 +if (parseFloat("010.") !== 10) { + throw new Test262Error('#10: parseFloat("010.") === 10. Actual: ' + (parseFloat("010."))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A5_T3.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A5_T3.js new file mode 100644 index 0000000000..b00f364f9c --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A5_T3.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Return the number value for the MV of Result(4) +esid: sec-parsefloat-string +description: Checking . DecimalDigits ExponentPart_opt +---*/ + +//CHECK#1 +if (parseFloat("+.1") !== 0.1) { + throw new Test262Error('#1: parseFloat("+.1") === 0.1. Actual: ' + (parseFloat("+.1"))); +} + +//CHECK#2 +if (parseFloat(".01") !== 0.01) { + throw new Test262Error('#2: parseFloat(".01") === 0.01. Actual: ' + (parseFloat(".01"))); +} + +//CHECK#3 +if (parseFloat("+.22e-1") !== 0.022) { + throw new Test262Error('#3: parseFloat("+.22e-1") === 0.022. Actual: ' + (parseFloat("+.22e-1"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A5_T4.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A5_T4.js new file mode 100644 index 0000000000..6c1153f518 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A5_T4.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Return the number value for the MV of Result(4) +esid: sec-parsefloat-string +description: Checking DecimalDigits ExponentPart_opt +---*/ + +//CHECK#1 +if (parseFloat("-11") !== -11) { + throw new Test262Error('#1: parseFloat("-11") === -11. Actual: ' + (parseFloat("-11"))); +} + +//CHECK#2 +if (parseFloat("01") !== 1) { + throw new Test262Error('#2: parseFloat("01") === 1. Actual: ' + (parseFloat("01"))); +} + +//CHECK#3 +if (parseFloat("-11e-1") !== -1.1) { + throw new Test262Error('#3: parseFloat("-11e-1") === -1.1. Actual: ' + (parseFloat("-11e-1"))); +} + +//CHECK#4 +if (parseFloat("01e1") !== 10) { + throw new Test262Error('#4: parseFloat("01e1") === 10. Actual: ' + (parseFloat("01e1"))); +} + +//CHECK#5 +if (parseFloat("001") !== 1) { + throw new Test262Error('#5: parseFloat("001") === 1. Actual: ' + (parseFloat("001"))); +} + +//CHECK#6 +if (parseFloat("1e001") !== 10) { + throw new Test262Error('#6: parseFloat("1e001") === 10. Actual: ' + (parseFloat("1e001"))); +} + +//CHECK#7 +if (parseFloat("010") !== 10) { + throw new Test262Error('#7: parseFloat("010") === 10. Actual: ' + (parseFloat("010"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A6.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A6.js new file mode 100644 index 0000000000..d75a847379 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A6.js @@ -0,0 +1,58 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + parseFloat may interpret only a leading portion of the string as + a number value; it ignores any characters that cannot be interpreted as part + of the notation of an decimal literal, and no indication is given that any such + characters were ignored. +esid: sec-parsefloat-string +description: Complex test without eval +includes: [decimalToHexString.js] +---*/ + +//CHECK +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; +for (var index = 0; index <= 65535; index++) { + if ((index < 0x0030) || (index > 0x0039)) { + if (parseFloat("0.1e1" + String.fromCharCode(index)) !== 1) { + if (indexO === 0) { + indexO = index; + } else { + if ((index - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + throw new Test262Error('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + throw new Test262Error('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; + } + count++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + throw new Test262Error('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + throw new Test262Error('#' + hexP + ' '); + } + throw new Test262Error('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A7.1.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A7.1.js new file mode 100644 index 0000000000..a3096f045c --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A7.1.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The length property of parseFloat has the attribute DontEnum +esid: sec-parsefloat-string +description: Checking use propertyIsEnumerable, for-in +---*/ + +//CHECK#1 +if (parseFloat.propertyIsEnumerable('length') !== false) { + throw new Test262Error('#1: parseFloat.propertyIsEnumerable(\'length\') === false. Actual: ' + (parseFloat.propertyIsEnumerable('length'))); +} + +//CHECK#2 +var result = true; +for (var p in parseFloat) { + if (p === "length") { + result = false; + } +} + +if (result !== true) { + throw new Test262Error('#2: result = true; for (p in parseFloat) { if (p === "length") result = false; } result === true;'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A7.2.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A7.2.js new file mode 100644 index 0000000000..58ecde89fd --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A7.2.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The length property of parseFloat does not have the attribute DontDelete +esid: sec-parsefloat-string +description: Checking use hasOwnProperty, delete +---*/ + +//CHECK#1 +if (parseFloat.hasOwnProperty('length') !== true) { + throw new Test262Error('#1: parseFloat.hasOwnProperty(\'length\') === true. Actual: ' + (parseFloat.hasOwnProperty('length'))); +} + +delete parseFloat.length; + +//CHECK#2 +if (parseFloat.hasOwnProperty('length') !== false) { + throw new Test262Error('#2: delete parseFloat.length; parseFloat.hasOwnProperty(\'length\') === false. Actual: ' + (parseFloat.hasOwnProperty('length'))); +} + +//CHECK#3 +if (parseFloat.length === undefined) { + throw new Test262Error('#3: delete parseFloat.length; parseFloat.length !== undefined'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A7.3.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A7.3.js new file mode 100644 index 0000000000..2080fc19ea --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A7.3.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The length property of parseFloat has the attribute ReadOnly +esid: sec-parsefloat-string +description: Checking if varying the length property fails +includes: [propertyHelper.js] +---*/ + +//CHECK#1 +var x = parseFloat.length; +verifyNotWritable(parseFloat, "length", null, Infinity); +if (parseFloat.length !== x) { + throw new Test262Error('#1: x = parseFloat.length; parseFloat.length = Infinity; parseFloat.length === x. Actual: ' + (parseFloat.length)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A7.4.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A7.4.js new file mode 100644 index 0000000000..51baab1b49 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A7.4.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The length property of parseFloat is 1 +esid: sec-parsefloat-string +description: parseFloat.length === 1 +---*/ + +//CHECK#1 +if (parseFloat.length !== 1) { + throw new Test262Error('#1: parseFloat.length === 1. Actual: ' + (parseFloat.length)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A7.5.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A7.5.js new file mode 100644 index 0000000000..a3d4b86c47 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A7.5.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The parseFloat property has the attribute DontEnum +esid: sec-parsefloat-string +description: Checking use propertyIsEnumerable, for-in +---*/ + +//CHECK#1 +if (this.propertyIsEnumerable('parseFloat') !== false) { + throw new Test262Error('#1:this.propertyIsEnumerable(\'parseFloat\') === false. Actual: ' + (this.propertyIsEnumerable('parseFloat'))); +} + +//CHECK#2 +var result = true; +for (var p in this) { + if (p === "parseFloat") { + result = false; + } +} + +if (result !== true) { + throw new Test262Error('#2: result = true; for (p in this) { if (p === "parseFloat") result = false; } result === true;'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A7.6.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A7.6.js new file mode 100644 index 0000000000..f75114b28e --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A7.6.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The parseFloat property has not prototype property +esid: sec-parsefloat-string +description: Checking parseFloat.prototype +---*/ + +//CHECK#1 +if (parseFloat.prototype !== undefined) { + throw new Test262Error('#1: parseFloat.prototype === undefined. Actual: ' + (parseFloat.prototype)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A7.7.js b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A7.7.js new file mode 100644 index 0000000000..7899ac0750 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_A7.7.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The parseFloat property can't be used as constructor +esid: sec-parsefloat-string +description: > + If property does not implement the internal [[Construct]] method, + throw a TypeError exception +---*/ + +//CHECK#1 + +try { + new parseFloat(); + throw new Test262Error('#1.1: new parseFloat() throw TypeError. Actual: ' + (new parseFloat())); +} catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#1.2: new parseFloat() throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/browser.js b/js/src/tests/test262/built-ins/parseFloat/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/browser.js diff --git a/js/src/tests/test262/built-ins/parseFloat/name.js b/js/src/tests/test262/built-ins/parseFloat/name.js new file mode 100644 index 0000000000..05b701e234 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-parsefloat-string +description: > + parseFloat.name is "parseFloat". +info: | + parseFloat (string) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(parseFloat.name, "parseFloat"); + +verifyNotEnumerable(parseFloat, "name"); +verifyNotWritable(parseFloat, "name"); +verifyConfigurable(parseFloat, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/not-a-constructor.js b/js/src/tests/test262/built-ins/parseFloat/not-a-constructor.js new file mode 100644 index 0000000000..4bbe63515e --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + parseFloat does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(parseFloat), false, 'isConstructor(parseFloat) must return false'); + +assert.throws(TypeError, () => { + new parseFloat(1); +}, '`new parseFloat(1)` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/prop-desc.js b/js/src/tests/test262/built-ins/parseFloat/prop-desc.js new file mode 100644 index 0000000000..8ec6944669 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/prop-desc.js @@ -0,0 +1,19 @@ +// Copyright (C) 2019 Bocoup. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-parsefloat-string +description: > + Property descriptor for parseFloat +info: | + Every other data property described in clauses 18 through 26 and in Annex B.2 + has the attributes { [[Writable]]: true, [[Enumerable]]: false, + [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js] +---*/ + +verifyNotEnumerable(this, "parseFloat"); +verifyWritable(this, "parseFloat"); +verifyConfigurable(this, "parseFloat"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/shell.js b/js/src/tests/test262/built-ins/parseFloat/shell.js new file mode 100644 index 0000000000..a9bb766df3 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/shell.js @@ -0,0 +1,52 @@ +// GENERATED, DO NOT EDIT +// file: decimalToHexString.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: | + Collection of functions used to assert the correctness of various encoding operations. +defines: [decimalToHexString, decimalToPercentHexString] +---*/ + +function decimalToHexString(n) { + var hex = "0123456789ABCDEF"; + n >>>= 0; + var s = ""; + while (n) { + s = hex[n & 0xf] + s; + n >>>= 4; + } + while (s.length < 4) { + s = "0" + s; + } + return s; +} + +function decimalToPercentHexString(n) { + var hex = "0123456789ABCDEF"; + return "%" + hex[(n >> 4) & 0xf] + hex[n & 0xf]; +} + +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dd-dot-dd-ep-sign-minus-dd-nsl-dd.js b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dd-dot-dd-ep-sign-minus-dd-nsl-dd.js new file mode 100644 index 0000000000..14b98d1864 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dd-dot-dd-ep-sign-minus-dd-nsl-dd.js @@ -0,0 +1,22 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-tonumber-applied-to-the-string-type +description: > + The NSL does not affect strings parsed by parseFloat - StrDecimalDigits . StrDecimalDigits StrExponentPart +info: | + StrUnsignedDecimalLiteral ::: + StrDecimalDigits . StrDecimalDigits StrExponentPart + + StrDecimalDigits ::: + DecimalDigit + StrDecimalDigits NumericLiteralSeparator DecimalDigit + + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(parseFloat("1.0e-1_0"), 1.0e-1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dd-dot-dd-ep-sign-minus-dds-nsl-dd.js b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dd-dot-dd-ep-sign-minus-dds-nsl-dd.js new file mode 100644 index 0000000000..01245898d2 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dd-dot-dd-ep-sign-minus-dds-nsl-dd.js @@ -0,0 +1,22 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-tonumber-applied-to-the-string-type +description: > + The NSL does not affect strings parsed by parseFloat - StrDecimalDigits . StrDecimalDigits StrExponentPart +info: | + StrUnsignedDecimalLiteral ::: + StrDecimalDigits . StrDecimalDigits StrExponentPart + + StrDecimalDigits ::: + DecimalDigit + StrDecimalDigits NumericLiteralSeparator DecimalDigit + + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(parseFloat("1.0e-10_0"), 1.0e-10); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dd-dot-dd-ep-sign-plus-dd-nsl-dd.js b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dd-dot-dd-ep-sign-plus-dd-nsl-dd.js new file mode 100644 index 0000000000..48424258de --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dd-dot-dd-ep-sign-plus-dd-nsl-dd.js @@ -0,0 +1,22 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-tonumber-applied-to-the-string-type +description: > + The NSL does not affect strings parsed by parseFloat - StrDecimalDigits . StrDecimalDigits StrExponentPart +info: | + StrUnsignedDecimalLiteral ::: + StrDecimalDigits . StrDecimalDigits StrExponentPart + + StrDecimalDigits ::: + DecimalDigit + StrDecimalDigits NumericLiteralSeparator DecimalDigit + + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(parseFloat("1.0e+1_0"), 1.0e+1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dd-dot-dd-ep-sign-plus-dds-nsl-dd.js b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dd-dot-dd-ep-sign-plus-dds-nsl-dd.js new file mode 100644 index 0000000000..457d783a39 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dd-dot-dd-ep-sign-plus-dds-nsl-dd.js @@ -0,0 +1,22 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-tonumber-applied-to-the-string-type +description: > + The NSL does not affect strings parsed by parseFloat - StrDecimalDigits . StrDecimalDigits StrExponentPart +info: | + StrUnsignedDecimalLiteral ::: + StrDecimalDigits . StrDecimalDigits StrExponentPart + + StrDecimalDigits ::: + DecimalDigit + StrDecimalDigits NumericLiteralSeparator DecimalDigit + + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(parseFloat("1.0e+10_0"), 1.0e+10); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dd-nsl-dd-one-of.js b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dd-nsl-dd-one-of.js new file mode 100644 index 0000000000..e1e630685b --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dd-nsl-dd-one-of.js @@ -0,0 +1,34 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-tonumber-applied-to-the-string-type +description: > + The NSL does not affect strings parsed by parseFloat - StrUnsignedDecimalLiteral +info: | + StrStrUnsignedDecimalLiteral ::: + StrUnsignedDecimalLiteral + + + StrDecimalDigits ::: + DecimalDigit + ... + + DecimalDigit ::: one of + 0 1 2 3 4 5 6 7 8 9 + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(parseFloat("1_0"), 1); +assert.sameValue(parseFloat("1_1"), 1); +assert.sameValue(parseFloat("1_2"), 1); +assert.sameValue(parseFloat("1_3"), 1); +assert.sameValue(parseFloat("1_4"), 1); +assert.sameValue(parseFloat("1_5"), 1); +assert.sameValue(parseFloat("1_6"), 1); +assert.sameValue(parseFloat("1_7"), 1); +assert.sameValue(parseFloat("1_8"), 1); +assert.sameValue(parseFloat("1_9"), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dds-dot-dd-nsl-dd-ep-dd.js b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dds-dot-dd-nsl-dd-ep-dd.js new file mode 100644 index 0000000000..6e4a68cc78 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dds-dot-dd-nsl-dd-ep-dd.js @@ -0,0 +1,21 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-tonumber-applied-to-the-string-type +description: > + The NSL does not affect strings parsed by parseFloat - StrDecimalDigits . StrDecimalDigits StrExponentPart +info: | + StrUnsignedDecimalLiteral ::: + . StrDecimalDigits StrExponentPart + + StrDecimalDigits ::: + DecimalDigit + StrDecimalDigits DecimalDigit + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(parseFloat("10.00_01e2"), 10.00); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dds-nsl-dd.js b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dds-nsl-dd.js new file mode 100644 index 0000000000..ff3e565919 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dds-nsl-dd.js @@ -0,0 +1,27 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-tonumber-applied-to-the-string-type +description: > + The NSL does not affect strings parsed by parseFloat - StrDecimalDigits +info: | + StrDecimalDigits ::: + DecimalDigit + StrDecimalDigits DecimalDigit + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(parseFloat("123456789_0"), 123456789); +assert.sameValue(parseFloat("123456789_1"), 123456789); +assert.sameValue(parseFloat("123456789_2"), 123456789); +assert.sameValue(parseFloat("123456789_3"), 123456789); +assert.sameValue(parseFloat("123456789_4"), 123456789); +assert.sameValue(parseFloat("123456789_5"), 123456789); +assert.sameValue(parseFloat("123456789_6"), 123456789); +assert.sameValue(parseFloat("123456789_7"), 123456789); +assert.sameValue(parseFloat("123456789_8"), 123456789); +assert.sameValue(parseFloat("123456789_9"), 123456789); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dot-dd-nsl-dd-ep.js b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dot-dd-nsl-dd-ep.js new file mode 100644 index 0000000000..89166b0703 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dot-dd-nsl-dd-ep.js @@ -0,0 +1,22 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-tonumber-applied-to-the-string-type +description: > + The NSL does not affect strings parsed by parseFloat - . StrDecimalDigits StrExponentPart +info: | + StrUnsignedDecimalLiteral ::: + . StrDecimalDigits StrExponentPart + + StrDecimalDigits ::: + DecimalDigit + ... + StrDecimalDigits DecimalDigit + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(parseFloat(".0_1e2"), .0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dot-dd-nsl-dds-ep.js b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dot-dd-nsl-dds-ep.js new file mode 100644 index 0000000000..2259a4bbdf --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dot-dd-nsl-dds-ep.js @@ -0,0 +1,22 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-tonumber-applied-to-the-string-type +description: > + The NSL does not affect strings parsed by parseFloat - . StrDecimalDigits StrExponentPart +info: | + StrUnsignedDecimalLiteral ::: + . StrDecimalDigits StrExponentPart + + StrDecimalDigits ::: + DecimalDigit + ... + StrDecimalDigits DecimalDigit + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(parseFloat(".1_01e2"), .1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dot-dds-nsl-dd-ep.js b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dot-dds-nsl-dd-ep.js new file mode 100644 index 0000000000..2ba12f06c7 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dot-dds-nsl-dd-ep.js @@ -0,0 +1,21 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-tonumber-applied-to-the-string-type +description: > + The NSL does not affect strings parsed by parseFloat - . StrDecimalDigits StrExponentPart +info: | + StrUnsignedDecimalLiteral ::: + . StrDecimalDigits StrExponentPart + + StrDecimalDigits ::: + DecimalDigit + StrDecimalDigits DecimalDigit + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(parseFloat(".10_1e2"), .10); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dot-dds-nsl-dds-ep.js b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dot-dds-nsl-dds-ep.js new file mode 100644 index 0000000000..85b02ae9e4 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-dot-dds-nsl-dds-ep.js @@ -0,0 +1,21 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-tonumber-applied-to-the-string-type +description: > + The NSL does not affect strings parsed by parseFloat - . StrDecimalDigits StrExponentPart +info: | + StrUnsignedDecimalLiteral ::: + . StrDecimalDigits StrExponentPart + + StrDecimalDigits ::: + DecimalDigit + StrDecimalDigits DecimalDigit + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(parseFloat(".00_01e2"), .00); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-nzd-nsl-dd-one-of.js b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-nzd-nsl-dd-one-of.js new file mode 100644 index 0000000000..0fe03d911a --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-nzd-nsl-dd-one-of.js @@ -0,0 +1,36 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-tonumber-applied-to-the-string-type +description: > + The NSL does not affect strings parsed by parseFloat - NonZeroDigit NumericLiteralSeparator DecimalDigit +info: | + StrUnsignedDecimalLiteral ::: + StrUnsignedDecimalLiteral + + NonZeroDigit ::: one of + 1 2 3 4 5 6 7 8 9 + + StrDecimalDigits ::: + DecimalDigit + ... + + DecimalDigit ::: one of + 0 1 2 3 4 5 6 7 8 9 + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(parseFloat("1_0"), 1); +assert.sameValue(parseFloat("1_1"), 1); +assert.sameValue(parseFloat("2_2"), 2); +assert.sameValue(parseFloat("3_3"), 3); +assert.sameValue(parseFloat("4_4"), 4); +assert.sameValue(parseFloat("5_5"), 5); +assert.sameValue(parseFloat("6_6"), 6); +assert.sameValue(parseFloat("7_7"), 7); +assert.sameValue(parseFloat("8_8"), 8); +assert.sameValue(parseFloat("9_9"), 9); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-nzd-nsl-dd.js b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-nzd-nsl-dd.js new file mode 100644 index 0000000000..45cf8d521e --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-nzd-nsl-dd.js @@ -0,0 +1,19 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-tonumber-applied-to-the-string-type +description: > + The NSL does not affect strings parsed by parseFloat - StrDecimalDigits +info: | + StrDecimalDigits ::: + DecimalDigit + StrDecimalDigits DecimalDigit + ... + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(parseFloat("1_1"), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-nzd-nsl-dds.js b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-nzd-nsl-dds.js new file mode 100644 index 0000000000..c286b2d2f5 --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-nzd-nsl-dds.js @@ -0,0 +1,18 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-tonumber-applied-to-the-string-type +description: > + The NSL does not affect strings parsed by parseFloat - DecimalDigit +info: | + StrDecimalDigits ::: + DecimalDigit + StrDecimalDigits DecimalDigit + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(parseFloat("1_0123456789"), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-sign-plus-dds-nsl-dd.js b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-sign-plus-dds-nsl-dd.js new file mode 100644 index 0000000000..fd2bfe4b2d --- /dev/null +++ b/js/src/tests/test262/built-ins/parseFloat/tonumber-numeric-separator-literal-sign-plus-dds-nsl-dd.js @@ -0,0 +1,27 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-tonumber-applied-to-the-string-type +description: > + The NSL does not affect strings parsed by parseFloat (StrUnsignedDecimalLiteral) +info: | + StrDecimalLiteral ::: + StrUnsignedDecimalLiteral + + StrUnsignedDecimalLiteral + - StrUnsignedDecimalLiteral +features: [numeric-separator-literal] +---*/ + +assert.sameValue(parseFloat("+123456789_0"), +123456789); +assert.sameValue(parseFloat("+123456789_1"), +123456789); +assert.sameValue(parseFloat("+123456789_2"), +123456789); +assert.sameValue(parseFloat("+123456789_3"), +123456789); +assert.sameValue(parseFloat("+123456789_4"), +123456789); +assert.sameValue(parseFloat("+123456789_5"), +123456789); +assert.sameValue(parseFloat("+123456789_6"), +123456789); +assert.sameValue(parseFloat("+123456789_7"), +123456789); +assert.sameValue(parseFloat("+123456789_8"), +123456789); +assert.sameValue(parseFloat("+123456789_9"), +123456789); + +reportCompare(0, 0); |