summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/expressions/bitwise-not
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/language/expressions/bitwise-not')
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A1.js62
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A2.1_T1.js39
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A2.1_T2.js21
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A2.2_T1.js79
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T1.js25
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T2.js45
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T3.js35
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T4.js20
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T5.js20
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-not/S9.5_A2.1_T2.js32
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-not/S9.5_A2.2_T2.js70
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-not/S9.5_A2.3_T2.js40
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-not/S9.5_A3.1_T4.js79
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-not/S9.5_A3.2_T2.js20
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-not/bigint-non-primitive.js46
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-not/bigint.js39
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-not/browser.js0
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-not/shell.js0
18 files changed, 672 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A1.js b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A1.js
new file mode 100644
index 0000000000..dbf1e1e160
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_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 "~" and UnaryExpression are
+ allowed
+es5id: 11.4.8_A1
+description: Checking by using eval
+---*/
+
+//CHECK#1
+if (eval("~\u00090") !== -1) {
+ $ERROR('#0: ~\\u00090 === -1');
+}
+
+//CHECK#2
+if (eval("~\u000B0") !== -1) {
+ $ERROR('#2: ~\\u000B0 === -1');
+}
+
+//CHECK#3
+if (eval("~\u000C0") !== -1) {
+ $ERROR('#3: ~\\u000C0 === -1');
+}
+
+//CHECK#4
+if (eval("~\u00200") !== -1) {
+ $ERROR('#4: ~\\u0020 === -1');
+}
+
+//CHECK#5
+if (eval("~\u00A00") !== -1) {
+ $ERROR('#5: ~\\u00A00 === -1');
+}
+
+//CHECK#6
+if (eval("~\u000A0") !== -1) {
+ $ERROR('#6: ~\\u000A0 === -1');
+}
+
+//CHECK#7
+if (eval("~\u000D0") !== -1) {
+ $ERROR('#7: ~\\u000D0 === -1');
+}
+
+//CHECK#8
+if (eval("~\u20280") !== -1) {
+ $ERROR('#8: ~\\u20280 === -1');
+}
+
+//CHECK#9
+if (eval("~\u20290") !== -1) {
+ $ERROR('#9: ~\\u20290 === -1');
+}
+
+//CHECK#10
+if (eval("~\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20290") !== -1) {
+ $ERROR('#10: ~\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20290 === -1');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A2.1_T1.js b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A2.1_T1.js
new file mode 100644
index 0000000000..5bebce87e7
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A2.1_T1.js
@@ -0,0 +1,39 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator ~x uses GetValue
+es5id: 11.4.8_A2.1_T1
+description: Either Type(x) is not Reference or GetBase(x) is not null
+---*/
+
+//CHECK#1
+if (~0 !== -1) {
+ $ERROR('#1: ~0 === -1. Actual: ' + (~0));
+}
+
+//CHECK#2
+if (~(~0) !== 0) {
+ $ERROR('#2: ~(~0) === 0. Actual: ' + (~(~0)));
+}
+
+//CHECK#3
+var x = 0;
+if (~x !== -1) {
+ $ERROR('#3: var x = 0; ~x === -1. Actual: ' + (~x));
+}
+
+//CHECK#4
+var x = 0;
+if (~(~x) !== 0) {
+ $ERROR('#4: var x = 0; ~(~x) === 0. Actual: ' + (~(~x)));
+}
+
+//CHECK#5
+var object = new Object();
+object.prop = 0;
+if (~object.prop !== -1) {
+ $ERROR('#5: var object = new Object(); object.prop = 0; ~object.prop === -1. Actual: ' + (~object.prop));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A2.1_T2.js b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A2.1_T2.js
new file mode 100644
index 0000000000..758c1aec79
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A2.1_T2.js
@@ -0,0 +1,21 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator ~x uses GetValue
+es5id: 11.4.8_A2.1_T2
+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));
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A2.2_T1.js b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A2.2_T1.js
new file mode 100644
index 0000000000..2df90309d5
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A2.2_T1.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.
+
+/*---
+info: Operator ~x uses [[Default Value]]
+es5id: 11.4.8_A2.2_T1
+description: If Type(value) is Object, evaluate ToPrimitive(value, Number)
+---*/
+
+//CHECK#1
+var object = {valueOf: function() {return 1}};
+if (~object !== -2) {
+ $ERROR('#1: var object = {valueOf: function() {return 1}}; ~object === -2. Actual: ' + (~object));
+}
+
+//CHECK#2
+var object = {valueOf: function() {return 1}, toString: function() {return 0}};
+if (~object !== -2) {
+ $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; ~object === -2. Actual: ' + (~object));
+}
+
+//CHECK#3
+var object = {valueOf: function() {return 1}, toString: function() {return {}}};
+if (~object !== -2) {
+ $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; ~object === -2. Actual: ' + (~object));
+}
+
+//CHECK#4
+try {
+ var object = {valueOf: function() {return 1}, toString: function() {throw "error"}};
+ if (~object !== -2) {
+ $ERROR('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ~object === -2. Actual: ' + (~object));
+ }
+}
+catch (e) {
+ if (e === "error") {
+ $ERROR('#4.2: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ~object not throw "error"');
+ } else {
+ $ERROR('#4.3: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ~object not throw Error. Actual: ' + (e));
+ }
+}
+
+//CHECK#5
+var object = {toString: function() {return 1}};
+if (~object !== -2) {
+ $ERROR('#5: var object = {toString: function() {return 1}}; ~object === -2. Actual: ' + (~object));
+}
+
+//CHECK#6
+var object = {valueOf: function() {return {}}, toString: function() {return 1}}
+if (~object !== -2) {
+ $ERROR('#6: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; ~object === -2. Actual: ' + (~object));
+}
+
+//CHECK#7
+try {
+ var object = {valueOf: function() {throw "error"}, toString: function() {return 1}};
+ ~object;
+ $ERROR('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; ~object throw "error". Actual: ' + (~object));
+}
+catch (e) {
+ if (e !== "error") {
+ $ERROR('#7.2: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; ~object throw "error". Actual: ' + (e));
+ }
+}
+
+//CHECK#8
+try {
+ var object = {valueOf: function() {return {}}, toString: function() {return {}}};
+ ~object;
+ $ERROR('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; ~object throw TypeError. Actual: ' + (~object));
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ $ERROR('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; ~object throw TypeError. Actual: ' + (e));
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T1.js b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T1.js
new file mode 100644
index 0000000000..5f4e84ed14
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T1.js
@@ -0,0 +1,25 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator ~x returns ~ToInt32(x)
+es5id: 11.4.8_A3_T1
+description: Type(x) is boolean primitive or Boolean object
+---*/
+
+//CHECK#1
+if (~false !== -1) {
+ $ERROR('#1: ~false === -1. Actual: ' + (~false));
+}
+
+//CHECK#2
+if (~new Boolean(true) !== -2) {
+ $ERROR('#2: ~new Boolean(true) === -2. Actual: ' + (~new Boolean(true)));
+}
+
+//CHECK#3
+if (~new Boolean(false) !== -1) {
+ $ERROR('#3: ~new Boolean(false) === -1. Actual: ' + (~new Boolean(false)));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T2.js b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T2.js
new file mode 100644
index 0000000000..340920f76f
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T2.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: Operator ~x returns ~ToInt32(x)
+es5id: 11.4.8_A3_T2
+description: Type(x) is number primitive or Number object
+---*/
+
+//CHECK#1
+if (~0.1 !== -1) {
+ $ERROR('#1: ~0.1 === -1. Actual: ' + (~0.1));
+}
+
+//CHECK#2
+if (~new Number(-0.1) !== -1) {
+ $ERROR('#2: ~new Number(-0.1) === -1. Actual: ' + (~new Number(-0.1)));
+}
+
+//CHECK#3
+if (~NaN !== -1) {
+ $ERROR('#3: ~NaN === -1. Actual: ' + (~NaN));
+}
+
+//CHECK#4
+if (~new Number(NaN) !== -1) {
+ $ERROR('#4: ~new Number(NaN) === -1. Actual: ' + (~new Number(NaN)));
+}
+
+//CHECK#5
+if (~1 !== -2) {
+ $ERROR('#5: ~1 === -2. Actual: ' + (~1));
+}
+
+//CHECK#6
+if (~new Number(-2) !== 1) {
+ $ERROR('#6: ~new Number(-2) === 1. Actual: ' + (~new Number(-2)));
+}
+
+//CHECK#7
+if (~Infinity !== -1) {
+ $ERROR('#7: ~Infinity === -1. Actual: ' + (~Infinity));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T3.js b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T3.js
new file mode 100644
index 0000000000..657c569984
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T3.js
@@ -0,0 +1,35 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator ~x returns ~ToInt32(x)
+es5id: 11.4.8_A3_T3
+description: Type(x) is string primitive or String object
+---*/
+
+//CHECK#1
+if (~"1" !== -2) {
+ $ERROR('#1: ~"1" === -2. Actual: ' + (~"1"));
+}
+
+//CHECK#2
+if (~new String("0") !== -1) {
+ $ERROR('#2: ~new String("0") === -1. Actual: ' + (~new String("0")));
+}
+
+//CHECK#3
+if (~"x" !== -1) {
+ $ERROR('#3: ~"x" === -1. Actual: ' + (~"x"));
+}
+
+//CHECK#4
+if (~"" !== -1) {
+ $ERROR('#4: ~"" === -1. Actual: ' + (~""));
+}
+
+//CHECK#5
+if (~new String("-2") !== 1) {
+ $ERROR('#5: ~new String("-2") === 1. Actual: ' + (~new String("-2")));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T4.js b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T4.js
new file mode 100644
index 0000000000..33740632f8
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T4.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.
+
+/*---
+info: Operator ~x returns ~ToInt32(x)
+es5id: 11.4.8_A3_T4
+description: Type(x) is undefined or null
+---*/
+
+//CHECK#1
+if (~void 0 !== -1) {
+ $ERROR('#1: ~void 0 === -1. Actual: ' + (~void 0));
+}
+
+//CHECK#2
+if (~null !== -1) {
+ $ERROR('#2: ~null === -1. Actual: ' + (~null));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T5.js b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T5.js
new file mode 100644
index 0000000000..ec57502c2c
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T5.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.
+
+/*---
+info: Operator ~x returns ~ToInt32(x)
+es5id: 11.4.8_A3_T5
+description: Type(x) is Object object or Function object
+---*/
+
+//CHECK#1
+if (~({}) !== -1) {
+ $ERROR('#1: ~({}) === -1. Actual: ' + (~({})));
+}
+
+//CHECK#2
+if (~(function(){return 1}) !== -1) {
+ $ERROR('#2: ~(function(){return 1}) === -1. Actual: ' + (~(function(){return 1})));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-not/S9.5_A2.1_T2.js b/js/src/tests/test262/language/expressions/bitwise-not/S9.5_A2.1_T2.js
new file mode 100644
index 0000000000..ded1320035
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-not/S9.5_A2.1_T2.js
@@ -0,0 +1,32 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: ToInt32 returns values between -2^31 and 2^31-1
+es5id: 9.5_A2.1_T2
+description: >
+ Converting some numbers, which are in\outside of Int32 scopes,
+ with ~ operator
+---*/
+
+// CHECK#1
+if (~-2147483649 !== ~2147483647) {
+ $ERROR('#1: ~-2147483649 === ~2147483647');
+}
+
+// CHECK#2
+if (~-4294967296 !== ~0) {
+ $ERROR('#2: ~-4294967296 === ~0');
+}
+
+// CHECK#3
+if (~2147483648 !== ~-2147483648) {
+ $ERROR('#3: ~2147483648 === ~-2147483648');
+}
+
+// CHECK#4
+if (~4294967296 !== ~0) {
+ $ERROR('#4: ~4294967296 === ~0');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-not/S9.5_A2.2_T2.js b/js/src/tests/test262/language/expressions/bitwise-not/S9.5_A2.2_T2.js
new file mode 100644
index 0000000000..2a22ebbcf2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-not/S9.5_A2.2_T2.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.
+
+/*---
+info: Compute result modulo 2^32
+es5id: 9.5_A2.2_T2
+description: Use operator ~
+---*/
+
+// CHECK#1
+if (~-2147483647 !== 2147483646) {
+ $ERROR('#1: ~-2147483647 === 2147483646)');
+}
+
+// CHECK#2
+if (~-2147483648 !== ~-2147483648) {
+ $ERROR('#2: ~-2147483648 ==== ~-2147483648)');
+}
+
+// CHECK#3
+if (~-2147483649 !== ~2147483647) {
+ $ERROR('#3: ~-2147483649 ==== ~2147483647)');
+}
+
+// CHECK#4
+if ((~4294967295 << 0) !== ~-1) {
+ $ERROR('#4: (~4294967295 << 0) === ~-1)');
+}
+
+// CHECK#5
+if ((~4294967296 << 0) !== ~0) {
+ $ERROR('#5: (~4294967296 << 0) === ~0)');
+}
+
+// CHECK#6
+if ((~4294967297 << 0) !== ~1) {
+ $ERROR('#6: (~4294967297 << 0) === ~1)');
+}
+
+// CHECK#7
+if ((~-4294967295 << 0) !== ~1) {
+ $ERROR('#7: (~-4294967295 << 0) === ~1)');
+}
+
+// CHECK#8
+if ((~-4294967296 << 0) !== ~0) {
+ $ERROR('#8: (~-4294967296 << 0) === ~0)');
+}
+
+// CHECK#9
+if ((~-4294967297 << 0) !== ~-1) {
+ $ERROR('#9: (~-4294967297 << 0) === ~-1)');
+}
+
+// CHECK#10
+if ((~8589934591 << 0) !== ~-1) {
+ $ERROR('#10: (~8589934591 << 0) === ~-1)');
+}
+
+// CHECK#11
+if ((~8589934592 << 0) !== ~0) {
+ $ERROR('#11: (~8589934592 << 0) === ~0)');
+}
+
+// CHECK#12
+if ((~8589934593 << 0) !== ~1) {
+ $ERROR('#12: (~8589934593 << 0) === ~1)');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-not/S9.5_A2.3_T2.js b/js/src/tests/test262/language/expressions/bitwise-not/S9.5_A2.3_T2.js
new file mode 100644
index 0000000000..0e54969d68
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-not/S9.5_A2.3_T2.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 result is greater than or equal to 2^31, return result -2^32
+es5id: 9.5_A2.3_T2
+description: Use operator ~
+---*/
+
+// CHECK#1
+if (~2147483647 !== -2147483648) {
+ $ERROR('#1: ~2147483647 ==== -2147483648)');
+}
+
+// CHECK#2
+if (~2147483648 !== ~-2147483648) {
+ $ERROR('#2: ~2147483648 ==== ~-2147483648)');
+}
+
+// CHECK#3
+if (~2147483649 !== ~-2147483647) {
+ $ERROR('#3: ~2147483649 ==== ~-2147483647)');
+}
+
+// CHECK#4
+if (~4294967295 !== ~-1) {
+ $ERROR('#4: ~4294967295 ==== ~-1)');
+}
+
+// CHECK#5
+if (~4294967296 !== ~0) {
+ $ERROR('#5: ~4294967296 ==== ~0)');
+}
+
+// CHECK#6
+if (~4294967297 !== ~1) {
+ $ERROR('#6: ~4294967297 ==== ~1)');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-not/S9.5_A3.1_T4.js b/js/src/tests/test262/language/expressions/bitwise-not/S9.5_A3.1_T4.js
new file mode 100644
index 0000000000..a1bbff87de
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-not/S9.5_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.
+
+/*---
+info: Operator uses ToNumber
+es5id: 9.5_A3.1_T4
+description: Type(x) is Object
+---*/
+
+//CHECK#1
+var object = {valueOf: function() {return 1}};
+if (~object !== ~1) {
+ $ERROR('#1: var object = {valueOf: function() {return 1}}; ~object === ~1');
+}
+
+//CHECK#2
+var object = {valueOf: function() {return 1}, toString: function() {return 0}};
+if (~object !== ~1) {
+ $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; ~object === ~1');
+}
+
+//CHECK#3
+var object = {valueOf: function() {return 1}, toString: function() {return {}}};
+if (~object !== ~1) {
+ $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; ~object === ~1');
+}
+
+//CHECK#4
+try {
+ var object = {valueOf: function() {return 1}, toString: function() {throw "error"}};
+ if (~object !== ~1) {
+ $ERROR('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ~object === ~1');
+ }
+}
+catch (e) {
+ if (e === ~"error") {
+ $ERROR('#4.2: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ~object not throw "error"');
+ } else {
+ $ERROR('#4.3: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ~object not throw Error. Actual: ' + (e));
+ }
+}
+
+//CHECK#5
+var object = {toString: function() {return 1}};
+if (~object !== ~1) {
+ $ERROR('#5: var object = {toString: function() {return 1}}; ~object === ~1');
+}
+
+//CHECK#6
+var object = {valueOf: function() {return {}}, toString: function() {return 1}}
+if (~object !== ~1) {
+ $ERROR('#6: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; ~object === ~1');
+}
+
+//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));
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-not/S9.5_A3.2_T2.js b/js/src/tests/test262/language/expressions/bitwise-not/S9.5_A3.2_T2.js
new file mode 100644
index 0000000000..2732d46bd8
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-not/S9.5_A3.2_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.
+
+/*---
+info: Operator uses floor, abs
+es5id: 9.5_A3.2_T2
+description: Use operator ~
+---*/
+
+// CHECK#1
+if (~1.2345 !== ~1) {
+ $ERROR('#1: ~1.2345 === ~1)');
+}
+
+// CHECK#2
+if (~-5.4321 !== ~-5) {
+ $ERROR('#2: ~-5.4321 === ~-5)');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-not/bigint-non-primitive.js b/js/src/tests/test262/language/expressions/bitwise-not/bigint-non-primitive.js
new file mode 100644
index 0000000000..b5ddf6a2fa
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-not/bigint-non-primitive.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2017 Josh Wolfe. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Bitwise NOT for BigInt object wrappers
+esid: sec-bitwise-not-operator-runtime-semantics-evaluation
+info: |
+ Runtime Semantics: Evaluation
+ UnaryExpression : ~ UnaryExpression
+
+ 1. Let expr be the result of evaluating UnaryExpression.
+ 2. Let oldValue be ? ToNumeric(? GetValue(expr)).
+ 3. Let T be Type(oldValue).
+ 4. Return ? T::bitwiseNOT(oldValue).
+
+features: [BigInt, Symbol.toPrimitive]
+---*/
+assert.sameValue(~Object(1n), -2n, 'The value of ~Object(1n) is -2n');
+
+function err() {
+ throw new Test262Error();
+}
+
+assert.sameValue(~{
+ [Symbol.toPrimitive]: function() {
+ return 1n;
+ },
+
+ valueOf: err,
+ toString: err
+}, -2n, 'The value of ~{[Symbol.toPrimitive]: function() {return 1n;}, valueOf: err, toString: err} is -2n');
+
+assert.sameValue(~{
+ valueOf: function() {
+ return 1n;
+ },
+
+ toString: err
+}, -2n, 'The value of ~{valueOf: function() {return 1n;}, toString: err} is -2n');
+
+assert.sameValue(~{
+ toString: function() {
+ return 1n;
+ }
+}, -2n, 'The value of ~{toString: function() {return 1n;}} is -2n');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-not/bigint.js b/js/src/tests/test262/language/expressions/bitwise-not/bigint.js
new file mode 100644
index 0000000000..dd1a896882
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-not/bigint.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2017 Josh Wolfe. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Bitwise NOT for BigInt values
+esid: sec-numeric-types-bigint-bitwiseNOT
+info: |
+ BigInt::bitwiseNOT (x)
+
+ The abstract operation BigInt::bitwiseNOT with an argument x of BigInt type returns the one's complement of x; that is, -x - 1.
+
+features: [BigInt]
+---*/
+
+assert.sameValue(~0n, -1n, "~0n === -1n");
+assert.sameValue(~(0n), -1n, "~(0n) === -1n");
+assert.sameValue(~1n, -2n, "~1n === -2n");
+assert.sameValue(~-1n, 0n, "~-1n === 0n");
+assert.sameValue(~(-1n), 0n, "~(-1n) === 0n");
+assert.sameValue(~~1n, 1n, "~~1n === 1n");
+assert.sameValue(~0x5an, -0x5bn, "~0x5an === -0x5bn");
+assert.sameValue(~-0x5an, 0x59n, "~-0x5an === 0x59n");
+assert.sameValue(~0xffn, -0x100n, "~0xffn === -0x100n");
+assert.sameValue(~-0xffn, 0xfen, "~-0xffn === 0xfen");
+assert.sameValue(~0xffffn, -0x10000n, "~0xffffn === -0x10000n");
+assert.sameValue(~-0xffffn, 0xfffen, "~-0xffffn === 0xfffen");
+assert.sameValue(~0xffffffffn, -0x100000000n, "~0xffffffffn === -0x100000000n");
+assert.sameValue(~-0xffffffffn, 0xfffffffen, "~-0xffffffffn === 0xfffffffen");
+assert.sameValue(
+ ~0xffffffffffffffffn, -0x10000000000000000n,
+ "~0xffffffffffffffffn === -0x10000000000000000n");
+assert.sameValue(
+ ~-0xffffffffffffffffn, 0xfffffffffffffffen,
+ "~-0xffffffffffffffffn === 0xfffffffffffffffen");
+assert.sameValue(
+ ~0x123456789abcdef0fedcba9876543210n, -0x123456789abcdef0fedcba9876543211n,
+ "~0x123456789abcdef0fedcba9876543210n === -0x123456789abcdef0fedcba9876543211n");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-not/browser.js b/js/src/tests/test262/language/expressions/bitwise-not/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-not/browser.js
diff --git a/js/src/tests/test262/language/expressions/bitwise-not/shell.js b/js/src/tests/test262/language/expressions/bitwise-not/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-not/shell.js