summaryrefslogtreecommitdiff
path: root/external/contributions/Google/sputnik_conformance_modified/15_Native/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.5_Number.prototype.toFixed/S15.7.4.5_A1.3_T02.js
diff options
context:
space:
mode:
Diffstat (limited to 'external/contributions/Google/sputnik_conformance_modified/15_Native/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.5_Number.prototype.toFixed/S15.7.4.5_A1.3_T02.js')
-rw-r--r--external/contributions/Google/sputnik_conformance_modified/15_Native/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.5_Number.prototype.toFixed/S15.7.4.5_A1.3_T02.js70
1 files changed, 70 insertions, 0 deletions
diff --git a/external/contributions/Google/sputnik_conformance_modified/15_Native/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.5_Number.prototype.toFixed/S15.7.4.5_A1.3_T02.js b/external/contributions/Google/sputnik_conformance_modified/15_Native/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.5_Number.prototype.toFixed/S15.7.4.5_A1.3_T02.js
new file mode 100644
index 000000000..bc4e330be
--- /dev/null
+++ b/external/contributions/Google/sputnik_conformance_modified/15_Native/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.5_Number.prototype.toFixed/S15.7.4.5_A1.3_T02.js
@@ -0,0 +1,70 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+ * @name: S15.7.4.5_A1.3_T02;
+ * @section: 15.7.4.5;
+ * @assertion: Step 4: If this number value is NaN, return the string "NaN";
+ * @description: direct usage of NaN;
+*/
+
+//CHECK#1
+if(Number.NaN.toFixed() !== "NaN"){
+ $ERROR('#1: Number.NaN.prototype.toFixed() === "NaN"');
+}
+
+//CHECK#2
+if(Number.NaN.toFixed(0) !== "NaN"){
+ $ERROR('#2: Number.NaN.prototype.toFixed(0) === "NaN"');
+}
+
+//CHECK#3
+if(Number.NaN.toFixed(1) !== "NaN"){
+ $ERROR('#3: Number.NaN.prototype.toFixed(1) === "NaN"');
+}
+
+//CHECK#4
+if(Number.NaN.toFixed(1.1) !== "NaN"){
+ $ERROR('#4: Number.NaN.toFixed(1.1) === "NaN"');
+}
+
+//CHECK#5
+if(Number.NaN.toFixed(0.9) !== "NaN"){
+ $ERROR('#5: Number.NaN.toFixed(0.9) === "NaN"');
+}
+
+//CHECK#6
+if(Number.NaN.toFixed("1") !== "NaN"){
+ $ERROR('#6: Number.NaN.toFixed("1") === "NaN"');
+}
+
+//CHECK#7
+if(Number.NaN.toFixed("1.1") !== "NaN"){
+ $ERROR('#7: Number.NaN.toFixed("1.1") === "NaN"');
+}
+
+//CHECK#8
+if(Number.NaN.toFixed("0.9") !== "NaN"){
+ $ERROR('#8: Number.NaN.toFixed("0.9") === "NaN"');
+}
+
+//CHECK#9
+if(Number.NaN.toFixed(Number.NaN) !== "NaN"){
+ $ERROR('#9: Number.NaN.toFixed(Number.NaN) === "NaN"');
+}
+
+//CHECK#10
+if(Number.NaN.toFixed("some string") !== "NaN"){
+ $ERROR('#9: Number.NaN.toFixed("some string") === "NaN"');
+}
+
+//CHECK#10
+try{
+ s = Number.NaN.toFixed(Number.POSITIVE_INFINITY);
+ $ERROR('#10: Number.NaN.toFixed(Number.POSITIVE_INFINITY) should throw RangeError, not return NaN');
+}
+catch(e){
+ if(!(e instanceof RangeError)){
+ $ERROR('#10: Number.NaN.toFixed(Number.POSITIVE_INFINITY) should throw RangeError, not '+e);
+ }
+}