diff options
Diffstat (limited to 'external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.4_Unary_Operators/11.4.4_Prefix_Increment_Operator')
15 files changed, 479 insertions, 0 deletions
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)); +} |