aboutsummaryrefslogtreecommitdiffstats
path: root/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf
diff options
context:
space:
mode:
Diffstat (limited to 'external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf')
-rw-r--r--external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf/S15.7.4.4_A1_T01.js49
-rw-r--r--external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf/S15.7.4.4_A1_T02.js49
-rw-r--r--external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf/S15.7.4.4_A2_T01.js38
-rw-r--r--external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf/S15.7.4.4_A2_T02.js38
-rw-r--r--external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf/S15.7.4.4_A2_T03.js38
-rw-r--r--external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf/S15.7.4.4_A2_T04.js38
-rw-r--r--external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf/S15.7.4.4_A2_T05.js38
7 files changed, 288 insertions, 0 deletions
diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf/S15.7.4.4_A1_T01.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf/S15.7.4.4_A1_T01.js
new file mode 100644
index 000000000..c46587a12
--- /dev/null
+++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf/S15.7.4.4_A1_T01.js
@@ -0,0 +1,49 @@
+// 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.4_A1_T01;
+ * @section: 15.7.4.4;
+ * @assertion: Number.prototype.valueOf() returns this number value;
+ * @description: Call without argument;
+*/
+
+//CHECK#1
+if(Number.prototype.valueOf() !== 0){
+ $ERROR('#1: Number.prototype.valueOf() === 0');
+}
+
+//CHECK#2
+if((new Number()).valueOf() !== 0){
+ $ERROR('#2: (new Number()).valueOf() === 0');
+}
+
+//CHECK#3
+if((new Number(0)).valueOf() !== 0){
+ $ERROR('#3: (new Number(0)).valueOf() === 0');
+}
+
+//CHECK#4
+if((new Number(-1)).valueOf() !== -1){
+ $ERROR('#4: (new Number(-1)).valueOf() === -1');
+}
+
+//CHECK#5
+if((new Number(1)).valueOf() !== 1){
+ $ERROR('#5: (new Number(1)).valueOf() === 1');
+}
+
+//CHECK#6
+if(!isNaN((new Number(Number.NaN)).valueOf())){
+ $ERROR('#6: (new Number(Number.NaN)).valueOf() === NaN');
+}
+
+//CHECK#7
+if((new Number(Number.POSITIVE_INFINITY)).valueOf() !== Number.POSITIVE_INFINITY){
+ $ERROR('#7: (new Number(Number.POSITIVE_INFINITY)).valueOf() === Infinity');
+}
+
+//CHECK#8
+if((new Number(Number.NEGATIVE_INFINITY)).valueOf() !== Number.NEGATIVE_INFINITY){
+ $ERROR('#8: (new Number(Number.NEGATIVE_INFINITY)).valueOf() === -Infinity');
+}
diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf/S15.7.4.4_A1_T02.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf/S15.7.4.4_A1_T02.js
new file mode 100644
index 000000000..30f6dc713
--- /dev/null
+++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf/S15.7.4.4_A1_T02.js
@@ -0,0 +1,49 @@
+// 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.4_A1_T02;
+ * @section: 15.7.4.4;
+ * @assertion: Number.prototype.valueOf() returns this number value;
+ * @description: calling with argument;
+*/
+
+//CHECK#1
+if(Number.prototype.valueOf("argument") !== 0){
+ $ERROR('#1: Number.prototype.valueOf("argument") === 0');
+}
+
+//CHECK#2
+if((new Number()).valueOf("argument") !== 0){
+ $ERROR('#2: (new Number()).valueOf("argument") === 0');
+}
+
+//CHECK#3
+if((new Number(0)).valueOf("argument") !== 0){
+ $ERROR('#3: (new Number(0)).valueOf("argument") === 0');
+}
+
+//CHECK#4
+if((new Number(-1)).valueOf("argument") !== -1){
+ $ERROR('#4: (new Number(-1)).valueOf("argument") === -1');
+}
+
+//CHECK#5
+if((new Number(1)).valueOf("argument") !== 1){
+ $ERROR('#5: (new Number(1)).valueOf("argument") === 1');
+}
+
+//CHECK#6
+if(!isNaN((new Number(Number.NaN)).valueOf("argument"))){
+ $ERROR('#6: (new Number(Number.NaN)).valueOf("argument") === NaN');
+}
+
+//CHECK#7
+if((new Number(Number.POSITIVE_INFINITY)).valueOf("argument") !== Number.POSITIVE_INFINITY){
+ $ERROR('#7: (new Number(Number.POSITIVE_INFINITY)).valueOf("argument") === Infinity');
+}
+
+//CHECK#8
+if((new Number(Number.NEGATIVE_INFINITY)).valueOf("argument") !== Number.NEGATIVE_INFINITY){
+ $ERROR('#8: (new Number(Number.NEGATIVE_INFINITY)).valueOf("argument") === -Infinity');
+}
diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf/S15.7.4.4_A2_T01.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf/S15.7.4.4_A2_T01.js
new file mode 100644
index 000000000..a88708ef9
--- /dev/null
+++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf/S15.7.4.4_A2_T01.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.
+
+/**
+ * @name: S15.7.4.4_A2_T01;
+ * @section: 15.7.4.4;
+ * @assertion: The valueOf function is not generic, it cannot be transferred
+ * to other kinds of objects for use as a method and there is should be
+ * a TypeError exception if its this value is not a Number object;
+ * @description: transferring to the String objects;
+*/
+
+//CHECK#1
+try{
+ var s1 = new String();
+ s1.valueOf = Number.prototype.valueOf;
+ var v1 = s1.valueOf();
+ $ERROR('#1: Number.prototype.valueOf on not a Number object should throw TypeError');
+}
+catch(e){
+ if(!(e instanceof TypeError)){
+ $ERROR('#1: Number.prototype.valueOf on not a Number object should throw TypeError, not '+e);
+ }
+}
+
+//CHECK#2
+try{
+ var s2 = new String();
+ s2.myValueOf = Number.prototype.valueOf;
+ var v2 = s2.myValueOf();
+ $ERROR('#2: Number.prototype.valueOf on not a Number object should throw TypeError');
+}
+catch(e){
+ if(!(e instanceof TypeError)){
+ $ERROR('#2: Number.prototype.valueOf on not a Number object should throw TypeError, not '+e);
+ }
+}
+
diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf/S15.7.4.4_A2_T02.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf/S15.7.4.4_A2_T02.js
new file mode 100644
index 000000000..285ac1533
--- /dev/null
+++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf/S15.7.4.4_A2_T02.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.
+
+/**
+ * @name: S15.7.4.4_A2_T02;
+ * @section: 15.7.4.4;
+ * @assertion: The valueOf function is not generic, it cannot be transferred
+ * to other kinds of objects for use as a method and there is should be
+ * a TypeError exception if its this value is not a Number object;
+ * @description: transferring to the Boolean objects;
+*/
+
+//CHECK#1
+try{
+ var s1 = new Boolean();
+ s1.valueOf = Number.prototype.valueOf;
+ var v1 = s1.valueOf();
+ $ERROR('#1: Number.prototype.valueOf on not a Number object should throw TypeError');
+}
+catch(e){
+ if(!(e instanceof TypeError)){
+ $ERROR('#1: Number.prototype.valueOf on not a Number object should throw TypeError, not '+e);
+ }
+}
+
+//CHECK#2
+try{
+ var s2 = new Boolean();
+ s2.myValueOf = Number.prototype.valueOf;
+ var v2 = s2.myValueOf();
+ $ERROR('#2: Number.prototype.valueOf on not a Number object should throw TypeError');
+}
+catch(e){
+ if(!(e instanceof TypeError)){
+ $ERROR('#2: Number.prototype.valueOf on not a Number object should throw TypeError, not '+e);
+ }
+}
+
diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf/S15.7.4.4_A2_T03.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf/S15.7.4.4_A2_T03.js
new file mode 100644
index 000000000..6515d3a64
--- /dev/null
+++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf/S15.7.4.4_A2_T03.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.
+
+/**
+ * @name: S15.7.4.4_A2_T03;
+ * @section: 15.7.4.4;
+ * @assertion: The valueOf function is not generic, it cannot be transferred
+ * to other kinds of objects for use as a method and there is should be
+ * a TypeError exception if its this value is not a Number object;
+ * @description: transferring to the Date objects;
+*/
+
+//CHECK#1
+try{
+ var s1 = new Date();
+ s1.valueOf = Number.prototype.valueOf;
+ var v1 = s1.valueOf();
+ $ERROR('#1: Number.prototype.valueOf on not a Number object should throw TypeError');
+}
+catch(e){
+ if(!(e instanceof TypeError)){
+ $ERROR('#1: Number.prototype.valueOf on not a Number object should throw TypeError, not '+e);
+ }
+}
+
+//CHECK#2
+try{
+ var s2 = new Date();
+ s2.myValueOf = Number.prototype.valueOf;
+ var v2 = s2.myValueOf();
+ $ERROR('#2: Number.prototype.valueOf on not a Number object should throw TypeError');
+}
+catch(e){
+ if(!(e instanceof TypeError)){
+ $ERROR('#2: Number.prototype.valueOf on not a Number object should throw TypeError, not '+e);
+ }
+}
+
diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf/S15.7.4.4_A2_T04.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf/S15.7.4.4_A2_T04.js
new file mode 100644
index 000000000..6b70d2077
--- /dev/null
+++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf/S15.7.4.4_A2_T04.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.
+
+/**
+ * @name: S15.7.4.4_A2_T04;
+ * @section: 15.7.4.4;
+ * @assertion: The valueOf function is not generic, it cannot be transferred
+ * to other kinds of objects for use as a method and there is should be
+ * a TypeError exception if its this value is not a Number object;
+ * @description: transferring to the Object objects;
+*/
+
+//CHECK#1
+try{
+ var s1 = new Object();
+ s1.valueOf = Number.prototype.valueOf;
+ var v1 = s1.valueOf();
+ $ERROR('#1: Number.prototype.valueOf on not a Number object should throw TypeError');
+}
+catch(e){
+ if(!(e instanceof TypeError)){
+ $ERROR('#1: Number.prototype.valueOf on not a Number object should throw TypeError, not '+e);
+ }
+}
+
+//CHECK#2
+try{
+ var s2 = new Object();
+ s2.myValueOf = Number.prototype.valueOf;
+ var v2 = s2.myValueOf();
+ $ERROR('#2: Number.prototype.valueOf on not a Number object should throw TypeError');
+}
+catch(e){
+ if(!(e instanceof TypeError)){
+ $ERROR('#2: Number.prototype.valueOf on not a Number object should throw TypeError, not '+e);
+ }
+}
+
diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf/S15.7.4.4_A2_T05.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf/S15.7.4.4_A2_T05.js
new file mode 100644
index 000000000..d69ce0959
--- /dev/null
+++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.7_Number_Objects/15.7.4_Properties_of_the_Number_Prototype_Object/15.7.4.4_Number.prototype.valueOf/S15.7.4.4_A2_T05.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.
+
+/**
+ * @name: S15.7.4.4_A2_T05;
+ * @section: 15.7.4.4;
+ * @assertion: The valueOf function is not generic, it cannot be transferred
+ * to other kinds of objects for use as a method and there is should be
+ * a TypeError exception if its this value is not a Number object;
+ * @description: transferring to the other objects;
+*/
+
+//CHECK#1
+try{
+ var s1 = {x: 1};
+ s1.valueOf = Number.prototype.valueOf;
+ var v1 = s1.valueOf();
+ $ERROR('#1: Number.prototype.valueOf on not a Number object should throw TypeError');
+}
+catch(e){
+ if(!(e instanceof TypeError)){
+ $ERROR('#1: Number.prototype.valueOf on not a Number object should throw TypeError, not '+e);
+ }
+}
+
+//CHECK#2
+try{
+ var s2 = {x: 1};
+ s2.myValueOf = Number.prototype.valueOf;
+ var v2 = s2.myValueOf();
+ $ERROR('#2: Number.prototype.valueOf on not a Number object should throw TypeError');
+}
+catch(e){
+ if(!(e instanceof TypeError)){
+ $ERROR('#2: Number.prototype.valueOf on not a Number object should throw TypeError, not '+e);
+ }
+}
+