diff options
Diffstat (limited to 'external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators')
95 files changed, 3108 insertions, 0 deletions
diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A1.js new file mode 100644 index 000000000..2642e00e6 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A1.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: S11.4.1_A1; +* @section: 11.4.1; +* @assertion: White Space and Line Terminator between "delete" and UnaryExpression are allowed; +* @description: Checking by using eval; +*/ + +//CHECK#1 +if (eval("delete\u00090") !== true) { + $ERROR('#1: delete\\u00090 === true'); +} + +//CHECK#2 +if (eval("delete\u000B0") !== true) { + $ERROR('#2: delete\\u000B0 === true'); +} + +//CHECK#3 +if (eval("delete\u000C0") !== true) { + $ERROR('#3: delete\\u000C0 === true'); +} + +//CHECK#4 +if (eval("delete\u00200") !== true) { + $ERROR('#4: delete\\u00200 === true'); +} + +//CHECK#5 +if (eval("delete\u00A00") !== true) { + $ERROR('#5: delete\\u00A00 === true'); +} + +//CHECK#6 +if (eval("delete\u000A0") !== true) { + $ERROR('#6: delete\\u000A0 === true'); +} + +//CHECK#7 +if (eval("delete\u000D0") !== true) { + $ERROR('#7: delete\\u000D0 === true'); +} + +//CHECK#8 +if (eval("delete\u20280") !== true) { + $ERROR('#8: delete\\u20280 === true'); +} + +//CHECK#9 +if (eval("delete\u20290") !== true) { + $ERROR('#9: delete\\u20290 === true'); +} + +//CHECK#10 +if (eval("delete\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20290") !== true) { + $ERROR('#10: delete\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20290 === true'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A2.1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A2.1.js new file mode 100644 index 000000000..3c960c972 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A2.1.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: S11.4.1_A2.1; +* @section: 11.4.1; +* @assertion: If Type(x) is not Reference, return true; +* @description: Checking primitive value and Object value cases; +*/ + +//CHECK#1 +if (delete 1 !== true) { + $ERROR('#1: delete 1 === true'); +} + +//CHECK#2 +if (delete new Object() !== true) { + $ERROR('#2: delete new Object() === true'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A2.2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A2.2_T1.js new file mode 100644 index 000000000..79b4f2997 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A2.2_T1.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: S11.4.1_A2.2_T1; +* @section: 11.4.1; +* @assertion: If GetBase(x) doesn't have a property GetPropertyName(x), return true; +* @description: Checking undeclared variable case; +*/ + +//CHECK#1 +if (delete x !== true) { + $ERROR('#1: delete x === true'); +} + +//CHECK#2 +if (delete this.x !== true) { + $ERROR('#2: delete this.x === true'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A2.2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A2.2_T2.js new file mode 100644 index 000000000..75e30cbe3 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A2.2_T2.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: S11.4.1_A2.2_T2; +* @section: 11.4.1; +* @assertion: If GetBase(x) doesn't have a property GetPropertyName(x), return true; +* @description: Checking Object object and Function object cases; +*/ + +//CHECK#1 +function MyFunction(){} +var MyObject = new MyFunction(); +if (delete MyObject.prop !== true) { + $ERROR('#1: function MyFunction(){}; var MyObject = new MyFunction(); delete MyObject.prop === true'); +} + +//CHECK#2 +var MyObject = new Object(); +if (delete MyObject.prop !== true) { + $ERROR('#2: var MyObject = new Object(); delete MyObject.prop === true'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A3.1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A3.1.js new file mode 100644 index 000000000..ea3ab3753 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A3.1.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. + +/** +* @name: S11.4.1_A3.1; +* @section: 11.4.1; +* @assertion: If the property has the DontDelete attribute, return false; +* @description: Checking declared variable; +*/ + +//CHECK#1 +var x = 1; +if (delete x !== false) { + $ERROR('#1: var x = 1; delete x === false'); +} + +//CHECK#2 +var y = 1; +if (delete this.y !== false) { + $ERROR('#2: var y = 1; delete this.y === false'); +} + +//CHECK#3 +function MyFunction(){}; +if (delete MyFunction !== false) { + $ERROR('#3: function MyFunction(){}; delete MyFunction === false'); +} + +//CHECK#4 +function MyFunction(){}; +var MyObject = new MyFunction(); +if (delete MyObject !== false) { + $ERROR('#4: function MyFunction(){}; var MyObject = new MyFunction(); delete MyObject === false'); +} + +//CHECK#5 +if (delete MyObject !== false) { + $ERROR('#5: function MyFunction(){}; var MyObject = new MyFunction(); delete MyObject === false'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A3.2.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A3.2.js new file mode 100644 index 000000000..16d7b94db --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A3.2.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. + +/** +* @name: S11.4.1_A3.2; +* @section: 11.4.1; +* @assertion: If the property doesn't have the DontDelete attribute, return true; +* @description: Checking declared variable; +*/ + +//CHECK#1 +x = 1; +if (delete x !== true) { + $ERROR('#1: x = 1; delete x === true'); +} + +//CHECK#2 +function MyFunction(){}; +MyFunction.prop = 1; +if (delete MyFunction.prop !== true) { + $ERROR('#2: function MyFunction(){}; MyFunction.prop = 1; delete MyFunction.prop === true'); +} + +//CHECK#3 +function MyFunction(){}; +var MyObject = new MyFunction(); +MyObject.prop = 1; +if (delete MyObject.prop !== true) { + $ERROR('#3: function MyFunction(){}; var MyObject = new MyFunction(); MyFunction.prop = 1; delete MyObject.prop === true'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A3.3.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A3.3.js new file mode 100644 index 000000000..169310d5d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A3.3.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. + +/** +* @name: S11.4.1_A3.3; +* @section: 11.4.1; +* @assertion: If the property doesn't have the DontDelete attribute, remove the property; +* @description: Checking declared variable; +*/ + +//CHECK#1 +try { + x = 1; + delete x; + x; + $ERROR('#1: x = 1; delete x; x is not exist'); +} catch (e) { + if (e instanceof ReferenceError !== true) { + $ERROR('#1: x = 1; delete x; x is not exist'); + } +} + + +//CHECK#2 +function MyFunction(){}; +MyFunction.prop = 1; +delete MyFunction.prop; +if (MyFunction.prop !== undefined) { + $ERROR('#2: function MyFunction(){}; MyFunction.prop = 1; delete MyFunction.prop; MyFunction.prop === undefined. Actual: ' + (MyFunction.prop)); + +} + +//CHECK#3 +function MyFunction(){}; +var MyObjectVar = new MyFunction(); +MyObjectVar.prop = 1; +delete MyObjectVar.prop; +if (MyObjectVar.prop !== undefined) { + $ERROR('#3: function MyFunction(){}; var MyObjectVar = new MyFunction(); MyFunction.prop = 1; delete MyObjectVar.prop; MyObjectVar.prop === undefined. Actual: ' + (MyObjectVar.prop)); +} + +//CHECK#4 +if (delete MyObjectVar !== false) { + $ERROR('#4: function MyFunction(){}; var MyObjectVar = new MyFunction(); delete MyObjectVar === false'); +} + +//CHECK#5 +function MyFunction(){}; +MyObjectNotVar = new MyFunction(); +MyObjectNotVar.prop = 1; +delete MyObjectNotVar.prop; +if (MyObjectNotVar.prop !== undefined) { + $ERROR('#5: function MyFunction(){}; MyObjectNotVar = new MyFunction(); MyFunction.prop = 1; delete MyObjectNotVar.prop; MyObjectNotVar.prop === undefined. Actual: ' + (MyObjectNotVar.prop)); +} + +//CHECK#6 +if (delete MyObjectNotVar !== true) { + $ERROR('#6: function MyFunction(){}; var MyObjectNotVar = new MyFunction(); delete MyObjectNotVar === true'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A4.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A4.js new file mode 100644 index 000000000..83f5ce1d9 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A4.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. + +/** +* @name: S11.4.1_A4; +* @section: 11.4.1; +* @assertion: "Delete" operator removes property, which is reference to the object, not the object; +* @description: Checking two reference by one object; +*/ + +//CHECK#1 +obj = new Object(); +ref = obj; +delete ref; +if (typeof obj !== "object") { + $ERROR('#1: obj = new Object(); ref = obj; delete ref; typeof obj === "object". Actual: ' + (typeof obj)); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.2_The_void_Operator/S11.4.2_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.2_The_void_Operator/S11.4.2_A1.js new file mode 100644 index 000000000..c299861ea --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.2_The_void_Operator/S11.4.2_A1.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: S11.4.2_A1; +* @section: 11.4.2; +* @assertion: White Space and Line Terminator between "void" and UnaryExpression are allowed; +* @description: Checking by using eval; +*/ + +//CHECK#1 +if (eval("void\u00090") !== undefined) { + $ERROR('#1: void\\u00090 === undefined'); +} + +//CHECK#2 +if (eval("void\u000B0") !== undefined) { + $ERROR('#2: void\\u000B0 === undefined'); +} + +//CHECK#3 +if (eval("void\u000C0") !== undefined) { + $ERROR('#3: void\\u000C0 === undefined'); +} + +//CHECK#4 +if (eval("void\u00200") !== undefined) { + $ERROR('#4: void\\u00200 === undefined'); +} + +//CHECK#5 +if (eval("void\u00A00") !== undefined) { + $ERROR('#5: void\\u00A00 === undefined'); +} + +//CHECK#6 +if (eval("void\u000A0") !== undefined) { + $ERROR('#6: void\\u000A0 === undefined'); +} + +//CHECK#7 +if (eval("void\u000D0") !== undefined) { + $ERROR('#7: void\\u000D0 === undefined'); +} + +//CHECK#8 +if (eval("void\u20280") !== undefined) { + $ERROR('#8: void\\u20280 === undefined'); +} + +//CHECK#9 +if (eval("void\u20290") !== undefined) { + $ERROR('#9: void\\u20290 === undefined'); +} + +//CHECK#10 +if (eval("void\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20290") !== undefined) { + $ERROR('#10: void\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20290 === undefined'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.2_The_void_Operator/S11.4.2_A2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.2_The_void_Operator/S11.4.2_A2_T1.js new file mode 100644 index 000000000..e668c4310 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.2_The_void_Operator/S11.4.2_A2_T1.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S11.4.2_A2_T1; +* @section: 11.4.2; +* @assertion: Operator "void" uses GetValue; +* @description: Either Type(x) is not Reference or GetBase(x) is not null; +*/ + +//CHECK#1 +if (void 0 !== undefined) { + $ERROR('#1: void 0 === undefined. Actual: ' + (void 0)); +} + +//CHECK#2 +var x = 0; +if (void x !== undefined) { + $ERROR('#2: var x = 0; void x === undefined. Actual: ' + (void x)); +} + +//CHECK#3 +var x = new Object(); +if (void x !== undefined) { + $ERROR('#3: var x = new Object(); void x === undefined. Actual: ' + (void x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.2_The_void_Operator/S11.4.2_A2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.2_The_void_Operator/S11.4.2_A2_T2.js new file mode 100644 index 000000000..8bc788ea8 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.2_The_void_Operator/S11.4.2_A2_T2.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. + +/** +* @name: S11.4.2_A2_T2; +* @section: 11.4.2; +* @assertion: Operator "void" uses GetValue; +* @description: If GetBase(x) is null, throw ReferenceError; +* @negative +*/ + +//CHECK#1 +void x; diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.2_The_void_Operator/S11.4.2_A4_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.2_The_void_Operator/S11.4.2_A4_T1.js new file mode 100644 index 000000000..944854623 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.2_The_void_Operator/S11.4.2_A4_T1.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. + +/** +* @name: S11.4.2_A4_T1; +* @section: 11.4.2; +* @assertion: Operator "void" evaluates UnaryExpression and returns undefined; +* @description: Type(x) is boolean primitive or Boolean object; +*/ + +//CHECK#1 +var x = false; +if (void x !== undefined) { + $ERROR('#1: var x = false; void x === undefined. Actual: ' + (void x)); +} + +//CHECK#2 +var x = new Boolean(true); +if (void x !== undefined) { + $ERROR('#2: var x = new Boolean(true); void x === undefined. Actual: ' + (void x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.2_The_void_Operator/S11.4.2_A4_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.2_The_void_Operator/S11.4.2_A4_T2.js new file mode 100644 index 000000000..5c2a33c54 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.2_The_void_Operator/S11.4.2_A4_T2.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. + +/** +* @name: S11.4.2_A4_T2; +* @section: 11.4.2; +* @assertion: Operator "void" evaluates UnaryExpression and returns undefined; +* @description: Type(x) is number primitive or Number object; +*/ + +//CHECK#1 +var x = 0.1; +if (void x !== undefined) { + $ERROR('#1: var x = 0.1; void x === undefined. Actual: ' + (void x)); +} + +//CHECK#2 +var x = new Number(-1.1); +if (void x !== undefined) { + $ERROR('#2: var x = new Number(-1.1); void x === undefined. Actual: ' + (void x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.2_The_void_Operator/S11.4.2_A4_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.2_The_void_Operator/S11.4.2_A4_T3.js new file mode 100644 index 000000000..9e41f2c03 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.2_The_void_Operator/S11.4.2_A4_T3.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. + +/** +* @name: S11.4.2_A4_T3; +* @section: 11.4.2; +* @assertion: Operator "void" evaluates UnaryExpression and returns undefined; +* @description: Type(x) is string primitive of String object; +*/ + +//CHECK#1 +var x = "1"; +if (void x !== undefined) { + $ERROR('#1: var x = "1"; void x === undefined. Actual: ' + (void x)); +} + +//CHECK#2 +var x = "x"; +if (isNaN(void x) !== true) { + $ERROR('#2: var x = "x"; void x === undefined. Actual: ' + (void x)); +} + +//CHECK#3 +var x = new String("-1"); +if (void x !== undefined) { + $ERROR('#3: var x = new String("-1"); void x === undefined. Actual: ' + (void x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.2_The_void_Operator/S11.4.2_A4_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.2_The_void_Operator/S11.4.2_A4_T4.js new file mode 100644 index 000000000..db4d09672 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.2_The_void_Operator/S11.4.2_A4_T4.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. + +/** +* @name: S11.4.2_A4_T4; +* @section: 11.4.2; +* @assertion: Operator "void" evaluates UnaryExpression and returns undefined; +* @description: Type(x) is undefined or null; +*/ + +//CHECK#1 +var x; +if (isNaN(void x) !== true) { + $ERROR('#1: var x; void x === undefined. Actual: ' + (void x)); +} + +//CHECK#2 +var x = null; +if (void x !== undefined) { + $ERROR('#2: var x = null; void x === undefined. Actual: ' + (void x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.2_The_void_Operator/S11.4.2_A4_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.2_The_void_Operator/S11.4.2_A4_T5.js new file mode 100644 index 000000000..d2df4cbd9 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.2_The_void_Operator/S11.4.2_A4_T5.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. + +/** +* @name: S11.4.2_A4_T5; +* @section: 11.4.2; +* @assertion: Operator "void" evaluates UnaryExpression and returns undefined; +* @description: Type(x) is Object object or Function object; +*/ + +//CHECK#1 +var x = {}; +if (isNaN(void x) !== true) { + $ERROR('#1: var x = {}; void x === undefined. Actual: ' + (void x)); +} + +//CHECK#2 +var x = function(){return 1}; +if (isNaN(void x) !== true) { + $ERROR('#2: var x = function(){return 1}; void x === undefined. Actual: ' + (void x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.2_The_void_Operator/S11.4.2_A4_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.2_The_void_Operator/S11.4.2_A4_T6.js new file mode 100644 index 000000000..1acd5848c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.2_The_void_Operator/S11.4.2_A4_T6.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: S11.4.2_A4_T6; +* @section: 11.4.2; +* @assertion: Operator "void" evaluates UnaryExpression and returns undefined; +* @description: Checking Simple Assignment operator; +*/ + +//CHECK#1 +var x = 0; +if (void (x = 1) !== undefined) { + $ERROR('#1: var x = 0; void (x = 1) === undefined. Actual: ' + (void (x = 1))); +} else { + if (x !== 1) { + $ERROR('#1: var x = 0; void (x = 1); x === 1. Actual: ' + (x)); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A1.js new file mode 100644 index 000000000..141c2fa28 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A1.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: S11.4.3_A1; +* @section: 11.4.3; +* @assertion: White Space and Line Terminator between "typeof" and UnaryExpression are allowed; +* @description: Checking by using eval; +*/ + +//CHECK#1 +if (eval("var x = 0; typeof\u0009x") !== "number") { + $ERROR('#1: var x = 0; typeof\\u0009x; x === "number". Actual: ' + (x)); +} + +//CHECK#2 +if (eval("var x = 0; typeof\u000Bx") !== "number") { + $ERROR('#2: var x = 0; typeof\\u000Bx; x === "number". Actual: ' + (x)); +} + +//CHECK#3 +if (eval("var x = 0; typeof\u000Cx") !== "number") { + $ERROR('#3: var x = 0; typeof\\u000Cx; x === "number". Actual: ' + (x)); +} + +//CHECK#4 +if (eval("var x = 0; typeof\u0020x") !== "number") { + $ERROR('#4: var x = 0; typeof\\u0020x; x === "number". Actual: ' + (x)); +} + +//CHECK#5 +if (eval("var x = 0; typeof\u00A0x") !== "number") { + $ERROR('#5: var x = 0; typeof\\u00A0x; x === "number". Actual: ' + (x)); +} + +//CHECK#6 +if (eval("var x = 0; typeof\u000Ax") !== "number") { + $ERROR('#6: var x = 0; typeof\\u000Ax; x === "number". Actual: ' + (x)); +} + +//CHECK#7 +if (eval("var x = 0; typeof\u000Dx") !== "number") { + $ERROR('#7: var x = 0; typeof\\u000Dx; x === "number". Actual: ' + (x)); +} + +//CHECK#8 +if (eval("var x = 0; typeof\u2028x") !== "number") { + $ERROR('#8: var x = 0; typeof\\u2028x; x === "number". Actual: ' + (x)); +} + +//CHECK#9 +if (eval("var x = 0; typeof\u2029x") !== "number") { + $ERROR('#9: var x = 0; typeof\\u2029x; x === "number". Actual: ' + (x)); +} + +//CHECK#10 +if (eval("var x = 0; typeof\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029x") !== "number") { + $ERROR('#10: var x = 0; typeof\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029x; x === "number". Actual: ' + (x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A2_T1.js new file mode 100644 index 000000000..e10b77101 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A2_T1.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S11.4.3_A2_T1; +* @section: 11.4.3; +* @assertion: Operator "typeof" uses GetValue; +* @description: Either Type(x) is not Reference or GetBase(x) is not null; +*/ + +//CHECK#1 +if (typeof 0 !== "number") { + $ERROR('#1: typeof 0 === "number". Actual: ' + (typeof 0)); +} + +//CHECK#2 +var x = 0; +if (typeof x !== "number") { + $ERROR('#2: typeof x === "number". Actual: ' + (typeof x)); +} + +//CHECK#3 +var x = new Object(); +if (typeof x !== "object") { + $ERROR('#3: var x = new Object(); typeof x === "object". Actual: ' + (typeof x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A2_T2.js new file mode 100644 index 000000000..a67f8bb7b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A2_T2.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S11.4.3_A2_T2; +* @section: 11.4.3; +* @assertion: Operator "typeof" uses GetValue; +* @description: If GetBase(x) is null, return "undefined"; +*/ + +//CHECK#1 +if (typeof x !== "undefined") { + $ERROR('#1: typeof x === "undefined". Actual: ' + (typeof x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A3.1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A3.1.js new file mode 100644 index 000000000..57f977aed --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A3.1.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: S11.4.3_A3.1; +* @section: 11.4.3; +* @assertion: Result of applying "typeof" operator to undefined is "undefined"; +* @description: typeof undefined === "undefined"; +*/ + +//CHECK#1 +if (typeof undefined !== "undefined") { + $ERROR('#1: typeof undefined === "undefined". Actual: ' + (typeof undefined)); +} + +//CHECK#2 +if (typeof void 0 !== "undefined") { + $ERROR('#2: typeof void 0 === "undefined". Actual: ' + (typeof void 0)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A3.2.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A3.2.js new file mode 100644 index 000000000..fa9289780 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A3.2.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: S11.4.3_A3.2; +* @section: 11.4.3; +* @assertion: Result of applying "typeof" operator to null is "object"; +* @description: typeof null === "object"; +*/ + +//CHECK#1 +if (typeof null !== "object") { + $ERROR('#1: typeof null === "object". Actual: ' + (typeof null)); +} + +//CHECK#2 +if (typeof RegExp("0").exec("1") !== "object") { + $ERROR('#2: typeof RegExp("0").exec("1") === "object". Actual: ' + (typeof RegExp("0").exec("1"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A3.3.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A3.3.js new file mode 100644 index 000000000..69ae3ea68 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A3.3.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: S11.4.3_A3.3; +* @section: 11.4.3; +* @assertion: Result of applying "typeof" operator to boolean is "boolean"; +* @description: typeof (boolean value) === "boolean"; +*/ + +//CHECK#1 +if (typeof true !== "boolean") { + $ERROR('#1: typeof true === "boolean". Actual: ' + (typeof true)); +} + +//CHECK#2 +if (typeof false !== "boolean") { + $ERROR('#2: typeof false === "boolean". Actual: ' + (typeof false)); +} + +//CHECK#3 +if (typeof !-1 !== "boolean") { + $ERROR('#3: typeof !-1 === "boolean". Actual: ' + (typeof !-1)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A3.4.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A3.4.js new file mode 100644 index 000000000..2eb59c509 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A3.4.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S11.4.3_A3.4; +* @section: 11.4.3; +* @assertion: Result of appying "typeof" operator to number is "number"; +* @description: typeof (number value) === "number"; +*/ + +//CHECK#1 +if (typeof 1 !== "number") { + $ERROR('#1: typeof 1 === "number". Actual: ' + (typeof 1)); +} + +//CHECK#2 +if (typeof Number.NaN !== "number") { + $ERROR('#2: typeof NaN === "number". Actual: ' + (typeof NaN)); +} + +//CHECK#3 +if (typeof Number.POSITIVE_INFINITY !== "number") { + $ERROR('#3: typeof Infinity === "number". Actual: ' + (typeof Infinity)); +} + +//CHECK#4 +if (typeof Number.NEGATIVE_INFINITY !== "number") { + $ERROR('#4: typeof -Infinity === "number". Actual: ' + (typeof -Infinity)); +} + +//CHECK#5 +if (typeof Math.PI !== "number") { + $ERROR('#5: typeof Math.PI === "number". Actual: ' + (typeof Math.PI)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A3.5.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A3.5.js new file mode 100644 index 000000000..4f16f8361 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A3.5.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. + +/** +* @name: S11.4.3_A3.5; +* @section: 11.4.3; +* @assertion: Result of appying "typeof" operator to string is "string"; +* @description: typeof (string value) === "string"; +*/ + +//CHECK#1 +if (typeof "1" !== "string") { + $ERROR('#1: typeof "1" === "string". Actual: ' + (typeof "1")); +} + +//CHECK#2 +if (typeof "NaN" !== "string") { + $ERROR('#2: typeof "NaN" === "string". Actual: ' + (typeof "NaN")); +} + +//CHECK#3 +if (typeof "Infinity" !== "string") { + $ERROR('#3: typeof "Infinity" === "string". Actual: ' + (typeof "Infinity")); +} + +//CHECK#4 +if (typeof "" !== "string") { + $ERROR('#4: typeof "" === "string". Actual: ' + (typeof "")); +} + +//CHECK#5 +if (typeof "true" !== "string") { + $ERROR('#5: typeof "true" === "string". Actual: ' + (typeof "true")); +} + +//CHECK#6 +if (typeof Date() !== "string") { + $ERROR('#6: typeof Date() === "string". Actual: ' + (typeof Date())); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A3.6.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A3.6.js new file mode 100644 index 000000000..b01810f97 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A3.6.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: S11.4.3_A3.6; +* @section: 11.4.3; +* @assertion: Result of applying "typeof" operator to the object that is native and doesn't implement [[Call]] is "object"; +* @description: typeof (object without [[Call]]) === "object"; +*/ + +//CHECK#1 +if (typeof this !== "object") { + $ERROR('#1: typeof this === "object". Actual: ' + (typeof this)); +} + +//CHECK#2 +if (typeof new Object() !== "object") { + $ERROR('#2: typeof new Object() === "object". Actual: ' + (typeof new Object())); +} + +//CHECK#3 +if (typeof new Array(1,2,3) !== "object") { + $ERROR('#3: typeof new Array(1,2,3) === "object". Actual: ' + (typeof new Array(1,2,3))); +} + +//CHECK#4 +if (typeof Array(1,2,3) !== "object") { + $ERROR('#4: typeof Array(1,2,3) === "object". Actual: ' + (typeof Array(1,2,3))); +} + +//CHECK#5 +if (typeof new String("x") !== "object") { + $ERROR('#5: typeof new String("x") === "object". Actual: ' + (typeof new String("x"))); +} + +//CHECK#6 +if (typeof new Boolean(true) !== "object") { + $ERROR('#6: typeof new Boolean(true) === "object". Actual: ' + (typeof new Boolean(true))); +} + +//CHECK#7 +if (typeof new Number(1) !== "object") { + $ERROR('#7: typeof new Number(1) === "object". Actual: ' + (typeof new Number(1))); +} + +//CHECK#8 +//The Math object does not have a [[Construct]] property; +//it is not possible to use the Math object as a constructor with the new operator. +//The Math object does not have a [[Call]] property; it is not possible to invoke the Math object as a object. +if (typeof Math !== "object") { + $ERROR('#8: typeof Math === "object". Actual: ' + (typeof Math)); +} + +//CHECK#9 +if (typeof new Date() !== "object") { + $ERROR('#9: typeof new Date() === "object". Actual: ' + (typeof new Date())); +} + +//CHECK#10 +if (typeof new Error() !== "object") { + $ERROR('#10: typeof new Error() === "object". Actual: ' + (typeof new Error())); +} + +//CHECK#11 +if (typeof new RegExp() !== "object") { + $ERROR('#11: typeof new RegExp() === "object". Actual: ' + (typeof new RegExp())); +} + +//CHECK#12 +if (typeof RegExp() !== "object") { + $ERROR('#12: typeof RegExp() === "object". Actual: ' + (typeof RegExp())); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A3.7.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A3.7.js new file mode 100644 index 000000000..b6134679e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A3.7.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. + +/** +* @name: S11.4.3_A3.7; +* @section: 11.4.3; +* @assertion: Result of applying "typeof" operator to the object that is native and implements [[Call]] is "function"; +* @description: typeof (object with [[Call]]) === "function"; +*/ + +//CHECK#1 +if (typeof new Function() !== "function") { + $ERROR('#1: typeof new Function() === "function". Actual: ' + (typeof new Function())); +} + +//CHECK#2 +if (typeof Function() !== "function") { + $ERROR('#2: typeof Function() === "function". Actual: ' + (typeof Function())); +} + +//CHECK#3 +if (typeof Object !== "function") { + $ERROR('#3: typeof Object === "function". Actual: ' + (typeof Object)); +} + +//CHECK#4 +if (typeof String !== "function") { + $ERROR('#4: typeof String === "function". Actual: ' + (typeof String)); +} + +//CHECK5 +if (typeof Boolean !== "function") { + $ERROR('#5: typeof Boolean === "function". Actual: ' + (typeof Boolean)); +} + +//CHECK#6 +if (typeof Number !== "function") { + $ERROR('#6: typeof Number === "function". Actual: ' + (typeof Number)); +} + +//CHECK#7 +if (typeof Date !== "function") { + $ERROR('#7: typeof Date === "function". Actual: ' + (typeof Date)); +} + +//CHECK#8 +if (typeof Error !== "function") { + $ERROR('#8: typeof Error === "function". Actual: ' + (typeof Error)); +} + +//CHECK#9 +if (typeof RegExp !== "function") { + $ERROR('#9: typeof RegExp === "function". Actual: ' + (typeof RegExp)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A1.js new file mode 100644 index 000000000..edd8abd85 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A1.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: S11.4.4_A1; +* @section: 11.4.4, 11.6.3, 7.2, 7.3; +* @assertion: White Space and Line Terminator between "++" and UnaryExpression are allowed; +* @description: Checking by using eval; +*/ + +//CHECK#1 +if (eval("var x = 0; ++\u0009x") !== 1) { + $ERROR('#1: var x = 0; ++\\u0009x; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +if (eval("var x = 0; ++\u000Bx") !== 1) { + $ERROR('#2: var x = 0; ++\\u000Bx; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +if (eval("var x = 0; ++\u000Cx") !== 1) { + $ERROR('#3: var x = 0; ++\\u000Cx; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +if (eval("var x = 0; ++\u0020x") !== 1) { + $ERROR('#4: var x = 0; ++\\u0020x; x === 1. Actual: ' + (x)); +} + +//CHECK#5 +if (eval("var x = 0; ++\u00A0x") !== 1) { + $ERROR('#5: var x = 0; ++\\u00A0x; x === 1. Actual: ' + (x)); +} + +//CHECK#6 +if (eval("var x = 0; ++\u000Ax") !== 1) { + $ERROR('#6: var x = 0; ++\\u000Ax; x === 1. Actual: ' + (x)); +} + +//CHECK#7 +if (eval("var x = 0; ++\u000Dx") !== 1) { + $ERROR('#7: var x = 0; ++\\u000Dx; x === 1. Actual: ' + (x)); +} + +//CHECK#8 +if (eval("var x = 0; ++\u2028x") !== 1) { + $ERROR('#8: var x = 0; ++\\u2028x; x === 1. Actual: ' + (x)); +} + +//CHECK#9 +if (eval("var x = 0; ++\u2029x") !== 1) { + $ERROR('#9: var x = 0; ++\\u2029x; x === 1. Actual: ' + (x)); +} + +//CHECK#10 +if (eval("var x = 0; ++\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029x") !== 1) { + $ERROR('#10: var x = 0; ++\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029x; x === 1. Actual: ' + (x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A2.1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A2.1_T1.js new file mode 100644 index 000000000..34d2168dd --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A2.1_T1.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S11.4.4_A2.1_T1; +* @section: 11.4.4, 11.6.3; +* @assertion: Operator ++x uses GetValue and PutValue; +* @description: Type(x) is Reference and GetBase(x) is not null; +*/ + +//CHECK#1 +var x = 1; +if (++x !== 1 + 1) { + $ERROR('#1: var x = 1; ++x === 1 + 1. Actual: ' + (++x)); +} else { + if (x !== 1 + 1) { + $ERROR('#1: var x = 1; ++x; x === 1 + 1. Actual: ' + (x)); + } +} + +//CHECK#2 +this.x = 1; +if (++this.x !== 1 + 1) { + $ERROR('#2: this.x = 1; ++this.x === 1 + 1. Actual: ' + (++this.x)); +} else { + if (this.x !== 1 + 1) { + $ERROR('#2: this.x = 1; ++this.x; this.x === 1 + 1. Actual: ' + (this.x)); + } +} + +//CHECK#3 +var object = new Object(); +object.prop = 1; +if (++object.prop !== 1 + 1) { + $ERROR('#3: var object = new Object(); object.prop = 1; ++object.prop === 1 + 1. Actual: ' + (++object.prop)); +} else { + if (this.x !== 1 + 1) { + $ERROR('#3: var object = new Object(); object.prop = 1; ++object.prop; object.prop === 1 + 1. Actual: ' + (object.prop)); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A2.1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A2.1_T2.js new file mode 100644 index 000000000..4c951602c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A2.1_T2.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: S11.4.4_A2.1_T2; +* @section: 11.4.4, 11.6.3; +* @assertion: Operator ++x uses GetValue and PutValue; +* @description: If GetBase(x) is null, throw ReferenceError; +*/ + +//CHECK#1 +try { + ++x; + $ERROR('#1.1: ++x throw ReferenceError. Actual: ' + (++x)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: ++x throw ReferenceError. Actual: ' + (e)); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A2.1_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A2.1_T3.js new file mode 100644 index 000000000..feffe6b60 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A2.1_T3.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: S11.4.4_A2.1_T3; +* @section: 11.4.4, 11.6.3; +* @assertion: Operator ++x uses GetValue and PutValue; +* @description: If Type(x) is not Reference, throw ReferenceError (or SyntaxError); +* @negative +*/ + +//CHECK#1 +try { + ++1; + $ERROR('#1.1: ++1 throw ReferenceError (or SyntaxError). Actual: ' + (++1)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: ++1 throw ReferenceError (or SyntaxError). Actual: ' + (e)); + } else { + ++1; + } +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A2.2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A2.2_T1.js new file mode 100644 index 000000000..6d0183284 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A2.2_T1.js @@ -0,0 +1,103 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S11.4.4_A2.2_T1; + * @section: 11.4.4, 8.6.2.6; + * @assertion: Operator ++x uses [[Default Value]]; + * @description: If Type(value) is Object, evaluate ToPrimitive(value, Number); + */ + +//CHECK#1 +var object = {valueOf: function() {return 1}}; +if (++object !== 1 + 1) { + $ERROR('#1: var object = {valueOf: function() {return 1}}; ++object === 1 + 1. Actual: ' + (++object)); +} else { + if (object !== 1 + 1) { + $ERROR('#1: var object = {valueOf: function() {return 1}}; ++object; object === 1 + 1. Actual: ' + (object)); + } +} + +//CHECK#2 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +if (++object !== 1 + 1) { + $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; ++object === 1 + 1. Actual: ' + (++object)); +} else { + if (object !== 1 + 1) { + $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; ++object; object === 1 + 1. Actual: ' + (object)); + } +} + +//CHECK#3 +var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +if (++object !== 1 + 1) { + $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; ++object === 1 + 1. Actual: ' + (++object)); +} else { + if (object !== 1 + 1) { + $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; ++object; object === 1 + 1. Actual: ' + (object)); + } +} + +//CHECK#4 +try { + var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; + if (++object !== 1 + 1) { + $ERROR('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ++object === 1 + 1. Actual: ' + (++object)); + } else { + if (object !== 1 + 1) { + $ERROR('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ++object; object === 1 + 1. Actual: ' + (object)); + } + } +} +catch (e) { + if (e === "error") { + $ERROR('#4.2: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ++object not throw "error"'); + } else { + $ERROR('#4.3: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ++object not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return 1}}; +if (++object !== 1 + 1) { + $ERROR('#5.1: var object = {toString: function() {return 1}}; ++object === 1 + 1. Actual: ' + (++object)); +} else { + if (object !== 1 + 1) { + $ERROR('#5.2: var object = {toString: function() {return 1}}; ++object; object === 1 + 1. Actual: ' + (object)); + } +} + + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return 1}} +if (++object !== 1 + 1) { + $ERROR('#6.1: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; ++object === 1 + 1. Actual: ' + (++object)); +} else { + if (object !== 1 + 1) { + $ERROR('#6.2: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; ++object; object === 1 + 1. Actual: ' + (object)); + } +} + +//CHECK#7 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; + ++object; + $ERROR('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; ++object throw "error". Actual: ' + (++object)); +} +catch (e) { + if (e !== "error") { + $ERROR('#7.2: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; ++object throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = {valueOf: function() {return {}}, toString: function() {return {}}}; + ++object; + $ERROR('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; ++object throw TypeError. Actual: ' + (++object)); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; ++object throw TypeError. Actual: ' + (e)); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A3_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A3_T1.js new file mode 100644 index 000000000..738629610 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A3_T1.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. + +/** +* @name: S11.4.4_A3_T1; +* @section: 11.4.4, 11.6.3; +* @assertion: Operator ++x returns x = ToNumber(x) + 1; +* @description: Type(x) is boolean primitive or Boolean object; +*/ + +//CHECK#1 +var x = false; +++x; +if (x !== 0 + 1) { + $ERROR('#1: var x = false; ++x; x === 0 + 1. Actual: ' + (x)); +} + +//CHECK#2 +var x = new Boolean(true); +++x; +if (x !== 1 + 1) { + $ERROR('#2: var x = new Boolean(true); ++x; x === 1 + 1. Actual: ' + (x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A3_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A3_T2.js new file mode 100644 index 000000000..c3e89f381 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A3_T2.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. + +/** +* @name: S11.4.4_A3_T2; +* @section: 11.4.4, 11.6.3; +* @assertion: Operator ++x returns x = ToNumber(x) + 1; +* @description: Type(x) is number primitive or Number object; +*/ + +//CHECK#1 +var x = 0.1; +++x; +if (x !== 0.1 + 1) { + $ERROR('#1: var x = 0.1; ++x; x === 0.1 + 1. Actual: ' + (x)); +} + +//CHECK#2 +var x = new Number(-1.1); +++x; +if (x !== -1.1 + 1) { + $ERROR('#2: var x = new Number(-1.1); ++x; x === -1.1 + 1. Actual: ' + (x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A3_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A3_T3.js new file mode 100644 index 000000000..50b298dd8 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A3_T3.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. + +/** +* @name: S11.4.4_A3_T3; +* @section: 11.4.4, 11.6.3; +* @assertion: Operator ++x returns x = ToNumber(x) + 1; +* @description: Type(x) is string primitive or String object; +*/ + +//CHECK#1 +var x = "1"; +++x; +if (x !== 1 + 1) { + $ERROR('#1: var x = "1"; ++x; x === 1 + 1. Actual: ' + (x)); +} + +//CHECK#2 +var x = "x"; +++x; +if (isNaN(x) !== true) { + $ERROR('#2: var x = "x"; ++x; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +var x = new Number("-1"); +++x; +if (x !== -1 + 1) { + $ERROR('#3: var x = new String("-1"); ++x; x === -1 + 1. Actual: ' + (x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A3_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A3_T4.js new file mode 100644 index 000000000..8b6f1c5ad --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A3_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. + +/** +* @name: S11.4.4_A3_T4; +* @section: 11.4.4, 11.6.3; +* @assertion: Operator ++x returns x = ToNumber(x) + 1; +* @description: Type(x) is undefined or null; +*/ + +//CHECK#1 +var x; +++x; +if (isNaN(x) !== true) { + $ERROR('#1: var x; ++x; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +var x = null; +++x; +if (x !== 1) { + $ERROR('#2: var x = null; ++x; x === 1. Actual: ' + (x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A3_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A3_T5.js new file mode 100644 index 000000000..c32f787ec --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A3_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. + +/** +* @name: S11.4.4_A3_T5; +* @section: 11.4.4, 11.6.3; +* @assertion: Operator ++x returns x = ToNumber(x) + 1; +* @description: Type(x) is Object object or Function object; +*/ + +//CHECK#1 +var x = {}; +++x; +if (isNaN(x) !== true) { + $ERROR('#1: var x = {}; ++x; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +var x = function(){return 1}; +++x; +if (isNaN(x) !== true) { + $ERROR('#2: var x = function(){return 1}; ++x; x === Not-a-Number. Actual: ' + (x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A4_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A4_T1.js new file mode 100644 index 000000000..304fefe64 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A4_T1.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. + +/** +* @name: S11.4.4_A4_T1; +* @section: 11.4.4, 11.6.3; +* @assertion: Operator ++x returns ToNumber(x) + 1; +* @description: Type(x) is boolean primitive or Boolean object; +*/ + +//CHECK#1 +var x = false; +if (++x !== 0 + 1) { + $ERROR('#1: var x = false; ++x === 0 + 1. Actual: ' + (++x)); +} + +//CHECK#2 +var x = new Boolean(true); +if (++x !== 1 + 1) { + $ERROR('#2: var x = new Boolean(true); ++x === 1 + 1. Actual: ' + (++x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A4_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A4_T2.js new file mode 100644 index 000000000..5f406a602 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A4_T2.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. + +/** +* @name: S11.4.4_A4_T2; +* @section: 11.4.4, 11.6.3; +* @assertion: Operator ++x returns ToNumber(x) + 1; +* @description: Type(x) is number primitive or Number object; +*/ + +//CHECK#1 +var x = 0.1; +if (++x !== 0.1 + 1) { + $ERROR('#1: var x = 0.1; ++x === 0.1 + 1. Actual: ' + (++x)); +} + +//CHECK#2 +var x = new Number(-1.1); +if (++x !== -1.1 + 1) { + $ERROR('#2: var x = new Number(-1.1); ++x === -1.1 + 1. Actual: ' + (++x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A4_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A4_T3.js new file mode 100644 index 000000000..9d3a3c734 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A4_T3.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. + +/** +* @name: S11.4.4_A4_T3; +* @section: 11.4.4, 11.6.3; +* @assertion: Operator ++x returns ToNumber(x) + 1; +* @description: Type(x) is string primitive or String object; +*/ + +//CHECK#1 +var x = "1"; +if (++x !== 1 + 1) { + $ERROR('#1: var x = "1"; ++x === 1 + 1. Actual: ' + (++x)); +} + +//CHECK#2 +var x = "x"; +if (isNaN(++x) !== true) { + $ERROR('#2: var x = "x"; ++x === Not-a-Number. Actual: ' + (++x)); +} + +//CHECK#3 +var x = new String("-1"); +if (++x !== -1 + 1) { + $ERROR('#3: var x = new String("-1"); ++x === -1 + 1. Actual: ' + (++x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A4_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A4_T4.js new file mode 100644 index 000000000..19ec7fcf6 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A4_T4.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. + +/** +* @name: S11.4.4_A4_T4; +* @section: 11.4.4, 11.6.3; +* @assertion: Operator ++x returns ToNumber(x) + 1; +* @description: Type(x) is undefined or null; +*/ + +//CHECK#1 +var x; +if (isNaN(++x) !== true) { + $ERROR('#1: var x; ++x === Not-a-Number. Actual: ' + (++x)); +} + +//CHECK#2 +var x = null; +if (++x !== 1) { + $ERROR('#2: var x = null; ++x === 1. Actual: ' + (++x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A4_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A4_T5.js new file mode 100644 index 000000000..dee44bfe4 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator/S11.4.4_A4_T5.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. + +/** +* @name: S11.4.4_A4_T5; +* @section: 11.4.4, 11.6.3; +* @assertion: Operator ++x returns ToNumber(x) + 1; +* @description: Type(x) is Object object or Function object; +*/ + +//CHECK#1 +var x = {}; +if (isNaN(++x) !== true) { + $ERROR('#1: var x = {}; ++x === Not-a-Number. Actual: ' + (++x)); +} + +//CHECK#2 +var x = function(){return 1}; +if (isNaN(++x) !== true) { + $ERROR('#2: var x = function(){return 1}; ++x === Not-a-Number. Actual: ' + (++x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A1.js new file mode 100644 index 000000000..0a3f512bc --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A1.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: S11.4.5_A1; +* @section: 11.4.5, 11.6.3, 7.2, 7.3; +* @assertion: White Space and Line Terminator between "--" and UnaryExpression are allowed; +* @description: Checking by using eval; +*/ + +//CHECK#1 +if (eval("var x = 1; --\u0009x") !== 0) { + $ERROR('#1: var x = 1; --\\u0009x; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +if (eval("var x = 1; --\u000Bx") !== 0) { + $ERROR('#2: var x = 1; --\\u000Bx; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +if (eval("var x = 1; --\u000Cx") !== 0) { + $ERROR('#3: var x = 1; --\\u000Cx; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +if (eval("var x = 1; --\u0020x") !== 0) { + $ERROR('#4: var x = 1; --\\u0020x; x === 0. Actual: ' + (x)); +} + +//CHECK#5 +if (eval("var x = 1; --\u00A0x") !== 0) { + $ERROR('#5: var x = 1; --\\u00A0x; x === 0. Actual: ' + (x)); +} + +//CHECK#6 +if (eval("var x = 1; --\u000Ax") !== 0) { + $ERROR('#6: var x = 1; --\\u000Ax; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +if (eval("var x = 1; --\u000Dx") !== 0) { + $ERROR('#7: var x = 1; --\\u000Dx; x === 0. Actual: ' + (x)); +} + +//CHECK#8 +if (eval("var x = 1; --\u2028x") !== 0) { + $ERROR('#8: var x = 1; --\\u2028x; x === 0. Actual: ' + (x)); +} + +//CHECK#9 +if (eval("var x = 1; --\u2029x") !== 0) { + $ERROR('#9: var x = 1; --\\u2029x; x === 0. Actual: ' + (x)); +} + +//CHECK#10 +if (eval("var x = 1; --\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029x") !== 0) { + $ERROR('#10: var x = 1; --\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029x; x === 0. Actual: ' + (x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A2.1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A2.1_T1.js new file mode 100644 index 000000000..c22f7a592 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A2.1_T1.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S11.4.5_A2.1_T1; +* @section: 11.4.5, 11.6.3; +* @assertion: Operator --x uses GetValue and PutValue; +* @description: Type(x) is Reference and GetBase(x) is not null; +*/ + +//CHECK#1 +var x = 1; +if (--x !== 1 - 1) { + $ERROR('#1: var x = 1; --x === 1 - 1. Actual: ' + (--x)); +} else { + if (x !== 1 - 1) { + $ERROR('#1: var x = 1; --x; x === 1 - 1. Actual: ' + (x)); + } +} + +//CHECK#2 +this.x = 1; +if (--this.x !== 1 - 1) { + $ERROR('#2: this.x = 1; --this.x === 1 - 1. Actual: ' + (--this.x)); +} else { + if (this.x !== 1 - 1) { + $ERROR('#2: this.x = 1; --this.x; this.x === 1 - 1. Actual: ' + (this.x)); + } +} + +//CHECK#3 +var object = new Object(); +object.prop = 1; +if (--object.prop !== 1 - 1) { + $ERROR('#3: var object = new Object(); object.prop = 1; --object.prop === 1 - 1. Actual: ' + (--object.prop)); +} else { + if (this.x !== 1 - 1) { + $ERROR('#3: var object = new Object(); object.prop = 1; --object.prop; object.prop === 1 - 1. Actual: ' + (object.prop)); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A2.1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A2.1_T2.js new file mode 100644 index 000000000..2b4e33646 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A2.1_T2.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. + +/** +* @name: S11.4.5_A2.1_T2; +* @section: 11.4.5, 11.6.3; +* @assertion: Operator --x uses GetValue and PutValue; +* @description: If GetBase(x) is null, throw ReferenceError; +*/ + +//CHECK#1 +try { + --x; + $ERROR('#1.1: --x throw ReferenceError. Actual: ' + (--x)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: --x throw ReferenceError. Actual: ' + (e)); + } +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A2.1_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A2.1_T3.js new file mode 100644 index 000000000..30901bae0 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A2.1_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. + +/** +* @name: S11.4.5_A2.1_T3; +* @section: 11.4.5, 11.6.3; +* @assertion: Operator --x uses GetValue and PutValue; +* @description: If Type(x) is not Reference, throw ReferenceError (or SyntaxError); +* @negative +*/ + +//CHECK#1 +try { + --1; + $ERROR('#1.1: --1 throw ReferenceError (or SyntaxError). Actual: ' + (--1)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: --1 throw ReferenceError (or SyntaxError). Actual: ' + (e)); + } else { + --1; + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A2.2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A2.2_T1.js new file mode 100644 index 000000000..365ab2577 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A2.2_T1.js @@ -0,0 +1,103 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S11.4.5_A2.2_T1; + * @section: 11.4.5, 8.6.2.6; + * @assertion: Operator --x uses [[Default Value]]; + * @description: If Type(value) is Object, evaluate ToPrimitive(value, Number); + */ + +//CHECK#1 +var object = {valueOf: function() {return 1}}; +if (--object !== 1 - 1) { + $ERROR('#1: var object = {valueOf: function() {return 1}}; --object === 1 - 1. Actual: ' + (--object)); +} else { + if (object !== 1 - 1) { + $ERROR('#1: var object = {valueOf: function() {return 1}}; --object; object === 1 - 1. Actual: ' + (object)); + } +} + +//CHECK#2 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +if (--object !== 1 - 1) { + $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; --object === 1 - 1. Actual: ' + (--object)); +} else { + if (object !== 1 - 1) { + $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; --object; object === 1 - 1. Actual: ' + (object)); + } +} + +//CHECK#3 +var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +if (--object !== 1 - 1) { + $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; --object === 1 - 1. Actual: ' + (--object)); +} else { + if (object !== 1 - 1) { + $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; --object; object === 1 - 1. Actual: ' + (object)); + } +} + +//CHECK#4 +try { + var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; + if (--object !== 1 - 1) { + $ERROR('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; --object === 1 - 1. Actual: ' + (--object)); + } else { + if (object !== 1 - 1) { + $ERROR('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; --object; object === 1 - 1. Actual: ' + (object)); + } + } +} +catch (e) { + if (e === "error") { + $ERROR('#4.2: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; --object not throw "error"'); + } else { + $ERROR('#4.3: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; --object not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return 1}}; +if (--object !== 1 - 1) { + $ERROR('#5.1: var object = {toString: function() {return 1}}; --object === 1 - 1. Actual: ' + (--object)); +} else { + if (object !== 1 - 1) { + $ERROR('#5.2: var object = {toString: function() {return 1}}; --object; object === 1 - 1. Actual: ' + (object)); + } +} + + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return 1}} +if (--object !== 1 - 1) { + $ERROR('#6.1: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; --object === 1 - 1. Actual: ' + (--object)); +} else { + if (object !== 1 - 1) { + $ERROR('#6.2: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; --object; object === 1 - 1. Actual: ' + (object)); + } +} + +//CHECK#7 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; + --object; + $ERROR('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; --object throw "error". Actual: ' + (--object)); +} +catch (e) { + if (e !== "error") { + $ERROR('#7.2: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; --object throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = {valueOf: function() {return {}}, toString: function() {return {}}}; + --object; + $ERROR('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; --object throw TypeError. Actual: ' + (--object)); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; --object throw TypeError. Actual: ' + (e)); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A3_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A3_T1.js new file mode 100644 index 000000000..280c47a3c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A3_T1.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. + +/** +* @name: S11.4.5_A3_T1; +* @section: 11.4.5, 11.6.3; +* @assertion: Operator --x returns x = ToNumber(x) - 1; +* @description: Type(x) is boolean primitive or Boolean object; +*/ + +//CHECK#1 +var x = true; +--x; +if (x !== 1 - 1) { + $ERROR('#1: var x = true; --x; x === 1 - 1. Actual: ' + (x)); +} + +//CHECK#2 +var x = new Boolean(false); +--x; +if (x !== 0 - 1) { + $ERROR('#2: var x = new Boolean(false); --x; x === 0 - 1. Actual: ' + (x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A3_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A3_T2.js new file mode 100644 index 000000000..06eb04ce7 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A3_T2.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. + +/** +* @name: S11.4.5_A3_T2; +* @section: 11.4.5, 11.6.3; +* @assertion: Operator --x returns x = ToNumber(x) - 1; +* @description: Type(x) is number primitive or Number object; +*/ + +//CHECK#1 +var x = 0.1; +--x; +if (x !== 0.1 - 1) { + $ERROR('#1: var x = 0.1; --x; x === 0.1 - 1. Actual: ' + (x)); +} + +//CHECK#2 +var x = new Number(-1.1); +--x; +if (x !== -1.1 - 1) { + $ERROR('#2: var x = new Number(-1.1); --x; x === -1.1 - 1. Actual: ' + (x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A3_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A3_T3.js new file mode 100644 index 000000000..f5d7bd077 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A3_T3.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. + +/** +* @name: S11.4.5_A3_T3; +* @section: 11.4.5, 11.6.3; +* @assertion: Operator --x returns x = ToNumber(x) - 1; +* @description: Type(x) is primitive string or String object; +*/ + +//CHECK#1 +var x = "1"; +--x; +if (x !== 1 - 1) { + $ERROR('#1: var x = "1"; --x; x === 1 - 1. Actual: ' + (x)); +} + +//CHECK#2 +var x = "x"; +--x; +if (isNaN(x) !== true) { + $ERROR('#2: var x = "x"; --x; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +var x = new Number("-1"); +--x; +if (x !== -1 - 1) { + $ERROR('#3: var x = new String("-1"); --x; x === -1 - 1. Actual: ' + (x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A3_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A3_T4.js new file mode 100644 index 000000000..60650b162 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A3_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. + +/** +* @name: S11.4.5_A3_T4; +* @section: 11.4.5, 11.6.3; +* @assertion: Operator --x returns x = ToNumber(x) - 1; +* @description: Type(x) is undefined or null; +*/ + +//CHECK#1 +var x; +--x; +if (isNaN(x) !== true) { + $ERROR('#1: var x; --x; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +var x = null; +--x; +if (x !== -1) { + $ERROR('#2: var x = null; --x; x === -1. Actual: ' + (x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A3_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A3_T5.js new file mode 100644 index 000000000..625aeb03d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A3_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. + +/** +* @name: S11.4.5_A3_T5; +* @section: 11.4.5, 11.6.3; +* @assertion: Operator --x returns x = ToNumber(x) - 1; +* @description: Type(x) is Object object or Function object; +*/ + +//CHECK#1 +var x = {}; +--x; +if (isNaN(x) !== true) { + $ERROR('#1: var x = {}; --x; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +var x = function(){return 1}; +--x; +if (isNaN(x) !== true) { + $ERROR('#2: var x = function(){return 1}; --x; x === Not-a-Number. Actual: ' + (x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A4_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A4_T1.js new file mode 100644 index 000000000..108dc2cde --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A4_T1.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. + +/** +* @name: S11.4.5_A4_T1; +* @section: 11.4.5, 11.6.3; +* @assertion: Operator --x returns ToNumber(x) - 1; +* @description: Type(x) is boolean primitive or Boolean object; +*/ + +//CHECK#1 +var x = true; +if (--x !== 1 - 1) { + $ERROR('#1: var x = true; --x === 1 - 1. Actual: ' + (--x)); +} + +//CHECK#2 +var x = new Boolean(false); +if (--x !== 0 - 1) { + $ERROR('#2: var x = new Boolean(false); --x === 0 - 1. Actual: ' + (--x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A4_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A4_T2.js new file mode 100644 index 000000000..55c8d1890 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A4_T2.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. + +/** +* @name: S11.4.5_A4_T2; +* @section: 11.4.5, 11.6.3; +* @assertion: Operator --x returns ToNumber(x) - 1; +* @description: Type(x) is number primitive or Number object; +*/ + +//CHECK#1 +var x = 0.1; +if (--x !== 0.1 - 1) { + $ERROR('#1: var x = 0.1; --x === 0.1 - 1. Actual: ' + (--x)); +} + +//CHECK#2 +var x = new Number(-1.1); +if (--x !== -1.1 - 1) { + $ERROR('#2: var x = new Number(-1.1); --x === -1.1- 1. Actual: ' + (--x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A4_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A4_T3.js new file mode 100644 index 000000000..dc33d235e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A4_T3.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. + +/** +* @name: S11.4.5_A4_T3; +* @section: 11.4.5, 11.6.3; +* @assertion: Operator --x returns ToNumber(x) - 1; +* @description: Type(x) is string primitive or String object; +*/ + +//CHECK#1 +var x = "1"; +if (--x !== 1 - 1) { + $ERROR('#1: var x = "1"; --x === 1 - 1. Actual: ' + (--x)); +} + +//CHECK#2 +var x = "x"; +if (isNaN(--x) !== true) { + $ERROR('#2: var x = "x"; --x === Not-a-Number. Actual: ' + (--x)); +} + +//CHECK#3 +var x = new String("-1"); +if (--x !== -1 - 1) { + $ERROR('#3: var x = new String("-1"); --x === -1 - 1. Actual: ' + (--x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A4_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A4_T4.js new file mode 100644 index 000000000..d2286fa1c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A4_T4.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: S11.4.5_A4_T4; +* @section: 11.4.5, 11.6.3; +* @assertion: Operator --x returns ToNumber(x) - 1; +* @description: Type(x) is undefined or null; +*/ + + +//CHECK#1 +var x; +if (isNaN(--x) !== true) { + $ERROR('#1: var x; --x; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +var x = null; +if (--x !== -1) { + $ERROR('#2: var x = null; --x === -1. Actual: ' + (--x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A4_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A4_T5.js new file mode 100644 index 000000000..53be1d0db --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.5_Prefix_Decrement_Operator/S11.4.5_A4_T5.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. + +/** +* @name: S11.4.5_A4_T5; +* @section: 11.4.5, 11.6.3; +* @assertion: Operator --x returns ToNumber(x) - 1; +* @description: Type(x) is Object object or Function object; +*/ + +//CHECK#1 +var x = {}; +if (isNaN(--x) !== true) { + $ERROR('#1: var x = {}; --x === Not-a-Number. Actual: ' + (--x)); +} + +//CHECK#2 +var x = function(){return 1}; +if (isNaN(--x) !== true) { + $ERROR('#2: var x = function(){return 1}; --x === Not-a-Number. Actual: ' + (--x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.6_Unary_plus_Operator/S11.4.6_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.6_Unary_plus_Operator/S11.4.6_A1.js new file mode 100644 index 000000000..aeb9636fc --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.6_Unary_plus_Operator/S11.4.6_A1.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: S11.4.6_A1; +* @section: 11.4.6, 7.2, 7.3; +* @assertion: White Space and Line Terminator between "+" and UnaryExpression are allowed; +* @description: Checking by using eval; +*/ + +//CHECK#1 +if (eval("+\u00091") !== 1) { + $ERROR('#1: +\\u00091 === 1'); +} + +//CHECK#2 +if (eval("+\u000B1") !== 1) { + $ERROR('#2: +\\u000B1 === 1'); +} + +//CHECK#3 +if (eval("+\u000C1") !== 1) { + $ERROR('#3: +\\u000C1 === 1'); +} + +//CHECK#4 +if (eval("+\u00201") !== 1) { + $ERROR('#4: +\\u0020 === 1'); +} + +//CHECK#5 +if (eval("+\u00A01") !== 1) { + $ERROR('#5: +\\u00A01 === 1'); +} + +//CHECK#6 +if (eval("+\u000A1") !== 1) { + $ERROR('#6: +\\u000A1 === 1'); +} + +//CHECK#7 +if (eval("+\u000D1") !== 1) { + $ERROR('#7: +\\u000D1 === 1'); +} + +//CHECK#8 +if (eval("+\u20281") !== 1) { + $ERROR('#8: +\\u20281 === 1'); +} + +//CHECK#9 +if (eval("+\u20291") !== 1) { + $ERROR('#9: +\\u20291 === 1'); +} + +//CHECK#10 +if (eval("+\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291") !== 1) { + $ERROR('#10: +\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291 === 1'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.6_Unary_plus_Operator/S11.4.6_A2.1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.6_Unary_plus_Operator/S11.4.6_A2.1_T1.js new file mode 100644 index 000000000..a703e0ff1 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.6_Unary_plus_Operator/S11.4.6_A2.1_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. + +/** +* @name: S11.4.6_A2.1_T1; +* @section: 11.4.6; +* @assertion: Operator +x uses GetValue; +* @description: Either Type(x) is not Reference or GetBase(x) is not null; +*/ + +//CHECK#1 +if (+1 !== 1) { + $ERROR('#1: +1 === 1. Actual: ' + (+1)); +} + +//CHECK#2 +if (+(+1) !== 1) { + $ERROR('#2: +(+1) === -1. Actual: ' + (+(+1))); +} + +//CHECK#3 +var x = 1; +if (+x !== 1) { + $ERROR('#3: var x = +1; -x === 1. Actual: ' + (-x)); +} + +//CHECK#4 +var x = 1; +if (+(+x) !== 1) { + $ERROR('#4: var x = 1; +(+x) === 1. Actual: ' + (+(+x))); +} + +//CHECK#5 +var object = new Object(); +object.prop = 1; +if (+object.prop !== 1) { + $ERROR('#5: var object = new Object(); object.prop = 1; +object.prop === 1. Actual: ' + (+object.prop)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.6_Unary_plus_Operator/S11.4.6_A2.1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.6_Unary_plus_Operator/S11.4.6_A2.1_T2.js new file mode 100644 index 000000000..befd6666c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.6_Unary_plus_Operator/S11.4.6_A2.1_T2.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: S11.4.6_A2.1_T2; +* @section: 11.4.6; +* @assertion: Operator +x uses GetValue; +* @description: If GetBase(x) is null, throw ReferenceError; +*/ + +//CHECK#1 +try { + +x; + $ERROR('#1.1: +x throw ReferenceError. Actual: ' + (+x)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: +x throw ReferenceError. Actual: ' + (e)); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.6_Unary_plus_Operator/S11.4.6_A2.2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.6_Unary_plus_Operator/S11.4.6_A2.2_T1.js new file mode 100644 index 000000000..c6a9dabdd --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.6_Unary_plus_Operator/S11.4.6_A2.2_T1.js @@ -0,0 +1,78 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S11.4.6_A2.2_T1; + * @section: 11.4.6, 8.6.2.6; + * @assertion: Operator +x uses [[Default Value]]; + * @description: If Type(value) is Object, evaluate ToPrimitive(value, Number); + */ + +//CHECK#1 +var object = {valueOf: function() {return 1}}; +if (+object !== 1) { + $ERROR('#1: var object = {valueOf: function() {return 1}}; +object === 1. Actual: ' + (+object)); +} + +//CHECK#2 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +if (+object !== 1) { + $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +object === 1. Actual: ' + (+object)); +} + +//CHECK#3 +var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +if (+object !== 1) { + $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +object === 1. Actual: ' + (+object)); +} + +//CHECK#4 +try { + var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; + if (+object !== 1) { + $ERROR('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; +object === 1. Actual: ' + (+object)); + } +} +catch (e) { + if (e === "error") { + $ERROR('#4.2: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; +object not throw "error"'); + } else { + $ERROR('#4.3: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; +object not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return 1}}; +if (+object !== 1) { + $ERROR('#5: var object = {toString: function() {return 1}}; +object === 1. Actual: ' + (+object)); +} + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return 1}} +if (+object !== 1) { + $ERROR('#6: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; +object === 1. Actual: ' + (+object)); +} + +//CHECK#7 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; + +object; + $ERROR('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; +object throw "error". Actual: ' + (+object)); +} +catch (e) { + if (e !== "error") { + $ERROR('#7.2: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; +object throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = {valueOf: function() {return {}}, toString: function() {return {}}}; + +object; + $ERROR('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; +object throw TypeError. Actual: ' + (+object)); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; +object throw TypeError. Actual: ' + (e)); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.6_Unary_plus_Operator/S11.4.6_A3_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.6_Unary_plus_Operator/S11.4.6_A3_T1.js new file mode 100644 index 000000000..35d2af330 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.6_Unary_plus_Operator/S11.4.6_A3_T1.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: S11.4.6_A3_T1; +* @section: 11.4.6; +* @assertion: Operator +x returns ToNumber(x); +* @description: Type(x) is boolean primitive or Boolean object; +*/ + +//CHECK#1 +if (+false !== 0) { + $ERROR('#1: +false === 0. Actual: ' + (+false)); +} + +//CHECK#2 +if (+new Boolean(true) !== 1) { + $ERROR('#2: +new Boolean(true) === 1. Actual: ' + (+new Boolean(true))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.6_Unary_plus_Operator/S11.4.6_A3_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.6_Unary_plus_Operator/S11.4.6_A3_T2.js new file mode 100644 index 000000000..860f6e333 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.6_Unary_plus_Operator/S11.4.6_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. + +/** +* @name: S11.4.6_A3_T2; +* @section: 11.4.6; +* @assertion: Operator +x returns ToNumber(x); +* @description: Type(x) is number primitive or Number object; +*/ + +//CHECK#1 +if (+0.1 !== 0.1) { + $ERROR('#1: +0.1 === 0.1. Actual: ' + (+0.1)); +} + +//CHECK#2 +if (+new Number(-1.1) !== -1.1) { + $ERROR('#2: +new Number(-1.1) === -1.1. Actual: ' + (+new Number(-1.1))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.6_Unary_plus_Operator/S11.4.6_A3_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.6_Unary_plus_Operator/S11.4.6_A3_T3.js new file mode 100644 index 000000000..40c2fa970 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.6_Unary_plus_Operator/S11.4.6_A3_T3.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: S11.4.6_A3_T3; +* @section: 11.4.6; +* @assertion: Operator +x returns ToNumber(x); +* @description: Type(x) is string primitive or String object; +*/ + +//CHECK#1 +if (+"1" !== 1) { + $ERROR('#1: +"1" === 1. Actual: ' + (+"1")); +} + +//CHECK#2 +if (isNaN(+"x") !== true) { + $ERROR('#2: +"x" === Not-a-Number. Actual: ' + (+"x")); +} + +//CHECK#3 +if (+new Number("-1") !== -1) { + $ERROR('#3: +new String("-1") === -1. Actual: ' + (+new String("-1"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.6_Unary_plus_Operator/S11.4.6_A3_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.6_Unary_plus_Operator/S11.4.6_A3_T4.js new file mode 100644 index 000000000..fa2f16602 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.6_Unary_plus_Operator/S11.4.6_A3_T4.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: S11.4.6_A3_T4; +* @section: 11.4.6; +* @assertion: Operator +x returns ToNumber(x); +* @description: Type(x) is undefined or null; +*/ + +//CHECK#1 +if (isNaN(+void 0) !== true) { + $ERROR('#1: +void 0 === Not-a-Number. Actual: ' + (+void 0)); +} + +//CHECK#2 +if (+null !== 0) { + $ERROR('#2: +null === 0. Actual: ' + (+null)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.6_Unary_plus_Operator/S11.4.6_A3_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.6_Unary_plus_Operator/S11.4.6_A3_T5.js new file mode 100644 index 000000000..78c89c941 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.6_Unary_plus_Operator/S11.4.6_A3_T5.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: S11.4.6_A3_T5; +* @section: 11.4.6; +* @assertion: Operator +x returns ToNumber(x); +* @description: Type(x) is Object object or Function object; +*/ + +//CHECK#1 +if (isNaN(+{}) !== true) { + $ERROR('#1: +{} === Not-a-Number. Actual: ' + (+{})); +} + +//CHECK#2 +if (isNaN(+function(){return 1}) !== true) { + $ERROR('#2: +function(){return 1} === Not-a-Number. Actual: ' + (+function(){return 1})); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A1.js new file mode 100644 index 000000000..0951fa297 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A1.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: S11.4.7_A1; +* @section: 11.4.7, 7.2, 7.3; +* @assertion: White Space and Line Terminator between "-" and UnaryExpression are allowed; +* @description: Checking by using eval; +*/ + +//CHECK#1 +if (eval("-\u00091") !== -1) { + $ERROR('#1: -\\u00091 === -1'); +} + +//CHECK#2 +if (eval("-\u000B1") !== -1) { + $ERROR('#2: -\\u000B1 === -1'); +} + +//CHECK#3 +if (eval("-\u000C1") !== -1) { + $ERROR('#3: -\\u000C1 === -1'); +} + +//CHECK#4 +if (eval("-\u00201") !== -1) { + $ERROR('#4: -\\u0020 === -1'); +} + +//CHECK#5 +if (eval("-\u00A01") !== -1) { + $ERROR('#5: -\\u00A01 === -1'); +} + +//CHECK#6 +if (eval("-\u000A1") !== -1) { + $ERROR('#6: -\\u000A1 === -1'); +} + +//CHECK#7 +if (eval("-\u000D1") !== -1) { + $ERROR('#7: -\\u000D1 === -1'); +} + +//CHECK#8 +if (eval("-\u20281") !== -1) { + $ERROR('#8: -\\u20281 === -1'); +} + +//CHECK#9 +if (eval("-\u20291") !== -1) { + $ERROR('#9: -\\u20291 === -1'); +} + +//CHECK#10 +if (eval("-\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291") !== -1) { + $ERROR('#10: -\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291 === -1'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A2.1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A2.1_T1.js new file mode 100644 index 000000000..22a322348 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A2.1_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. + +/** +* @name: S11.4.7_A2.1_T1; +* @section: 11.4.7; +* @assertion: Operator -x uses GetValue; +* @description: Either Type(x) is not Reference or GetBase(x) is not null; +*/ + +//CHECK#1 +if (-1 !== -1) { + $ERROR('#1: -1 === -1. Actual: ' + (-1)); +} + +//CHECK#2 +if (-(-1) !== 1) { + $ERROR('#2: -(-1) === -1. Actual: ' + (-(-1))); +} + +//CHECK#3 +var x = -1; +if (-x !== 1) { + $ERROR('#3: var x = -1; -x === 1. Actual: ' + (-x)); +} + +//CHECK#4 +var x = -1; +if (-(-x) !== -1) { + $ERROR('#4: var x = -1; -(-x) === -1. Actual: ' + (-(-x))); +} + +//CHECK#5 +var object = new Object(); +object.prop = 1; +if (-object.prop !== -1) { + $ERROR('#5: var object = new Object(); object.prop = -1; -object.prop === -1. Actual: ' + (-object.prop)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A2.1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A2.1_T2.js new file mode 100644 index 000000000..6067d4078 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A2.1_T2.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. + +/** +* @name: S11.4.7_A2.1_T2; +* @section: 11.4.7; +* @assertion: Operator -x uses GetValue; +* @description: If GetBase(x) is null, throw ReferenceError; +*/ + +//CHECK#1 +try { + -x; + $ERROR('#1.1: -x throw ReferenceError. Actual: ' + (-x)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: -x throw ReferenceError. Actual: ' + (e)); + } +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A2.2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A2.2_T1.js new file mode 100644 index 000000000..62445055b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A2.2_T1.js @@ -0,0 +1,78 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S11.4.7_A2.2_T1; + * @section: 11.4.7, 8.6.2.6; + * @assertion: Operator -x uses [[Default Value]]; + * @description: If Type(value) is Object, evaluate ToPrimitive(value, Number); + */ + +//CHECK#1 +var object = {valueOf: function() {return -1}}; +if (-object !== 1) { + $ERROR('#1: var object = {valueOf: function() {return -1}}; -object === 1. Actual: ' + (-object)); +} + +//CHECK#2 +var object = {valueOf: function() {return -1}, toString: function() {return 0}}; +if (-object !== 1) { + $ERROR('#2: var object = {valueOf: function() {return -1}, toString: function() {return 0}}; -object === 1. Actual: ' + (-object)); +} + +//CHECK#3 +var object = {valueOf: function() {return -1}, toString: function() {return {}}}; +if (-object !== 1) { + $ERROR('#3: var object = {valueOf: function() {return -1}, toString: function() {return {}}}; -object === 1. Actual: ' + (-object)); +} + +//CHECK#4 +try { + var object = {valueOf: function() {return -1}, toString: function() {throw "error"}}; + if (-object !== 1) { + $ERROR('#4.1: var object = {valueOf: function() {return -1}, toString: function() {throw "error"}}; -object === 1. Actual: ' + (-object)); + } +} +catch (e) { + if (e === "error") { + $ERROR('#4.2: var object = {valueOf: function() {return -1}, toString: function() {throw "error"}}; -object not throw "error"'); + } else { + $ERROR('#4.3: var object = {valueOf: function() {return -1}, toString: function() {throw "error"}}; -object not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return -1}}; +if (-object !== 1) { + $ERROR('#5.1: var object = {toString: function() {return -1}}; -object === 1. Actual: ' + (-object)); +} + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return -1}} +if (-object !== 1) { + $ERROR('#6: var object = {valueOf: function() {return {}}, toString: function() {return -1}}; -object === 1. Actual: ' + (-object)); +} + +//CHECK#7 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return -1}}; + -object; + $ERROR('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return -1}}; -object throw "error". Actual: ' + (-object)); +} +catch (e) { + if (e !== "error") { + $ERROR('#7.2: var object = {valueOf: function() {throw "error"}, toString: function() {return -1}}; -object throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = {valueOf: function() {return {}}, toString: function() {return {}}}; + -object; + $ERROR('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; -object throw TypeError. Actual: ' + (-object)); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; -object throw TypeError. Actual: ' + (e)); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A3_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A3_T1.js new file mode 100644 index 000000000..c988818da --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A3_T1.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: S11.4.7_A3_T1; +* @section: 11.4.7; +* @assertion: Operator -x returns -ToNumber(x); +* @description: Type(x) is boolean primitive or Boolean object; +*/ + +//CHECK#1 +if (-false !== 0) { + $ERROR('#1: -false === 0. Actual: ' + (-false)); +} + +//CHECK#2 +if (-new Boolean(true) !== -1) { + $ERROR('#2: -new Boolean(true) === -1. Actual: ' + (-new Boolean(true))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A3_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A3_T2.js new file mode 100644 index 000000000..bf763effe --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_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. + +/** +* @name: S11.4.7_A3_T2; +* @section: 11.4.7; +* @assertion: Operator -x returns -ToNumber(x); +* @description: Type(x) is number primitive or Number object; +*/ + +//CHECK#1 +if (-(1) !== -1) { + $ERROR('#1: -(1) === -1. Actual: ' + (-(1))); +} + +//CHECK#2 +if (-new Number(-1) !== 1) { + $ERROR('#2: -new Number(-1) === 1. Actual: ' + (-new Number(-1))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A3_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A3_T3.js new file mode 100644 index 000000000..d6be7cc99 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A3_T3.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: S11.4.7_A3_T3; +* @section: 11.4.7; +* @assertion: Operator -x returns -ToNumber(x); +* @description: Type(x) is string primitive or String object; +*/ + +//CHECK#1 +if (-"1" !== -1) { + $ERROR('#1: -"1" === -1. Actual: ' + (-"1")); +} + +//CHECK#2 +if (isNaN(-"x") !== true) { + $ERROR('#2: -"x" === Not-a-Number. Actual: ' + (-"x")); +} + +//CHECK#3 +if (-new String("-1") !== 1) { + $ERROR('#3: -new String("-1") === 1. Actual: ' + (-new String("-1"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A3_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A3_T4.js new file mode 100644 index 000000000..1877387ed --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A3_T4.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: S11.4.7_A3_T4; +* @section: 11.4.7; +* @assertion: Operator -x returns -ToNumber(x); +* @description: Type(x) is undefined or null; +*/ + +//CHECK#1 +if (isNaN(-void 0) !== true) { + $ERROR('#1: +void 0 === Not-a-Number. Actual: ' + (+void 0)); +} + +//CHECK#2 +if (-null !== 0) { + $ERROR('#2: +null === 0. Actual: ' + (+null)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A3_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A3_T5.js new file mode 100644 index 000000000..0a63fa917 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A3_T5.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: S11.4.7_A3_T5; +* @section: 11.4.7; +* @assertion: Operator -x returns -ToNumber(x); +* @description: Type(x) is Object object or Function object; +*/ + +//CHECK#1 +if (isNaN(-{}) !== true) { + $ERROR('#1: -{} === Not-a-Number. Actual: ' + (-{})); +} + +//CHECK#2 +if (isNaN(-function(){return 1}) !== true) { + $ERROR('#2: -function(){return 1} === Not-a-Number. Actual: ' + (-function(){return 1})); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A4.1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A4.1.js new file mode 100644 index 000000000..6a1fa75c2 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A4.1.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: S11.4.7_A4.1; +* @section: 11.4.7; +* @assertion: If x is NaN, operator -x returns NaN; +* @description: Checking NaN; +*/ + +//CHECK#1 +if (isNaN(-NaN) !== true) { + $ERROR('#1: -NaN === Not-a-Number. Actual: ' + (-NaN)); +} + +//CHECK#2 +var x = NaN; +if (isNaN(-x) != true) { + $ERROR('#2: var x = NaN; -x === Not-a-Number. Actual: ' + (-x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A4.2.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A4.2.js new file mode 100644 index 000000000..8a6bd8005 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.7_Unary_minus_Operator/S11.4.7_A4.2.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S11.4.7_A4.2; +* @section: 11.4.7; +* @assertion: Negating +0 produces -0, negating -0 produces +0; +* @description: Checking Infinity; +*/ + +//CHECK#1 +var x = 0; +x = -x; +if (x !== -0) { + $ERROR('#1.1: var x = 0; x = -x; x === 0. Actual: ' + (x)); +} else { + if (1/x !== Number.NEGATIVE_INFINITY) { + $ERROR('#1.2: var x = 0; x = -x; x === - 0. Actual: +0'); + } +} + +//CHECK#2 +var x = -0; +x = -x; +if (x !== 0) { + $ERROR('#2.1: var x = -0; x = -x; x === 0. Actual: ' + (x)); +} else { + if (1/x !== Number.POSITIVE_INFINITY) { + $ERROR('#2.2: var x = -0; x = -x; x === + 0. Actual: -0'); + } +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.8_Bitwise_NOT_Operator/S11.4.8_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.8_Bitwise_NOT_Operator/S11.4.8_A1.js new file mode 100644 index 000000000..d4dc1ead9 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.8_Bitwise_NOT_Operator/S11.4.8_A1.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: S11.4.8_A1; +* @section: 11.4.8, 7.2, 7.3; +* @assertion: White Space and Line Terminator between "~" and UnaryExpression are allowed; +* @description: Checking by using eval; +*/ + +//CHECK#1 +if (eval("~\u00090") !== -1) { + $ERROR('#0: ~\\u00090 === -1'); +} + +//CHECK#2 +if (eval("~\u000B0") !== -1) { + $ERROR('#2: ~\\u000B0 === -1'); +} + +//CHECK#3 +if (eval("~\u000C0") !== -1) { + $ERROR('#3: ~\\u000C0 === -1'); +} + +//CHECK#4 +if (eval("~\u00200") !== -1) { + $ERROR('#4: ~\\u0020 === -1'); +} + +//CHECK#5 +if (eval("~\u00A00") !== -1) { + $ERROR('#5: ~\\u00A00 === -1'); +} + +//CHECK#6 +if (eval("~\u000A0") !== -1) { + $ERROR('#6: ~\\u000A0 === -1'); +} + +//CHECK#7 +if (eval("~\u000D0") !== -1) { + $ERROR('#7: ~\\u000D0 === -1'); +} + +//CHECK#8 +if (eval("~\u20280") !== -1) { + $ERROR('#8: ~\\u20280 === -1'); +} + +//CHECK#9 +if (eval("~\u20290") !== -1) { + $ERROR('#9: ~\\u20290 === -1'); +} + +//CHECK#10 +if (eval("~\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20290") !== -1) { + $ERROR('#10: ~\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20290 === -1'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.8_Bitwise_NOT_Operator/S11.4.8_A2.1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.8_Bitwise_NOT_Operator/S11.4.8_A2.1_T1.js new file mode 100644 index 000000000..39107ff07 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.8_Bitwise_NOT_Operator/S11.4.8_A2.1_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. + +/** +* @name: S11.4.8_A2.1_T1; +* @section: 11.4.8; +* @assertion: Operator ~x uses GetValue; +* @description: Either Type(x) is not Reference or GetBase(x) is not null; +*/ + +//CHECK#1 +if (~0 !== -1) { + $ERROR('#1: ~0 === -1. Actual: ' + (~0)); +} + +//CHECK#2 +if (~(~0) !== 0) { + $ERROR('#2: ~(~0) === 0. Actual: ' + (~(~0))); +} + +//CHECK#3 +var x = 0; +if (~x !== -1) { + $ERROR('#3: var x = 0; ~x === -1. Actual: ' + (~x)); +} + +//CHECK#4 +var x = 0; +if (~(~x) !== 0) { + $ERROR('#4: var x = 0; ~(~x) === 0. Actual: ' + (~(~x))); +} + +//CHECK#5 +var object = new Object(); +object.prop = 0; +if (~object.prop !== -1) { + $ERROR('#5: var object = new Object(); object.prop = 0; ~object.prop === -1. Actual: ' + (~object.prop)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.8_Bitwise_NOT_Operator/S11.4.8_A2.1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.8_Bitwise_NOT_Operator/S11.4.8_A2.1_T2.js new file mode 100644 index 000000000..c55ac7a4b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.8_Bitwise_NOT_Operator/S11.4.8_A2.1_T2.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. + +/** +* @name: S11.4.8_A2.1_T2; +* @section: 11.4.8; +* @assertion: Operator ~x uses GetValue; +* @description: If GetBase(x) is null, throw ReferenceError; +*/ + +//CHECK#1 +try { + ~x; + $ERROR('#1.1: ~x throw ReferenceError. Actual: ' + (~x)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: ~x throw ReferenceError. Actual: ' + (e)); + } +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.8_Bitwise_NOT_Operator/S11.4.8_A2.2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.8_Bitwise_NOT_Operator/S11.4.8_A2.2_T1.js new file mode 100644 index 000000000..03fff147a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.8_Bitwise_NOT_Operator/S11.4.8_A2.2_T1.js @@ -0,0 +1,78 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S11.4.8_A2.2_T1; + * @section: 11.4.8, 8.6.2.6; + * @assertion: Operator ~x uses [[Default Value]]; + * @description: If Type(value) is Object, evaluate ToPrimitive(value, Number); + */ + +//CHECK#1 +var object = {valueOf: function() {return 1}}; +if (~object !== -2) { + $ERROR('#1: var object = {valueOf: function() {return 1}}; ~object === -2. Actual: ' + (~object)); +} + +//CHECK#2 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +if (~object !== -2) { + $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; ~object === -2. Actual: ' + (~object)); +} + +//CHECK#3 +var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +if (~object !== -2) { + $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; ~object === -2. Actual: ' + (~object)); +} + +//CHECK#4 +try { + var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; + if (~object !== -2) { + $ERROR('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ~object === -2. Actual: ' + (~object)); + } +} +catch (e) { + if (e === "error") { + $ERROR('#4.2: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ~object not throw "error"'); + } else { + $ERROR('#4.3: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ~object not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return 1}}; +if (~object !== -2) { + $ERROR('#5: var object = {toString: function() {return 1}}; ~object === -2. Actual: ' + (~object)); +} + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return 1}} +if (~object !== -2) { + $ERROR('#6: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; ~object === -2. Actual: ' + (~object)); +} + +//CHECK#7 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; + ~object; + $ERROR('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; ~object throw "error". Actual: ' + (~object)); +} +catch (e) { + if (e !== "error") { + $ERROR('#7.2: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; ~object throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = {valueOf: function() {return {}}, toString: function() {return {}}}; + ~object; + $ERROR('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; ~object throw TypeError. Actual: ' + (~object)); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; ~object throw TypeError. Actual: ' + (e)); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.8_Bitwise_NOT_Operator/S11.4.8_A3_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.8_Bitwise_NOT_Operator/S11.4.8_A3_T1.js new file mode 100644 index 000000000..6b7d15f22 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.8_Bitwise_NOT_Operator/S11.4.8_A3_T1.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: S11.4.8_A3_T1; +* @section: 11.4.8; +* @assertion: Operator ~x returns ~ToInt32(x); +* @description: Type(x) is boolean primitive or Boolean object; +*/ + +//CHECK#1 +if (~false !== -1) { + $ERROR('#1: ~false === -1. Actual: ' + (~false)); +} + +//CHECK#2 +if (~new Boolean(true) !== -2) { + $ERROR('#2: ~new Boolean(true) === -2. Actual: ' + (~new Boolean(true))); +} + +//CHECK#3 +if (~new Boolean(false) !== -1) { + $ERROR('#3: ~new Boolean(false) === -1. Actual: ' + (~new Boolean(false))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.8_Bitwise_NOT_Operator/S11.4.8_A3_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.8_Bitwise_NOT_Operator/S11.4.8_A3_T2.js new file mode 100644 index 000000000..9b6abb6bd --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.8_Bitwise_NOT_Operator/S11.4.8_A3_T2.js @@ -0,0 +1,44 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S11.4.8_A3_T2; +* @section: 11.4.8; +* @assertion: Operator ~x returns ~ToInt32(x); +* @description: Type(x) is number primitive or Number object; +*/ + +//CHECK#1 +if (~0.1 !== -1) { + $ERROR('#1: ~0.1 === -1. Actual: ' + (~0.1)); +} + +//CHECK#2 +if (~new Number(-0.1) !== -1) { + $ERROR('#2: ~new Number(-0.1) === -1. Actual: ' + (~new Number(-0.1))); +} + +//CHECK#3 +if (~NaN !== -1) { + $ERROR('#3: ~NaN === -1. Actual: ' + (~NaN)); +} + +//CHECK#4 +if (~new Number(NaN) !== -1) { + $ERROR('#4: ~new Number(NaN) === -1. Actual: ' + (~new Number(NaN))); +} + +//CHECK#5 +if (~1 !== -2) { + $ERROR('#5: ~1 === -2. Actual: ' + (~1)); +} + +//CHECK#6 +if (~new Number(-2) !== 1) { + $ERROR('#6: ~new Number(-2) === 1. Actual: ' + (~new Number(-2))); +} + +//CHECK#7 +if (~Infinity !== -1) { + $ERROR('#7: ~Infinity === -1. Actual: ' + (~Infinity)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.8_Bitwise_NOT_Operator/S11.4.8_A3_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.8_Bitwise_NOT_Operator/S11.4.8_A3_T3.js new file mode 100644 index 000000000..e17e797bd --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.8_Bitwise_NOT_Operator/S11.4.8_A3_T3.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S11.4.8_A3_T3; +* @section: 11.4.8; +* @assertion: Operator ~x returns ~ToInt32(x); +* @description: Type(x) is string primitive or String object; +*/ + +//CHECK#1 +if (~"1" !== -2) { + $ERROR('#1: ~"1" === -2. Actual: ' + (~"1")); +} + +//CHECK#2 +if (~new String("0") !== -1) { + $ERROR('#2: ~new String("0") === -1. Actual: ' + (~new String("0"))); +} + +//CHECK#3 +if (~"x" !== -1) { + $ERROR('#3: ~"x" === -1. Actual: ' + (~"x")); +} + +//CHECK#4 +if (~"" !== -1) { + $ERROR('#4: ~"" === -1. Actual: ' + (~"")); +} + +//CHECK#5 +if (~new String("-2") !== 1) { + $ERROR('#5: ~new String("-2") === 1. Actual: ' + (~new String("-2"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.8_Bitwise_NOT_Operator/S11.4.8_A3_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.8_Bitwise_NOT_Operator/S11.4.8_A3_T4.js new file mode 100644 index 000000000..8dd87158c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.8_Bitwise_NOT_Operator/S11.4.8_A3_T4.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: S11.4.8_A3_T4; +* @section: 11.4.8; +* @assertion: Operator ~x returns ~ToInt32(x); +* @description: Type(x) is undefined or null; +*/ + +//CHECK#1 +if (~void 0 !== -1) { + $ERROR('#1: ~void 0 === -1. Actual: ' + (~void 0)); +} + +//CHECK#2 +if (~null !== -1) { + $ERROR('#2: ~null === -1. Actual: ' + (~null)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.8_Bitwise_NOT_Operator/S11.4.8_A3_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.8_Bitwise_NOT_Operator/S11.4.8_A3_T5.js new file mode 100644 index 000000000..0dc107d5d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.8_Bitwise_NOT_Operator/S11.4.8_A3_T5.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: S11.4.8_A3_T5; +* @section: 11.4.8; +* @assertion: Operator ~x returns ~ToInt32(x); +* @description: Type(x) is Object object or Function object; +*/ + +//CHECK#1 +if (~({}) !== -1) { + $ERROR('#1: ~({}) === -1. Actual: ' + (~({}))); +} + +//CHECK#2 +if (~(function(){return 1}) !== -1) { + $ERROR('#2: ~(function(){return 1}) === -1. Actual: ' + (~(function(){return 1}))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.9_Logical_NOT_Operator/S11.4.9_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.9_Logical_NOT_Operator/S11.4.9_A1.js new file mode 100644 index 000000000..49803af79 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.9_Logical_NOT_Operator/S11.4.9_A1.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: S11.4.9_A1; +* @section: 11.4.9, 7.2, 7.3; +* @assertion: White Space and Line Terminator between "!" and UnaryExpression are allowed; +* @description: Checking by using eval; +*/ + +//CHECK#1 +if (eval("!\u0009true") !== false) { + $ERROR('#true: !\\u0009true === false'); +} + +//CHECK#2 +if (eval("!\u000Btrue") !== false) { + $ERROR('#2: !\\u000Btrue === false'); +} + +//CHECK#3 +if (eval("!\u000Ctrue") !== false) { + $ERROR('#3: !\\u000Ctrue === false'); +} + +//CHECK#4 +if (eval("!\u0020true") !== false) { + $ERROR('#4: !\\u0020 === false'); +} + +//CHECK#5 +if (eval("!\u00A0true") !== false) { + $ERROR('#5: !\\u00A0true === false'); +} + +//CHECK#6 +if (eval("!\u000Atrue") !== false) { + $ERROR('#6: !\\u000Atrue === false'); +} + +//CHECK#7 +if (eval("!\u000Dtrue") !== false) { + $ERROR('#7: !\\u000Dtrue === false'); +} + +//CHECK#8 +if (eval("!\u2028true") !== false) { + $ERROR('#8: !\\u2028true === false'); +} + +//CHECK#9 +if (eval("!\u2029true") !== false) { + $ERROR('#9: !\\u2029true === false'); +} + +//CHECK#10 +if (eval("!\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029true") !== false) { + $ERROR('#10: !\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029true === false'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.9_Logical_NOT_Operator/S11.4.9_A2.1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.9_Logical_NOT_Operator/S11.4.9_A2.1_T1.js new file mode 100644 index 000000000..f5a4cde73 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.9_Logical_NOT_Operator/S11.4.9_A2.1_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. + +/** +* @name: S11.4.9_A2.1_T1; +* @section: 11.4.9; +* @assertion: Operator !x uses GetValue; +* @description: Either Type(x) is not Reference or GetBase(x) is not null; +*/ + +//CHECK#1 +if (!true !== false) { + $ERROR('#1: !true === false'); +} + +//CHECK#2 +if (!(!true) !== true) { + $ERROR('#2: !(!true) === true'); +} + +//CHECK#3 +var x = true; +if (!x !== false) { + $ERROR('#3: var x = true; !x === false'); +} + +//CHECK#4 +var x = true; +if (!(!x) !== true) { + $ERROR('#4: var x = true; !(!x) === true'); +} + +//CHECK#5 +var object = new Object(); +object.prop = true; +if (!object.prop !== false) { + $ERROR('#5: var object = new Object(); object.prop = true; !object.prop === false'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.9_Logical_NOT_Operator/S11.4.9_A2.1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.9_Logical_NOT_Operator/S11.4.9_A2.1_T2.js new file mode 100644 index 000000000..dfa6ed469 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.9_Logical_NOT_Operator/S11.4.9_A2.1_T2.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. + +/** +* @name: S11.4.9_A2.1_T2; +* @section: 11.4.9; +* @assertion: Operator !x uses GetValue; +* @description: If GetBase(x) is null, throw ReferenceError; +*/ + +//CHECK#1 +try { + !x; + $ERROR('#1.1: !x throw ReferenceError. Actual: ' + (!x)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: !x throw ReferenceError. Actual: ' + (e)); + } +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.9_Logical_NOT_Operator/S11.4.9_A2.2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.9_Logical_NOT_Operator/S11.4.9_A2.2_T1.js new file mode 100644 index 000000000..dce742a7e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.9_Logical_NOT_Operator/S11.4.9_A2.2_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. + +/** + * @name: S11.4.9_A2.2_T1; + * @section: 11.4.9, 8.6.2.6; + * @assertion: Operator !x uses [[Default Value]]; + * @description: If Type(value) is Object, return false; + */ + +//CHECK#1 +var object = {valueOf: function() {return 1}}; +if (!object !== false) { + $ERROR('#1: var object = {valueOf: function() {return 1}}; !object === false. Actual: ' + (!object)); +} + +//CHECK#2 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +if (!object !== false) { + $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; !object === false. Actual: ' + (!object)); +} + +//CHECK#3 +var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +if (!object !== false) { + $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; !object === false. Actual: ' + (!object)); +} + +//CHECK#4 +var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; +if (!object !== false) { + $ERROR('#4: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; !object === false. Actual: ' + (!object)); +} + +//CHECK#5 +var object = {toString: function() {return 1}}; +if (!object !== false) { + $ERROR('#5: var object = {toString: function() {return 1}}; !object === false. Actual: ' + (!object)); +} + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return 1}} +if (!object !== false) { + $ERROR('#6: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; !object === false. Actual: ' + (!object)); +} + +//CHECK#7 +var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; +if (!object !== false) { + $ERROR('#7: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; !object === false. Actual: ' + (!object)); +} + +//CHECK#8 +var object = {valueOf: function() {return {}}, toString: function() {return {}}}; +if (!object !== false) { + $ERROR('#8: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; !object === false. Actual: ' + (!object)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.9_Logical_NOT_Operator/S11.4.9_A3_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.9_Logical_NOT_Operator/S11.4.9_A3_T1.js new file mode 100644 index 000000000..76b1284c8 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.9_Logical_NOT_Operator/S11.4.9_A3_T1.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: S11.4.9_A3_T1; +* @section: 11.4.9; +* @assertion: Operator !x returns !ToBoolean(x); +* @description: Type(x) is boolean primitive or Boolean object; +*/ + +//CHECK#1 +if (!false !== true) { + $ERROR('#1: !false === true'); +} + +//CHECK#2 +if (!new Boolean(true) !== false) { + $ERROR('#2: !new Boolean(true) === false'); +} + +//CHECK#3 +if (!new Boolean(false) !== false) { + $ERROR('#3: !new Boolean(false) === false'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.9_Logical_NOT_Operator/S11.4.9_A3_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.9_Logical_NOT_Operator/S11.4.9_A3_T2.js new file mode 100644 index 000000000..8a1ec70b6 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.9_Logical_NOT_Operator/S11.4.9_A3_T2.js @@ -0,0 +1,44 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S11.4.9_A3_T2; +* @section: 11.4.9; +* @assertion: Operator !x returns !ToBoolean(x); +* @description: Type(x) is number primitive or Number object; +*/ + +//CHECK#1 +if (!0.1 !== false) { + $ERROR('#1: !0.1 === false'); +} + +//CHECK#2 +if (!new Number(-0.1) !== false) { + $ERROR('#2: !new Number(-0.1) === false'); +} + +//CHECK#3 +if (!NaN !== true) { + $ERROR('#3: !NaN === true'); +} + +//CHECK#4 +if (!new Number(NaN) !== false) { + $ERROR('#4: !new Number(NaN) === false'); +} + +//CHECK#5 +if (!0 !== true) { + $ERROR('#5: !0 === true'); +} + +//CHECK#6 +if (!new Number(0) !== false) { + $ERROR('#6: !new Number(0) === false'); +} + +//CHECK#7 +if (!Infinity !== false) { + $ERROR('#7: !Infinity === false'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.9_Logical_NOT_Operator/S11.4.9_A3_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.9_Logical_NOT_Operator/S11.4.9_A3_T3.js new file mode 100644 index 000000000..b894c4d1e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.9_Logical_NOT_Operator/S11.4.9_A3_T3.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S11.4.9_A3_T3; +* @section: 11.4.9; +* @assertion: Operator !x returns !ToBoolean(x); +* @description: Type(x) is string primitive or String object; +*/ + +//CHECK#1 +if (!"1" !== false) { + $ERROR('#1: !"1" === false'); +} + +//CHECK#2 +if (!new String("0") !== false) { + $ERROR('#2: !new String("0") === false'); +} + +//CHECK#3 +if (!"x" !== false) { + $ERROR('#3: !"x" === false'); +} + +//CHECK#4 +if (!"" !== true) { + $ERROR('#4: !"" === true'); +} + +//CHECK#5 +if (!new String("") !== false) { + $ERROR('#5: !new String("") === false'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.9_Logical_NOT_Operator/S11.4.9_A3_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.9_Logical_NOT_Operator/S11.4.9_A3_T4.js new file mode 100644 index 000000000..8ff189aca --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.9_Logical_NOT_Operator/S11.4.9_A3_T4.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: S11.4.9_A3_T4; +* @section: 11.4.9; +* @assertion: Operator !x returns !ToBoolean(x); +* @description: Type(x) is undefined or null; +*/ + +//CHECK#1 +if (!void 0 !== true) { + $ERROR('#1: !void 0 === true'); +} + +//CHECK#2 +if (!null !== true) { + $ERROR('#2: !null === true'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.9_Logical_NOT_Operator/S11.4.9_A3_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.9_Logical_NOT_Operator/S11.4.9_A3_T5.js new file mode 100644 index 000000000..6e484eab9 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.9_Logical_NOT_Operator/S11.4.9_A3_T5.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: S11.4.9_A3_T5; +* @section: 11.4.9; +* @assertion: Operator !x returns !ToBoolean(x); +* @description: Type(x) is Object object or Function object; +*/ + +//CHECK#1 +if ((!{}) !== false) { + $ERROR('#1: !({}) === false'); +} + +//CHECK#2 +if (!(function(){return 1}) !== false) { + $ERROR('#2: !(function(){return 1}) === false'); +} |