aboutsummaryrefslogtreecommitdiffstats
path: root/website/resources/scripts/testcases2/11.9.4_The_Strict_Equals_Operator.json
diff options
context:
space:
mode:
Diffstat (limited to 'website/resources/scripts/testcases2/11.9.4_The_Strict_Equals_Operator.json')
-rw-r--r--website/resources/scripts/testcases2/11.9.4_The_Strict_Equals_Operator.json134
1 files changed, 134 insertions, 0 deletions
diff --git a/website/resources/scripts/testcases2/11.9.4_The_Strict_Equals_Operator.json b/website/resources/scripts/testcases2/11.9.4_The_Strict_Equals_Operator.json
new file mode 100644
index 000000000..c4366b923
--- /dev/null
+++ b/website/resources/scripts/testcases2/11.9.4_The_Strict_Equals_Operator.json
@@ -0,0 +1,134 @@
+{
+ "testCollection": {
+ "name": "11.9.4_The_Strict_Equals_Operator",
+ "numTests": 21,
+ "tests": [
+ {
+ "section": "11.9.4, 7.2, 7.3",
+ "description": "Checking by using eval",
+ "test": "//CHECK#1\nif (!(eval(\"1\\u0009===\\u00091\"))) {\n $ERROR('#1: 1\\\\u0009===\\\\u00091');\n}\n\n//CHECK#2\nif (!(eval(\"1\\u000B===\\u000B1\"))) {\n $ERROR('#2: 1\\\\u000B===\\\\u000B1'); \n}\n\n//CHECK#3\nif (!(eval(\"1\\u000C===\\u000C1\"))) {\n $ERROR('#3: 1\\\\u000C===\\\\u000C1');\n}\n\n//CHECK#4\nif (!(eval(\"1\\u0020===\\u00201\"))) {\n $ERROR('#4: 1\\\\u0020===\\\\u00201');\n}\n\n//CHECK#5\nif (!(eval(\"1\\u00A0===\\u00A01\"))) {\n $ERROR('#5: 1\\\\u00A0===\\\\u00A01');\n}\n\n//CHECK#6\nif (!(eval(\"1\\u000A===\\u000A1\"))) {\n $ERROR('#6: 1\\\\u000A===\\\\u000A1'); \n}\n\n//CHECK#7\nif (!(eval(\"1\\u000D===\\u000D1\"))) {\n $ERROR('#7: 1\\\\u000D===\\\\u000D1');\n}\n\n//CHECK#8\nif (!(eval(\"1\\u2028===\\u20281\"))) {\n $ERROR('#8: 1\\\\u2028===\\\\u20281');\n}\n\n//CHECK#9\nif (!(eval(\"1\\u2029===\\u20291\"))) {\n $ERROR('#9: 1\\\\u2029===\\\\u20291');\n}\n\n//CHECK#10\nif (!(eval(\"1\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029===\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291\"))) {\n $ERROR('#10: 1\\\\u0009\\\\u000B\\\\u000C\\\\u0020\\\\u00A0\\\\u000A\\\\u000D\\\\u2028\\\\u2029===\\\\u0009\\\\u000B\\\\u000C\\\\u0020\\\\u00A0\\\\u000A\\\\u000D\\\\u2028\\\\u20291');\n}\n",
+ "id": "S11.9.4_A1"
+ },
+ {
+ "section": "11.9.4",
+ "description": "Either Type is not Reference or GetBase is not null",
+ "test": "//CHECK#1\nif (!(1 === 1)) {\n $ERROR('#1: 1 === 1');\n}\n\n//CHECK#2\nvar x = 1;\nif (!(x === 1)) {\n $ERROR('#2: var x = 1; x === 1');\n}\n\n//CHECK#3\nvar y = 1;\nif (!(1 === y)) {\n $ERROR('#3: var y = 1; 1 === y');\n}\n\n//CHECK#4\nvar x = 1;\nvar y = 1;\nif (!(x === y)) {\n $ERROR('#4: var x = 1; var y = 1; x === y');\n}\n\n//CHECK#5\nvar objectx = new Object();\nvar objecty = new Object();\nobjectx.prop = 1;\nobjecty.prop = 1;\nif (!(objectx.prop === objecty.prop)) {\n $ERROR('#5: var objectx = new Object(); var objecty = new Object(); objectx.prop = 1; objecty.prop = 1; objectx.prop === objecty.prop');\n}\n\n",
+ "id": "S11.9.4_A2.1_T1"
+ },
+ {
+ "section": "11.9.4",
+ "description": "If GetBase(x) is null, throw ReferenceError",
+ "test": "//CHECK#1\ntry {\n x === 1;\n $ERROR('#1.1: x === 1 throw ReferenceError. Actual: ' + (x === 1)); \n}\ncatch (e) {\n if ((e instanceof ReferenceError) !== true) {\n $ERROR('#1.2: x === 1 throw ReferenceError. Actual: ' + (e)); \n }\n}\n\n",
+ "id": "S11.9.4_A2.1_T2"
+ },
+ {
+ "section": "11.9.4",
+ "description": "If GetBase(y) is null, throw ReferenceError",
+ "test": "//CHECK#1\ntry {\n 1 === y;\n $ERROR('#1.1: 1 === y throw ReferenceError. Actual: ' + (1 === y)); \n}\ncatch (e) {\n if ((e instanceof ReferenceError) !== true) {\n $ERROR('#1.2: 1 === y throw ReferenceError. Actual: ' + (e)); \n }\n}\n\n",
+ "id": "S11.9.4_A2.1_T3"
+ },
+ {
+ "section": "11.9.4",
+ "description": "Checking with \"=\"",
+ "test": "//CHECK#1\nvar x = 0; \nif (!((x = 1) === x)) {\n $ERROR('#1: var x = 0; (x = 1) === x');\n}\n\n//CHECK#2\nvar x = 0; \nif (x === (x = 1)) {\n $ERROR('#2: var x = 0; x !== (x = 1)');\n}\n\n",
+ "id": "S11.9.4_A2.4_T1"
+ },
+ {
+ "section": "11.9.4",
+ "description": "Checking with \"throw\"",
+ "test": "//CHECK#1\nvar x = function () { throw \"x\"; };\nvar y = function () { throw \"y\"; };\ntry {\n x() === y();\n $ERROR('#1.1: var x = function () { throw \"x\"; }; var y = function () { throw \"y\"; }; x() === y() throw \"x\". Actual: ' + (x() === y()));\n} catch (e) {\n if (e === \"y\") {\n $ERROR('#1.2: First expression is evaluated first, and then second expression');\n } else {\n if (!(e === \"x\")) {\n $ERROR('#1.3: var x = function () { throw \"x\"; }; var y = function () { throw \"y\"; }; x() === y() throw \"x\". Actual: ' + (e));\n }\n }\n}\n",
+ "id": "S11.9.4_A2.4_T2"
+ },
+ {
+ "section": "11.9.4",
+ "description": "Checking with undeclarated variables",
+ "test": "//CHECK#1\ntry {\n x === (x = 1);\n $ERROR('#1.1: x === (x = 1) throw ReferenceError. Actual: ' + (x === (x = 1))); \n}\ncatch (e) {\n if ((e instanceof ReferenceError) !== true) {\n $ERROR('#1.2: x === (x = 1) throw ReferenceError. Actual: ' + (e)); \n }\n}\n\n//CHECK#2\nif (!((y = 1) === y)) {\n $ERROR('#2: (y = 1) === y');\n}\n\n",
+ "id": "S11.9.4_A2.4_T3"
+ },
+ {
+ "section": "11.9.4, 11.9.6",
+ "description": "x and y are primitive booleans",
+ "test": "//CHECK#1\nif (!(true === true)) {\n $ERROR('#1: true === true');\n}\n\n//CHECK#2\nif (!(false === false)) {\n $ERROR('#2: false === false');\n}\n\n//CHECK#3\nif (true === false) {\n $ERROR('#3: true !== false');\n}\n\n//CHECK#4\nif (false === true) {\n $ERROR('#4: false !== true');\n}\n",
+ "id": "S11.9.4_A3"
+ },
+ {
+ "section": "11.9.4, 11.9.6",
+ "description": "x is NaN",
+ "test": "//CHECK#1\nif (Number.NaN === true) {\n $ERROR('#1: NaN !== true');\n}\n\n//CHECK#2\nif (Number.NaN === 1) {\n $ERROR('#2: NaN !== 1');\n}\n\n//CHECK#3\nif (Number.NaN === Number.NaN) {\n $ERROR('#3: NaN !== NaN');\n}\n\n//CHECK#4\nif (Number.NaN === Number.POSITIVE_INFINITY) {\n $ERROR('#4: NaN !== +Infinity');\n}\n\n//CHECK#5\nif (Number.NaN === Number.NEGATIVE_INFINITY) {\n $ERROR('#5: NaN !== -Infinity');\n}\n\n//CHECK#6\nif (Number.NaN === Number.MAX_VALUE) {\n $ERROR('#6: NaN !== Number.MAX_VALUE');\n}\n\n//CHECK#7\nif (Number.NaN === Number.MIN_VALUE) {\n $ERROR('#7: NaN !== Number.MIN_VALUE');\n}\n\n//CHECK#8\nif (Number.NaN === \"string\") {\n $ERROR('#8: NaN !== \"string\"');\n}\n\n//CHECK#9\nif (Number.NaN === new Object()) {\n $ERROR('#9: NaN !== new Object()');\n}\n\n",
+ "id": "S11.9.4_A4.1_T1"
+ },
+ {
+ "section": "11.9.4, 11.9.6",
+ "description": "y is NaN",
+ "test": "//CHECK#1\nif (true === Number.NaN) {\n $ERROR('#1: true !== NaN');\n}\n\n//CHECK#2\nif (-1 === Number.NaN) {\n $ERROR('#2: -1 !== NaN');\n}\n\n//CHECK#3\nif (Number.NaN === Number.NaN) {\n $ERROR('#3: NaN !== NaN');\n}\n\n//CHECK#4\nif (Number.POSITIVE_INFINITY === Number.NaN) {\n $ERROR('#4: +Infinity !== NaN');\n}\n\n//CHECK#5\nif (Number.NEGATIVE_INFINITY === Number.NaN) {\n $ERROR('#5: -Infinity !== NaN');\n}\n\n//CHECK#6\nif (Number.MAX_VALUE === Number.NaN) {\n $ERROR('#6: Number.MAX_VALUE !== NaN');\n}\n\n//CHECK#7\nif (Number.MIN_VALUE === Number.NaN) {\n $ERROR('#7: Number.MIN_VALUE !== NaN');\n}\n\n//CHECK#8\nif (\"string\" === Number.NaN) {\n $ERROR('#8: \"string\" !== NaN');\n}\n\n//CHECK#9\nif (new Object() === Number.NaN) {\n $ERROR('#9: new Object() !== NaN');\n}\n",
+ "id": "S11.9.4_A4.1_T2"
+ },
+ {
+ "section": "11.9.4, 11.9.6",
+ "description": "Checking all combinations",
+ "test": "//CHECK#1\nif (!(+0 === -0)) {\n $ERROR('#1: +0 === -0');\n}\n\n//CHECK#2\nif (!(-0 === +0)) {\n $ERROR('#2: -0 === +0');\n}\n",
+ "id": "S11.9.4_A4.2"
+ },
+ {
+ "section": "11.9.4, 11.9.6",
+ "description": "x and y are primitive numbers",
+ "test": "//CHECK#1\nif (!(Number.POSITIVE_INFINITY === Number.POSITIVE_INFINITY)) {\n $ERROR('#1: +Infinity === +Infinity');\n}\n\n//CHECK#2\nif (!(Number.NEGATIVE_INFINITY === Number.NEGATIVE_INFINITY)) {\n $ERROR('#2: -Infinity === -Infinity');\n}\n\n//CHECK#3\nif (!(13 === 13)) {\n $ERROR('#3: 13 === 13');\n}\n\n//CHECK#4\nif (!(-13 === -13)) {\n $ERROR('#4: -13 === -13');\n}\n\n//CHECK#5\nif (!(1.3 === 1.3)) {\n $ERROR('#5: 1.3 === 1.3');\n}\n\n//CHECK#6\nif (!(-1.3 === -1.3)) {\n $ERROR('#6: -1.3 === -1.3');\n}\n\n//CHECK#7\nif (!(Number.POSITIVE_INFINITY === -Number.NEGATIVE_INFINITY)) {\n $ERROR('#7: +Infinity === -(-Infinity)');\n}\n\n//CHECK#8\nif (1 === 0.999999999999) {\n $ERROR('#8: 1 !== 0.999999999999');\n}\n\n//CHECK#9\nif (!(1.0 === 1)) {\n $ERROR('#9: 1.0 === 1');\n}\n",
+ "id": "S11.9.4_A4.3"
+ },
+ {
+ "section": "11.9.4, 11.9.6",
+ "description": "x and y are primitive strings",
+ "test": "//CHECK#1\nif (!(\"\" === \"\")) {\n $ERROR('#1: \"\" === \"\"');\n}\n\n//CHECK#2\nif (!(\" \" === \" \")) {\n $ERROR('#2: \" \" === \" \"');\n}\n\n//CHECK#3\nif (!(\"string\" === \"string\")) {\n $ERROR('#3: \"string\" === \"string\"');\n}\n\n//CHECK#4\nif (\" string\" === \"string \") {\n $ERROR('#4: \" string\" !== \"string \"');\n}\n\n//CHECK#5\nif (\"1.0\" === \"1\") {\n $ERROR('#5: \"1.0\" !== \"1\"');\n}\n",
+ "id": "S11.9.4_A5"
+ },
+ {
+ "section": "11.9.4, 11.9.6",
+ "description": "void 0, eval(\"var x\") is undefined",
+ "test": "//CHECK#1\nif (!(undefined === undefined)) {\n $ERROR('#1: undefined === undefined');\n}\n\n//CHECK#2\nif (!(void 0 === undefined)) {\n $ERROR('#2: void 0 === undefined');\n}\n\n//CHECK#3\nif (!(undefined === eval(\"var x\"))) {\n $ERROR('#3: undefined === eval(\"var x\")');\n}\n",
+ "id": "S11.9.4_A6.1"
+ },
+ {
+ "section": "11.9.4, 11.9.6",
+ "description": "null === null",
+ "test": "//CHECK#1\nif (!(null === null)) {\n $ERROR('#1: null === null');\n}\n",
+ "id": "S11.9.4_A6.2"
+ },
+ {
+ "section": "11.9.4, 11.9.6",
+ "description": "Checking Boolean object, Number object, String object, Object object",
+ "test": "//CHECK#1\nif (new Object() === new Object()) {\n $ERROR('#1: new Object() !== new Object()');\n}\n\n//CHECK#2\nif (new Object(true) === new Object(true)) {\n $ERROR('#2: new Object() !== new Object()');\n}\n\n//CHECK#3\nif (new Object(false) === new Object(false)) {\n $ERROR('#3: new Object() !== new Object()');\n}\n\n//CHECK#4\nif (new Object(+0) === new Object(-0)) {\n $ERROR('#4: new Object(+0) !== new Object(-0)');\n}\n\n//CHECK#5\nx = {}; \ny = x;\nif (!(x === y)) {\n $ERROR('#5: x = {}; y = x; x === y');\n}\n\n//CHECK#6\nif (new Boolean(true) === new Number(1)) {\n $ERROR('#6 new Boolean(true) === new Number(1)');\n}\n\n//CHECK#7\nif (new Number(1) === new String(\"1\")) {\n $ERROR('#7: new Number(1) === new String(\"1\")');\n}\n\n//CHECK#8\nif (new String(\"1\") === new Boolean(true)) {\n $ERROR('#8: new String(\"x\") === new Boolean(true)');\n}\n",
+ "id": "S11.9.4_A7"
+ },
+ {
+ "section": "11.9.4, 11.9.6",
+ "description": "x or y is primitive boolean",
+ "test": "//CHECK#1\nif (true === new Boolean(true)) {\n $ERROR('#1: true !== new Number(true)');\n}\n\n//CHECK#2\nif (true === 1) {\n $ERROR('#2: true !== 1');\n}\n\n//CHECK#3\nif (true === new Number(true)) {\n $ERROR('#3: true !== new Number(true)');\n}\n\n//CHECK#4\nif (true === \"1\") {\n $ERROR('#4: true !== \"1\"');\n}\n\n//CHECK#5\nif (true === new String(true)) {\n $ERROR('#5: true !== new String(true)');\n}\n\n//CHECK#6\nif (new Boolean(false) === false) {\n $ERROR('#6: new Number(false) !== false');\n}\n\n//CHECK#7\nif (0 === false) {\n $ERROR('#7: 0 !== false');\n}\n\n//CHECK#8\nif (new Number(false) === false) {\n $ERROR('#8: new Number(false) !== false');\n}\n\n//CHECK#9\nif (\"0\" === false) {\n $ERROR('#9: \"0\" !== false');\n}\n\n//CHECK#10\nif (false === new String(false)) {\n $ERROR('#10: false !== new String(false)');\n}\n\n//CHECK#11\nif (true === {valueOf: function () {return true}}) {\n $ERROR('#11: true === {valueOf: function () {return true}}');\n}\n",
+ "id": "S11.9.4_A8_T1"
+ },
+ {
+ "section": "11.9.4, 11.9.6",
+ "description": "x or y is primitive number",
+ "test": "//CHECK#1\nif (1 === new Number(1)) {\n $ERROR('#1: 1 !== new Number(1)');\n}\n\n//CHECK#2\nif (1 === true) {\n $ERROR('#2: 1 !== true');\n}\n\n//CHECK#3\nif (1 === new Boolean(1)) {\n $ERROR('#3: 1 !== new Boolean(1)');\n}\n\n//CHECK#4\nif (1 === \"1\") {\n $ERROR('#4: 1 !== \"1\"');\n}\n\n//CHECK#5\nif (1 === new String(1)) {\n $ERROR('#5: 1 !== new String(1)');\n}\n\n//CHECK#6\nif (new Number(0) === 0) {\n $ERROR('#6: new Number(0) !== 0');\n}\n\n//CHECK#7\nif (false === 0) {\n $ERROR('#7: false !== 0');\n}\n\n//CHECK#8\nif (new Boolean(0) === 0) {\n $ERROR('#8: new Boolean(0) !== 0');\n}\n\n//CHECK#9\nif (\"0\" === 0) {\n $ERROR('#9: \"0\" !== 0');\n}\n\n//CHECK#10\nif (new String(0) === 0) {\n $ERROR('#10: new String(0) !== 0');\n}\n\n//CHECK#11\nif (1 === {valueOf: function () {return 1}}) {\n $ERROR('#11: 1 === {valueOf: function () {return 1}}');\n}\n",
+ "id": "S11.9.4_A8_T2"
+ },
+ {
+ "section": "11.9.4, 11.9.6",
+ "description": "x or y is primitive string",
+ "test": "//CHECK#1\nif (\"1\" === new String(\"1\")) {\n $ERROR('#1: \"1\" !== new String(\"1\")');\n}\n\n//CHECK#2\nif (\"1\" === true) {\n $ERROR('#2: \"1\" !== true');\n}\n\n//CHECK#3\nif (\"1\" === new Boolean(\"1\")) {\n $ERROR('#3: \"1\" !== new Boolean(\"1\")');\n}\n\n//CHECK#4\nif (\"1\" === 1) {\n $ERROR('#4: \"1\" === 1');\n}\n\n//CHECK#5\nif (\"1\" === new Number(\"1\")) {\n $ERROR('#5: \"1\" === new Number(\"1\")');\n}\n\n//CHECK#6\nif (new String(false) === false) {\n $ERROR('#6: new Number(false) !== false');\n}\n\n//CHECK#7\nif (false === \"0\") {\n $ERROR('#7: false !== \"0\"');\n}\n\n//CHECK#8\nif (\"0\" === new Boolean(\"0\")) {\n $ERROR('#8: \"0\" !== new Boolean(\"0\")');\n}\n\n//CHECK#9\nif (false === 0) {\n $ERROR('#9: false !== 0');\n}\n\n//CHECK#10\nif (false === new Number(false)) {\n $ERROR('#10: false !== new Number(false)');\n}\n\n//CHECK#11\nif (\"1\" === {valueOf: function () {return \"1\"}}) {\n $ERROR('#11: \"1\" === {valueOf: function () {return \"1\"}}');\n}\n",
+ "id": "S11.9.4_A8_T3"
+ },
+ {
+ "section": "11.9.4, 11.9.6",
+ "description": "x or y is null or undefined",
+ "test": "//CHECK#1\nif (undefined === null) {\n $ERROR('#1: undefined !== null');\n}\n\n//CHECK#2\nif (null === undefined) {\n $ERROR('#2: null !== undefined');\n}\n\n//CHECK#3\nif (null === 0) {\n $ERROR('#3: null !== 0');\n}\n\n//CHECK#4\nif (0 === null) {\n $ERROR('#4: 0 !== null');\n}\n\n//CHECK#5\nif (null === false) {\n $ERROR('#5: null !== false');\n}\n\n//CHECK#6\nif (false === null) {\n $ERROR('#6: false !== null');\n}\n\n//CHECK#7\nif (undefined === false) {\n $ERROR('#7: undefined !== false');\n}\n\n//CHECK#8\nif (false === undefined) {\n $ERROR('#8: false !== undefined');\n}\n\n//CHECK#9\nif (null === new Object()) {\n $ERROR('#9: null !== new Object()');\n}\n\n//CHECK#10\nif (new Object() === null) {\n $ERROR('#10: new Object() !== null');\n}\n\n//CHECK#11\nif (null === \"null\") {\n $ERROR('#11: null !== \"null\"');\n}\n\n//CHECK#12\nif (\"null\" === null) {\n $ERROR('#12: \"null\" !== null');\n}\n\n//CHECK#13\nif (undefined === \"undefined\") {\n $ERROR('#13: undefined !== \"undefined\"');\n}\n\n//CHECK#14\nif (\"undefined\" === undefined) {\n $ERROR('#14: \"undefined\" !== undefined');\n}\n",
+ "id": "S11.9.4_A8_T4"
+ },
+ {
+ "section": "11.9.4, 11.9.6",
+ "description": "Checking with such x and y that either x or y is primitive string and the other is primitive number",
+ "test": "//CHECK#1\ntry {\n throw 1;\n} catch(e) {\n if (e === \"1\") {\n $ERROR('#1: throw 1 !== \"1\"');\n }\n}\n\n//CHECK#2\ntry {\n throw \"1\";\n} catch(e) {\n if (1 === e) {\n $ERROR('#2: 1 !== throw \"1\"');\n }\n} \n",
+ "id": "S11.9.4_A8_T5"
+ }
+ ]
+ }
+}