aboutsummaryrefslogtreecommitdiffstats
path: root/website/resources/scripts/testcases2/9.7_ToUint16.json
diff options
context:
space:
mode:
Diffstat (limited to 'website/resources/scripts/testcases2/9.7_ToUint16.json')
-rw-r--r--website/resources/scripts/testcases2/9.7_ToUint16.json56
1 files changed, 56 insertions, 0 deletions
diff --git a/website/resources/scripts/testcases2/9.7_ToUint16.json b/website/resources/scripts/testcases2/9.7_ToUint16.json
new file mode 100644
index 000000000..1673371e9
--- /dev/null
+++ b/website/resources/scripts/testcases2/9.7_ToUint16.json
@@ -0,0 +1,56 @@
+{
+ "testCollection": {
+ "name": "9.7_ToUint16",
+ "numTests": 8,
+ "tests": [
+ {
+ "section": "9.7, 15.5.3.2, 15.5.4.5",
+ "description": "For testing use String.fromCharCode(Number).charCodeAt(0) construction",
+ "test": "// CHECK#1\nif (String.fromCharCode(Number.NaN).charCodeAt(0) !== +0) {\n $ERROR('#1.1: String.fromCharCode(Number.NaN).charCodeAt(0) === 0. Actual: ' + (String.fromCharCode(Number.NaN).charCodeAt(0)));\n} else if (1/String.fromCharCode(Number.NaN).charCodeAt(0) !== Number.POSITIVE_INFINITY) {\n $ERROR('#1.2: String.fromCharCode(Number.NaN).charCodeAt(0) === +0. Actual: -0');\n}\n\n// CHECK#2\nif (String.fromCharCode(Number(\"abc\")).charCodeAt(0) !== +0) {\n $ERROR('#2.1: String.fromCharCode(Number(\"abc\")).charCodeAt(0) === 0. Actual: ' + (String.fromCharCode(Number(\"abc\")).charCodeAt(0)));\n} else if (1/String.fromCharCode(0).charCodeAt(0) !== Number.POSITIVE_INFINITY) {\n $ERROR('#2.2: String.fromCharCode(0).charCodeAt(0) === +0. Actual: -0');\n}\n\n// CHECK#3\nif (String.fromCharCode(0).charCodeAt(0) !== +0) {\n $ERROR('#3.1: String.fromCharCode(0).charCodeAt(0) === 0. Actual: ' + (String.fromCharCode(0).charCodeAt(0)));\n} else if (1/String.fromCharCode(0).charCodeAt(0) !== Number.POSITIVE_INFINITY) {\n $ERROR('#3.2: String.fromCharCode(0).charCodeAt(0) === +0. Actual: -0');\n}\n\n// CHECK#4\nif (String.fromCharCode(-0).charCodeAt(0) !== +0) {\n $ERROR(\"#4.1: String.fromCharCode(-0).charCodeAt(0) === +0\");\n} else if (1/String.fromCharCode(-0).charCodeAt(0) !== Number.POSITIVE_INFINITY) {\n $ERROR(\"#4.2: String.fromCharCode(-0).charCodeAt(0) === +0. Actual: -0\");\n}\n\n// CHECK#5\nif (String.fromCharCode(Number.POSITIVE_INFINITY).charCodeAt(0) !== +0) {\n $ERROR('#5.1: String.fromCharCode(Number.POSITIVE_INFINITY).charCodeAt(0) === 0. Actual: ' + (String.fromCharCode(Number.POSITIVE_INFINITY).charCodeAt(0)));\n} else if (1/String.fromCharCode(Number.POSITIVE_INFINITY).charCodeAt(0) !== Number.POSITIVE_INFINITY) {\n $ERROR('#5.2: String.fromCharCode(Number.POSITIVE_INFINITY).charCodeAt(0) === +0. Actual: -0');\n}\n\n// CHECK#6\nif (String.fromCharCode(Number.NEGATIVE_INFINITY).charCodeAt(0) !== +0) {\n $ERROR(\"#6.1: String.fromCharCode(Number.NEGATIVE_INFINITY).charCodeAt(0) === +0\");\n} else if (1/String.fromCharCode(Number.NEGATIVE_INFINITY).charCodeAt(0) !== Number.POSITIVE_INFINITY) {\n $ERROR(\"#6.2: String.fromCharCode(Number.NEGATIVE_INFINITY).charCodeAt(0) === +0. Actual: -0\");\n}\n\n\n",
+ "id": "S9.7_A1"
+ },
+ {
+ "section": "9.7, 11.7.3",
+ "description": "Converting numbers, which are in\\outside of Uint16 scopes, with String.fromCharCode(Number).charCodeAt(0) construction",
+ "test": "// CHECK#1\nif (String.fromCharCode(0).charCodeAt(0) !== 0) {\n $ERROR('#1: String.fromCharCode(0).charCodeAt(0) === 0. Actual: ' + (String.fromCharCode(0).charCodeAt(0)));\n}\n\n// CHECK#2\nif (String.fromCharCode(1).charCodeAt(0) !== 1) {\n $ERROR('#2: String.fromCharCode(1).charCodeAt(0) === 1. Actual: ' + (String.fromCharCode(1).charCodeAt(0)));\n}\n\n// CHECK#3\nif (String.fromCharCode(-1).charCodeAt(0) !== 65535) {\n $ERROR('#3: String.fromCharCode(-1).charCodeAt(0) === 65535. Actual: ' + (String.fromCharCode(-1).charCodeAt(0)));\n}\n\n// CHECK#4\nif (String.fromCharCode(65535).charCodeAt(0) !== 65535) {\n $ERROR('#4: String.fromCharCode(65535).charCodeAt(0) === 65535. Actual: ' + (String.fromCharCode(65535).charCodeAt(0)));\n}\n\n// CHECK#5\nif (String.fromCharCode(65534).charCodeAt(0) !== 65534) {\n $ERROR('#5: String.fromCharCode(65534).charCodeAt(0) === 65534. Actual: ' + (String.fromCharCode(65534).charCodeAt(0)));\n}\n\n// CHECK#6\nif (String.fromCharCode(65536).charCodeAt(0) !== 0) {\n $ERROR('#6: String.fromCharCode(65536).charCodeAt(0) === 0. Actual: ' + (String.fromCharCode(65536).charCodeAt(0)));\n}\n\n// CHECK#7\nif (String.fromCharCode(4294967295).charCodeAt(0) !== 65535) {\n $ERROR('#7: String.fromCharCode(4294967295).charCodeAt(0) === 65535. Actual: ' + (String.fromCharCode(4294967295).charCodeAt(0)));\n}\n\n// CHECK#8\nif (String.fromCharCode(4294967294).charCodeAt(0) !== 65534) {\n $ERROR('#8: String.fromCharCode(4294967294).charCodeAt(0) === 65534. Actual: ' + (String.fromCharCode(4294967294).charCodeAt(0)));\n}\n\n// CHECK#9\nif (String.fromCharCode(4294967296).charCodeAt(0) !== 0) {\n $ERROR('#9: String.fromCharCode(4294967296).charCodeAt(0) === 0. Actual: ' + (String.fromCharCode(4294967296).charCodeAt(0)));\n}\n",
+ "id": "S9.7_A2.1"
+ },
+ {
+ "section": "9.7, 11.7.3",
+ "description": "For testing use String.fromCharCode(Number).charCodeAt(0) construction",
+ "test": "// CHECK#1\nif (String.fromCharCode(-32767).charCodeAt(0) !== 32769) {\n $ERROR('#1: String.fromCharCode(-32767).charCodeAt(0) === 32769. Actual: ' + (String.fromCharCode(-32767).charCodeAt(0)));\n}\n\n// CHECK#2\nif (String.fromCharCode(-32768).charCodeAt(0) !== 32768) {\n $ERROR('#2: String.fromCharCode(-32768).charCodeAt(0) === 32768. Actual: ' + (String.fromCharCode(-32768).charCodeAt(0)));\n}\n\n// CHECK#3\nif (String.fromCharCode(-32769).charCodeAt(0) !== 32767) {\n $ERROR('#3: String.fromCharCode(-32769).charCodeAt(0) === 32767. Actual: ' + (String.fromCharCode(-32769).charCodeAt(0)));\n}\n\n// CHECK#4\nif (String.fromCharCode(-65535).charCodeAt(0) !== 1) {\n $ERROR('#4: String.fromCharCode(-65535).charCodeAt(0) === 1. Actual: ' + (String.fromCharCode(-65535).charCodeAt(0)));\n}\n\n// CHECK#5\nif (String.fromCharCode(-65536).charCodeAt(0) !== 0) {\n $ERROR('#5: String.fromCharCode(-65536).charCodeAt(0) === 0. Actual: ' + (String.fromCharCode(-65536).charCodeAt(0)));\n}\n\n// CHECK#6\nif (String.fromCharCode(-65537).charCodeAt(0) !== 65535) {\n $ERROR('#6: String.fromCharCode(-65537).charCodeAt(0) === 65535. Actual: ' + (String.fromCharCode(-65537).charCodeAt(0)));\n}\n\n// CHECK#7\nif (String.fromCharCode(65535).charCodeAt(0) !== 65535) {\n $ERROR('#7: String.fromCharCode(65535).charCodeAt(0) === 65535. Actual: ' + (String.fromCharCode(65535).charCodeAt(0)));\n}\n\n// CHECK#8\nif (String.fromCharCode(65536).charCodeAt(0) !== 0) {\n $ERROR('#8: String.fromCharCode(65536).charCodeAt(0) === 0. Actual: ' + (String.fromCharCode(65536).charCodeAt(0)));\n}\n\n// CHECK#9\nif (String.fromCharCode(65537).charCodeAt(0) !== 1) {\n $ERROR('#9: String.fromCharCode(65537).charCodeAt(0) === 1. Actual: ' + (String.fromCharCode(65537).charCodeAt(0)));\n}\n\n// CHECK#10\nif (String.fromCharCode(131071).charCodeAt(0) !== 65535) {\n $ERROR('#10: String.fromCharCode(131071).charCodeAt(0) === 65535. Actual: ' + (String.fromCharCode(131071).charCodeAt(0)));\n}\n\n// CHECK#11\nif (String.fromCharCode(131072).charCodeAt(0) !== 0) {\n $ERROR('#11: String.fromCharCode(131072).charCodeAt(0) === 0. Actual: ' + (String.fromCharCode(131072).charCodeAt(0)));\n}\n\n// CHECK#12\nif (String.fromCharCode(131073).charCodeAt(0) !== 1) {\n $ERROR('#12: String.fromCharCode(131073).charCodeAt(0) === 1. Actual: ' + (String.fromCharCode(131073).charCodeAt(0)));\n}\n",
+ "id": "S9.7_A2.2"
+ },
+ {
+ "section": "9.7",
+ "description": "Type(x) is Boolean",
+ "test": "// CHECK#1\nif (String.fromCharCode(new Boolean(true)).charCodeAt(0) !== 1) {\n $ERROR('#1: String.fromCharCode(new Boolean(true)).charCodeAt(0) === 1. Actual: ' + (String.fromCharCode(new Boolean(true)).charCodeAt(0)));\n}\n\n// CHECK#2\nif (String.fromCharCode(false).charCodeAt(0) !== 0) {\n $ERROR('#2: String.fromCharCode(false).charCodeAt(0) === 0. Actual: ' + (String.fromCharCode(false).charCodeAt(0)));\n}\n",
+ "id": "S9.7_A3.1_T1"
+ },
+ {
+ "section": "9.7",
+ "description": "Type(x) is Number",
+ "test": "// CHECK#1\nif (String.fromCharCode(new Number(1)).charCodeAt(0) !== 1) {\n $ERROR('#1: String.fromCharCode(new Number(1)).charCodeAt(0) === 1. Actual: ' + (String.fromCharCode(new Number(1)).charCodeAt(0)));\n}\n\n// CHECK#2\nif (String.fromCharCode(-1.234).charCodeAt(0) !== 65535) {\n $ERROR('#2: String.fromCharCode(-1.234).charCodeAt(0) === 65535. Actual: ' + (String.fromCharCode(-1.234).charCodeAt(0)));\n}\n",
+ "id": "S9.7_A3.1_T2"
+ },
+ {
+ "section": "9.7",
+ "description": "Type(x) is String",
+ "test": "// CHECK#1\nif (String.fromCharCode(new String(1)).charCodeAt(0) !== 1) {\n $ERROR('#1: String.fromCharCode(new String(1)).charCodeAt(0) === 1. Actual: ' + (String.fromCharCode(new String(1)).charCodeAt(0)));\n}\n\n// CHECK#2\nif (String.fromCharCode(\"-1.234\").charCodeAt(0) !== 65535) {\n $ERROR('#2: String.fromCharCode(\"-1.234\").charCodeAt(0) === 65535. Actual: ' + (String.fromCharCode(\"-1.234\").charCodeAt(0)));\n}\n",
+ "id": "S9.7_A3.1_T3"
+ },
+ {
+ "section": "9.7",
+ "description": "Type(x) is Object",
+ "test": "//CHECK#1\nvar object = {valueOf: function() {return 1}};\nif (String.fromCharCode(object).charCodeAt(0) !== 1) {\n $ERROR('#1: var object = {valueOf: function() {return 1}}; String.fromCharCode(object).charCodeAt(0) === 1. Actual: ' + (String.fromCharCode(object).charCodeAt(0)));\n}\n\n//CHECK#2\nvar object = {valueOf: function() {return 1}, toString: function() {return 0}};\nif (String.fromCharCode(object).charCodeAt(0) !== 1) {\n $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; String.fromCharCode(object).charCodeAt(0) === 1. Actual: ' + (String.fromCharCode(object).charCodeAt(0)));\n} \n\n//CHECK#3\nvar object = {valueOf: function() {return 1}, toString: function() {return {}}};\nif (String.fromCharCode(object).charCodeAt(0) !== 1) {\n $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; String.fromCharCode(object).charCodeAt(0) === 1. Actual: ' + (String.fromCharCode(object).charCodeAt(0)));\n}\n\n//CHECK#4\ntry {\n var object = {valueOf: function() {return 1}, toString: function() {throw \"error\"}};\n if (String.fromCharCode(object).charCodeAt(0) !== 1) {\n $ERROR('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw \"error\"}}; String.fromCharCode(object).charCodeAt(0) === 1. Actual: ' + (String.fromCharCode(object).charCodeAt(0)));\n }\n}\ncatch (e) {\n if (e === \"error\") {\n $ERROR('#4.2: var object = {valueOf: function() {return 1}, toString: function() {throw \"error\"}}; object not throw \"error\"');\n } else {\n $ERROR('#4.3: var object = {valueOf: function() {return 1}, toString: function() {throw \"error\"}}; object not throw Error. Actual: ' + (e));\n }\n}\n\n//CHECK#5\nvar object = {toString: function() {return 1}};\nif (String.fromCharCode(object).charCodeAt(0) !== 1) {\n $ERROR('#5: var object = {toString: function() {return 1}}; String.fromCharCode(object).charCodeAt(0) === 1. Actual: ' + (String.fromCharCode(object).charCodeAt(0)));\n}\n\n//CHECK#6\nvar object = {valueOf: function() {return {}}, toString: function() {return 1}}\nif (String.fromCharCode(object).charCodeAt(0) !== 1) {\n $ERROR('#6: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; String.fromCharCode(object).charCodeAt(0) === 1. Actual: ' + (String.fromCharCode(object).charCodeAt(0)));\n}\n\n//CHECK#7\ntry {\n var object = {valueOf: function() {throw \"error\"}, toString: function() {return 1}};\n object >>> 0;\n $ERROR('#7.1: var object = {valueOf: function() {throw \"error\"}, toString: function() {return 1}}; object throw \"error\". Actual: ' + (object >>> 0));\n} \ncatch (e) {\n if (e !== \"error\") {\n $ERROR('#7.2: var object = {valueOf: function() {throw \"error\"}, toString: function() {return 1}}; object throw \"error\". Actual: ' + (e));\n } \n}\n\n//CHECK#8\ntry {\n var object = {valueOf: function() {return {}}, toString: function() {return {}}};\n object >>> 0;\n $ERROR('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; object throw TypeError. Actual: ' + (object >>> 0));\n} \ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; object throw TypeError. Actual: ' + (e));\n } \n}\n",
+ "id": "S9.7_A3.1_T4"
+ },
+ {
+ "section": "9.7",
+ "description": "For testing use String.fromCharCode(Number).charCodeAt(0) construction",
+ "test": "// CHECK#1\nif (String.fromCharCode(1.2345).charCodeAt(0) !== 1) {\n $ERROR('#1: String.fromCharCode(1.2345).charCodeAt(0) === 1. Actual: ' + (String.fromCharCode(1.2345).charCodeAt(0)));\n}\n\n// CHECK#2\nif (String.fromCharCode(-5.4321).charCodeAt(0) !== 65531) {\n $ERROR('#2: String.fromCharCode(-5.4321).charCodeAt(0) === 65531. Actual: ' + (String.fromCharCode(-5.4321).charCodeAt(0)));\n}\n",
+ "id": "S9.7_A3.2_T1"
+ }
+ ]
+ }
+}