diff options
Diffstat (limited to 'js/src/tests/test262/language/expressions/greater-than')
51 files changed, 1996 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/expressions/greater-than/11.8.2-1.js b/js/src/tests/test262/language/expressions/greater-than/11.8.2-1.js new file mode 100644 index 0000000000..51d0794027 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/11.8.2-1.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.8.2-1 +description: > + 11.8.2 Greater-than Operator - Partial left to right order + enforced when using Greater-than operator: valueOf > valueOf +---*/ + +var accessed = false; +var obj1 = { + valueOf: function () { + accessed = true; + return 3; + } +}; +var obj2 = { + valueOf: function () { + return 4; + } +}; + +assert.sameValue(obj1 > obj2, false, 'The result of (obj1 > obj2) is false'); +assert.sameValue(accessed, true, 'The value of accessed is true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/11.8.2-2.js b/js/src/tests/test262/language/expressions/greater-than/11.8.2-2.js new file mode 100644 index 0000000000..3ce46ca740 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/11.8.2-2.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.8.2-2 +description: > + 11.8.2 Greater-than Operator - Partial left to right order + enforced when using Greater-than operator: valueOf > toString +---*/ + +var accessed = false; +var obj1 = { + valueOf: function () { + accessed = true; + return 3; + } +}; +var obj2 = { + toString: function () { + return 4; + } +}; + +assert.sameValue(obj1 > obj2, false, 'The result of (obj1 > obj2) is false'); +assert.sameValue(accessed, true, 'The value of accessed is true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/11.8.2-3.js b/js/src/tests/test262/language/expressions/greater-than/11.8.2-3.js new file mode 100644 index 0000000000..4960c37278 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/11.8.2-3.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.8.2-3 +description: > + 11.8.2 Greater-than Operator - Partial left to right order + enforced when using Greater-than operator: toString > valueOf +---*/ + +var accessed = false; +var obj1 = { + toString: function () { + accessed = true; + return 3; + } +}; +var obj2 = { + valueOf: function () { + return 4; + } +}; + +assert.sameValue(obj1 > obj2, false, 'The result of (obj1 > obj2) is false'); +assert.sameValue(accessed, true, 'The value of accessed is true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/11.8.2-4.js b/js/src/tests/test262/language/expressions/greater-than/11.8.2-4.js new file mode 100644 index 0000000000..fda8104eff --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/11.8.2-4.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.8.2-4 +description: > + 11.8.2 Greater-than Operator - Partial left to right order + enforced when using Greater-than operator: toString > toString +---*/ + +var accessed = false; +var obj1 = { + toString: function () { + accessed = true; + return 3; + } +}; +var obj2 = { + toString: function () { + return 4; + } +}; + +assert.sameValue(obj1 > obj2, false, 'The result of (obj1 > obj2) is false'); +assert.sameValue(accessed, true, 'The value of accessed is true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A1.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A1.js new file mode 100644 index 0000000000..ac04fe911d --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between RelationalExpression and ">" or + ">" and ShiftExpression are allowed +es5id: 11.8.2_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("0\u0009>\u00091") !== false) { + throw new Test262Error('#1: 0\\u0009>\\u00091) === false'); +} + +//CHECK#2 +if (eval("0\u000B>\u000B1") !== false) { + throw new Test262Error('#2: 0\\u000B>\\u000B1) === false'); +} + +//CHECK#3 +if (eval("0\u000C>\u000C1") !== false) { + throw new Test262Error('#3: (0\\u000C>\\u000C1) === false'); +} + +//CHECK#4 +if (eval("0\u0020>\u00201") !== false) { + throw new Test262Error('#4: (0\\u0020>\\u00201) === false'); +} + +//CHECK#5 +if (eval("0\u00A0>\u00A01") !== false) { + throw new Test262Error('#5: (0\\u00A0>\\u00A01) === false'); +} + +//CHECK#6 +if (eval("0\u000A>\u000A1") !== false) { + throw new Test262Error('#6: (0\\u000A>\\u000A1) === false'); +} + +//CHECK#7 +if (eval("0\u000D>\u000D1") !== false) { + throw new Test262Error('#7: (0\\u000D>\\u000D1) === false'); +} + +//CHECK#8 +if (eval("0\u2028>\u20281") !== false) { + throw new Test262Error('#8: (0\\u2028>\\u20281) === false'); +} + +//CHECK#9 +if (eval("0\u2029>\u20291") !== false) { + throw new Test262Error('#9: (0\\u2029>\\u20291) === false'); +} + +//CHECK#10 +if (eval("1\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029>=\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291") !== true) { + throw new Test262Error('#10: (1\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029>=\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.1_T1.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.1_T1.js new file mode 100644 index 0000000000..7ad2573860 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.1_T1.js @@ -0,0 +1,43 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x > y uses GetValue +es5id: 11.8.2_A2.1_T1 +description: Either Type is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if (2 > 1 !== true) { + throw new Test262Error('#1: 2 > 1 === true'); +} + +//CHECK#2 +var x = 2; +if (x > 1 !== true) { + throw new Test262Error('#2: var x = 2; x > 1 === true'); +} + +//CHECK#3 +var y = 1; +if (2 > y !== true) { + throw new Test262Error('#3: var y = 1; 2 > y === true'); +} + +//CHECK#4 +var x = 2; +var y = 1; +if (x > y !== true) { + throw new Test262Error('#4: var x = 2; var y = 1; x > y === true'); +} + +//CHECK#5 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = 2; +objecty.prop = 1; +if (objectx.prop > objecty.prop !== true) { + throw new Test262Error('#5: var objectx = new Object(); var objecty = new Object(); objectx.prop = 2; objecty.prop = 1; objectx.prop > objecty.prop === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.1_T2.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.1_T2.js new file mode 100644 index 0000000000..2ca35d3864 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_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. + +/*--- +info: Operator x > y uses GetValue +es5id: 11.8.2_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x > 1; + throw new Test262Error('#1.1: x > 1 throw ReferenceError. Actual: ' + (x > 1)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x > 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.1_T3.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.1_T3.js new file mode 100644 index 0000000000..ff3d7291b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.1_T3.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. + +/*--- +info: Operator x > y uses GetValue +es5id: 11.8.2_A2.1_T3 +description: If GetBase(y) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + 1 > y; + throw new Test262Error('#1.1: 1 > y throw ReferenceError. Actual: ' + (1 > y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: 1 > y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.2_T1.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.2_T1.js new file mode 100644 index 0000000000..8aa14008a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.2_T1.js @@ -0,0 +1,71 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x > y uses [[Default Value]] +es5id: 11.8.2_A2.2_T1 +description: If Type(value) is Object, evaluate ToPrimitive(value, Number) +---*/ + +//CHECK#1 +if ({valueOf: function() {return 2}} > 1 !== true) { + throw new Test262Error('#1: {valueOf: function() {return 1}} > 1 === true. Actual: ' + ({valueOf: function() {return 1}} > 1)); +} + +//CHECK#2 +if ({valueOf: function() {return 2}, toString: function() {return 0}} > 1 !== true) { + throw new Test262Error('#2: {valueOf: function() {return 1}, toString: function() {return 2}} > 1 === true. Actual: ' + ({valueOf: function() {return 1}, toString: function() {return 2}} > 1)); +} + +//CHECK#3 +if ({valueOf: function() {return 2}, toString: function() {return {}}} > 1 !== true) { + throw new Test262Error('#3: {valueOf: function() {return 1}, toString: function() {return {}}} > 1 === true. Actual: ' + ({valueOf: function() {return 1}, toString: function() {return {}}} > 1)); +} + +//CHECK#4 +try { + if ({valueOf: function() {return 2}, toString: function() {throw "error"}} > 1 !== true) { + throw new Test262Error('#4.1: {valueOf: function() {return 1}, toString: function() {throw "error"}} > 1 === true. Actual: ' + ({valueOf: function() {return 1}, toString: function() {throw "error"}} > 1)); + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: {valueOf: function() {return 2}, toString: function() {throw "error"}} > 1 not throw "error"'); + } else { + throw new Test262Error('#4.3: {valueOf: function() {return 2}, toString: function() {throw "error"}} > 1 not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +if (1 > {toString: function() {return 0}} !== true) { + throw new Test262Error('#5: 1 > {toString: function() {return 0}} === true. Actual: ' + (1 > {toString: function() {return 0}})); +} + +//CHECK#6 +if (1 > {valueOf: function() {return {}}, toString: function() {return 0}} !== true) { + throw new Test262Error('#6: 1 > {valueOf: function() {return {}}, toString: function() {return 0}} === true. Actual: ' + (1 > {valueOf: function() {return {}}, toString: function() {return 0}})); +} + +//CHECK#7 +try { + 1 > {valueOf: function() {throw "error"}, toString: function() {return 0}}; + throw new Test262Error('#7.1: 1 > {valueOf: function() {throw "error"}, toString: function() {return 0}} throw "error". Actual: ' + (1 > {valueOf: function() {throw "error"}, toString: function() {return 0}})); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: 1 > {valueOf: function() {throw "error"}, toString: function() {return 0}} throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + 1 > {valueOf: function() {return {}}, toString: function() {return {}}}; + throw new Test262Error('#8.1: 1 > {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (1 > {valueOf: function() {return {}}, toString: function() {return {}}})); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: 1 > {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.3_T1.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.3_T1.js new file mode 100644 index 0000000000..4c8b975924 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.3_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. + +/*--- +info: In ES5, First expression should be evaluated first. +es5id: 11.8.2_A2.3_T1 +description: Checking that operands of a "<" evaluate left-to-right +---*/ + +//CHECK#1 +var x = { valueOf: function () { throw "x"; } }; +var y = { valueOf: function () { throw "y"; } }; +try { + x > y; + throw new Test262Error('#1.1: Should have thrown'); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: First expression should be evaluated first'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: Failed with: ' + e); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.4_T1.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.4_T1.js new file mode 100644 index 0000000000..7fc28d9a56 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.4_T1.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. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.8.2_A2.4_T1 +description: Checking with "=" +---*/ + +//CHECK#1 +var x = 0; +if ((x = 1) > x !== false) { + throw new Test262Error('#1: var x = 0; (x = 1) > x === false'); +} + +//CHECK#2 +var x = 1; +if (x > (x = 0) !== true) { + throw new Test262Error('#2: var x = 1; x > (x = 0) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.4_T2.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.4_T2.js new file mode 100644 index 0000000000..606bfe02ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.4_T2.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. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.8.2_A2.4_T2 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() > y(); + throw new Test262Error('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() > y() throw "x". Actual: ' + (x() > y())); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() > y() throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.4_T3.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.4_T3.js new file mode 100644 index 0000000000..03e6cc878c --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.4_T3.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. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.8.2_A2.4_T3 +description: Checking with undeclarated variables +---*/ + +//CHECK#1 +try { + x > (x = 1); + throw new Test262Error('#1.1: x > (x = 1) throw ReferenceError. Actual: ' + (x > (x = 1))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x > (x = 1) throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.4_T4.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.4_T4.js new file mode 100644 index 0000000000..950aaa524f --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.4_T4.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.8.2_A2.4_T4 +description: Checking with undeclarated variables +flags: [noStrict] +---*/ + +//CHECK#1 +if ((y = 1) > y !== false) { + throw new Test262Error('#1: (y = 1) > y === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T1.1.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T1.1.js new file mode 100644 index 0000000000..cdbd11d1e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T1.1.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. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x > y returns ToNumber(x) > ToNumber(y) +es5id: 11.8.2_A3.1_T1.1 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between primitive + boolean and Boolean object +---*/ + +//CHECK#1 +if (true > true !== false) { + throw new Test262Error('#1: true > true === false'); +} + +//CHECK#2 +if (new Boolean(true) > true !== false) { + throw new Test262Error('#2: new Boolean(true) > true === false'); +} + +//CHECK#3 +if (true > new Boolean(true) !== false) { + throw new Test262Error('#3: true > new Boolean(true) === false'); +} + +//CHECK#4 +if (new Boolean(true) > new Boolean(true) !== false) { + throw new Test262Error('#4: new Boolean(true) > new Boolean(true) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T1.2.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T1.2.js new file mode 100644 index 0000000000..55d5965558 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T1.2.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. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x > y returns ToNumber(x) > ToNumber(y) +es5id: 11.8.2_A3.1_T1.2 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between primitive + number and Number object +---*/ + +//CHECK#1 +if (1 > 1 !== false) { + throw new Test262Error('#1: 1 > 1 === false'); +} + +//CHECK#2 +if (new Number(1) > 1 !== false) { + throw new Test262Error('#2: new Number(1) > 1 === false'); +} + +//CHECK#3 +if (1 > new Number(1) !== false) { + throw new Test262Error('#3: 1 > new Number(1) === false'); +} + +//CHECK#4 +if (new Number(1) > new Number(1) !== false) { + throw new Test262Error('#4: new Number(1) > new Number(1) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T1.3.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T1.3.js new file mode 100644 index 0000000000..c3548eda0b --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T1.3.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. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x > y returns ToNumber(x) > ToNumber(y) +es5id: 11.8.2_A3.1_T1.3 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between Null and + Undefined +---*/ + +//CHECK#1 +if (null > undefined !== false) { + throw new Test262Error('#1: null > undefined === false'); +} + +//CHECK#2 +if (undefined > null !== false) { + throw new Test262Error('#2: undefined > null === false'); +} + +//CHECK#3 +if (undefined > undefined !== false) { + throw new Test262Error('#3: undefined > undefined === false'); +} + +//CHECK#4 +if (null > null !== false) { + throw new Test262Error('#4: null > null === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.1.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.1.js new file mode 100644 index 0000000000..e6853a9847 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.1.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x > y returns ToNumber(x) > ToNumber(y) +es5id: 11.8.2_A3.1_T2.1 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Number (primitive or object) and Boolean + (primitive and object) +---*/ + +//CHECK#1 +if (true > 1 !== false) { + throw new Test262Error('#1: true > 1 === false'); +} + +//CHECK#2 +if (1 > true !== false) { + throw new Test262Error('#2: 1 > true === false'); +} + +//CHECK#3 +if (new Boolean(true) > 1 !== false) { + throw new Test262Error('#3: new Boolean(true) > 1 === false'); +} + +//CHECK#4 +if (1 > new Boolean(true) !== false) { + throw new Test262Error('#4: 1 > new Boolean(true) === false'); +} + +//CHECK#5 +if (true > new Number(1) !== false) { + throw new Test262Error('#5: true > new Number(1) === false'); +} + +//CHECK#6 +if (new Number(1) > true !== false) { + throw new Test262Error('#6: new Number(1) > true === false'); +} + +//CHECK#7 +if (new Boolean(true) > new Number(1) !== false) { + throw new Test262Error('#7: new Boolean(true) > new Number(1) === false'); +} + +//CHECK#8 +if (new Number(1) > new Boolean(true) !== false) { + throw new Test262Error('#8: new Number(1) > new Boolean(true) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.2.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.2.js new file mode 100644 index 0000000000..748b983b9c --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.2.js @@ -0,0 +1,65 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x > y returns ToNumber(x) > ToNumber(y) +es5id: 11.8.2_A3.1_T2.2 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Number (primitive or object) and String + (primitive and object) +---*/ + +//CHECK#1 +if ("1" > 1 !== false) { + throw new Test262Error('#1: "1" > 1 === false'); +} + +//CHECK#2 +if (1 > "1" !== false) { + throw new Test262Error('#2: 1 > "1" === false'); +} + +//CHECK#3 +if (new String("1") > 1 !== false) { + throw new Test262Error('#3: new String("1") > 1 === false'); +} + +//CHECK#4 +if (1 > new String("1") !== false) { + throw new Test262Error('#4: 1 > new String("1") === false'); +} + +//CHECK#5 +if ("1" > new Number(1) !== false) { + throw new Test262Error('#5: "1" > new Number(1) === false'); +} + +//CHECK#6 +if (new Number(1) > "1" !== false) { + throw new Test262Error('#6: new Number(1) > "1" === false'); +} + +//CHECK#7 +if (new String("1") > new Number(1) !== false) { + throw new Test262Error('#7: new String("1") > new Number(1) === false'); +} + +//CHECK#8 +if (new Number(1) > new String("1") !== false) { + throw new Test262Error('#8: new Number(1) > new String("1") === false'); +} + +//CHECK#9 +if ("x" > 1 !== false) { + throw new Test262Error('#9: "x" > 1 === false'); +} + +//CHECK#10 +if (1 > "x" !== false) { + throw new Test262Error('#10: 1 > "x" === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.3.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.3.js new file mode 100644 index 0000000000..a21db3ca84 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.3.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. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x > y returns ToNumber(x) > ToNumber(y) +es5id: 11.8.2_A3.1_T2.3 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Number (primitive or object) and Null +---*/ + +//CHECK#1 +if (1 > null !== true) { + throw new Test262Error('#1: 1 > null === true'); +} + +//CHECK#2 +if (null > 1 !== false) { + throw new Test262Error('#2: null > 1 === false'); +} + +//CHECK#3 +if (new Number(1) > null !== true) { + throw new Test262Error('#3: new Number(1) > null === true'); +} + +//CHECK#4 +if (null > new Number(1) !== false) { + throw new Test262Error('#4: null > new Number(1) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.4.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.4.js new file mode 100644 index 0000000000..e1befa60ec --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.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. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x > y returns ToNumber(x) > ToNumber(y) +es5id: 11.8.2_A3.1_T2.4 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Number (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (1 > undefined !== false) { + throw new Test262Error('#1: 1 > undefined === false'); +} + +//CHECK#2 +if (undefined > 1 !== false) { + throw new Test262Error('#2: undefined > 1 === false'); +} + +//CHECK#3 +if (new Number(1) > undefined !== false) { + throw new Test262Error('#3: new Number(1) > undefined === false'); +} + +//CHECK#4 +if (undefined > new Number(1) !== false) { + throw new Test262Error('#4: undefined > new Number(1) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.5.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.5.js new file mode 100644 index 0000000000..18e3d476dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.5.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x > y returns ToNumber(x) > ToNumber(y) +es5id: 11.8.2_A3.1_T2.5 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between String (primitive or object) and Boolean + (primitive and object) +---*/ + +//CHECK#1 +if (true > "1" !== false) { + throw new Test262Error('#1: true > "1" === false'); +} + +//CHECK#2 +if ("1" > true !== false) { + throw new Test262Error('#2: "1" > true === false'); +} + +//CHECK#3 +if (new Boolean(true) > "1" !== false) { + throw new Test262Error('#3: new Boolean(true) > "1" === false'); +} + +//CHECK#4 +if ("1" > new Boolean(true) !== false) { + throw new Test262Error('#4: "1" > new Boolean(true) === false'); +} + +//CHECK#5 +if (true > new String("1") !== false) { + throw new Test262Error('#5: true > new String("1") === false'); +} + +//CHECK#6 +if (new String("1") > true !== false) { + throw new Test262Error('#6: new String("1") > true === false'); +} + +//CHECK#7 +if (new Boolean(true) > new String("1") !== false) { + throw new Test262Error('#7: new Boolean(true) > new String("1") === false'); +} + +//CHECK#8 +if (new String("1") > new Boolean(true) !== false) { + throw new Test262Error('#8: new String("1") > new Boolean(true) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.6.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.6.js new file mode 100644 index 0000000000..bca527e047 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.6.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. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x > y returns ToNumber(x) > ToNumber(y) +es5id: 11.8.2_A3.1_T2.6 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between String (primitive or object) and Undefined +---*/ + +//CHECK#1 +if ("1" > undefined !== false) { + throw new Test262Error('#1: "1" > undefined === false'); +} + +//CHECK#2 +if (undefined > "1" !== false) { + throw new Test262Error('#2: undefined > "1" === false'); +} + +//CHECK#3 +if (new String("1") > undefined !== false) { + throw new Test262Error('#3: new String("1") > undefined === false'); +} + +//CHECK#4 +if (undefined > new String("1") !== false) { + throw new Test262Error('#4: undefined > new String("1") === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.7.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.7.js new file mode 100644 index 0000000000..fb766892d1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.7.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. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x > y returns ToNumber(x) > ToNumber(y) +es5id: 11.8.2_A3.1_T2.7 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between String (primitive or object) and Null +---*/ + +//CHECK#1 +if ("1" > null !== true) { + throw new Test262Error('#1: "1" > null === true'); +} + +//CHECK#2 +if (null > "1" !== false) { + throw new Test262Error('#2: null > "1" === false'); +} + +//CHECK#3 +if (new String("1") > null !== true) { + throw new Test262Error('#3: new String("1") > null === true'); +} + +//CHECK#4 +if (null > new String("1") !== false) { + throw new Test262Error('#4: null > new String("1") === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.8.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.8.js new file mode 100644 index 0000000000..2f4a759c83 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.8.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. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x > y returns ToNumber(x) > ToNumber(y) +es5id: 11.8.2_A3.1_T2.8 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Boolean (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (true > undefined !== false) { + throw new Test262Error('#1: true > undefined === false'); +} + +//CHECK#2 +if (undefined > true !== false) { + throw new Test262Error('#2: undefined > true === false'); +} + +//CHECK#3 +if (new Boolean(true) > undefined !== false) { + throw new Test262Error('#3: new Boolean(true) > undefined === false'); +} + +//CHECK#4 +if (undefined > new Boolean(true) !== false) { + throw new Test262Error('#4: undefined > new Boolean(true) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.9.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.9.js new file mode 100644 index 0000000000..0c84edc721 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.9.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. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x > y returns ToNumber(x) > ToNumber(y) +es5id: 11.8.2_A3.1_T2.9 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Boolean (primitive or object) and Null +---*/ + +//CHECK#1 +if (true > null !== true) { + throw new Test262Error('#1: true > null === true'); +} + +//CHECK#2 +if (null > true !== false) { + throw new Test262Error('#2: null > true === false'); +} + +//CHECK#3 +if (new Boolean(true) > null !== true) { + throw new Test262Error('#3: new Boolean(true) > null === true'); +} + +//CHECK#4 +if (null > new Boolean(true) !== false) { + throw new Test262Error('#4: null > new Boolean(true) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.2_T1.1.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.2_T1.1.js new file mode 100644 index 0000000000..95a8c47ff7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.2_T1.1.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. + +/*--- +info: | + If Type(Primitive(x)) is String and Type(Primitive(y)) is String, then + operator x > y returns ToString(x) > ToString(y) +es5id: 11.8.2_A3.2_T1.1 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between primitive + string and String object +---*/ + +//CHECK#1 +if ("1" > "1" !== false) { + throw new Test262Error('#1: "1" > "1" === false'); +} + +//CHECK#2 +if (new String("1") > "1" !== false) { + throw new Test262Error('#2: new String("1") > "1" === false'); +} + +//CHECK#3 +if ("1" > new String("1") !== false) { + throw new Test262Error('#3: "1" > new String("1") === false'); +} + +//CHECK#4 +if (new String("1") > new String("1") !== false) { + throw new Test262Error('#4: new String("1") > new String("1") === false'); +} + +//CHECK#5 +if ("x" > "1" !== true) { + throw new Test262Error('#5: "x" > "1" === true'); +} + +//CHECK#6 +if ("1" > "x" !== false) { + throw new Test262Error('#6: "1" > "x" === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.2_T1.2.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.2_T1.2.js new file mode 100644 index 0000000000..26ce9b7ffd --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.2_T1.2.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. + +/*--- +info: | + If Type(Primitive(x)) is String and Type(Primitive(y)) is String, then + operator x > y returns ToString(x) > ToString(y) +es5id: 11.8.2_A3.2_T1.2 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between Object + object and Function object +---*/ + +//CHECK#1 +if (({} > function(){return 1}) !== ({}.toString() > function(){return 1}.toString())) { + throw new Test262Error('#1: ({} > function(){return 1}) === ({}.toString() > function(){return 1}.toString())'); +} + +//CHECK#2 +if ((function(){return 1} > {}) !== (function(){return 1}.toString() > {}.toString())) { + throw new Test262Error('#2: (function(){return 1} > {}) === (function(){return 1}.toString() > {}.toString())'); +} + +//CHECK#3 +if ((function(){return 1} > function(){return 1}) !== (function(){return 1}.toString() > function(){return 1}.toString())) { + throw new Test262Error('#3: (function(){return 1} > function(){return 1}) === (function(){return 1}.toString() > function(){return 1}.toString())'); +} + +//CHECK#4 +if (({} > {}) !== ({}.toString() > {}.toString())) { + throw new Test262Error('#4: ({} > {}) === ({}.toString() > {}.toString())'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.1.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.1.js new file mode 100644 index 0000000000..f829fc2897 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.1.js @@ -0,0 +1,50 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is NaN, return false (if result in 11.8.5 is undefined, return false) +es5id: 11.8.2_A4.1 +description: y is number primitive +---*/ + +//CHECK#1 +if ((Number.NaN > 0) !== false) { + throw new Test262Error('#1: (NaN > 0) === false'); +} + +//CHECK#2 +if ((Number.NaN > 1.1) !== false) { + throw new Test262Error('#2: (NaN > 1.1) === false'); +} + +//CHECK#3 +if ((Number.NaN > -1.1) !== false) { + throw new Test262Error('#3: (NaN > -1.1) === false'); +} + +//CHECK#4 +if ((Number.NaN > Number.NaN) !== false) { + throw new Test262Error('#4: (NaN > NaN) === false'); +} + +//CHECK#5 +if ((Number.NaN > Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#5: (NaN > +Infinity) === false'); +} + +//CHECK#6 +if ((Number.NaN > Number.NEGATIVE_INFINITY) !== false) { + throw new Test262Error('#6: (NaN > -Infinity) === false'); +} + +//CHECK#7 +if ((Number.NaN > Number.MAX_VALUE) !== false) { + throw new Test262Error('#7: (NaN > Number.MAX_VALUE) === false'); +} + +//CHECK#8 +if ((Number.NaN > Number.MIN_VALUE) !== false) { + throw new Test262Error('#8: (NaN > Number.MIN_VALUE) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.10.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.10.js new file mode 100644 index 0000000000..9773655acd --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.10.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is a prefix of y, return false +es5id: 11.8.2_A4.10 +description: x and y are string primitives +---*/ + +//CHECK#1 +if (("x" > "x") !== false) { + throw new Test262Error('#1: ("x" > "x") === false'); +} + +//CHECK#2 +if (("" > "x") !== false) { + throw new Test262Error('#2: ("" > "x") === false'); +} + +//CHECK#3 +if (("ab" > "abcd") !== false) { + throw new Test262Error('#3: ("ab" > abcd") === false'); +} + +//CHECK#4 +if (("abcd" > "abc\u0064") !== false) { + throw new Test262Error('#4: ("abcd" > abc\\u0064") === false'); +} + +//CHECK#5 +if (("x" > "x" + "y") !== false) { + throw new Test262Error('#5: ("x" > "x" + "y") === false'); +} + +//CHECK#6 +var x = "x"; +if ((x > x + "y") !== false) { + throw new Test262Error('#6: var x = "x"; (x > x + "y") === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.11.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.11.js new file mode 100644 index 0000000000..27688e3192 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.11.js @@ -0,0 +1,51 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If y is a prefix of x and x !== y, return true +es5id: 11.8.2_A4.11 +description: x and y are string primitives +---*/ + +//CHECK#1 +if (("x " > "x") !== true) { + throw new Test262Error('#1: ("x " > "x") === true'); +} + +//CHECK#2 +if (("x" > "") !== true) { + throw new Test262Error('#2: ("x" > "") === true'); +} + +//CHECK#3 +if (("abcd" > "ab") !== true) { + throw new Test262Error('#3: ("abcd" > ab") === true'); +} + +//CHECK#4 +if (("abc\u0064" > "abcd") !== false) { + throw new Test262Error('#4: ("abc\\u0064" > abc") === false'); +} + +//CHECK#5 +if (("x" + "y" > "x") !== true) { + throw new Test262Error('#5: ("x" + "y" > "x") === true'); +} + +//CHECK#6 +var x = "x"; +if ((x + 'y' > x) !== true) { + throw new Test262Error('#6: var x = "x"; (x + "y" > x) === true'); +} + +//CHECK#7 +if (("a\u0000a" > "a\u0000") !== true) { + throw new Test262Error('#7: ("a\\u0000a" > "a\\u0000") === true'); +} + +//CHECK#8 +if ((" x" > "x") !== false) { + throw new Test262Error('#8: (" x" > "x") === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.12_T1.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.12_T1.js new file mode 100644 index 0000000000..9f3588c206 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.12_T1.js @@ -0,0 +1,48 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If neither x, nor y is a prefix of each other, returned result of strings + comparison applies a simple lexicographic ordering to the sequences of + code point value values +es5id: 11.8.2_A4.12_T1 +description: x and y are string primitives +---*/ + +//CHECK#1 +if (("xy" > "xx") !== true) { + throw new Test262Error('#1: ("xy" > "xx") === true'); +} + +//CHECK#2 +if (("xx" > "xy") !== false) { + throw new Test262Error('#2: ("xx" > "xy") === false'); +} + +//CHECK#3 +if (("y" > "x") !== true) { + throw new Test262Error('#3: ("y" > "x") === true'); +} + +//CHECK#4 +if (("aba" > "aab") !== true) { + throw new Test262Error('#4: ("aba" > aab") === true'); +} + +//CHECK#5 +if (("\u0061\u0061\u0061\u0061" > "\u0061\u0061\u0061\u0062") !== false) { + throw new Test262Error('#5: ("\\u0061\\u0061\\u0061\\u0061" > \\u0061\\u0061\\u0061\\u0062") === false'); +} + +//CHECK#6 +if (("a\u0000b" > "a\u0000a") !== true) { + throw new Test262Error('#6: ("a\\u0000b" > "a\\u0000a") === true'); +} + +//CHECK#7 +if (("aa" > "aB") !== true) { + throw new Test262Error('#7: ("aa" > aB") === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.12_T2.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.12_T2.js new file mode 100644 index 0000000000..f58dfa7d92 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.12_T2.js @@ -0,0 +1,48 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If neither x, nor y is a prefix of each other, returned result of strings + comparison applies a simple lexicographic ordering to the sequences of + code point value values +es5id: 11.8.2_A4.12_T2 +description: x and y are string primitives +---*/ + +//CHECK#1 +if (("x" > "0") !== true) { + throw new Test262Error('#1: ("x" > "0") !== true'); +} + +//CHECK#2 +if (("0" > "-") !== true) { + throw new Test262Error('#2: ("0" > "-") !== true'); +} + +//CHECK#3 +if (("0" > ".") !== true) { + throw new Test262Error('#3: ("0" > ".") !== true'); +} + +//CHECK#4 +if (("-" > "+") !== true) { + throw new Test262Error('#4: ("-" > "+") !== true'); +} + +//CHECK#5 +if (("-1" > "-0") !== true) { + throw new Test262Error('#5: ("-1" > "-0") !== true'); +} + +//CHECK#6 +if (("-1" > "+1") !== true) { + throw new Test262Error('#6: ("-1" > "+1") !== true'); +} + +//CHECK#7 +if (("1e-10" > "1") !== true) { +throw new Test262Error('#7: ("1e-10" > "1") !== true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.2.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.2.js new file mode 100644 index 0000000000..5b17f46b59 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.2.js @@ -0,0 +1,50 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If y is NaN, return false (if result in 11.8.5 is undefined, return false) +es5id: 11.8.2_A4.2 +description: x is number primitive +---*/ + +//CHECK#1 +if ((0 > Number.NaN) !== false) { + throw new Test262Error('#1: (0 > NaN) === false'); +} + +//CHECK#2 +if ((1.1 > Number.NaN) !== false) { + throw new Test262Error('#2: (1.1 > NaN) === false'); +} + +//CHECK#3 +if ((-1.1 > Number.NaN) !== false) { + throw new Test262Error('#3: (-1.1 > NaN) === false'); +} + +//CHECK#4 +if ((Number.NaN > Number.NaN) !== false) { + throw new Test262Error('#4: (NaN > NaN) === false'); +} + +//CHECK#5 +if ((Number.POSITIVE_INFINITY > Number.NaN) !== false) { + throw new Test262Error('#5: (+Infinity > NaN) === false'); +} + +//CHECK#6 +if ((Number.NEGATIVE_INFINITY > Number.NaN) !== false) { + throw new Test262Error('#6: (-Infinity > NaN) === false'); +} + +//CHECK#7 +if ((Number.MAX_VALUE > Number.NaN) !== false) { + throw new Test262Error('#7: (Number.MAX_VALUE > NaN) === false'); +} + +//CHECK#8 +if ((Number.MIN_VALUE > Number.NaN) !== false) { + throw new Test262Error('#8: (Number.MIN_VALUE > NaN) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.3.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.3.js new file mode 100644 index 0000000000..9274a583d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.3.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x and y are the same number value, return false +es5id: 11.8.2_A4.3 +description: x and y are number primitives +---*/ + +//CHECK#1 +if ((1 > 1) !== false) { + throw new Test262Error('#1: (1 > 1) === false'); +} + +//CHECK#2 +if ((1.1 > 1.1) !== false) { + throw new Test262Error('#2: (1.1 > 1.1) === false'); +} + +//CHECK#3 +if ((-1.1 > -1.1) !== false) { + throw new Test262Error('#3: (-1.1 > -1.1) === false'); +} + +//CHECK#4 +if ((Number.NEGATIVE_INFINITY > Number.NEGATIVE_INFINITY) !== false) { + throw new Test262Error('#4: (-Infinity > -Infinity) === false'); +} + +//CHECK#5 +if ((Number.POSITIVE_INFINITY > Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#5: (+Infinity > +Infinity) === false'); +} + +//CHECK#6 +if ((Number.MAX_VALUE > Number.MAX_VALUE) !== false) { + throw new Test262Error('#6: (Number.MAX_VALUE > Number.MAX_VALUE) === false'); +} + +//CHECK#7 +if ((Number.MIN_VALUE > Number.MIN_VALUE) !== false) { + throw new Test262Error('#7: (Number.MIN_VALUE > Number.MIN_VALUE) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.4.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.4.js new file mode 100644 index 0000000000..f554feb4c0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.4.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. + +/*--- +info: If either variable x or y is +0 and the other is -0, return false +es5id: 11.8.2_A4.4 +description: Checking all combinations +---*/ + +//CHECK#1 +if ((0 > 0) !== false) { + throw new Test262Error('#1: (0 > 0) === false'); +} + +//CHECK#2 +if ((-0 > -0) !== false) { + throw new Test262Error('#2: (-0 > -0) === false'); +} + +//CHECK#3 +if ((+0 > -0) !== false) { + throw new Test262Error('#3: (+0 > -0) === false'); +} + +//CHECK#4 +if ((-0 > +0) !== false) { + throw new Test262Error('#4: (-0 > +0) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.5.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.5.js new file mode 100644 index 0000000000..f147d0987f --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.5.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. + +/*--- +info: If x is +Infinity and x !== y, return true +es5id: 11.8.2_A4.5 +description: y is number primitive +---*/ + +//CHECK#1 +if ((Number.POSITIVE_INFINITY > 0) !== true) { + throw new Test262Error('#1: (+Infinity > 0) === true'); +} + +//CHECK#2 +if ((Number.POSITIVE_INFINITY > 1.1) !== true) { + throw new Test262Error('#2: (+Infinity > 1.1) === true'); +} + +//CHECK#3 +if ((Number.POSITIVE_INFINITY > -1.1) !== true) { + throw new Test262Error('#3: (+Infinity > -1.1) === true'); +} + +//CHECK#4 +if ((Number.POSITIVE_INFINITY > Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#4: (+Infinity > -Infinity) === true'); +} + +//CHECK#5 +if ((Number.POSITIVE_INFINITY > Number.MAX_VALUE) !== true) { + throw new Test262Error('#5: (+Infinity > Number.MAX_VALUE) === true'); +} + +//CHECK#6 +if ((Number.POSITIVE_INFINITY > Number.MIN_VALUE) !== true) { + throw new Test262Error('#6: (+Infinity > Number.MIN_VALUE) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.6.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.6.js new file mode 100644 index 0000000000..3b05e89fef --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.6.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. + +/*--- +info: If y is +Infinity, return false +es5id: 11.8.2_A4.6 +description: x is number primitive +---*/ + +//CHECK#1 +if ((0 > Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#1: (0 > +Infinity) === false'); +} + +//CHECK#2 +if ((1.1 > Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#2: (1.1 > +Infinity) === false'); +} + +//CHECK#3 +if ((-1.1 > Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#3: (-1.1 > +Infinity) === false'); +} + +//CHECK#4 +if ((Number.NEGATIVE_INFINITY > Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#4: (-Infinity > +Infinity) === false'); +} + +//CHECK#5 +if ((Number.MAX_VALUE > Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#5: (Number.MAX_VALUE > +Infinity) === false'); +} + +//CHECK#6 +if ((Number.MIN_VALUE > Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#6: (Number.MIN_VALUE > +Infinity) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.7.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.7.js new file mode 100644 index 0000000000..f09a555633 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.7.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. + +/*--- +info: If x is -Infinity, return false +es5id: 11.8.2_A4.7 +description: y is number primitive +---*/ + +//CHECK#1 +if ((Number.NEGATIVE_INFINITY > 0) !== false) { + throw new Test262Error('#1: (-Infinity > 0) === false'); +} + +//CHECK#2 +if ((Number.NEGATIVE_INFINITY > 1.1) !== false) { + throw new Test262Error('#2: (-Infinity > 1.1) === false'); +} + +//CHECK#3 +if ((Number.NEGATIVE_INFINITY > -1.1) !== false) { + throw new Test262Error('#3: (-Infinity > -1.1) === false'); +} + +//CHECK#4 +if ((Number.NEGATIVE_INFINITY > Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#4: (-Infinity > +Infinity) === false'); +} + +//CHECK#5 +if ((Number.NEGATIVE_INFINITY > Number.MAX_VALUE) !== false) { + throw new Test262Error('#5: (-Infinity > Number.MAX_VALUE) === false'); +} + +//CHECK#6 +if ((Number.NEGATIVE_INFINITY > Number.MIN_VALUE) !== false) { + throw new Test262Error('#6: (-Infinity > Number.MIN_VALUE) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.8.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.8.js new file mode 100644 index 0000000000..12ae0c7714 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.8.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. + +/*--- +info: If y is -Infinity and x !== y, return true +es5id: 11.8.2_A4.8 +description: x is number primitive +---*/ + +//CHECK#1 +if ((0 > Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#1: (0 > -Infinity) === true'); +} + +//CHECK#2 +if ((1.1 > Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#2: (1.1 > -Infinity) === true'); +} + +//CHECK#3 +if ((-1.1 > Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#3: (-1.1 > -Infinity) === true'); +} + +//CHECK#4 +if ((Number.POSITIVE_INFINITY > Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#4: (+Infinity > -Infinity) === true'); +} + +//CHECK#5 +if ((Number.MAX_VALUE > Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#5: (Number.MAX_VALUE > -Infinity) === true'); +} + +//CHECK#6 +if ((Number.MIN_VALUE > Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#6: (Number.MIN_VALUE > -Infinity) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.9.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.9.js new file mode 100644 index 0000000000..5375d96c4f --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.9.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If is x greater than y and these values are both finite non-zero, return + true; otherwise, return false +es5id: 11.8.2_A4.9 +description: x and y are number primitives +---*/ + +//CHECK#1 +if ((1 > 1.1) !== false) { + throw new Test262Error('#1: (1 > 1.1) === false'); +} + +//CHECK#2 +if ((1.1 > 1) !== true) { + throw new Test262Error('#2: (1.1 > 1) === true'); +} + +//CHECK#3 +if ((-1 > -1.1) !== true) { + throw new Test262Error('#3: (-1 > -1.1) === true'); +} + +//CHECK#4 +if ((-1.1 > -1) !== false) { + throw new Test262Error('#4: (-1.1 > -1) === false'); +} + +//CHECK#5 +if ((0.1 > 0) !== true) { + throw new Test262Error('#5: (0.1 > 0) === true'); +} + +//CHECK#6 +if ((0 > -0.1) !== true) { + throw new Test262Error('#6: (0 > -0.1) === true'); +} + +//CHECK#7 +if ((Number.MAX_VALUE > Number.MAX_VALUE/2) !== true) { + throw new Test262Error('#7: (Number.MAX_VALUE > Number.MAX_VALUE/2) === true'); +} + +//CHECK#8 +if ((Number.MIN_VALUE*2 > Number.MIN_VALUE) !== true) { + throw new Test262Error('#8: (Number.MIN_VALUE*2 > Number.MIN_VALUE) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/bigint-and-bigint.js b/js/src/tests/test262/language/expressions/greater-than/bigint-and-bigint.js new file mode 100644 index 0000000000..17c16fd1b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/bigint-and-bigint.js @@ -0,0 +1,166 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Comparisons of BigInt and BigInt values +esid: sec-abstract-relational-comparison +info: | + ... + 3. If both px and py are Strings, then + ... + 4. Else, + a. Let nx be ? ToNumeric(px). Because px and py are primitive values evaluation order is not important. + b. Let ny be ? ToNumeric(py). + c. If Type(nx) is Type(ny), return ? Type(nx)::lessThan(nx, ny). + + sec-numeric-types-bigint-lessThan + BigInt::lessThan (x, y) + + The abstract operation BigInt::lessThan with two arguments x and y of BigInt type returns true if x is less than y and false otherwise. + +features: [BigInt] +---*/ +assert.sameValue(0n > 0n, false, 'The result of (0n > 0n) is false'); +assert.sameValue(1n > 1n, false, 'The result of (1n > 1n) is false'); +assert.sameValue(-1n > -1n, false, 'The result of (-1n > -1n) is false'); +assert.sameValue(0n > -0n, false, 'The result of (0n > -0n) is false'); +assert.sameValue(-0n > 0n, false, 'The result of (-0n > 0n) is false'); +assert.sameValue(0n > 1n, false, 'The result of (0n > 1n) is false'); +assert.sameValue(1n > 0n, true, 'The result of (1n > 0n) is true'); +assert.sameValue(0n > -1n, true, 'The result of (0n > -1n) is true'); +assert.sameValue(-1n > 0n, false, 'The result of (-1n > 0n) is false'); +assert.sameValue(1n > -1n, true, 'The result of (1n > -1n) is true'); +assert.sameValue(-1n > 1n, false, 'The result of (-1n > 1n) is false'); + +assert.sameValue( + 0x1fffffffffffff01n > 0x1fffffffffffff02n, + false, + 'The result of (0x1fffffffffffff01n > 0x1fffffffffffff02n) is false' +); + +assert.sameValue( + 0x1fffffffffffff02n > 0x1fffffffffffff01n, + true, + 'The result of (0x1fffffffffffff02n > 0x1fffffffffffff01n) is true' +); + +assert.sameValue( + -0x1fffffffffffff01n > -0x1fffffffffffff02n, + true, + 'The result of (-0x1fffffffffffff01n > -0x1fffffffffffff02n) is true' +); + +assert.sameValue( + -0x1fffffffffffff02n > -0x1fffffffffffff01n, + false, + 'The result of (-0x1fffffffffffff02n > -0x1fffffffffffff01n) is false' +); + +assert.sameValue( + 0x10000000000000000n > 0n, + true, + 'The result of (0x10000000000000000n > 0n) is true' +); + +assert.sameValue( + 0n > 0x10000000000000000n, + false, + 'The result of (0n > 0x10000000000000000n) is false' +); + +assert.sameValue( + 0x10000000000000000n > 1n, + true, + 'The result of (0x10000000000000000n > 1n) is true' +); + +assert.sameValue( + 1n > 0x10000000000000000n, + false, + 'The result of (1n > 0x10000000000000000n) is false' +); + +assert.sameValue( + 0x10000000000000000n > -1n, + true, + 'The result of (0x10000000000000000n > -1n) is true' +); + +assert.sameValue( + -1n > 0x10000000000000000n, + false, + 'The result of (-1n > 0x10000000000000000n) is false' +); + +assert.sameValue( + 0x10000000000000001n > 0n, + true, + 'The result of (0x10000000000000001n > 0n) is true' +); + +assert.sameValue( + 0n > 0x10000000000000001n, + false, + 'The result of (0n > 0x10000000000000001n) is false' +); + +assert.sameValue( + -0x10000000000000000n > 0n, + false, + 'The result of (-0x10000000000000000n > 0n) is false' +); + +assert.sameValue( + 0n > -0x10000000000000000n, + true, + 'The result of (0n > -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000000n > 1n, + false, + 'The result of (-0x10000000000000000n > 1n) is false' +); + +assert.sameValue( + 1n > -0x10000000000000000n, + true, + 'The result of (1n > -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000000n > -1n, + false, + 'The result of (-0x10000000000000000n > -1n) is false' +); + +assert.sameValue( + -1n > -0x10000000000000000n, + true, + 'The result of (-1n > -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000001n > 0n, + false, + 'The result of (-0x10000000000000001n > 0n) is false' +); + +assert.sameValue( + 0n > -0x10000000000000001n, + true, + 'The result of (0n > -0x10000000000000001n) is true' +); + +assert.sameValue( + 0x10000000000000000n > 0x100000000n, + true, + 'The result of (0x10000000000000000n > 0x100000000n) is true' +); + +assert.sameValue( + 0x100000000n > 0x10000000000000000n, + false, + 'The result of (0x100000000n > 0x10000000000000000n) is false' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/bigint-and-boolean.js b/js/src/tests/test262/language/expressions/greater-than/bigint-and-boolean.js new file mode 100644 index 0000000000..263b7c2e6d --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/bigint-and-boolean.js @@ -0,0 +1,23 @@ +// Copyright (C) 2018 Caio Lima. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Relational comparison of BigInt and boolean values +esid: sec-abstract-relational-comparison +features: [BigInt] +---*/ +assert.sameValue(0n > false, false, 'The result of (0n > false) is false'); +assert.sameValue(false > 0n, false, 'The result of (false > 0n) is false'); +assert.sameValue(0n > true, false, 'The result of (0n > true) is false'); +assert.sameValue(true > 0n, true, 'The result of (true > 0n) is true'); +assert.sameValue(1n > false, true, 'The result of (1n > false) is true'); +assert.sameValue(false > 1n, false, 'The result of (false > 1n) is false'); +assert.sameValue(1n > true, false, 'The result of (1n > true) is false'); +assert.sameValue(true > 1n, false, 'The result of (true > 1n) is false'); +assert.sameValue(31n > true, true, 'The result of (31n > true) is true'); +assert.sameValue(true > 31n, false, 'The result of (true > 31n) is false'); +assert.sameValue(-3n > true, false, 'The result of (-3n > true) is false'); +assert.sameValue(true > -3n, true, 'The result of (true > -3n) is true'); +assert.sameValue(-3n > false, false, 'The result of (-3n > false) is false'); +assert.sameValue(false > -3n, true, 'The result of (false > -3n) is true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/bigint-and-incomparable-string.js b/js/src/tests/test262/language/expressions/greater-than/bigint-and-incomparable-string.js new file mode 100644 index 0000000000..f0902a1fe1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/bigint-and-incomparable-string.js @@ -0,0 +1,29 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Relational comparison of BigInt and string values +esid: sec-abstract-relational-comparison +features: [BigInt] +---*/ +assert.sameValue(1n > '0n', false, 'The result of (1n > "0n") is false'); +assert.sameValue(1n > '0.', false, 'The result of (1n > "0.") is false'); +assert.sameValue(1n > '.0', false, 'The result of (1n > ".0") is false'); +assert.sameValue(1n > '0/1', false, 'The result of (1n > "0/1") is false'); +assert.sameValue(1n > 'z0', false, 'The result of (1n > "z0") is false'); +assert.sameValue(1n > '0z', false, 'The result of (1n > "0z") is false'); +assert.sameValue(1n > '++0', false, 'The result of (1n > "++0") is false'); +assert.sameValue(1n > '--0', false, 'The result of (1n > "--0") is false'); +assert.sameValue(1n > '0e0', false, 'The result of (1n > "0e0") is false'); +assert.sameValue(1n > 'Infinity', false, 'The result of (1n > "Infinity") is false'); +assert.sameValue('1n' > 0n, false, 'The result of ("1n" > 0n) is false'); +assert.sameValue('1.' > 0n, false, 'The result of ("1." > 0n) is false'); +assert.sameValue('.1' > 0n, false, 'The result of (".1" > 0n) is false'); +assert.sameValue('1/1' > 0n, false, 'The result of ("1/1" > 0n) is false'); +assert.sameValue('z1' > 0n, false, 'The result of ("z1" > 0n) is false'); +assert.sameValue('1z' > 0n, false, 'The result of ("1z" > 0n) is false'); +assert.sameValue('++1' > 0n, false, 'The result of ("++1" > 0n) is false'); +assert.sameValue('--1' > 0n, false, 'The result of ("--1" > 0n) is false'); +assert.sameValue('1e0' > 0n, false, 'The result of ("1e0" > 0n) is false'); +assert.sameValue('Infinity' > 0n, false, 'The result of ("Infinity" > 0n) is false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/bigint-and-non-finite.js b/js/src/tests/test262/language/expressions/greater-than/bigint-and-non-finite.js new file mode 100644 index 0000000000..bb651a58a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/bigint-and-non-finite.js @@ -0,0 +1,31 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Comparisons of BigInt and non-finite Number values +esid: sec-abstract-relational-comparison +info: | + ... + 3. If both px and py are Strings, then + ... + 4. Else, + a. Let nx be ? ToNumeric(px). Because px and py are primitive values evaluation order is not important. + b. Let ny be ? ToNumeric(py). + c. If Type(nx) is Type(ny), return ? Type(nx)::lessThan(nx, ny). + d. Assert: Type(nx) is BigInt and Type(ny) is Number, or if Type(nx) is Number and Type(ny) is BigInt. + e. If x or y are any of NaN, return undefined. + f. If x is -∞, or y is +∞, return true. + g. If x is +∞, or y is -∞, return false. +features: [BigInt] +---*/ +assert.sameValue(1n > Infinity, false, 'The result of (1n > Infinity) is false'); +assert.sameValue(Infinity > 1n, true, 'The result of (Infinity > 1n) is true'); +assert.sameValue(-1n > Infinity, false, 'The result of (-1n > Infinity) is false'); +assert.sameValue(Infinity > -1n, true, 'The result of (Infinity > -1n) is true'); +assert.sameValue(1n > -Infinity, true, 'The result of (1n > -Infinity) is true'); +assert.sameValue(-Infinity > 1n, false, 'The result of (-Infinity > 1n) is false'); +assert.sameValue(-1n > -Infinity, true, 'The result of (-1n > -Infinity) is true'); +assert.sameValue(-Infinity > -1n, false, 'The result of (-Infinity > -1n) is false'); +assert.sameValue(0n > NaN, false, 'The result of (0n > NaN) is false'); +assert.sameValue(NaN > 0n, false, 'The result of (NaN > 0n) is false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/bigint-and-number-extremes.js b/js/src/tests/test262/language/expressions/greater-than/bigint-and-number-extremes.js new file mode 100644 index 0000000000..c0323cde2c --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/bigint-and-number-extremes.js @@ -0,0 +1,50 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Comparisons of BigInt and Number values +esid: sec-abstract-relational-comparison +info: | + ... + 3. If both px and py are Strings, then + ... + 4. Else, + a. Let nx be ? ToNumeric(px). Because px and py are primitive values evaluation order is not important. + b. Let ny be ? ToNumeric(py). + c. If Type(nx) is Type(ny), return ? Type(nx)::lessThan(nx, ny). + d. Assert: Type(nx) is BigInt and Type(ny) is Number, or if Type(nx) is Number and Type(ny) is BigInt. + e. If x or y are any of NaN, return undefined. + f. If x is -∞, or y is +∞, return true. + g. If x is +∞, or y is -∞, return false. + h. If the mathematical value of nx is less than the mathematical value of ny, return true, otherwise return false. +features: [BigInt] +---*/ +assert.sameValue(1n > Number.MAX_VALUE, false, 'The result of (1n > Number.MAX_VALUE) is false'); +assert.sameValue(Number.MAX_VALUE > 1n, true, 'The result of (Number.MAX_VALUE > 1n) is true'); +assert.sameValue(1n > -Number.MAX_VALUE, true, 'The result of (1n > -Number.MAX_VALUE) is true'); +assert.sameValue(-Number.MAX_VALUE > 1n, false, 'The result of (-Number.MAX_VALUE > 1n) is false'); + +assert.sameValue( + 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn > Number.MAX_VALUE, + false, + 'The result of (0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn > Number.MAX_VALUE) is false' +); + +assert.sameValue( + Number.MAX_VALUE > 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn, + true, + 'The result of (Number.MAX_VALUE > 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn) is true' +); + +assert.sameValue( + 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n > Number.MAX_VALUE, + true, + 'The result of (0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n > Number.MAX_VALUE) is true' +); + +assert.sameValue( + Number.MAX_VALUE > 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n, + false, + 'The result of (Number.MAX_VALUE > 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n) is false' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/bigint-and-number.js b/js/src/tests/test262/language/expressions/greater-than/bigint-and-number.js new file mode 100644 index 0000000000..852f4e4322 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/bigint-and-number.js @@ -0,0 +1,48 @@ +// Copyright (C) 2017 Robin Templeton. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Comparisons of BigInt and Number values +esid: sec-abstract-relational-comparison +info: | + ... + 3. If both px and py are Strings, then + ... + 4. Else, + a. Let nx be ? ToNumeric(px). Because px and py are primitive values evaluation order is not important. + b. Let ny be ? ToNumeric(py). + c. If Type(nx) is Type(ny), return ? Type(nx)::lessThan(nx, ny). + d. Assert: Type(nx) is BigInt and Type(ny) is Number, or if Type(nx) is Number and Type(ny) is BigInt. + e. If x or y are any of NaN, return undefined. + f. If x is -∞, or y is +∞, return true. + g. If x is +∞, or y is -∞, return false. + h. If the mathematical value of nx is less than the mathematical value of ny, return true, otherwise return false. +features: [BigInt] +---*/ +assert.sameValue(0n > 0, false, 'The result of (0n > 0) is false'); +assert.sameValue(0 > 0n, false, 'The result of (0 > 0n) is false'); +assert.sameValue(0n > -0, false, 'The result of (0n > -0) is false'); +assert.sameValue(-0 > 0n, false, 'The result of (-0 > 0n) is false'); +assert.sameValue(0n > 0.000000000001, false, 'The result of (0n > 0.000000000001) is false'); +assert.sameValue(0.000000000001 > 0n, true, 'The result of (0.000000000001 > 0n) is true'); +assert.sameValue(0n > 1, false, 'The result of (0n > 1) is false'); +assert.sameValue(1 > 0n, true, 'The result of (1 > 0n) is true'); +assert.sameValue(1n > 0, true, 'The result of (1n > 0) is true'); +assert.sameValue(0 > 1n, false, 'The result of (0 > 1n) is false'); +assert.sameValue(1n > 0.999999999999, true, 'The result of (1n > 0.999999999999) is true'); +assert.sameValue(0.999999999999 > 1n, false, 'The result of (0.999999999999 > 1n) is false'); +assert.sameValue(1n > 1, false, 'The result of (1n > 1) is false'); +assert.sameValue(1 > 1n, false, 'The result of (1 > 1n) is false'); +assert.sameValue(0n > Number.MIN_VALUE, false, 'The result of (0n > Number.MIN_VALUE) is false'); +assert.sameValue(Number.MIN_VALUE > 0n, true, 'The result of (Number.MIN_VALUE > 0n) is true'); +assert.sameValue(0n > -Number.MIN_VALUE, true, 'The result of (0n > -Number.MIN_VALUE) is true'); +assert.sameValue(-Number.MIN_VALUE > 0n, false, 'The result of (-Number.MIN_VALUE > 0n) is false'); + +assert.sameValue( + -10n > Number.MIN_VALUE, + false, + 'The result of (-10n > Number.MIN_VALUE) is false' +); + +assert.sameValue(Number.MIN_VALUE > -10n, true, 'The result of (Number.MIN_VALUE > -10n) is true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/bigint-and-string.js b/js/src/tests/test262/language/expressions/greater-than/bigint-and-string.js new file mode 100644 index 0000000000..0355e77be4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/bigint-and-string.js @@ -0,0 +1,62 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Relational comparison of BigInt and string values +esid: sec-abstract-relational-comparison +features: [BigInt] +---*/ +assert.sameValue(0n > '0', false, 'The result of (0n > "0") is false'); +assert.sameValue('0' > 0n, false, 'The result of ("0" > 0n) is false'); +assert.sameValue(0n > '1', false, 'The result of (0n > "1") is false'); +assert.sameValue('0' > 1n, false, 'The result of ("0" > 1n) is false'); +assert.sameValue(1n > '0', true, 'The result of (1n > "0") is true'); +assert.sameValue('1' > 0n, true, 'The result of ("1" > 0n) is true'); +assert.sameValue(0n > '', false, 'The result of (0n > "") is false'); +assert.sameValue('' > 0n, false, 'The result of ("" > 0n) is false'); +assert.sameValue(0n > '1', false, 'The result of (0n > "1") is false'); +assert.sameValue('' > 1n, false, 'The result of ("" > 1n) is false'); +assert.sameValue(1n > '', true, 'The result of (1n > "") is true'); +assert.sameValue('1' > 0n, true, 'The result of ("1" > 0n) is true'); +assert.sameValue(1n > '1', false, 'The result of (1n > "1") is false'); +assert.sameValue('1' > 1n, false, 'The result of ("1" > 1n) is false'); +assert.sameValue(1n > '-1', true, 'The result of (1n > "-1") is true'); +assert.sameValue('1' > -1n, true, 'The result of ("1" > -1n) is true'); +assert.sameValue(-1n > '1', false, 'The result of (-1n > "1") is false'); +assert.sameValue('-1' > 1n, false, 'The result of ("-1" > 1n) is false'); +assert.sameValue(-1n > '-1', false, 'The result of (-1n > "-1") is false'); +assert.sameValue('-1' > -1n, false, 'The result of ("-1" > -1n) is false'); +assert.sameValue('0x10' > 15n, true, 'The result of ("0x10" > 15n) is true'); +assert.sameValue('0x10' > 16n, false, 'The result of ("0x10" > 16n) is false'); +assert.sameValue('0x10' > 17n, false, 'The result of ("0x10" > 17n) is false'); +assert.sameValue('0o10' > 7n, true, 'The result of ("0o10" > 7n) is true'); +assert.sameValue('0o10' > 8n, false, 'The result of ("0o10" > 8n) is false'); +assert.sameValue('0o10' > 9n, false, 'The result of ("0o10" > 9n) is false'); +assert.sameValue('0b10' > 1n, true, 'The result of ("0b10" > 1n) is true'); +assert.sameValue('0b10' > 2n, false, 'The result of ("0b10" > 2n) is false'); +assert.sameValue('0b10' > 3n, false, 'The result of ("0b10" > 3n) is false'); + +assert.sameValue( + 9007199254740993n > '9007199254740992', + true, + 'The result of (9007199254740993n > "9007199254740992") is true' +); + +assert.sameValue( + '9007199254740993' > 9007199254740992n, + true, + 'The result of ("9007199254740993" > 9007199254740992n) is true' +); + +assert.sameValue( + -9007199254740992n > '-9007199254740993', + true, + 'The result of (-9007199254740992n > "-9007199254740993") is true' +); + +assert.sameValue( + '-9007199254740992' > -9007199254740993n, + true, + 'The result of ("-9007199254740992" > -9007199254740993n) is true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/bigint-and-symbol.js b/js/src/tests/test262/language/expressions/greater-than/bigint-and-symbol.js new file mode 100644 index 0000000000..5de77bc5d1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/bigint-and-symbol.js @@ -0,0 +1,16 @@ +// Copyright (C) 2018 Caio Lima. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Relational comparison of BigInt and Symbol values +esid: sec-abstract-relational-comparison +features: [BigInt, Symbol] +---*/ +assert.throws(TypeError, function() { + 3n > Symbol('2'); +}, '3n > Symbol("2") throws TypeError'); + +assert.throws(TypeError, function() { + Symbol('2') > 3n; +}, 'Symbol("2") > 3n throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/browser.js b/js/src/tests/test262/language/expressions/greater-than/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/browser.js diff --git a/js/src/tests/test262/language/expressions/greater-than/shell.js b/js/src/tests/test262/language/expressions/greater-than/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/shell.js |