aboutsummaryrefslogtreecommitdiffstats
path: root/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type
diff options
context:
space:
mode:
Diffstat (limited to 'external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type')
-rw-r--r--external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A1.js24
-rw-r--r--external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A10.js59
-rw-r--r--external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A2.js19
-rw-r--r--external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A3.js20
-rw-r--r--external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A4.js29
-rw-r--r--external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A6.js92
-rw-r--r--external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A7.js22
-rw-r--r--external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A8.js53
-rw-r--r--external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A9_T1.js72
-rw-r--r--external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A9_T2.js72
10 files changed, 462 insertions, 0 deletions
diff --git a/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A1.js
new file mode 100644
index 000000000..75549707d
--- /dev/null
+++ b/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A1.js
@@ -0,0 +1,24 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+ * @name: S9.8.1_A1;
+ * @section: 9.8.1;
+ * @assertion: If m is NaN, return the string "NaN";
+ * @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/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A10.js b/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A10.js
new file mode 100644
index 000000000..13408bee6
--- /dev/null
+++ b/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A10.js
@@ -0,0 +1,59 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+ * @name: S9.8.1_A10;
+ * @section: 9.8.1;
+ * @assertion: 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);
+ * @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/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A2.js b/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A2.js
new file mode 100644
index 000000000..878e2ae4d
--- /dev/null
+++ b/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A2.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.
+
+/**
+ * @name: S9.8.1_A2;
+ * @section: 9.8.1;
+ * @assertion: If m is +0 or -0, return the string "0";
+ * @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/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A3.js b/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A3.js
new file mode 100644
index 000000000..87666fc93
--- /dev/null
+++ b/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A3.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.
+
+/**
+ * @name: S9.8.1_A3;
+ * @section: 9.8.1;
+ * @assertion: If m is less than zero, return the string concatenation of the
+ * string "-" and ToString(-m);
+ * @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/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A4.js b/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A4.js
new file mode 100644
index 000000000..2e3435f43
--- /dev/null
+++ b/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A4.js
@@ -0,0 +1,29 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+ * @name: S9.8.1_A4;
+ * @section: 9.8.1;
+ * @assertion: If m is infinity, return the string "Infinity";
+ * @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/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A6.js b/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A6.js
new file mode 100644
index 000000000..55d51fa0f
--- /dev/null
+++ b/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A6.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.
+
+/**
+ * @name: S9.8.1_A6;
+ * @section: 9.8.1;
+ * @assertion: 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';
+ * @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/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A7.js b/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A7.js
new file mode 100644
index 000000000..296326e8e
--- /dev/null
+++ b/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A7.js
@@ -0,0 +1,22 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+ * @name: S9.8.1_A7;
+ * @section: 9.8.1;
+ * @assertion: 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;
+ * @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/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A8.js b/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A8.js
new file mode 100644
index 000000000..3f57113b2
--- /dev/null
+++ b/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A8.js
@@ -0,0 +1,53 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+ * @name: S9.8.1_A8;
+ * @section: 9.8.1;
+ * @assertion: 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;
+ * @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/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A9_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A9_T1.js
new file mode 100644
index 000000000..f400b8996
--- /dev/null
+++ b/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A9_T1.js
@@ -0,0 +1,72 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+ * @name: S9.8.1_A9_T1;
+ * @section: 9.8.1;
+ * @assertion: 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);
+ * @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/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A9_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A9_T2.js
new file mode 100644
index 000000000..7e62553b3
--- /dev/null
+++ b/external/contributions/Google/sputniktests/tests/Conformance/09_Type_Conversion/9.8_ToString/9.8.1_ToString_Applied_to_the_Number_Type/S9.8.1_A9_T2.js
@@ -0,0 +1,72 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+ * @name: S9.8.1_A9_T2;
+ * @section: 9.8.1;
+ * @assertion: 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);
+ * @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)));
+}