summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/ch09/9.8/9.8.1
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/ch09/9.8/9.8.1')
-rw-r--r--js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A1.js25
-rw-r--r--js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A10.js60
-rw-r--r--js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A2.js20
-rw-r--r--js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A3.js21
-rw-r--r--js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A4.js30
-rw-r--r--js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A6.js93
-rw-r--r--js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A7.js23
-rw-r--r--js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A8.js54
-rw-r--r--js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A9_T1.js73
-rw-r--r--js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A9_T2.js73
-rw-r--r--js/src/tests/test262/ch09/9.8/9.8.1/browser.js0
-rw-r--r--js/src/tests/test262/ch09/9.8/9.8.1/shell.js0
12 files changed, 472 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A1.js b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A1.js
new file mode 100644
index 000000000..b51e4cca1
--- /dev/null
+++ b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A1.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.
+
+/**
+ * If m is NaN, return the string "NaN"
+ *
+ * @path ch09/9.8/9.8.1/S9.8.1_A1.js
+ * @description NaN convert to String by explicit transformation
+ */
+
+// CHECK#1
+if (String(NaN) !== "NaN") {
+ $ERROR('#1: String(NaN) === Not-a-Number Actual: ' + (String(NaN)));
+}
+
+// CHECK#2
+if (String(Number.NaN) !== "NaN") {
+ $ERROR('#2: String(Number.NaN) === Not-a-Number Actual: ' + (String(Number.NaN)));
+}
+
+// CHECK#3
+if (String(Number("asasa")) !== "NaN") {
+ $ERROR('#3: String(Number("asasa")) === Not-a-Number Actual: ' + (String(Number("asasa"))));
+}
+
diff --git a/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A10.js b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A10.js
new file mode 100644
index 000000000..17fa40697
--- /dev/null
+++ b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A10.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.
+
+/**
+ * Return the string consisting of the most significant
+ * digit of the decimal representation of s, followed by a decimal point '.',
+ * followed by the remaining k-1 digits of the decimal representation of s,
+ * followed by the lowercase character 'e', followed by a plus sign '+' or
+ * minus sign '-' according to whether n-1 is positive or negative, followed
+ * by the decimal representation of the integer abs(n-1) (with no leading zeros)
+ *
+ * @path ch09/9.8/9.8.1/S9.8.1_A10.js
+ * @description Various float numbers convert to String by explicit transformation
+ */
+
+// CHECK#1
+if (String(1.2345) !== "1.2345") {
+ $ERROR('#1: String(1.2345) === "1.2345". Actual: ' + (String(1.2345)));
+}
+
+// CHECK#2
+if (String(1.234567890) !== "1.23456789") {
+ $ERROR('#2: String(1.234567890) === "1.23456789". Actual: ' + (String(1.234567890)));
+}
+
+// CHECK#3
+if (String(0.12345) !== "0.12345") {
+ $ERROR('#3: String(0.12345) === "0.12345". Actual: ' + (String(0.12345)));
+}
+
+// CHECK#4
+if (String(.012345) !== "0.012345") {
+ $ERROR('#4: String(.012345) === "0.012345". Actual: ' + (String(.012345)));
+}
+
+// CHECK#5
+if (String(.0012345) !== "0.0012345") {
+ $ERROR('#5: String(.0012345) === "0.0012345". Actual: ' + (String(.0012345)));
+}
+
+// CHECK#6
+if (String(.00012345) !== "0.00012345") {
+ $ERROR('#6: String(.00012345) === "0.00012345". Actual: ' + (String(.00012345)));
+}
+
+// CHECK#7
+if (String(.000012345) !== "0.000012345") {
+ $ERROR('#7: String(.000012345) === "0.000012345". Actual: ' + (String(.000012345)));
+}
+
+// CHECK#8
+if (String(.0000012345) !== "0.0000012345") {
+ $ERROR('#8: String(.0000012345) === "0.0000012345". Actual: ' + (String(.0000012345)));
+}
+
+// CHECK#9
+if (String(.00000012345) !== "1.2345e-7") {
+ $ERROR('#9: String(.00000012345) === "1.2345e-7". Actual: ' + (String(.00000012345)));
+}
+
diff --git a/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A2.js b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A2.js
new file mode 100644
index 000000000..adc8e1f5e
--- /dev/null
+++ b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A2.js
@@ -0,0 +1,20 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+ * If m is +0 or -0, return the string "0"
+ *
+ * @path ch09/9.8/9.8.1/S9.8.1_A2.js
+ * @description +0 and -0 convert to String by explicit transformation
+ */
+
+// CHECK#1
+if (String(+0) !== "0") {
+ $ERROR('#1: String(+0) === "0". Actual: ' + (String(+0)));
+}
+
+// CHECK#2
+if (String(-0) !== "0") {
+ $ERROR('#2: String(-0) === "0". Actual: ' + (String(-0)));
+}
+
diff --git a/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A3.js b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A3.js
new file mode 100644
index 000000000..3945f2279
--- /dev/null
+++ b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A3.js
@@ -0,0 +1,21 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+ * If m is less than zero, return the string concatenation of the
+ * string "-" and ToString(-m)
+ *
+ * @path ch09/9.8/9.8.1/S9.8.1_A3.js
+ * @description -1234567890 convert to String by explicit transformation
+ */
+
+// CHECK#1
+if (String(-1234567890) !== "-1234567890") {
+ $ERROR('#1: String(-1234567890) === "-1234567890". Actual: ' + (String(-1234567890)));
+}
+
+// CHECK#2
+if ("-"+String(-(-1234567890)) !== "-1234567890") {
+ $ERROR('#2: "-"+String(-(-1234567890)) === "-1234567890". Actual: ' + ("-"+String(-(-1234567890))));
+}
+
diff --git a/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A4.js b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A4.js
new file mode 100644
index 000000000..f71ac7557
--- /dev/null
+++ b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A4.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.
+
+/**
+ * If m is infinity, return the string "Infinity"
+ *
+ * @path ch09/9.8/9.8.1/S9.8.1_A4.js
+ * @description +/-Infinity convert to String by explicit transformation
+ */
+
+// CHECK#1
+if (String(Infinity) !== "Infinity") {
+ $ERROR('#1: String(Infinity) === "Infinity". Actual: ' + (String(Infinity)));
+}
+
+// CHECK#2
+if (String(Number.POSITIVE_INFINITY) !== "Infinity") {
+ $ERROR('#2: String(Number.POSITIVE_INFINITY) === "Infinity". Actual: ' + (String(Number.POSITIVE_INFINITY)));
+}
+
+// CHECK#3
+if (String(-Infinity) !== "-Infinity") {
+ $ERROR('#3: String(-Infinity) === "-Infinity". Actual: ' + (String(-Infinity)));
+}
+
+// CHECK#4
+if (String(Number.NEGATIVE_INFINITY) !== "-Infinity") {
+ $ERROR('#4: String(Number.NEGATIVE_INFINITY) === "-Infinity". Actual: ' + (String(Number.NEGATIVE_INFINITY)));
+}
+
diff --git a/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A6.js b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A6.js
new file mode 100644
index 000000000..8b9ddf42e
--- /dev/null
+++ b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A6.js
@@ -0,0 +1,93 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+ * If 1 <= s < 1e21 or -1e21 s < -1, return the string
+ * consisting of the k digits of the decimal representation of s (in order,
+ * with no leading zeroes), followed by n-k occurrences of the character '0'
+ *
+ * @path ch09/9.8/9.8.1/S9.8.1_A6.js
+ * @description Various integer numbers convert to String by explicit transformation
+ */
+
+// CHECK#1
+if (String(1) !== "1") {
+ $ERROR('#1: String(1) === "1". Actual: ' + (String(1)));
+}
+
+// CHECK#2
+if (String(10) !== "10") {
+ $ERROR('#2: String(10) === "10". Actual: ' + (String(10)));
+}
+
+// CHECK#3
+if (String(100) !== "100") {
+ $ERROR('#3: String(100) === "100". Actual: ' + (String(100)));
+}
+
+// CHECK#4
+if (String(100000000000000000000) !== "100000000000000000000") {
+ $ERROR('#4: String(100000000000000000000) === "100000000000000000000". Actual: ' + (String(100000000000000000000)));
+}
+
+// CHECK#5
+if (String(1e20) !== "100000000000000000000") {
+ $ERROR('#5: String(1e20) === "100000000000000000000". Actual: ' + (String(1e20)));
+}
+
+// CHECK#6
+if (String(12345) !== "12345") {
+ $ERROR('#6: String(12345) === "12345". Actual: ' + (String(12345)));
+}
+
+// CHECK#7
+if (String(12345000) !== "12345000") {
+ $ERROR('#7: String(12345000) === "12345000". Actual: ' + (String(12345000)));
+}
+
+// CHECK#8
+if (String(-1) !== "-1") {
+ $ERROR('#8: String(-1) === "-1". Actual: ' + (String(-1)));
+}
+
+// CHECK#9
+if (String(-10) !== "-10") {
+ $ERROR('#9: String(-10) === "-10". Actual: ' + (String(-10)));
+}
+
+// CHECK#10
+if (String(-100) !== "-100") {
+ $ERROR('#3: String(-100) === "-100". Actual: ' + (String(-100)));
+}
+
+// CHECK#10
+if (String(-100000000000000000000) !== "-100000000000000000000") {
+ $ERROR('#10: String(-100000000000000000000) === "-100000000000000000000". Actual: ' + (String(-100000000000000000000)));
+}
+
+// CHECK#11
+if (String(-1e20) !== "-100000000000000000000") {
+ $ERROR('#11: String(-1e20) === "-100000000000000000000". Actual: ' + (String(-1e20)));
+}
+
+// CHECK#12
+if (String(-12345) !== "-12345") {
+ $ERROR('#12: String(-12345) === "-12345". Actual: ' + (String(-12345)));
+}
+
+// CHECK#13
+if (String(-12345000) !== "-12345000") {
+ $ERROR('#13: String(-12345000) === "-12345000". Actual: ' + (String(-12345000)));
+}
+
+// CHECK#14
+if (String(1E20) !== "100000000000000000000") {
+ $ERROR('#14: String(1E20) === "100000000000000000000". Actual: ' + (String(1E20)));
+}
+
+// CHECK#15
+if (String(-1E20) !== "-100000000000000000000") {
+ $ERROR('#15: String(-1E20) === "-100000000000000000000". Actual: ' + (String(-1E20)));
+}
+
+
diff --git a/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A7.js b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A7.js
new file mode 100644
index 000000000..5ad14c25d
--- /dev/null
+++ b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A7.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.
+
+/**
+ * If 1 <= s < 1e21 or -1e21 s < -1 and s has a fractional
+ * component, return the string consisting of the most significant n digits of
+ * the decimal representation of s, followed by a decimal point '.',
+ * followed by the remaining k-n digits of the decimal representation of s
+ *
+ * @path ch09/9.8/9.8.1/S9.8.1_A7.js
+ * @description 1.0000001 and -1.0000001 convert to String by explicit transformation
+ */
+
+// CHECK#1
+if (String(1.0000001) !== "1.0000001") {
+ $ERROR('#1: String(1.0000001) === "1.0000001". Actual: ' + (String(1.0000001)));
+}
+
+// CHECK#2
+if (String(-1.0000001) !== "-1.0000001") {
+ $ERROR('#2: String(-1.0000001) === "-1.0000001". Actual: ' + (String(-1.0000001)));
+}
+
diff --git a/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A8.js b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A8.js
new file mode 100644
index 000000000..91efe0b52
--- /dev/null
+++ b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A8.js
@@ -0,0 +1,54 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+ * If 1 > s > -1, and -6 < n <= 0, return the string consisting of the
+ * character '0', followed by a decimal point '.', followed by -n occurrences
+ * of the character '0', followed by the k digits of the decimal
+ * representation of s
+ *
+ * @path ch09/9.8/9.8.1/S9.8.1_A8.js
+ * @description Various float numbers convert to String by explicit transformation
+ */
+
+// CHECK#1
+if (String(0.1) !== "0.1") {
+ $ERROR('#1: String(0.1) === "0.1". Actual: ' + (String(0.1)));
+}
+
+// CHECK#2
+if (String(0.000001) !== "0.000001") {
+ $ERROR('#2: String(0.000001) === "0.000001". Actual: ' + (String(0.000001)));
+}
+
+// CHECK#3
+if (String(1e-6) !== "0.000001") {
+ $ERROR('#3: String(1e-6) === "0.000001". Actual: ' + (String(1e-6)));
+}
+
+// CHECK#4
+if (String(1E-6) !== "0.000001") {
+ $ERROR('#4: String(1E-6) === "0.000001". Actual: ' + (String(1E-6)));
+}
+
+// CHECK#5
+if (String(-0.1) !== "-0.1") {
+ $ERROR('#5: String(-0.1) === "-0.1". Actual: ' + (String(-0.1)));
+}
+
+// CHECK#6
+if (String(-0.000001) !== "-0.000001") {
+ $ERROR('#6: String(-0.000001) === "-0.000001". Actual: ' + (String(-0.000001)));
+}
+
+// CHECK#7
+if (String(-1e-6) !== "-0.000001") {
+ $ERROR('#7: String(-1e-6) === "0.000001". Actual: ' + (String(-1e-6)));
+}
+
+// CHECK#8
+if (String(-1E-6) !== "-0.000001") {
+ $ERROR('#8: String(-1E-6) === "0.000001". Actual: ' + (String(-1E-6)));
+}
+
+
diff --git a/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A9_T1.js b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A9_T1.js
new file mode 100644
index 000000000..d4614194b
--- /dev/null
+++ b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A9_T1.js
@@ -0,0 +1,73 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+ * Return the string consisting of the single digit of s,
+ * followed by lowercase character 'e', followed by a plus sign '+' or minus
+ * sign '-' according to whether n-1 is positive or negative, followed by the
+ * decimal representation of the integer abs(n-1) (with no leading zeros)
+ *
+ * @path ch09/9.8/9.8.1/S9.8.1_A9_T1.js
+ * @description Various big numbers convert to String by explicit transformation
+ */
+
+// CHECK#1
+if (String(1000000000000000000000) !== "1e+21") {
+ $ERROR('#1: String(1000000000000000000000) === "1e+21". Actual: ' + (String(1000000000000000000000)));
+}
+
+// CHECK#2
+if (String(10000000000000000000000) !== "1e+22") {
+ $ERROR('#2: String(10000000000000000000000) === "1e+22". Actual: ' + (String(10000000000000000000000)));
+}
+
+// CHECK#3
+if (String(1e21) !== "1e+21") {
+ $ERROR('#3: String(1e21) === "1e+21". Actual: ' + (String(1e21)));
+}
+
+// CHECK#4
+if (String(1.0e22) !== "1e+22") {
+ $ERROR('#4: String(1.0e22) === "1e+22". Actual: ' + (String(1.0e22)));
+}
+
+// CHECK#5
+if (String(1E21) !== "1e+21") {
+ $ERROR('#5: String(1E21) === "1e+21". Actual: ' + (String(1E21)));
+}
+
+// CHECK#6
+if (String(1.0E22) !== "1e+22") {
+ $ERROR('#6: String(1.0E22) === "1e+22". Actual: ' + (String(1.0E22)));
+}
+
+// CHECK#7
+if (String(-1000000000000000000000) !== "-1e+21") {
+ $ERROR('#7: String(-1000000000000000000000) === "-1e+21". Actual: ' + (String(-1000000000000000000000)));
+}
+
+// CHECK#8
+if (String(-10000000000000000000000) !== "-1e+22") {
+ $ERROR('#8: String(-10000000000000000000000) === "-1e+22". Actual: ' + (String(-10000000000000000000000)));
+}
+
+// CHECK#9
+if (String(-1e21) !== "-1e+21") {
+ $ERROR('#9: String(-1e21) === "-1e+21". Actual: ' + (String(-1e21)));
+}
+
+// CHECK#10
+if (String(-1.0e22) !== "-1e+22") {
+ $ERROR('#10: String(-1.0e22) === "-1e+22". Actual: ' + (String(-1.0e22)));
+}
+
+// CHECK#11
+if (String(-1E21) !== "-1e+21") {
+ $ERROR('#11: String(-1E21) === "-1e+21". Actual: ' + (String(-1E21)));
+}
+
+// CHECK#12
+if (String(-1.0E22) !== "-1e+22") {
+ $ERROR('#12: String(-1.0E22) === "-1e+22". Actual: ' + (String(-1.0E22)));
+}
+
diff --git a/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A9_T2.js b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A9_T2.js
new file mode 100644
index 000000000..79ca7873e
--- /dev/null
+++ b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A9_T2.js
@@ -0,0 +1,73 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+ * Return the string consisting of the single digit of s,
+ * followed by lowercase character 'e', followed by a plus sign '+' or minus
+ * sign '-' according to whether n-1 is positive or negative, followed by the
+ * decimal representation of the integer abs(n-1) (with no leading zeros)
+ *
+ * @path ch09/9.8/9.8.1/S9.8.1_A9_T2.js
+ * @description Various float numbers with many zeros convert to String by explicit transformation
+ */
+
+// CHECK#1
+if (String(0.0000001) !== "1e-7") {
+ $ERROR('#1: String(0.0000001) === "1e-7". Actual: ' + (String(0.0000001)));
+}
+
+// CHECK#2
+if (String(0.000000000100000000000) !== "1e-10") {
+ $ERROR('#2: String(0.000000000100000000000) === "1e-10". Actual: ' + (String(0.000000000100000000000)));
+}
+
+// CHECK#3
+if (String(1e-7) !== "1e-7") {
+ $ERROR('#3: String(1e-7) === "1e-7". Actual: ' + (String(1e-7)));
+}
+
+// CHECK#4
+if (String(1.0e-10) !== "1e-10") {
+ $ERROR('#4: String(1.0e-10) === "1e-10". Actual: ' + (String(1.0e-10)));
+}
+
+// CHECK#5
+if (String(1E-7) !== "1e-7") {
+ $ERROR('#5: String(1E-7) === "1e-7". Actual: ' + (String(1E-7)));
+}
+
+// CHECK#6
+if (String(1.0E-10) !== "1e-10") {
+ $ERROR('#6: String(1.0E-10) === "1e-10". Actual: ' + (String(1.0E-10)));
+}
+
+// CHECK#7
+if (String(-0.0000001) !== "-1e-7") {
+ $ERROR('#7: String(-0.0000001) === "1e-7". Actual: ' + (String(-0.0000001)));
+}
+
+// CHECK#8
+if (String(-0.000000000100000000000) !== "-1e-10") {
+ $ERROR('#8: String(-0.000000000100000000000) === "1e-10". Actual: ' + (String(-0.000000000100000000000)));
+}
+
+// CHECK#9
+if (String(-1e-7) !== "-1e-7") {
+ $ERROR('#9: String(-1e-7) === "-1e-7". Actual: ' + (String(-1e-7)));
+}
+
+// CHECK#10
+if (String(-1.0e-10) !== "-1e-10") {
+ $ERROR('#10: String(-1.0e-10) === "-1e-10". Actual: ' + (String(-1.0e-10)));
+}
+
+// CHECK#11
+if (String(-1E-7) !== "-1e-7") {
+ $ERROR('#11: String(-1E-7) === "-1e-7". Actual: ' + (String(-1E-7)));
+}
+
+// CHECK#12
+if (String(-1.0E-10) !== "-1e-10") {
+ $ERROR('#12: String(-1.0E-10) === "-1e-10". Actual: ' + (String(-1.0E-10)));
+}
+
diff --git a/js/src/tests/test262/ch09/9.8/9.8.1/browser.js b/js/src/tests/test262/ch09/9.8/9.8.1/browser.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/test262/ch09/9.8/9.8.1/browser.js
diff --git a/js/src/tests/test262/ch09/9.8/9.8.1/shell.js b/js/src/tests/test262/ch09/9.8/9.8.1/shell.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/test262/ch09/9.8/9.8.1/shell.js