summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A4_T2.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A4_T2.js')
-rw-r--r--js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A4_T2.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A4_T2.js b/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A4_T2.js
new file mode 100644
index 000000000..5aaea6dce
--- /dev/null
+++ b/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A4_T2.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.
+
+/**
+ * If ToBoolean(x) is true, return y
+ *
+ * @path ch11/11.11/11.11.1/S11.11.1_A4_T2.js
+ * @description Type(x) and Type(y) vary between primitive number and Number object
+ */
+
+//CHECK#1
+if ((-1 && -0) !== 0) {
+ $ERROR('#1.1: (-1 && -0) === 0');
+} else {
+ if ((1 / (-1 && -0)) !== Number.NEGATIVE_INFINITY) {
+ $ERROR('#1.2: (-1 && -0) === -0');
+ }
+}
+
+//CHECK#2
+if ((-1 && 0) !== 0) {
+ $ERROR('#2.1: (-1 && 0) === 0');
+} else {
+ if ((1 / (-1 && 0)) !== Number.POSITIVE_INFINITY) {
+ $ERROR('#2.2: (-1 && 0) === +0');
+ }
+}
+
+//CHECK#3
+if ((isNaN(0.1 && NaN)) !== true) {
+ $ERROR('#3: (0.1 && NaN) === Not-a-Number');
+}
+
+//CHECK#4
+var y = new Number(0);
+if ((new Number(-1) && y) !== y) {
+ $ERROR('#4: (var y = new Number(0); (new Number(-1) && y) === y');
+}
+
+//CHECK#5
+var y = new Number(NaN);
+if ((new Number(0) && y) !== y) {
+ $ERROR('#5: (var y = new Number(NaN); (new Number(0) && y) === y');
+}
+
+//CHECK#6
+var y = new Number(-1);
+if ((new Number(NaN) && y) !== y) {
+ $ERROR('#6: (var y = new Number(-1); (new Number(NaN) && y) === y');
+}
+