diff options
Diffstat (limited to 'js/src/tests/test262/ch09/9.6')
-rw-r--r-- | js/src/tests/test262/ch09/9.6/S9.6_A1.js | 54 | ||||
-rw-r--r-- | js/src/tests/test262/ch09/9.6/S9.6_A2.1.js | 40 | ||||
-rw-r--r-- | js/src/tests/test262/ch09/9.6/S9.6_A2.2.js | 70 | ||||
-rw-r--r-- | js/src/tests/test262/ch09/9.6/S9.6_A3.1_T1.js | 20 | ||||
-rw-r--r-- | js/src/tests/test262/ch09/9.6/S9.6_A3.1_T2.js | 20 | ||||
-rw-r--r-- | js/src/tests/test262/ch09/9.6/S9.6_A3.1_T3.js | 20 | ||||
-rw-r--r-- | js/src/tests/test262/ch09/9.6/S9.6_A3.1_T4.js | 79 | ||||
-rw-r--r-- | js/src/tests/test262/ch09/9.6/S9.6_A3.2_T1.js | 20 | ||||
-rw-r--r-- | js/src/tests/test262/ch09/9.6/browser.js | 0 | ||||
-rw-r--r-- | js/src/tests/test262/ch09/9.6/shell.js | 0 |
10 files changed, 323 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch09/9.6/S9.6_A1.js b/js/src/tests/test262/ch09/9.6/S9.6_A1.js new file mode 100644 index 000000000..6e370541b --- /dev/null +++ b/js/src/tests/test262/ch09/9.6/S9.6_A1.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If value is NaN, +0, -0, +Infinity, or -Infinity, return +0 + * + * @path ch09/9.6/S9.6_A1.js + * @description For testing use operator >>>0 + */ + +// CHECK#1 +if ((Number.NaN >>> 0) !== +0) { + $ERROR('#1.1: (Number.NaN >>> 0) === 0. Actual: ' + ((Number.NaN >>> 0))); +} else if (1/(Number.NaN >>> 0) !== Number.POSITIVE_INFINITY) { + $ERROR('#1.2: (Number.NaN >>> 0) === +0. Actual: -0'); +} + +// CHECK#2 +if ((Number("abc") >>> 0) !== +0) { + $ERROR('#2.1: (Number("abc") >>> 0) === 0. Actual: ' + ((Number("abc") >>> 0))); +} else if (1/(0 >>> 0) !== Number.POSITIVE_INFINITY) { + $ERROR('#2.2: (0 >>> 0) === +0. Actual: -0'); +} + +// CHECK#3 +if ((0 >>> 0) !== +0) { + $ERROR('#3.1: (0 >>> 0) === 0. Actual: ' + ((0 >>> 0))); +} else if (1/(0 >>> 0) !== Number.POSITIVE_INFINITY) { + $ERROR('#3.2: (0 >>> 0) === +0. Actual: -0'); +} + +// CHECK#4 +if ((-0 >>> 0) !== +0) { + $ERROR("#4.1: (-0 >>> 0) === 0"); +} else if (1/(-0 >>> 0) !== Number.POSITIVE_INFINITY) { + $ERROR("#4.2: (-0 >>> 0) === +0. Actual: -0"); +} + +// CHECK#5 +if ((Number.POSITIVE_INFINITY >>> 0) !== +0) { + $ERROR('#5.1: (Number.POSITIVE_INFINITY >>> 0) === 0. Actual: ' + ((Number.POSITIVE_INFINITY >>> 0))); +} else if (1/(Number.POSITIVE_INFINITY >>> 0) !== Number.POSITIVE_INFINITY) { + $ERROR('#5.2: (Number.POSITIVE_INFINITY >>> 0) === +0. Actual: -0'); +} + +// CHECK#6 +if ((Number.NEGATIVE_INFINITY >>> 0) !== +0) { + $ERROR("#6.1: (Number.NEGATIVE_INFINITY >>> 0) === 0"); +} else if (1/(Number.NEGATIVE_INFINITY >>> 0) !== Number.POSITIVE_INFINITY) { + $ERROR("#6.2: (Number.NEGATIVE_INFINITY >>> 0) === +0. Actual: -0"); +} + + + diff --git a/js/src/tests/test262/ch09/9.6/S9.6_A2.1.js b/js/src/tests/test262/ch09/9.6/S9.6_A2.1.js new file mode 100644 index 000000000..cc2f38c85 --- /dev/null +++ b/js/src/tests/test262/ch09/9.6/S9.6_A2.1.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. + +/** + * ToUint32 returns values between 0 and 2^32-1 + * + * @path ch09/9.6/S9.6_A2.1.js + * @description Converting numbers, which are in\outside of Uint32 scopes, with >>>0 operator + */ + +// CHECK#1 +if ((0 >>> 0) !== 0) { + $ERROR('#1: (0 >>> 0) === 0. Actual: ' + ((0 >>> 0))); +} + +// CHECK#2 +if ((1 >>> 0) !== 1) { + $ERROR('#2: (1 >>> 0) === 1. Actual: ' + ((1 >>> 0))); +} + +// CHECK#3 +if ((-1 >>> 0) !== 4294967295) { + $ERROR('#3: (-1 >>> 0) === 4294967295. Actual: ' + ((-1 >>> 0))); +} + +// CHECK#4 +if ((4294967295 >>> 0) !== 4294967295) { + $ERROR('#4: (4294967295 >>> 0) === 4294967295. Actual: ' + ((4294967295 >>> 0))); +} + +// CHECK#5 +if ((4294967294 >>> 0) !== 4294967294) { + $ERROR('#5: (4294967294 >>> 0) === 4294967294. Actual: ' + ((4294967294 >>> 0))); +} + +// CHECK#6 +if ((4294967296 >>> 0) !== 0) { + $ERROR('#6: (4294967296 >>> 0) === 0. Actual: ' + ((4294967296 >>> 0))); +} + diff --git a/js/src/tests/test262/ch09/9.6/S9.6_A2.2.js b/js/src/tests/test262/ch09/9.6/S9.6_A2.2.js new file mode 100644 index 000000000..7438cbe95 --- /dev/null +++ b/js/src/tests/test262/ch09/9.6/S9.6_A2.2.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Compute result modulo 2^32 + * + * @path ch09/9.6/S9.6_A2.2.js + * @description Use operator >>>0 + */ + +// CHECK#1 +if ((-2147483647 >>> 0) !== 2147483649) { + $ERROR('#1: (-2147483647 >>> 0) === 2147483649. Actual: ' + ((-2147483647 >>> 0))); +} + +// CHECK#2 +if ((-2147483648 >>> 0) !== 2147483648) { + $ERROR('#2: (-2147483648 >>> 0) === 2147483648. Actual: ' + ((-2147483648 >>> 0))); +} + +// CHECK#3 +if ((-2147483649 >>> 0) !== 2147483647) { + $ERROR('#3: (-2147483649 >>> 0) === 2147483647. Actual: ' + ((-2147483649 >>> 0))); +} + +// CHECK#4 +if ((-4294967295 >>> 0) !== 1) { + $ERROR('#4: (-4294967295 >>> 0) === 1. Actual: ' + ((-4294967295 >>> 0))); +} + +// CHECK#5 +if ((-4294967296 >>> 0) !== 0) { + $ERROR('#5: (-4294967296 >>> 0) === 0. Actual: ' + ((-4294967296 >>> 0))); +} + +// CHECK#6 +if ((-4294967297 >>> 0) !== 4294967295) { + $ERROR('#6: (-4294967297 >>> 0) === 4294967295. Actual: ' + ((-4294967297 >>> 0))); +} + +// CHECK#7 +if ((4294967295 >>> 0) !== 4294967295) { + $ERROR('#7: (4294967295 >>> 0) === 4294967295. Actual: ' + ((4294967295 >>> 0))); +} + +// CHECK#8 +if ((4294967296 >>> 0) !== 0) { + $ERROR('#8: (4294967296 >>> 0) === 0. Actual: ' + ((4294967296 >>> 0))); +} + +// CHECK#9 +if ((4294967297 >>> 0) !== 1) { + $ERROR('#9: (4294967297 >>> 0) === 1. Actual: ' + ((4294967297 >>> 0))); +} + +// CHECK#10 +if ((8589934591 >>> 0) !== 4294967295) { + $ERROR('#10: (8589934591 >>> 0) === 4294967295. Actual: ' + ((8589934591 >>> 0))); +} + +// CHECK#11 +if ((8589934592 >>> 0) !== 0) { + $ERROR('#11: (8589934592 >>> 0) === 0. Actual: ' + ((8589934592 >>> 0))); +} + +// CHECK#12 +if ((8589934593 >>> 0) !== 1) { + $ERROR('#12: (8589934593 >>> 0) === 1. Actual: ' + ((8589934593 >>> 0))); +} + diff --git a/js/src/tests/test262/ch09/9.6/S9.6_A3.1_T1.js b/js/src/tests/test262/ch09/9.6/S9.6_A3.1_T1.js new file mode 100644 index 000000000..d73f715b9 --- /dev/null +++ b/js/src/tests/test262/ch09/9.6/S9.6_A3.1_T1.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. + +/** + * Operator uses ToNumber + * + * @path ch09/9.6/S9.6_A3.1_T1.js + * @description Type(x) is Boolean + */ + +// CHECK#1 +if ((new Boolean(true) >>> 0) !== 1) { + $ERROR('#1: (new Boolean(true) >>> 0) === 1. Actual: ' + ((new Boolean(true) >>> 0))); +} + +// CHECK#2 +if ((false >>> 0) !== 0) { + $ERROR('#2: (false >>> 0) === 0. Actual: ' + ((false >>> 0))); +} + diff --git a/js/src/tests/test262/ch09/9.6/S9.6_A3.1_T2.js b/js/src/tests/test262/ch09/9.6/S9.6_A3.1_T2.js new file mode 100644 index 000000000..5e99b13b3 --- /dev/null +++ b/js/src/tests/test262/ch09/9.6/S9.6_A3.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. + +/** + * Operator uses ToNumber + * + * @path ch09/9.6/S9.6_A3.1_T2.js + * @description Type(x) is Number + */ + +// CHECK#1 +if ((new Number(1) >>> 0) !== 1) { + $ERROR('#1: (new Number(1) >>> 0) === 1. Actual: ' + ((new Number(1) >>> 0))); +} + +// CHECK#2 +if ((-1.234 >>> 0) !== 4294967295) { + $ERROR('#2: (-1.234 >>> 0) === 4294967295. Actual: ' + ((-1.234 >>> 0))); +} + diff --git a/js/src/tests/test262/ch09/9.6/S9.6_A3.1_T3.js b/js/src/tests/test262/ch09/9.6/S9.6_A3.1_T3.js new file mode 100644 index 000000000..480ffd0cc --- /dev/null +++ b/js/src/tests/test262/ch09/9.6/S9.6_A3.1_T3.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. + +/** + * Operator uses ToNumber + * + * @path ch09/9.6/S9.6_A3.1_T3.js + * @description Type(x) is String + */ + +// CHECK#1 +if ((new String(1) >>> 0) !== 1) { + $ERROR('#1: (new String(1) >>> 0) === 1. Actual: ' + ((new String(1) >>> 0))); +} + +// CHECK#2 +if (("-1.234" >>> 0) !== 4294967295) { + $ERROR('#2: ("-1.234" >>> 0) === 4294967295. Actual: ' + (("-1.234" >>> 0))); +} + diff --git a/js/src/tests/test262/ch09/9.6/S9.6_A3.1_T4.js b/js/src/tests/test262/ch09/9.6/S9.6_A3.1_T4.js new file mode 100644 index 000000000..65381fd0d --- /dev/null +++ b/js/src/tests/test262/ch09/9.6/S9.6_A3.1_T4.js @@ -0,0 +1,79 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator uses ToNumber + * + * @path ch09/9.6/S9.6_A3.1_T4.js + * @description Type(x) is Object + */ + +//CHECK#1 +var object = {valueOf: function() {return 1}}; +if ((object >>> 0) !== 1) { + $ERROR('#1: var object = {valueOf: function() {return 1}}; (object >>> 0) === 1. Actual: ' + ((object >>> 0))); +} + +//CHECK#2 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +if ((object >>> 0) !== 1) { + $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; (object >>> 0) === 1. Actual: ' + ((object >>> 0))); +} + +//CHECK#3 +var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +if ((object >>> 0) !== 1) { + $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; (object >>> 0) === 1. Actual: ' + ((object >>> 0))); +} + +//CHECK#4 +try { + var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; + if ((object >>> 0) !== 1) { + $ERROR('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; (object >>> 0) === 1. Actual: ' + ((object >>> 0))); + } +} +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 >>> 0) !== 1) { + $ERROR('#5: var object = {toString: function() {return 1}}; (object >>> 0) === 1. Actual: ' + ((object >>> 0))); +} + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return 1}} +if ((object >>> 0) !== 1) { + $ERROR('#6: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; (object >>> 0) === 1. Actual: ' + ((object >>> 0))); +} + +//CHECK#7 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; + object >>> 0; + $ERROR('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; object throw "error". Actual: ' + (object >>> 0)); +} +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 >>> 0; + $ERROR('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; object throw TypeError. Actual: ' + (object >>> 0)); +} +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/js/src/tests/test262/ch09/9.6/S9.6_A3.2_T1.js b/js/src/tests/test262/ch09/9.6/S9.6_A3.2_T1.js new file mode 100644 index 000000000..87d0b2a84 --- /dev/null +++ b/js/src/tests/test262/ch09/9.6/S9.6_A3.2_T1.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. + +/** + * Operator uses floor, abs + * + * @path ch09/9.6/S9.6_A3.2_T1.js + * @description Use operator >>>0 + */ + +// CHECK#1 +if ((1.2345 >>> 0) !== 1) { + $ERROR('#1: (1.2345 >>> 0) === 1. Actual: ' + ((1.2345 >>> 0))); +} + +// CHECK#2 +if ((-5.4321 >>> 0) !== 4294967291) { + $ERROR('#2: (-5.4321 >>> 0) === 4294967291. Actual: ' + ((-5.4321 >>> 0))); +} + diff --git a/js/src/tests/test262/ch09/9.6/browser.js b/js/src/tests/test262/ch09/9.6/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch09/9.6/browser.js diff --git a/js/src/tests/test262/ch09/9.6/shell.js b/js/src/tests/test262/ch09/9.6/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch09/9.6/shell.js |