aboutsummaryrefslogtreecommitdiffstats
path: root/website/resources/scripts/testcases2/15.4.4.20.json
diff options
context:
space:
mode:
Diffstat (limited to 'website/resources/scripts/testcases2/15.4.4.20.json')
-rw-r--r--website/resources/scripts/testcases2/15.4.4.20.json1576
1 files changed, 1576 insertions, 0 deletions
diff --git a/website/resources/scripts/testcases2/15.4.4.20.json b/website/resources/scripts/testcases2/15.4.4.20.json
new file mode 100644
index 000000000..b6b3178ec
--- /dev/null
+++ b/website/resources/scripts/testcases2/15.4.4.20.json
@@ -0,0 +1,1576 @@
+{
+ "testCollection": {
+ "name": "15.4.4.20",
+ "numTests": 224,
+ "tests": [
+ {
+ "id": "15.4.4.20-0-1",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-0-1.js",
+ "description": "Array.prototype.filter must exist as a function",
+ "test": "assertTrue((function testcase() {\n var f = Array.prototype.filter;\n if (typeof(f) === \"function\") {\n return true;\n }\n }).call(this));\n"
+ },
+ {
+ "id": "15.4.4.20-0-2",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-0-2.js",
+ "description": "Array.prototype.filter.length must be 1",
+ "test": "assertTrue((Array.prototype.filter.length === 1));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-1-1",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-1-1.js",
+ "description": "Array.prototype.filter applied to undefined throws a TypeError",
+ "test": "assertTrue((function testcase() {\n try {\n Array.prototype.filter.call(undefined); // TypeError is thrown if value is undefined\n return false;\n } catch (ex) {\n return ex instanceof TypeError;\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-1-10",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-1-10.js",
+ "description": "Array.prototype.filter applied to the Math object",
+ "test": "assertTrue((function testcase() {\n function callbackfn(val, idx, obj) {\n return '[object Math]' === Object.prototype.toString.call(obj);\n }\n\n try {\n Math.length = 1;\n Math[0] = 1;\n var newArr = Array.prototype.filter.call(Math, callbackfn);\n return newArr[0] === 1;\n } finally {\n delete Math[0];\n delete Math.length;\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-1-11",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-1-11.js",
+ "description": "Array.prototype.filter applied to Date object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return obj instanceof Date;\n }\n\n var obj = new Date();\n obj.length = 1;\n obj[0] = 1;\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr[0] === 1;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-1-12",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-1-12.js",
+ "description": "Array.prototype.filter applied to RegExp object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return obj instanceof RegExp;\n }\n\n var obj = new RegExp();\n obj.length = 2;\n obj[1] = true;\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n return newArr[0] === true;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-1-13",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-1-13.js",
+ "description": "Array.prototype.filter applied to the JSON object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return '[object JSON]' === Object.prototype.toString.call(JSON);\n }\n\n try {\n JSON.length = 1;\n JSON[0] = 1;\n var newArr = Array.prototype.filter.call(JSON, callbackfn);\n return newArr[0] === 1;\n } finally {\n delete JSON.length;\n delete JSON[0];\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-1-14",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-1-14.js",
+ "description": "Array.prototype.filter applied to Error object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return obj instanceof Error;\n }\n\n var obj = new Error();\n obj.length = 1;\n obj[0] = 1;\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr[0] === 1;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-1-15",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-1-15.js",
+ "description": "Array.prototype.filter applied to the Arguments object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return '[object Arguments]' === Object.prototype.toString.call(obj);\n }\n\n var obj = (function () {\n return arguments;\n }(\"a\", \"b\"));\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr[0] === \"a\" && newArr[1] === \"b\";\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-1-2",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-1-2.js",
+ "description": "Array.prototype.filter applied to null throws a TypeError",
+ "test": "assertTrue((function testcase() {\n try {\n Array.prototype.filter.call(null);\n return false;\n } catch (ex) {\n return ex instanceof TypeError;\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-1-3",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-1-3.js",
+ "description": "Array.prototype.filter applied to boolean primitive",
+ "test": "assertTrue((function testcase() {\n function callbackfn(val, idx, obj) {\n return obj instanceof Boolean;\n }\n\n try {\n Boolean.prototype[0] = true;\n Boolean.prototype.length = 1;\n\n var newArr = Array.prototype.filter.call(false, callbackfn);\n return newArr[0] === true;\n\n } finally {\n delete Boolean.prototype[0];\n delete Boolean.prototype.length;\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-1-4",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-1-4.js",
+ "description": "Array.prototype.filter applied to Boolean Object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return obj instanceof Boolean;\n }\n\n var obj = new Boolean(true);\n obj.length = 2;\n obj[0] = 11;\n obj[1] = 12;\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr[0] === 11 && newArr[1] === 12;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-1-5",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-1-5.js",
+ "description": "Array.prototype.filter applied to number primitive",
+ "test": "assertTrue((function testcase() {\n function callbackfn(val, idx, obj) {\n return obj instanceof Number;\n }\n\n try {\n Number.prototype[0] = 1;\n Number.prototype.length = 1;\n\n var newArr = Array.prototype.filter.call(2.5, callbackfn);\n return newArr[0] === 1;\n } finally {\n delete Number.prototype[0];\n delete Number.prototype.length;\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-1-6",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-1-6.js",
+ "description": "Array.prototype.filter applied to Number object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return obj instanceof Number;\n }\n\n var obj = new Number(-128);\n obj.length = 2;\n obj[0] = 11;\n obj[1] = 12;\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n return newArr[0] === 11 && newArr[1] === 12;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-1-7",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-1-7.js",
+ "description": "Array.prototype.filter applied to string primitive",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return obj instanceof String;\n }\n\n var newArr = Array.prototype.filter.call(\"abc\", callbackfn);\n\n return newArr[0] === \"a\";\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-1-8",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-1-8.js",
+ "description": "Array.prototype.filter applied to String object",
+ "test": "assertTrue((function testcase() {\n function callbackfn(val, idx, obj) {\n return obj instanceof String;\n }\n\n var obj = new String(\"abc\");\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr[0] === \"a\";\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-1-9",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-1-9.js",
+ "description": "Array.prototype.filter applied to Function object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return obj instanceof Function;\n }\n\n var obj = function (a, b) {\n return a + b;\n };\n obj[0] = 11;\n obj[1] = 9;\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr[0] === 11 && newArr[1] === 9;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-10-1",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-10-1.js",
+ "description": "Array.prototype.filter doesn't mutate the Array on which it is called on",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj)\n {\n return true;\n }\n var srcArr = [1,2,3,4,5];\n srcArr.filter(callbackfn);\n if(srcArr[0] === 1 &&\n srcArr[1] === 2 &&\n srcArr[2] === 3 &&\n srcArr[3] === 4 &&\n srcArr[4] === 5)\n {\n return true;\n }\n\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-10-2",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-10-2.js",
+ "description": "Array.prototype.filter returns new Array with length equal to number of true returned by callbackfn",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj)\n {\n if(val % 2)\n return true;\n else\n return false;\n }\n var srcArr = [1,2,3,4,5];\n var resArr = srcArr.filter(callbackfn);\n if(resArr.length === 3 &&\n resArr[0] === 1 &&\n resArr[1] === 3 &&\n resArr[2] === 5)\n {\n return true;\n }\n\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-10-3",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-10-3.js",
+ "description": "Array.prototype.filter - subclassed array when length is reduced",
+ "test": "assertTrue((function testcase() {\n foo.prototype = new Array(1, 2, 3);\n function foo() {}\n var f = new foo();\n f.length = 1;\n \n function cb(){return true;}\n var a = f.filter(cb);\n \n if (Array.isArray(a) &&\n a.length === 1) {\n return true;\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-10-4",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-10-4.js",
+ "description": "Array.prototype.filter doesn't visit expandos",
+ "test": "assertTrue((function testcase() {\n\n var callCnt = 0;\n function callbackfn(val, idx, obj)\n {\n callCnt++;\n }\n var srcArr = [1,2,3,4,5];\n srcArr[\"i\"] = 10;\n srcArr[true] = 11;\n\n var resArr = srcArr.filter(callbackfn);\n if(callCnt == 5)\n {\n return true;\n }\n\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-2-1",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-2-1.js",
+ "description": "Array.prototype.filter applied to Array-like object, 'length' is own data property",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return obj.length === 2;\n }\n\n var obj = {\n 0: 12,\n 1: 11,\n 2: 9,\n length: 2\n };\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 2;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-2-10",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-2-10.js",
+ "description": "Array.prototype.filter applied to Array-like object, 'length' is inherited accessor property",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return obj.length === 2;\n }\n\n var proto = {};\n\n Object.defineProperty(proto, \"length\", {\n get: function () {\n return 2;\n },\n configurable: true\n });\n\n var Con = function () { };\n Con.prototype = proto;\n\n var child = new Con();\n child[0] = 12;\n child[1] = 11;\n child[2] = 9;\n\n var newArr = Array.prototype.filter.call(child, callbackfn);\n return newArr.length === 2;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty))"
+ },
+ {
+ "id": "15.4.4.20-2-11",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-2-11.js",
+ "description": "Array.prototype.filter applied to Array-like object, 'length' is own accessor property without a get function",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n function callbackfn(val, idx, obj) {\n accessed = true;\n return true;\n }\n\n var obj = {\n 0: 11,\n 1: 12\n };\n Object.defineProperty(obj, \"length\", {\n set: function () { },\n configurable: true\n });\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n return newArr.length === 0 && !accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty))"
+ },
+ {
+ "id": "15.4.4.20-2-12",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-2-12.js",
+ "description": "Array.prototype.filter - 'length' is own accessor property without a get function that overrides an inherited accessor property",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n function callbackfn(val, idx, obj) {\n accessed = true;\n return true;\n }\n\n try {\n Object.defineProperty(Object.prototype, \"length\", {\n get: function () {\n return 2;\n },\n configurable: true\n });\n\n var obj = { 0: 12, 1: 11 };\n Object.defineProperty(obj, \"length\", {\n set: function () { },\n configurable: true\n });\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n return newArr.length === 0 && !accessed;\n } finally {\n delete Object.prototype.length;\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty))"
+ },
+ {
+ "id": "15.4.4.20-2-13",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-2-13.js",
+ "description": "Array.prototype.filter applied to the Array-like object that 'length' is inherited accessor property without a get function",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n function callbackfn(val, idx, obj) {\n accessed = true;\n return true;\n }\n\n var proto = {};\n Object.defineProperty(proto, \"length\", {\n set: function () { },\n configurable: true\n });\n\n var Con = function () { };\n Con.prototype = proto;\n\n var child = new Con();\n child[0] = 11;\n child[1] = 12;\n\n var newArr = Array.prototype.filter.call(child, callbackfn);\n return newArr.length === 0 && !accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty))"
+ },
+ {
+ "id": "15.4.4.20-2-14",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-2-14.js",
+ "description": "Array.prototype.filter applied to the Array-like object that 'length property doesn't exist",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n function callbackfn(val, idx, obj) {\n accessed = true;\n return true;\n }\n\n var obj = { 0: 11, 1: 12 };\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n return newArr.length === 0 && !accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-2-15",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-2-15.js",
+ "description": "Array.prototype.filter - 'length' is property of the global object",
+ "test": "assertTrue((function testcase() {\n \n function callbackfn(val, idx, obj) {\n return obj.length === 2;\n }\n\n try {\n var oldLen = fnGlobalObject().length;\n fnGlobalObject()[0] = 12;\n fnGlobalObject()[1] = 11;\n fnGlobalObject()[2] = 9;\n fnGlobalObject().length = 2;\n var newArr = Array.prototype.filter.call(fnGlobalObject(), callbackfn);\n return newArr.length === 2;\n } finally {\n delete fnGlobalObject()[0];\n delete fnGlobalObject()[1];\n delete fnGlobalObject()[2];\n fnGlobalObject().length = oldLen;\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-2-17",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-2-17.js",
+ "description": "Array.prototype.filter applied to the Arguments object, which implements its own property get method",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return obj.length === 2;\n }\n\n var func = function (a, b) {\n var newArr = Array.prototype.filter.call(arguments, callbackfn);\n return newArr.length === 2;\n };\n\n return func(12, 11);\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-2-18",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-2-18.js",
+ "description": "Array.prototype.filter applied to String object, which implements its own property get method",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return obj.length === 3;\n }\n\n var str = new String(\"012\");\n\n var newArr = Array.prototype.filter.call(str, callbackfn);\n return newArr.length === 3;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-2-19",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-2-19.js",
+ "description": "Array.prototype.filter applied to Function object, which implements its own property get method",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return obj.length === 2;\n }\n\n var fun = function (a, b) {\n return a + b;\n };\n fun[0] = 12;\n fun[1] = 11;\n fun[2] = 9;\n\n var newArr = Array.prototype.filter.call(fun, callbackfn);\n return newArr.length === 2;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-2-2",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-2-2.js",
+ "description": "Array.prototype.filter - 'length' is own data property on an Array",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return obj.length === 2;\n }\n\n var newArr = [12, 11].filter(callbackfn);\n return newArr.length === 2;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-2-3",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-2-3.js",
+ "description": "Array.prototype.filter applied to Array-like object, 'length' is an own data property that overrides an inherited data property",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return obj.length === 2;\n }\n\n var proto = { length: 3 };\n\n var Con = function () { };\n Con.prototype = proto;\n\n var child = new Con();\n child.length = 2;\n child[0] = 12;\n child[1] = 11;\n child[2] = 9;\n\n var newArr = Array.prototype.filter.call(child, callbackfn);\n return newArr.length === 2;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-2-4",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-2-4.js",
+ "description": "Array.prototype.filter - 'length' is own data property that overrides an inherited data property on an Array",
+ "test": "assertTrue((function testcase() {\n\n var arrProtoLen;\n\n function callbackfn(val, idx, obj) {\n return obj.length === 2;\n }\n\n try {\n arrProtoLen = Array.prototype.length;\n Array.prototype.length = 0;\n var newArr = [12, 11].filter(callbackfn);\n return newArr.length === 2;\n } finally {\n Array.prototype.length = arrProtoLen;\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-2-5",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-2-5.js",
+ "description": "Array.prototype.filter to Array-like object, 'length' is an own data property that overrides an inherited accessor property",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return obj.length === 2;\n }\n\n var proto = {};\n\n Object.defineProperty(proto, \"length\", {\n get: function () {\n return 3;\n },\n configurable: true\n });\n\n var Con = function () { };\n Con.prototype = proto;\n\n var child = new Con();\n Object.defineProperty(child, \"length\", {\n value: 2,\n configurable: true\n });\n child[0] = 12;\n child[1] = 11;\n child[2] = 9;\n\n var newArr = Array.prototype.filter.call(child, callbackfn);\n return newArr.length === 2;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty))"
+ },
+ {
+ "id": "15.4.4.20-2-6",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-2-6.js",
+ "description": "Array.prototype.filter applied to Array-like object, 'length' is an inherited data property",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return obj.length === 2;\n }\n\n var proto = { length: 2 };\n\n var Con = function () { };\n Con.prototype = proto;\n\n var child = new Con();\n child[0] = 12;\n child[1] = 11;\n child[2] = 9;\n\n var newArr = Array.prototype.filter.call(child, callbackfn);\n return newArr.length === 2;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-2-7",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-2-7.js",
+ "description": "Array.prototype.filter applied to Array-like object, 'length' is an own accessor property",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return obj.length === 2;\n }\n\n var obj = {};\n\n Object.defineProperty(obj, \"length\", {\n get: function () {\n return 2;\n },\n configurable: true\n });\n\n obj[0] = 12;\n obj[1] = 11;\n obj[2] = 9;\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n return newArr.length === 2;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty))"
+ },
+ {
+ "id": "15.4.4.20-2-8",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-2-8.js",
+ "description": "Array.prototype.filter applied to Array-like object, 'length' is own accessor property that overrides an inherited data property",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return obj.length === 2;\n }\n\n var proto = { length: 3 };\n\n var Con = function () { };\n Con.prototype = proto;\n\n var child = new Con();\n\n Object.defineProperty(child, \"length\", {\n get: function () {\n return 2;\n },\n configurable: true\n });\n\n child[0] = 12;\n child[1] = 11;\n child[2] = 9;\n\n var newArr = Array.prototype.filter.call(child, callbackfn);\n return newArr.length === 2;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty))"
+ },
+ {
+ "id": "15.4.4.20-2-9",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-2-9.js",
+ "description": "Array.prototype.filter applied to Array-like object, 'length' is an own accessor property that overrides an inherited accessor property",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return obj.length === 2;\n }\n\n var proto = {};\n\n Object.defineProperty(proto, \"length\", {\n get: function () {\n return 3;\n },\n configurable: true\n });\n\n var Con = function () { };\n Con.prototype = proto;\n\n var child = new Con();\n\n Object.defineProperty(child, \"length\", {\n get: function () {\n return 2;\n },\n configurable: true\n });\n\n child[0] = 12;\n child[1] = 11;\n child[2] = 9;\n\n var newArr = Array.prototype.filter.call(child, callbackfn);\n return newArr.length === 2;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty))"
+ },
+ {
+ "id": "15.4.4.20-3-1",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-3-1.js",
+ "description": "Array.prototype.filter - value of 'length' is undefined",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n function callbackfn(val, idx, obj) {\n accessed = true;\n return true;\n }\n\n var obj = { 0: 0, 1: 1, length: undefined };\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 0 && !accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-3-10",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-3-10.js",
+ "description": "Array.prototype.filter - value of 'length' is a number (value is NaN)",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n function callbackfn(val, idx, obj) {\n accessed = true;\n return true;\n }\n\n var obj = { 0: 9, length: NaN };\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 0 && !accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-3-11",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-3-11.js",
+ "description": "Array.prototype.filter - 'length' is a string containing a positive number",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return true;\n }\n\n var obj = { 1: 11, 2: 9, length: \"2\" };\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-3-12",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-3-12.js",
+ "description": "Array.prototype.filter - 'length' is a string containing a negative number",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return true;\n }\n\n var obj = { 1: 11, 2: 9, length: \"-4294967294\" };\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-3-13",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-3-13.js",
+ "description": "Array.prototype.filter - 'length' is a string containing a decimal number",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return true;\n }\n\n var obj = { 1: 11, 2: 9, length: \"2.5\" };\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-3-14",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-3-14.js",
+ "description": "Array.prototype.filter - 'length' is a string containing +/-Infinity",
+ "test": "assertTrue((function testcase() {\n\n var accessed1 = false;\n var accessed2 = false;\n var accessed3 = false;\n\n function callbackfn1(val, idx, obj) {\n accessed1 = true;\n return true;\n }\n\n function callbackfn2(val, idx, obj) {\n accessed2 = true;\n return true;\n }\n\n function callbackfn3(val, idx, obj) {\n accessed3 = true;\n return true;\n }\n\n var obj1 = { 0: 9, length: \"Infinity\" };\n var obj2 = { 0: 9, length: \"-Infinity\" };\n var obj3 = { 0: 9, length: \"+Infinity\" };\n\n var newArr1 = Array.prototype.filter.call(obj1, callbackfn1);\n var newArr2 = Array.prototype.filter.call(obj2, callbackfn2);\n var newArr3 = Array.prototype.filter.call(obj3, callbackfn3);\n\n return !accessed1 && newArr1.length === 0 &&\n !accessed2 && newArr2.length === 0 && \n !accessed3 && newArr3.length === 0;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-3-15",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-3-15.js",
+ "description": "Array.prototype.filter - 'length' is a string containing an exponential number",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return true;\n }\n\n var obj = { 1: 11, 2: 9, length: \"2E0\" };\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-3-16",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-3-16.js",
+ "description": "Array.prototype.filter - 'length' is a string containing a hex number",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return true;\n }\n\n var obj = { 1: 11, 2: 9, length: \"0x0002\" };\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-3-17",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-3-17.js",
+ "description": "Array.prototype.filter - 'length' is a string containing a number with leading zeros",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return true;\n }\n\n var obj = { 1: 11, 2: 9, length: \"0002.00\" };\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-3-18",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-3-18.js",
+ "description": "Array.prototype.filter - value of 'length' is a string that can't convert to a number",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n function callbackfn(val, idx, obj) {\n accessed = true;\n return true;\n }\n\n var obj = { 0: 9, length: \"asdf!_\" };\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return !accessed && newArr.length === 0;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-3-19",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-3-19.js",
+ "description": "Array.prototype.filter - value of 'length' is an Object which has an own toString method.",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return true;\n }\n\n var obj = {\n 1: 11,\n 2: 9,\n length: {\n toString: function () {\n return '2';\n }\n }\n };\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-3-2",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-3-2.js",
+ "description": "Array.prototype.filter applied on an Array-like object if 'length' is 1 (length overridden to true(type conversion))",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return true;\n }\n\n var obj = { 0: 11, 1: 9, length: true };\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-3-20",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-3-20.js",
+ "description": "Array.prototype.filter - value of 'length' is an Object which has an own valueOf method.",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return true;\n }\n\n var obj = {\n 1: 11,\n 2: 9,\n length: {\n valueOf: function () {\n return 2;\n }\n }\n };\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-3-21",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-3-21.js",
+ "description": "Array.prototype.filter - 'length' is an object that has an own valueOf method that returns an object and toString method that returns a string",
+ "test": "assertTrue((function testcase() {\n\n var firstStepOccured = false;\n var secondStepOccured = false;\n\n function callbackfn(val, idx, obj) {\n return true;\n }\n\n var obj = {\n 1: 11,\n 2: 9,\n length: {\n valueOf: function () {\n firstStepOccured = true;\n return {};\n },\n toString: function () {\n secondStepOccured = true;\n return '2';\n }\n }\n };\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 1 && newArr[0] === 11 && firstStepOccured && secondStepOccured;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-3-22",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-3-22.js",
+ "description": "Array.prototype.filter throws TypeError exception when 'length' is an object with toString and valueOf methods that don�t return primitive values",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n var firstStepOccured = false;\n var secondStepOccured = false;\n\n function callbackfn(val, idx, obj) {\n accessed = true;\n return true;\n }\n\n var obj = {\n 1: 11,\n 2: 12,\n\n length: {\n valueOf: function () {\n firstStepOccured = true;\n return {};\n },\n toString: function () {\n secondStepOccured = true;\n return {};\n }\n }\n };\n\n try {\n Array.prototype.filter.call(obj, callbackfn);\n return false;\n } catch (ex) {\n return (ex instanceof TypeError) && !accessed && firstStepOccured && secondStepOccured;\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-3-23",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-3-23.js",
+ "description": "Array.prototype.filter uses inherited valueOf method when 'length' is an object with an own toString and inherited valueOf methods",
+ "test": "assertTrue((function testcase() {\n\n var valueOfAccessed = false;\n var toStringAccessed = false;\n\n function callbackfn(val, idx, obj) {\n return true;\n }\n\n var proto = {\n valueOf: function () {\n valueOfAccessed = true;\n return 2;\n }\n };\n\n var Con = function () { };\n Con.prototype = proto;\n\n var child = new Con();\n\n child.toString = function () {\n toStringAccessed = true;\n return '1';\n };\n\n var obj = {\n 1: 11,\n 2: 9,\n length: child\n };\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 1 && newArr[0] === 11 && valueOfAccessed && !toStringAccessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-3-24",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-3-24.js",
+ "description": "Array.prototype.filter - value of 'length' is a positive non-integer, ensure truncation occurs in the proper direction",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return true;\n }\n\n var obj = {\n 1: 11,\n 2: 9,\n length: 2.685\n };\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-3-25",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-3-25.js",
+ "description": "Array.prototype.filter - value of 'length' is a negative non-integer, ensure truncation occurs in the proper direction",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return true;\n }\n\n var obj = {\n 1: 11,\n 2: 9,\n length: -4294967294.5\n };\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-3-28",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-3-28.js",
+ "description": "Array.prototype.filter - value of 'length' is boundary value (2^32)",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n function callbackfn(val, idx, obj) {\n accessed = true;\n return true;\n }\n\n var obj = {\n 0: 12,\n length: 4294967296\n };\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return !accessed && newArr.length === 0;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-3-29",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-3-29.js",
+ "description": "Array.prototype.filter - value of 'length' is boundary value (2^32 + 1)",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return true;\n }\n\n var obj = {\n 0: 11,\n 1: 9,\n length: 4294967297\n };\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-3-3",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-3-3.js",
+ "description": "Array.prototype.filter - value of 'length' is a number (value is 0)",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n function callbackfn(val, idx, obj) {\n accessed = true;\n return true;\n }\n\n var obj = { 0: 11, length: 0 };\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 0 && !accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-3-4",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-3-4.js",
+ "description": "Array.prototype.filter - value of 'length' is a number (value is +0)",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n function callbackfn(val, idx, obj) {\n accessed = true;\n return true;\n }\n\n var obj = { 0: 11, length: +0 };\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 0 && !accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-3-5",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-3-5.js",
+ "description": "Array.prototype.filter - value of 'length' is a number (value is -0)",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n function callbackfn(val, idx, obj) {\n accessed = true;\n return true;\n }\n\n var obj = { 0: 11, length: -0 };\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 0 && !accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-3-6",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-3-6.js",
+ "description": "Array.prototype.filter - value of 'length' is a number (value is positive)",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return true;\n }\n\n var obj = { 1: 11, 2: 9, length: 2 };\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-3-7",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-3-7.js",
+ "description": "Array.prototype.filter - value of 'length' is a number (value is negative)",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return true;\n }\n\n var obj = { 1: 11, 2: 9, length: -4294967294 };\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-3-8",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-3-8.js",
+ "description": "Array.prototype.filter - value of 'length' is a number (value is Infinity)",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n function callbackfn(val, idx, obj) {\n accessed = true;\n return true;\n }\n\n var obj = { 0: 9, length: Infinity };\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 0 && !accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-3-9",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-3-9.js",
+ "description": "Array.prototype.filter - value of 'length' is a number (value is -Infinity)",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n function callbackfn(val, idx, obj) {\n accessed = true;\n return true;\n }\n\n var obj = { 0: 9, length: -Infinity };\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 0 && !accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-4-1",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-4-1.js",
+ "description": "Array.prototype.filter throws TypeError if callbackfn is undefined",
+ "test": "assertTrue((function testcase() {\n\n var arr = new Array(10);\n try {\n arr.filter(); \n }\n catch(e) {\n if(e instanceof TypeError)\n return true; \n }\n\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-4-10",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-4-10.js",
+ "description": "Array.prototype.filter - the exception is not thrown if exception was thrown by step 2",
+ "test": "assertTrue((function testcase() {\n\n var obj = { 0: 11, 1: 12 };\n\n Object.defineProperty(obj, \"length\", {\n get: function () {\n throw new SyntaxError();\n },\n configurable: true\n });\n\n try {\n Array.prototype.filter.call(obj, undefined);\n return false;\n } catch (ex) {\n return !(ex instanceof TypeError);\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty))"
+ },
+ {
+ "id": "15.4.4.20-4-11",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-4-11.js",
+ "description": "Array.prototype.filter - the exception is not thrown if exception was thrown by step 3",
+ "test": "assertTrue((function testcase() {\n\n var obj = { 0: 11, 1: 12 };\n\n Object.defineProperty(obj, \"length\", {\n get: function () {\n return {\n toString: function () {\n throw new SyntaxError();\n }\n };\n },\n configurable: true\n });\n\n try {\n Array.prototype.filter.call(obj, undefined);\n return false;\n } catch (ex) {\n return !(ex instanceof TypeError);\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty))"
+ },
+ {
+ "id": "15.4.4.20-4-12",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-4-12.js",
+ "description": "Array.prototype.filter - 'callbackfn' is a function",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n if (idx === 1) {\n return val === 9;\n }\n return false;\n }\n\n var newArr = [11, 9].filter(callbackfn);\n return newArr.length === 1 && newArr[0] === 9;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-4-15",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-4-15.js",
+ "description": "Array.prototype.filter - calling with no callbackfn is the same as passing undefined for callbackfn",
+ "test": "assertTrue((function testcase() {\n var obj = { 10: 10 };\n var lengthAccessed = false;\n var loopAccessed = false;\n Object.defineProperty(obj, \"length\", {\n get: function () {\n lengthAccessed = true;\n return 20;\n },\n configurable: true\n });\n Object.defineProperty(obj, \"0\", {\n get: function () {\n loopAccessed = true;\n return 10;\n },\n configurable: true\n });\n\n try {\n Array.prototype.filter.call(obj);\n return false;\n } catch (ex) {\n return (ex instanceof TypeError) && lengthAccessed && !loopAccessed;\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
+ },
+ {
+ "id": "15.4.4.20-4-2",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-4-2.js",
+ "description": "Array.prototype.filter throws ReferenceError if callbackfn is unreferenced",
+ "test": "assertTrue((function testcase() {\n\n var arr = new Array(10);\n try {\n arr.filter(foo); \n }\n catch(e) {\n if(e instanceof ReferenceError)\n return true; \n }\n\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-4-3",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-4-3.js",
+ "description": "Array.prototype.filter throws TypeError if callbackfn is null",
+ "test": "assertTrue((function testcase() {\n\n var arr = new Array(10);\n try {\n arr.filter(null); \n }\n catch(e) {\n if(e instanceof TypeError)\n return true; \n }\n\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-4-4",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-4-4.js",
+ "description": "Array.prototype.filter throws TypeError if callbackfn is boolean",
+ "test": "assertTrue((function testcase() {\n\n var arr = new Array(10);\n try {\n arr.filter(true); \n }\n catch(e) {\n if(e instanceof TypeError)\n return true; \n }\n\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-4-5",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-4-5.js",
+ "description": "Array.prototype.filter throws TypeError if callbackfn is number",
+ "test": "assertTrue((function testcase() {\n\n var arr = new Array(10);\n try {\n arr.filter(5); \n }\n catch(e) {\n if(e instanceof TypeError)\n return true; \n }\n\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-4-6",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-4-6.js",
+ "description": "Array.prototype.filter throws TypeError if callbackfn is string",
+ "test": "assertTrue((function testcase() {\n\n var arr = new Array(10);\n try {\n arr.filter(\"abc\"); \n }\n catch(e) {\n if(e instanceof TypeError)\n return true; \n }\n\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-4-7",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-4-7.js",
+ "description": "Array.prototype.filter throws TypeError if callbackfn is Object without [[Call]] internal method",
+ "test": "assertTrue((function testcase() {\n\n var arr = new Array(10);\n try {\n arr.filter(new Object()); \n }\n catch(e) {\n if(e instanceof TypeError)\n return true; \n }\n\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-4-8",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-4-8.js",
+ "description": "Array.prototype.filter - side effects produced by step 2 are visible when an exception occurs",
+ "test": "assertTrue((function testcase() {\n\n var obj = { 0: 11, 1: 12 };\n\n var accessed = false;\n\n Object.defineProperty(obj, \"length\", {\n get: function () {\n accessed = true;\n return 2;\n },\n configurable: true\n });\n\n try {\n Array.prototype.filter.call(obj, null);\n return false;\n } catch (ex) {\n return ex instanceof TypeError && accessed;\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty))"
+ },
+ {
+ "id": "15.4.4.20-4-9",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-4-9.js",
+ "description": "Array.prototype.filter - side effects produced by step 3 are visible when an exception occurs",
+ "test": "assertTrue((function testcase() {\n\n var obj = { 0: 11, 1: 12 };\n\n var accessed = false;\n\n Object.defineProperty(obj, \"length\", {\n get: function () {\n return {\n toString: function () {\n accessed = true;\n return \"2\";\n }\n };\n },\n configurable: true\n });\n\n try {\n Array.prototype.filter.call(obj, null);\n return false;\n } catch (ex) {\n return ex instanceof TypeError && accessed;\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty))"
+ },
+ {
+ "id": "15.4.4.20-5-1-s",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20-5-1-s.js",
+ "description": "Array.prototype.filter - thisArg not passed to strict callbackfn",
+ "test": "assertTrue((function testcase() {\n var innerThisCorrect = false;\n \n function callbackfn(val, idx, obj) {\n \"use strict\";\n innerThisCorrect = this===undefined;\n return true;\n }\n\n [1].filter(callbackfn);\n return innerThisCorrect; \n }).call(this));\n",
+ "precondition": "(fnSupportsStrict() && fnExists(Array.prototype.filter))",
+ "strict_only": ""
+ },
+ {
+ "id": "15.4.4.20-5-1",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-5-1.js",
+ "description": "Array.prototype.filter - thisArg is passed",
+ "test": "assertTrue((function testcase() {\n this._15_4_4_20_5_1 = false;\n var _15_4_4_20_5_1 = true;\n\n function callbackfn(val, idx, obj) {\n return this._15_4_4_20_5_1;\n }\n var srcArr = [1];\n var resArr = srcArr.filter(callbackfn);\n return resArr.length === 0;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-5-10",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-5-10.js",
+ "description": "Array.prototype.filter - Array Object can be used as thisArg",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n var objArray = new Array(10);\n\n function callbackfn(val, idx, obj) {\n accessed = true;\n return this === objArray;\n }\n\n\n var newArr = [11].filter(callbackfn, objArray);\n\n return newArr[0] === 11 && accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-5-11",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-5-11.js",
+ "description": "Array.prototype.filter - String Object can be used as thisArg",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n var objString = new String();\n\n function callbackfn(val, idx, obj) {\n accessed = true;\n return this === objString;\n }\n\n var newArr = [11].filter(callbackfn, objString);\n\n return newArr[0] === 11 && accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-5-12",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-5-12.js",
+ "description": "Array.prototype.filter - Boolean Object can be used as thisArg",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n var objBoolean = new Boolean();\n\n function callbackfn(val, idx, obj) {\n accessed = true;\n return this === objBoolean;\n }\n\n var newArr = [11].filter(callbackfn, objBoolean);\n\n return newArr[0] === 11 && accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-5-13",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-5-13.js",
+ "description": "Array.prototype.filter - Number Object can be used as thisArg",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n var objNumber = new Number();\n\n function callbackfn(val, idx, obj) {\n accessed = true;\n return this === objNumber;\n }\n\n var newArr = [11].filter(callbackfn, objNumber);\n\n return newArr[0] === 11 && accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-5-14",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-5-14.js",
+ "description": "Array.prototype.filter - the Math object can be used as thisArg",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n\n function callbackfn(val, idx, obj) {\n accessed = true;\n return this === Math;\n }\n\n var newArr = [11].filter(callbackfn, Math);\n\n return newArr[0] === 11 && accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-5-15",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-5-15.js",
+ "description": "Array.prototype.filter - Date Object can be used as thisArg",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n\n var objDate = new Date();\n\n function callbackfn(val, idx, obj) {\n accessed = true;\n return this === objDate;\n }\n\n var newArr = [11].filter(callbackfn, objDate);\n\n return newArr[0] === 11 && accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-5-16",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-5-16.js",
+ "description": "Array.prototype.filter - RegExp Object can be used as thisArg",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n\n var objRegExp = new RegExp();\n\n function callbackfn(val, idx, obj) {\n accessed = true;\n return this === objRegExp;\n }\n\n var newArr = [11].filter(callbackfn, objRegExp);\n\n return newArr[0] === 11 && accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-5-17",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-5-17.js",
+ "description": "Array.prototype.filter - the JSON object can be used as thisArg",
+ "test": "assertTrue((function testcase() {\n var accessed = false;\n\n function callbackfn(val, idx, obj) {\n accessed = true;\n return this === JSON;\n }\n\n var newArr = [11].filter(callbackfn, JSON);\n\n return newArr[0] === 11 && accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-5-18",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-5-18.js",
+ "description": "Array.prototype.filter - Error Object can be used as thisArg",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n var objError = new RangeError();\n\n function callbackfn(val, idx, obj) {\n accessed = true;\n return this === objError;\n }\n\n var newArr = [11].filter(callbackfn, objError);\n\n return newArr[0] === 11 && accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-5-19",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-5-19.js",
+ "description": "Array.prototype.filter - the Arguments object can be used as thisArg",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n var arg;\n\n function callbackfn(val, idx, obj) {\n accessed = true;\n return this === arg;\n }\n\n (function fun() {\n arg = arguments;\n }(1, 2, 3));\n\n var newArr = [11].filter(callbackfn, arg);\n return newArr[0] === 11 && accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-5-2",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-5-2.js",
+ "description": "Array.prototype.filter - thisArg is Object",
+ "test": "assertTrue((function testcase() {\n var res = false;\n var o = new Object();\n o.res = true;\n function callbackfn(val, idx, obj)\n {\n return this.res;\n }\n\n var srcArr = [1];\n var resArr = srcArr.filter(callbackfn,o);\n if( resArr.length === 1)\n return true;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-5-21",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-5-21.js",
+ "description": "Array.prototype.filter - the global object can be used as thisArg",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n\n function callbackfn(val, idx, obj) {\n accessed = true;\n return this === fnGlobalObject();\n }\n\n var newArr = [11].filter(callbackfn, fnGlobalObject());\n\n return newArr[0] === 11 && accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-5-22",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-5-22.js",
+ "description": "Array.prototype.filter - boolean primitive can be used as thisArg",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n\n function callbackfn(val, idx, obj) {\n accessed = true;\n return this.valueOf() === false;\n }\n\n var newArr = [11].filter(callbackfn, false);\n\n return newArr[0] === 11 && accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-5-23",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-5-23.js",
+ "description": "Array.prototype.filter - number primitive can be used as thisArg",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n\n function callbackfn(val, idx, obj) {\n accessed = true;\n return this.valueOf() === 101;\n }\n\n var newArr = [11].filter(callbackfn, 101);\n\n return newArr[0] === 11 && accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-5-24",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-5-24.js",
+ "description": "Array.prototype.filter - string primitive can be used as thisArg",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n\n function callbackfn(val, idx, obj) {\n accessed = true;\n return this.valueOf() === \"abc\";\n }\n\n var newArr = [11].filter(callbackfn, \"abc\");\n\n return newArr[0] === 11 && accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-5-27",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-5-27.js",
+ "description": "Array.prototype.filter - Array.isArray(arg) returns true when arg is the returned array",
+ "test": "assertTrue((function testcase() {\n\n var newArr = [11].filter(function () { });\n\n return Array.isArray(newArr);\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Array.isArray))"
+ },
+ {
+ "id": "15.4.4.20-5-28",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-5-28.js",
+ "description": "Array.prototype.filter - the returned array is instanceof Array",
+ "test": "assertTrue((function testcase() {\n\n var newArr = [11].filter(function () { });\n\n return newArr instanceof Array;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-5-29",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-5-29.js",
+ "description": "Array.prototype.filter - returns an array whose length is 0",
+ "test": "assertTrue((function testcase() {\n\n var newArr = [11].filter(function () { });\n\n return newArr.length === 0;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-5-3",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-5-3.js",
+ "description": "Array.prototype.filter - thisArg is Array",
+ "test": "assertTrue((function testcase() {\n var res = false;\n var a = new Array();\n a.res = true;\n function callbackfn(val, idx, obj)\n {\n return this.res;\n }\n\n var srcArr = [1];\n var resArr = srcArr.filter(callbackfn,a);\n if( resArr.length === 1)\n return true;\n\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-5-30",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-5-30.js",
+ "description": "Array.prototype.filter - thisArg not passed",
+ "test": "assertTrue((function testcase() {\n function innerObj() {\n this._15_4_4_20_5_30 = true;\n var _15_4_4_20_5_30 = false;\n \n function callbackfn(val, idx, obj) {\n return this._15_4_4_20_5_30;\n }\n var srcArr = [1];\n var resArr = srcArr.filter(callbackfn);\n this.retVal = resArr.length === 0;\n }\n return new innerObj().retVal;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-5-4",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-5-4.js",
+ "description": "Array.prototype.filter - thisArg is object from object template(prototype)",
+ "test": "assertTrue((function testcase() {\n var res = false;\n function callbackfn(val, idx, obj)\n {\n return this.res;\n }\n \n function foo(){}\n foo.prototype.res = true;\n var f = new foo();\n\n var srcArr = [1];\n var resArr = srcArr.filter(callbackfn,f);\n if( resArr.length === 1)\n return true; \n\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-5-5",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-5-5.js",
+ "description": "Array.prototype.filter - thisArg is object from object template",
+ "test": "assertTrue((function testcase() {\n var res = false;\n function callbackfn(val, idx, obj)\n {\n return this.res;\n }\n\n function foo(){}\n var f = new foo();\n f.res = true;\n \n var srcArr = [1];\n var resArr = srcArr.filter(callbackfn,f);\n if( resArr.length === 1)\n return true; \n\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-5-6",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-5-6.js",
+ "description": "Array.prototype.filter - thisArg is function",
+ "test": "assertTrue((function testcase() {\n var res = false;\n function callbackfn(val, idx, obj)\n {\n return this.res;\n }\n\n function foo(){}\n foo.res = true;\n \n var srcArr = [1];\n var resArr = srcArr.filter(callbackfn,foo);\n if( resArr.length === 1)\n return true; \n\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-5-7",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-5-7.js",
+ "description": "Array.prototype.filter - built-in functions can be used as thisArg",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n\n function callbackfn(val, idx, obj) {\n accessed = true;\n return this === eval;\n }\n\n var newArr = [11].filter(callbackfn, eval);\n\n return newArr[0] === 11 && accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-5-9",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-5-9.js",
+ "description": "Array.prototype.filter - Function Object can be used as thisArg",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n var objFunction = function () { };\n\n function callbackfn(val, idx, obj) {\n accessed = true;\n return this === objFunction;\n }\n\n var newArr = [11].filter(callbackfn, objFunction);\n\n return newArr[0] === 11 && accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-6-1",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-6-1.js",
+ "description": "Array.prototype.filter returns an empty array if 'length' is 0 (empty array)",
+ "test": "assertTrue((function testcase() {\n function cb(){}\n var a = [].filter(cb);\n if (Array.isArray(a) &&\n a.length === 0) {\n return true;\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-6-2",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-6-2.js",
+ "description": "Array.prototype.filter returns an empty array if 'length' is 0 (subclassed Array, length overridden to null (type conversion))",
+ "test": "assertTrue((function testcase() {\n foo.prototype = new Array(1, 2, 3);\n function foo() {}\n var f = new foo();\n f.length = null;\n \n function cb(){}\n var a = f.filter(cb);\n \n if (Array.isArray(a) &&\n a.length === 0) {\n return true;\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-6-3",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-6-3.js",
+ "description": "Array.prototype.filter returns an empty array if 'length' is 0 (subclassed Array, length overridden to false (type conversion))",
+ "test": "assertTrue((function testcase() {\n foo.prototype = new Array(1, 2, 3);\n function foo() {}\n var f = new foo();\n f.length = false;\n \n function cb(){}\n var a = f.filter(cb);\n \n if (Array.isArray(a) &&\n a.length === 0) {\n return true;\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-6-4",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-6-4.js",
+ "description": "Array.prototype.filter returns an empty array if 'length' is 0 (subclassed Array, length overridden to 0 (type conversion))",
+ "test": "assertTrue((function testcase() {\n foo.prototype = new Array(1, 2, 3);\n function foo() {}\n var f = new foo();\n f.length = 0;\n \n function cb(){}\n var a = f.filter(cb);\n \n if (Array.isArray(a) &&\n a.length === 0) {\n return true;\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-6-5",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-6-5.js",
+ "description": "Array.prototype.filter returns an empty array if 'length' is 0 (subclassed Array, length overridden to '0' (type conversion))",
+ "test": "assertTrue((function testcase() {\n foo.prototype = new Array(1, 2, 3);\n function foo() {}\n var f = new foo();\n f.length = '0';\n \n function cb(){}\n var a = f.filter(cb);\n \n if (Array.isArray(a) &&\n a.length === 0) {\n return true;\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-6-6",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-6-6.js",
+ "description": "Array.prototype.filter returns an empty array if 'length' is 0 (subclassed Array, length overridden with obj with valueOf)",
+ "test": "assertTrue((function testcase() {\n foo.prototype = new Array(1, 2, 3);\n function foo() {}\n var f = new foo();\n \n var o = { valueOf: function () { return 0;}};\n f.length = o;\n \n function cb(){}\n var a = f.filter(cb);\n \n if (Array.isArray(a) &&\n a.length === 0) {\n return true;\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-6-7",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-6-7.js",
+ "description": "Array.prototype.filter returns an empty array if 'length' is 0 (subclassed Array, length overridden with obj w/o valueOf (toString))",
+ "test": "assertTrue((function testcase() {\n foo.prototype = new Array(1, 2, 3);\n function foo() {}\n var f = new foo();\n \n var o = { toString: function () { return '0';}};\n f.length = o;\n \n // objects inherit the default valueOf method of the Object object;\n // that simply returns the itself. Since the default valueOf() method\n // does not return a primitive value, ES next tries to convert the object\n // to a number by calling its toString() method and converting the\n // resulting string to a number.\n\n function cb(){}\n var a = f.filter(cb);\n \n if (Array.isArray(a) &&\n a.length === 0) {\n return true;\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-6-8",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-6-8.js",
+ "description": "Array.prototype.filter returns an empty array if 'length' is 0 (subclassed Array, length overridden with []",
+ "test": "assertTrue((function testcase() {\n foo.prototype = new Array(1, 2, 3);\n function foo() {}\n var f = new foo();\n \n f.length = [];\n \n // objects inherit the default valueOf method of the Object object;\n // that simply returns the itself. Since the default valueOf() method\n // does not return a primitive value, ES next tries to convert the object\n // to a number by calling its toString() method and converting the\n // resulting string to a number.\n //\n // The toString( ) method on Array converts the array elements to strings,\n // then returns the result of concatenating these strings, with commas in\n // between. An array with no elements converts to the empty string, which\n // converts to the number 0. If an array has a single element that is a\n // number n, the array converts to a string representation of n, which is\n // then converted back to n itself. If an array contains more than one element,\n // or if its one element is not a number, the array converts to NaN.\n\n function cb(){}\n var a = f.filter(cb);\n \n if (Array.isArray(a) &&\n a.length === 0) {\n return true;\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-1",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-1.js",
+ "description": "Array.prototype.filter doesn't consider new elements added to array after it is called",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n srcArr[2] = 3;\n srcArr[5] = 6;\n return true;\n }\n\n var srcArr = [1, 2, , 4, 5];\n var resArr = srcArr.filter(callbackfn);\n return resArr.length === 5;\n\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-2",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-2.js",
+ "description": "Array.prototype.filter considers new value of elements in array after it is called",
+ "test": "assertTrue((function testcase() { \n \n function callbackfn(val, idx, obj)\n { \n srcArr[2] = -1;\n srcArr[4] = -1;\n if(val > 0)\n return true;\n else\n return false;\n }\n\n var srcArr = [1,2,3,4,5];\n var resArr = srcArr.filter(callbackfn);\n if(resArr.length === 3 && resArr[0] === 1 && resArr[2] === 4)\n return true; \n \n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-3",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-3.js",
+ "description": "Array.prototype.filter doesn't visit deleted elements in array after the call",
+ "test": "assertTrue((function testcase() { \n \n function callbackfn(val, idx, obj)\n {\n delete srcArr[2];\n delete srcArr[4];\n if(val > 0)\n return true;\n else\n return false;\n }\n\n var srcArr = [1,2,3,4,5];\n var resArr = srcArr.filter(callbackfn);\n if(resArr.length === 3 && resArr[0] === 1 && resArr[2] === 4 ) // two elements deleted\n return true; \n \n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-4",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-4.js",
+ "description": "Array.prototype.filter doesn't visit deleted elements when Array.length is decreased",
+ "test": "assertTrue((function testcase() { \n \n function callbackfn(val, idx, obj)\n {\n srcArr.length = 2;\n return true;\n }\n\n var srcArr = [1,2,3,4,6];\n var resArr = srcArr.filter(callbackfn);\n if(resArr.length === 2 )\n return true; \n \n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-5",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-5.js",
+ "description": "Array.prototype.filter doesn't consider newly added elements in sparse array",
+ "test": "assertTrue((function testcase() { \n \n function callbackfn(val, idx, obj)\n {\n srcArr[1000] = 3;\n return true;\n }\n\n var srcArr = new Array(10);\n srcArr[1] = 1;\n srcArr[2] = 2;\n var resArr = srcArr.filter(callbackfn);\n if( resArr.length === 2) \n return true; \n \n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-6",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-6.js",
+ "description": "Array.prototype.filter visits deleted element in array after the call when same index is also present in prototype",
+ "test": "assertTrue((function testcase() { \n \n function callbackfn(val, idx, obj)\n {\n delete srcArr[2];\n delete srcArr[4];\n if(val > 0)\n return true;\n else\n return false;\n }\n\n Array.prototype[4] = 5;\n var srcArr = [1,2,3,4,5];\n var resArr = srcArr.filter(callbackfn);\n delete Array.prototype[4];\n if(resArr.length === 4 && resArr[0] === 1 && resArr[3] == 5) // only one element deleted\n return true; \n \n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-7",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-7.js",
+ "description": "Array.prototype.filter stops calling callbackfn once the array is deleted during the call",
+ "test": "assertTrue((function testcase() {\n var o = new Object();\n o.srcArr = [1, 2, 3, 4, 5];\n\n function callbackfn(val, idx, obj) {\n delete o.srcArr;\n if (val > 0)\n return true;\n else\n return false;\n }\n\n var resArr = o.srcArr.filter(callbackfn);\n return resArr.length === 5 && typeof o.srcArr === \"undefined\";\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-8",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-8.js",
+ "description": "Array.prototype.filter - no observable effects occur if len is 0",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n\n function callbackfn(val, idx, obj) {\n accessed = true;\n return val > 10;\n }\n\n var obj = { 0: 11, 1: 12, length: 0 };\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return accessed === false && obj.length === 0 && newArr.length === 0;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-9",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-9.js",
+ "description": "Array.prototype.filter - modifications to length don't change number of iterations",
+ "test": "assertTrue((function testcase() {\n\n var called = 0;\n\n function callbackfn(val, idx, obj) {\n called++;\n return true;\n }\n\n var obj = { 1: 12, 2: 9, length: 2 };\n\n Object.defineProperty(obj, \"0\", {\n get: function () {\n obj.length = 3;\n return 11;\n },\n configurable: true\n });\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 2 && 2 === called;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
+ },
+ {
+ "id": "15.4.4.20-9-b-1",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-b-1.js",
+ "description": "Array.prototype.filter - callbackfn not called for indexes never been assigned values",
+ "test": "assertTrue((function testcase() { \n \n var callCnt = 0;\n function callbackfn(val, idx, obj)\n {\n callCnt++;\n return false;\n }\n\n var srcArr = new Array(10);\n srcArr[1] = undefined; //explicitly assigning a value\n var resArr = srcArr.filter(callbackfn);\n if( resArr.length === 0 && callCnt === 1)\n return true; \n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-b-10",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-b-10.js",
+ "description": "Array.prototype.filter - deleting property of prototype causes prototype index property not to be visited on an Array-like Object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return true;\n }\n var obj = { 2: 2, length: 20 };\n\n Object.defineProperty(obj, \"0\", {\n get: function () {\n delete Object.prototype[1];\n return 0;\n },\n configurable: true\n });\n\n try {\n Object.prototype[1] = 1;\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 2 && newArr[1] !== 1;\n } finally {\n delete Object.prototype[1];\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
+ },
+ {
+ "id": "15.4.4.20-9-b-11",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-b-11.js",
+ "description": "Array.prototype.filter - deleting property of prototype causes prototype index property not to be visited on an Array",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return true;\n }\n var arr = [0, , 2];\n\n Object.defineProperty(arr, \"0\", {\n get: function () {\n delete Array.prototype[1];\n return 0;\n },\n configurable: true\n });\n\n try {\n Array.prototype[1] = 1;\n var newArr = arr.filter(callbackfn);\n return newArr.length === 2 && newArr[1] !== 1;\n } finally {\n delete Array.prototype[1];\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && ![, 1].hasOwnProperty(0) && fnSupportsArrayIndexGettersOnArrays())"
+ },
+ {
+ "id": "15.4.4.20-9-b-12",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-b-12.js",
+ "description": "Array.prototype.filter - deleting own property with prototype property causes prototype index property to be visited on an Array-like object",
+ "test": "assertTrue((function testcase() {\n function callbackfn(val, idx, obj) {\n return true;\n }\n var obj = { 0: 0, 1: 111, 2: 2, length: 10 };\n\n Object.defineProperty(obj, \"0\", {\n get: function () {\n delete obj[1];\n return 0;\n },\n configurable: true\n });\n\n try {\n Object.prototype[1] = 1;\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 3 && newArr[1] === 1;\n } finally {\n delete Object.prototype[1];\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
+ },
+ {
+ "id": "15.4.4.20-9-b-13",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-b-13.js",
+ "description": "Array.prototype.filter - deleting own property with prototype property causes prototype index property to be visited on an Array",
+ "test": "assertTrue((function testcase() {\n function callbackfn(val, idx, obj) {\n return val < 3 ? true : false;\n }\n var arr = [0, 111, 2];\n\n Object.defineProperty(arr, \"0\", {\n get: function () {\n delete arr[1];\n return 0;\n },\n configurable: true\n });\n\n try {\n Array.prototype[1] = 1;\n var newArr = arr.filter(callbackfn);\n\n return newArr.length === 3 && newArr[1] === 1;\n } finally {\n delete Array.prototype[1];\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
+ },
+ {
+ "id": "15.4.4.20-9-b-14",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-b-14.js",
+ "description": "Array.prototype.filter - decreasing length of array causes index property not to be visited",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return true;\n }\n var arr = [0, 1, 2, \"last\"];\n\n Object.defineProperty(arr, \"0\", {\n get: function () {\n arr.length = 3;\n return 0;\n },\n configurable: true\n });\n\n var newArr = arr.filter(callbackfn);\n\n\n return newArr.length === 3 && newArr[2] === 2;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
+ },
+ {
+ "id": "15.4.4.20-9-b-15",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-b-15.js",
+ "description": "Array.prototype.filter - decreasing length of array with prototype property causes prototype index property to be visited",
+ "test": "assertTrue((function testcase() {\n function callbackfn(val, idx, obj) {\n return true;\n }\n var arr = [0, 1, 2];\n\n try {\n Object.defineProperty(Array.prototype, \"2\", {\n get: function () {\n return \"prototype\";\n },\n configurable: true\n });\n\n Object.defineProperty(arr, \"1\", {\n get: function () {\n arr.length = 2;\n return 1;\n },\n configurable: true\n });\n\n var newArr = arr.filter(callbackfn);\n\n return newArr.length === 3 && newArr[2] === \"prototype\";\n } finally {\n delete Array.prototype[2];\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
+ },
+ {
+ "id": "15.4.4.20-9-b-16",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-b-16.js",
+ "description": "Array.prototype.filter - decreasing length of array does not delete non-configurable properties",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return true;\n }\n\n var arr = [0, 1, 2];\n\n Object.defineProperty(arr, \"2\", {\n get: function () {\n return \"unconfigurable\";\n },\n configurable: false\n });\n\n Object.defineProperty(arr, \"1\", {\n get: function () {\n arr.length = 2;\n return 1;\n },\n configurable: true\n });\n\n var newArr = arr.filter(callbackfn);\n\n return newArr.length === 3 && newArr[2] === \"unconfigurable\";\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
+ },
+ {
+ "id": "15.4.4.20-9-b-2",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-b-2.js",
+ "description": "Array.prototype.filter - added properties in step 2 are visible here",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return true;\n }\n\n var obj = {};\n\n Object.defineProperty(obj, \"length\", {\n get: function () {\n obj[2] = \"length\";\n return 3;\n },\n configurable: true\n });\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 1 && newArr[0] === \"length\";\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty))"
+ },
+ {
+ "id": "15.4.4.20-9-b-3",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-b-3.js",
+ "description": "Array.prototype.filter - deleted properties in step 2 are visible here",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return true;\n }\n var obj = { 2: 6.99, 8: 19 };\n\n Object.defineProperty(obj, \"length\", {\n get: function () {\n delete obj[2];\n return 10;\n },\n configurable: true\n });\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 1 && newArr[0] !== 6.99;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty))"
+ },
+ {
+ "id": "15.4.4.20-9-b-4",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-b-4.js",
+ "description": "Array.prototype.filter - properties added into own object after current position are visited on an Array-like object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return true;\n }\n\n var obj = { length: 2 };\n\n Object.defineProperty(obj, \"0\", {\n get: function () {\n Object.defineProperty(obj, \"1\", {\n get: function () {\n return 6.99;\n },\n configurable: true\n });\n return 0;\n },\n configurable: true\n });\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 2 && newArr[1] === 6.99;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
+ },
+ {
+ "id": "15.4.4.20-9-b-5",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-b-5.js",
+ "description": "Array.prototype.filter - properties added into own object after current position are visited on an Array",
+ "test": "assertTrue((function testcase() {\n function callbackfn(val, idx, obj) {\n return true;\n }\n\n var arr = [0, , 2];\n\n Object.defineProperty(arr, \"0\", {\n get: function () {\n Object.defineProperty(arr, \"1\", {\n get: function () {\n return 6.99;\n },\n configurable: true\n });\n return 0;\n },\n configurable: true\n });\n\n var newArr = arr.filter(callbackfn);\n\n return newArr.length === 3 && newArr[1] === 6.99;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
+ },
+ {
+ "id": "15.4.4.20-9-b-6",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-b-6.js",
+ "description": "Array.prototype.filter - properties can be added to prototype after current position are visited on an Array-like object",
+ "test": "assertTrue((function testcase() {\n function callbackfn(val, idx, obj) {\n return true;\n }\n var obj = { length: 2 };\n\n try {\n Object.defineProperty(obj, \"0\", {\n get: function () {\n Object.defineProperty(Object.prototype, \"1\", {\n get: function () {\n return 6.99;\n },\n configurable: true\n });\n return 0;\n },\n configurable: true\n });\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 2 && Array[1] === 6.99;\n } finally {\n delete Object.prototype[1];\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
+ },
+ {
+ "id": "15.4.4.20-9-b-7",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-b-7.js",
+ "description": "Array.prototype.filter - properties can be added to prototype after current position are visited on an Array",
+ "test": "assertTrue((function testcase() {\n function callbackfn(val, idx, obj) {\n return true;\n }\n var arr = [0, , 2];\n\n try {\n Object.defineProperty(arr, \"0\", {\n get: function () {\n Object.defineProperty(Array.prototype, \"1\", {\n get: function () {\n return 6.99;\n },\n configurable: true\n });\n return 0;\n },\n configurable: true\n });\n\n var newArr = arr.filter(callbackfn);\n\n return newArr.length === 3 && newArr[1] === 6.99;\n } finally {\n delete Array.prototype[1];\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && ![, 1].hasOwnProperty(0) && fnSupportsArrayIndexGettersOnArrays())"
+ },
+ {
+ "id": "15.4.4.20-9-b-8",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-b-8.js",
+ "description": "Array.prototype.filter - deleting own property causes index property not to be visited on an Array-like object",
+ "test": "assertTrue((function testcase() {\n var accessed = false;\n var obj = { length: 2 };\n\n function callbackfn(val, idx, o) {\n accessed = true;\n return true;\n }\n\n Object.defineProperty(obj, \"1\", {\n get: function () {\n return 6.99;\n },\n configurable: true\n });\n\n Object.defineProperty(obj, \"0\", {\n get: function () {\n delete obj[1];\n return 0;\n },\n configurable: true\n });\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 1 && newArr[0] === 0;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
+ },
+ {
+ "id": "15.4.4.20-9-b-9",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-b-9.js",
+ "description": "Array.prototype.filter - deleting own property causes index property not to be visited on an Array",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return true;\n }\n var arr = [1, 2];\n\n Object.defineProperty(arr, \"1\", {\n get: function () {\n return \"6.99\";\n },\n configurable: true\n });\n\n Object.defineProperty(arr, \"0\", {\n get: function () {\n delete arr[1];\n return 0;\n },\n configurable: true\n });\n\n var newArr = arr.filter(callbackfn);\n\n return newArr.length === 1 && newArr[0] === 0;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-1",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-1.js",
+ "description": "Array.prototype.filter - element to be retrieved is own data property on an Array-like object",
+ "test": "assertTrue((function testcase() {\n\n var kValue = {};\n function callbackfn(val, idx, obj) {\n return (idx === 5) && (val === kValue);\n }\n\n var obj = { 5: kValue, length: 100 };\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 1 && newArr[0] === kValue;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-10",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-10.js",
+ "description": "Array.prototype.filter - element to be retrieved is own accessor property on an Array",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return idx === 2 && val === 12;\n }\n\n var arr = [];\n\n Object.defineProperty(arr, \"2\", {\n get: function () {\n return 12;\n },\n configurable: true\n });\n var newArr = arr.filter(callbackfn);\n\n return newArr.length === 1 && newArr[0] === 12;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-11",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-11.js",
+ "description": "Array.prototype.filter - element to be retrieved is own accessor property that overrides an inherited data property on an Array-like object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return idx === 0 && val === 11;\n }\n\n var proto = { 0: 5, 1: 6 };\n\n var Con = function () { };\n Con.prototype = proto;\n\n var child = new Con();\n child.length = 10;\n\n Object.defineProperty(child, \"0\", {\n get: function () {\n return 11;\n },\n configurable: true\n });\n var newArr = Array.prototype.filter.call(child, callbackfn);\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-12",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-12.js",
+ "description": " Array.prototype.filter - element to be retrieved is own accessor property that overrides an inherited data property on an Array",
+ "test": "assertTrue((function testcase() {\n function callbackfn(val, idx, obj) {\n return val === 111 && idx === 0;\n }\n\n var arr = [];\n try {\n Array.prototype[0] = 10;\n\n Object.defineProperty(arr, \"0\", {\n get: function () {\n return 111;\n },\n configurable: true\n });\n var newArr = arr.filter(callbackfn);\n\n return newArr.length === 1 && newArr[0] === 111;\n } finally {\n delete Array.prototype[0];\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-13",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-13.js",
+ "description": "Array.prototype.filter - element to be retrieved is own accessor property that overrides an inherited accessor property on an Array-like object",
+ "test": "assertTrue((function testcase() {\n function callbackfn(val, idx, obj) {\n return idx === 1 && val === 12;\n }\n\n var proto = {};\n\n Object.defineProperty(proto, \"1\", {\n get: function () {\n return 6;\n },\n configurable: true\n });\n\n var Con = function () { };\n Con.prototype = proto;\n\n var child = new Con();\n child.length = 10;\n\n Object.defineProperty(child, \"1\", {\n get: function () {\n return 12;\n },\n configurable: true\n });\n var newArr = Array.prototype.filter.call(child, callbackfn);\n\n return newArr.length === 1 && newArr[0] === 12;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-14",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-14.js",
+ "description": " Array.prototype.filter - element to be retrieved is own accessor property that overrides an inherited accessor property on an Array",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return idx === 0 && val === 11;\n }\n\n var arr = [];\n try {\n Object.defineProperty(Array.prototype, \"0\", {\n get: function () {\n return 5;\n },\n configurable: true\n });\n\n Object.defineProperty(arr, \"0\", {\n get: function () {\n return 11;\n },\n configurable: true\n });\n var newArr = arr.filter(callbackfn);\n\n return newArr.length === 1 && newArr[0] === 11;\n } finally {\n delete Array.prototype[0];\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-15",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-15.js",
+ "description": "Array.prototype.filter - element to be retrieved is inherited accessor property on an Array-like object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return val === 11 && idx === 1;\n }\n\n var proto = {};\n\n Object.defineProperty(proto, \"1\", {\n get: function () {\n return 11;\n },\n configurable: true\n });\n\n var Con = function () { };\n Con.prototype = proto;\n\n var child = new Con();\n child.length = 20;\n var newArr = Array.prototype.filter.call(child, callbackfn);\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-16",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-16.js",
+ "description": "Array.prototype.filter - element to be retrieved is inherited accessor property on an Array",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return idx === 0 && val === 11;\n }\n\n try {\n Object.defineProperty(Array.prototype, \"0\", {\n get: function () {\n return 11;\n },\n configurable: true\n });\n var newArr = [, , , ].filter(callbackfn);\n\n return newArr.length === 1 && newArr[0] === 11;\n } finally {\n delete Array.prototype[0];\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && ![, 1].hasOwnProperty(0) && fnSupportsArrayIndexGettersOnArrays())"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-17",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-17.js",
+ "description": "Array.prototype.filter - element to be retrieved is own accessor property without a get function on an Array-like object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return undefined === val && idx === 1;\n }\n\n var obj = { length: 2 };\n Object.defineProperty(obj, \"1\", {\n set: function () { },\n configurable: true\n });\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 1 && newArr[0] === undefined;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-18",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-18.js",
+ "description": "Array.prototype.filter - element to be retrieved is own accessor property without a get function on an Array",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return undefined === val && idx === 0;\n }\n\n var arr = [];\n\n Object.defineProperty(arr, \"0\", {\n set: function () { },\n configurable: true\n });\n\n var newArr = arr.filter(callbackfn);\n\n return newArr.length === 1 && newArr[0] === undefined;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-19",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-19.js",
+ "description": "Array.prototype.filter - element to be retrieved is own accessor property without a get function that overrides an inherited accessor property on an Array-like object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return undefined === val && idx === 1;\n }\n\n var obj = { length: 2 };\n Object.defineProperty(obj, \"1\", {\n set: function () { },\n configurable: true\n });\n try {\n Object.prototype[1] = 10;\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 1 && newArr[0] === undefined;\n } finally {\n delete Object.prototype[1];\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-2",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-2.js",
+ "description": "Array.prototype.filter - element to be retrieved is own data property on an Array",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n if (idx === 0) {\n return val === 11;\n }\n }\n\n var newArr = [11].filter(callbackfn);\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-20",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-20.js",
+ "description": "Array.prototype.filter - element to be retrieved is own accessor property without a get function that overrides an inherited accessor property on an Array",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return undefined === val && idx === 0;\n }\n\n var arr = [];\n\n Object.defineProperty(arr, \"0\", {\n set: function () { },\n configurable: true\n });\n\n try {\n Array.prototype[0] = 100;\n var newArr = arr.filter(callbackfn);\n\n return newArr.length === 1 && newArr[0] === undefined;\n } finally {\n delete Array.prototype[0];\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-21",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-21.js",
+ "description": "Array.prototype.filter - element to be retrieved is inherited accessor property without a get function on an Array-like object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return val === undefined && idx === 1;\n }\n\n var proto = {};\n Object.defineProperty(proto, \"1\", {\n set: function () { },\n configurable: true\n });\n\n var Con = function () { };\n Con.prototype = proto;\n\n var child = new Con();\n child.length = 2;\n var newArr = Array.prototype.filter.call(child, callbackfn);\n\n return newArr.length === 1 && newArr[0] === undefined;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-22",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-22.js",
+ "description": "Array.prototype.filter - element to be retrieved is inherited accessor property without a get function on an Array",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return undefined === val && idx === 0;\n }\n\n try {\n Object.defineProperty(Array.prototype, \"0\", {\n set: function () { },\n configurable: true\n });\n var newArr = [, ].filter(callbackfn);\n\n return newArr.length === 1 && newArr[0] === undefined;\n } finally {\n delete Array.prototype[0];\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && ![, 1].hasOwnProperty(0) && fnSupportsArrayIndexGettersOnArrays())"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-23",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-23.js",
+ "description": "Array.prototype.filter - This object is the global object which contains index property",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return idx === 0 && val === 11;\n }\n\n try {\n var oldLen = fnGlobalObject().length;\n fnGlobalObject()[0] = 11;\n fnGlobalObject().length = 1;\n var newArr = Array.prototype.filter.call(fnGlobalObject(), callbackfn);\n return newArr.length === 1 && newArr[0] === 11;\n } finally {\n delete fnGlobalObject()[0];\n fnGlobalObject().length = oldLen;\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-25",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-25.js",
+ "description": "Array.prototype.filter - This object is the Arguments object which implements its own property get method (number of arguments is less than number of parameters)",
+ "test": "assertTrue((function testcase() {\n function callbackfn(val, idx, obj) {\n return val === 11 && idx === 0;\n }\n\n var func = function (a, b) {\n return Array.prototype.filter.call(arguments, callbackfn);\n };\n\n var newArr = func(11);\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-26",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-26.js",
+ "description": "Array.prototype.filter - This object is the Arguments object which implements its own property get method (number of arguments equals number of parameters)",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n if (idx === 0) {\n return val === 11;\n } else if (idx === 1) {\n return val === 9;\n } else {\n return false;\n }\n }\n\n var func = function (a, b) {\n return Array.prototype.filter.call(arguments, callbackfn);\n };\n var newArr = func(11, 9);\n\n return newArr.length === 2 && newArr[0] === 11 &&\n newArr[1] === 9;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-27",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-27.js",
+ "description": "Array.prototype.filter - This object is the Arguments object which implements its own property get method (number of arguments is greater than number of parameters)",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n if (idx === 0) {\n return val === 11;\n } else if (idx === 1) {\n return val === 12;\n } else if (idx === 2) {\n return val === 9;\n } else {\n return false;\n }\n }\n\n var func = function (a, b) {\n return Array.prototype.filter.call(arguments, callbackfn);\n };\n var newArr = func(11, 12, 9);\n\n return newArr.length === 3 && newArr[0] === 11 &&\n newArr[1] === 12 && newArr[2] === 9;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-28",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-28.js",
+ "description": "Array.prototype.filter - element changed by getter on previous iterations is observed on an Array",
+ "test": "assertTrue((function testcase() {\n\n var preIterVisible = false;\n var arr = [];\n\n function callbackfn(val, idx, obj) {\n return idx === 1 && val === 9;\n }\n\n Object.defineProperty(arr, \"0\", {\n get: function () {\n preIterVisible = true;\n return 11;\n },\n configurable: true\n });\n\n Object.defineProperty(arr, \"1\", {\n get: function () {\n if (preIterVisible) {\n return 9;\n } else {\n return 11;\n }\n },\n configurable: true\n });\n var newArr = arr.filter(callbackfn);\n\n return newArr.length === 1 && newArr[0] === 9;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-29",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-29.js",
+ "description": "Array.prototype.filter - element changed by getter on previous iterations is observed on an Array-like object",
+ "test": "assertTrue((function testcase() {\n function callbackfn(val, idx, obj) {\n return val === 9 && idx === 1;\n }\n\n var preIterVisible = false;\n var obj = { length: 2 };\n\n Object.defineProperty(obj, \"0\", {\n get: function () {\n preIterVisible = true;\n return 11;\n },\n configurable: true\n });\n\n Object.defineProperty(obj, \"1\", {\n get: function () {\n if (preIterVisible) {\n return 9;\n } else {\n return 13;\n }\n },\n configurable: true\n });\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 1 && newArr[0] === 9;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-3",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-3.js",
+ "description": "Array.prototype.filter - element to be retrieved is own data property that overrides an inherited data property on an Array-like object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return (idx === 5) && (val === \"abc\");\n }\n\n var proto = { 0: 11, 5: 100 };\n\n var Con = function () { };\n Con.prototype = proto;\n\n var child = new Con();\n child[5] = \"abc\";\n child.length = 10;\n\n var newArr = Array.prototype.filter.call(child, callbackfn);\n\n return newArr.length === 1 && newArr[0] === \"abc\";\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-30",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-30.js",
+ "description": "Array.prototype.filter - unnhandled exceptions happened in getter terminate iteration on an Array-like object",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n function callbackfn(val, idx, obj) {\n if (idx > 1) {\n accessed = true;\n }\n return true;\n }\n\n var obj = { 0: 11, 5: 10, 10: 8, length: 20 };\n Object.defineProperty(obj, \"1\", {\n get: function () {\n throw new RangeError(\"unhandle exception happened in getter\");\n },\n configurable: true\n });\n\n try {\n Array.prototype.filter.call(obj, callbackfn);\n return false;\n } catch (ex) {\n return (ex instanceof RangeError) && !accessed;\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-31",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-31.js",
+ "description": "Array.prototype.filter - unnhandled exceptions happened in getter terminate iteration on an Array",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n function callbackfn(val, idx, obj) {\n if (idx > 1) {\n accessed = true;\n }\n return true;\n }\n\n var arr = [];\n arr[5] = 10;\n arr[10] = 100;\n\n Object.defineProperty(arr, \"1\", {\n get: function () {\n throw new RangeError(\"unhandle exception happened in getter\");\n },\n configurable: true\n });\n\n try {\n arr.filter(callbackfn);\n return false;\n } catch (ex) {\n return (ex instanceof RangeError) && !accessed;\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-4",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-4.js",
+ "description": "Array.prototype.filter - element to be retrieved is own data property that overrides an inherited data property on an Array",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return (idx === 0) && (val === 12);\n }\n\n try {\n Array.prototype[0] = 11;\n var newArr = [12].filter(callbackfn);\n\n return newArr.length === 1 && newArr[0] === 12;\n } finally {\n delete Array.prototype[0];\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-5",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-5.js",
+ "description": "Array.prototype.filter - element to be retrieved is own data property that overrides an inherited accessor property on an Array-like object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return idx === 0 && val === 11;\n }\n\n var proto = {};\n\n Object.defineProperty(proto, \"0\", {\n get: function () {\n return 5;\n },\n configurable: true\n });\n\n var Con = function () { };\n Con.prototype = proto;\n\n var child = new Con();\n child.length = 2;\n Object.defineProperty(child, \"0\", {\n value: 11,\n configurable: true\n });\n child[1] = 12;\n\n var newArr = Array.prototype.filter.call(child, callbackfn);\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-6",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-6.js",
+ "description": "Array.prototype.filter - element to be retrieved is own data property that overrides an inherited accessor property on an Array",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return val === 11;\n }\n\n try {\n Object.defineProperty(Array.prototype, \"0\", {\n get: function () {\n return 9;\n },\n configurable: true\n });\n var newArr = [11].filter(callbackfn);\n\n return newArr.length === 1 && newArr[0] === 11;\n } finally {\n delete Array.prototype[0];\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-7",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-7.js",
+ "description": "Array.prototype.filter - element to be retrieved is inherited data property on an Array-like object",
+ "test": "assertTrue((function testcase() {\n\n var kValue = 'abc';\n\n function callbackfn(val, idx, obj) {\n return (idx === 5) && (val === kValue);\n }\n\n var proto = { 5: kValue };\n\n var Con = function () { };\n Con.prototype = proto;\n\n var child = new Con();\n child.length = 10;\n\n var newArr = Array.prototype.filter.call(child, callbackfn);\n\n return newArr.length === 1 && newArr[0] === kValue;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-8",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-8.js",
+ "description": "Array.prototype.filter - element to be retrieved is inherited data property on an Array",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return (idx === 1) && (val === 13);\n }\n\n try {\n Array.prototype[1] = 13;\n var newArr = [, , , ].filter(callbackfn);\n\n return newArr.length === 1 && newArr[0] === 13;\n } finally {\n delete Array.prototype[1];\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && ![, 1].hasOwnProperty(0))"
+ },
+ {
+ "id": "15.4.4.20-9-c-i-9",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-i-9.js",
+ "description": "Array.prototype.filter - element to be retrieved is own accessor property on an Array-like object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return (idx === 0) && (val === 11);\n }\n\n var obj = { 10: 10, length: 20 };\n\n Object.defineProperty(obj, \"0\", {\n get: function () {\n return 11;\n },\n configurable: true\n });\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
+ },
+ {
+ "id": "15.4.4.20-9-c-ii-1",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-ii-1.js",
+ "description": "Array.prototype.filter - callbackfn called with correct parameters",
+ "test": "assertTrue((function testcase() { \n \n var bPar = true;\n var bCalled = false;\n function callbackfn(val, idx, obj)\n {\n bCalled = true;\n if(obj[idx] !== val)\n bPar = false;\n }\n\n var srcArr = [0,1,true,null,new Object(),\"five\"];\n srcArr[999999] = -6.6;\n var resArr = srcArr.filter(callbackfn);\n \n if(bCalled === true && bPar === true)\n return true;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-ii-10",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-ii-10.js",
+ "description": "Array.prototype.filter - callbackfn is called with 1 formal parameter",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val) {\n return val > 10;\n }\n var newArr = [12].filter(callbackfn);\n\n return newArr.length === 1 && newArr[0] === 12;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-ii-11",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-ii-11.js",
+ "description": "Array.prototype.filter - callbackfn is called with 2 formal parameter",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx) {\n return val > 10 && arguments[2][idx] === val;\n }\n var newArr = [11].filter(callbackfn);\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-ii-12",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-ii-12.js",
+ "description": "Array.prototype.filter - callbackfn is called with 3 formal parameter",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return val > 10 && obj[idx] === val;\n }\n var newArr = [11].filter(callbackfn);\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-ii-13",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-ii-13.js",
+ "description": "Array.prototype.filter - callbackfn that uses arguments object to get parameter value",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn() {\n return arguments[2][arguments[1]] === arguments[0];\n }\n var newArr = [11].filter(callbackfn);\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-ii-16",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-ii-16.js",
+ "description": "Array.prototype.filter - 'this' of 'callbackfn' is a Boolean object when T is not an object (T is a boolean)",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return this.valueOf() === false;\n }\n\n var obj = { 0: 11, length: 2 };\n var newArr = Array.prototype.filter.call(obj, callbackfn, false);\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-ii-17",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-ii-17.js",
+ "description": "Array.prototype.filter -'this' of 'callbackfn' is a Number object when T is not an object (T is a number)",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, o) {\n return 5 === this.valueOf();\n }\n\n var obj = { 0: 11, length: 2 };\n var newArr = Array.prototype.filter.call(obj, callbackfn, 5);\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-ii-18",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-ii-18.js",
+ "description": "Array.prototype.filter - 'this' of 'callbackfn' is an String object when T is not an object (T is a string)",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return 'hello' === this.valueOf();\n }\n\n var obj = { 0: 11, length: 2 };\n var newArr = Array.prototype.filter.call(obj, callbackfn, \"hello\");\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-ii-19",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-ii-19.js",
+ "description": "Array.prototype.filter - non-indexed properties are not called",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n\n function callbackfn(val, idx, obj) {\n accessed = true;\n return val === 8;\n }\n\n var obj = { 0: 11, non_index_property: 8, 2: 5, length: 20 };\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 0 && accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-ii-2",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-ii-2.js",
+ "description": "Array.prototype.filter - callbackfn takes 3 arguments",
+ "test": "assertTrue((function testcase() { \n \n var parCnt = 3;\n var bCalled = false\n function callbackfn(val, idx, obj)\n { \n bCalled = true;\n if(arguments.length !== 3)\n parCnt = arguments.length; //verify if callbackfn was called with 3 parameters\n }\n\n var srcArr = [0,1,2,3,4,5,6,7,8,9];\n var resArr = srcArr.filter(callbackfn);\n if(bCalled === true && parCnt === 3)\n return true;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-ii-20",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-ii-20.js",
+ "description": "Array.prototype.filter - callbackfn called with correct parameters (thisArg is correct)",
+ "test": "assertTrue((function testcase() {\n\n var thisArg = { threshold: 10 };\n\n function callbackfn(val, idx, obj) {\n return this === thisArg;\n }\n\n var obj = { 0: 11, length: 1 };\n var newArr = Array.prototype.filter.call(obj, callbackfn, thisArg);\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-ii-21",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-ii-21.js",
+ "description": "Array.prototype.filter - callbackfn called with correct parameters (kValue is correct)",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n if (idx === 0) {\n return val === 11;\n }\n\n if (idx === 1) {\n return val === 12;\n }\n\n return false;\n }\n\n var obj = { 0: 11, 1: 12, length: 2 };\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 2 && newArr[0] === 11 && newArr[1] === 12;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-ii-22",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-ii-22.js",
+ "description": "Array.prototype.filter - callbackfn called with correct parameters (the index k is correct)",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n if (val === 11) {\n return idx === 0;\n }\n\n if (val === 12) {\n return idx === 1;\n }\n\n return false;\n }\n\n var obj = { 0: 11, 1: 12, length: 2 };\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 2 && newArr[0] === 11 && newArr[1] === 12;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-ii-23",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-ii-23.js",
+ "description": "Array.prototype.filter - callbackfn called with correct parameters (this object O is correct)",
+ "test": "assertTrue((function testcase() {\n\n var obj = { 0: 11, length: 2 };\n\n function callbackfn(val, idx, o) {\n return obj === o;\n }\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-ii-4",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-ii-4.js",
+ "description": "Array.prototype.filter - k values are passed in ascending numeric order",
+ "test": "assertTrue((function testcase() {\n\n var arr = [0, 1, 2, 3, 4, 5];\n var lastIdx = 0;\n var called = 0;\n function callbackfn(val, idx, o) {\n called++;\n if (lastIdx !== idx) {\n return false;\n } else {\n lastIdx++;\n return true;\n }\n }\n var newArr = arr.filter(callbackfn);\n\n return newArr.length === called;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-ii-5",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-ii-5.js",
+ "description": "Array.prototype.filter - k values are accessed during each iteration and not prior to starting the loop on an Array",
+ "test": "assertTrue((function testcase() {\n\n var kIndex = [];\n var called = 0;\n\n //By below way, we could verify that k would be setted as 0, 1, ..., length - 1 in order, and each value will be setted one time.\n function callbackfn(val, idx, obj) {\n called++;\n //Each position should be visited one time, which means k is accessed one time during iterations.\n if (kIndex[idx] === undefined) {\n //when current position is visited, its previous index should has been visited.\n if (idx !== 0 && kIndex[idx - 1] === undefined) {\n return true;\n }\n kIndex[idx] = 1;\n return false;\n } else {\n return true;\n }\n }\n var newArr = [11, 12, 13, 14].filter(callbackfn, undefined);\n\n return newArr.length === 0 && called === 4;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-ii-6",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-ii-6.js",
+ "description": "Array.prototype.filter - arguments to callbackfn are self consistent",
+ "test": "assertTrue((function testcase() {\n\n var obj = { 0: 11, length: 1 };\n var thisArg = {};\n\n function callbackfn() {\n return this === thisArg &&\n arguments[0] === 11 &&\n arguments[1] === 0 &&\n arguments[2] === obj;\n }\n\n var newArr = Array.prototype.filter.call(obj, callbackfn, thisArg);\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-ii-7",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-ii-7.js",
+ "description": "Array.prototype.filter - unhandled exceptions happened in callbackfn terminate iteration",
+ "test": "assertTrue((function testcase() {\n\n var called = 0;\n\n function callbackfn(val, idx, obj) {\n called++;\n if (called === 1) {\n throw new Error(\"Exception occurred in callbackfn\");\n }\n return true;\n }\n\n var obj = { 0: 11, 4: 10, 10: 8, length: 20 };\n\n try {\n Array.prototype.filter.call(obj, callbackfn);\n return false;\n } catch (ex) {\n return 1 === called && ex instanceof Error;\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-ii-8",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-ii-8.js",
+ "description": "Array.prototype.filter - element changed by callbackfn on previous iterations is observed",
+ "test": "assertTrue((function testcase() {\n\n var obj = { 0: 11, 1: 12, length: 2 };\n\n function callbackfn(val, idx, o) {\n if (idx === 0) {\n obj[idx + 1] = 8;\n }\n return val > 10;\n }\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-ii-9",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-ii-9.js",
+ "description": "Array.prototype.filter - callbackfn is called with 0 formal parameter",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn() {\n return true;\n }\n var newArr = [11].filter(callbackfn);\n\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-1-1",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-1-1.js",
+ "description": "Array.prototype.filter - value of returned array element equals to 'kValue'",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return true;\n }\n\n var obj = { 0: 11, 1: 9, length: 2 };\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n return newArr[0] === obj[0] && newArr[1] === obj[1];\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-1-2",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-1-2.js",
+ "description": "Array.prototype.filter - value of returned array element can be overwritten",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return true;\n }\n\n var obj = { 0: 11, 1: 9, length: 2 };\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n try {\n var tempVal = newArr[1];\n newArr[1] += 1;\n return newArr[1] !== tempVal;\n } catch (ex) {\n return false;\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-1-3",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-1-3.js",
+ "description": "Array.prototype.filter - value of returned array element can be enumerated",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return true;\n }\n\n var obj = { 0: 11, length: 2 };\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n var prop;\n var enumerable = false;\n for (prop in newArr) {\n if (newArr.hasOwnProperty(prop)) {\n if (prop === \"0\") {\n enumerable = true;\n }\n }\n }\n\n return enumerable;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-1-4",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-1-4.js",
+ "description": "Array.prototype.filter - value of returned array element can be changed or deleted",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return true;\n }\n\n var obj = { 0: 11, 1: 9, length: 2 };\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n\n try {\n var tempVal = newArr[1];\n delete newArr[1];\n return tempVal !== undefined && newArr[1] === undefined;\n } catch (ex) {\n return false;\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-1-5",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-1-5.js",
+ "description": "Array.prototype.filter - values of 'to' are passed in acending numeric order",
+ "test": "assertTrue((function testcase() {\n\n var arr = [0, 1, 2, 3, 4];\n var lastToIdx = 0;\n var called = 0;\n function callbackfn(val, idx, obj) {\n called++;\n if (lastToIdx !== idx) {\n return false;\n } else {\n lastToIdx++;\n return true;\n }\n }\n var newArr = arr.filter(callbackfn);\n\n return newArr.length === 5 && called === 5;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-1-6",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-1-6.js",
+ "description": "Array.prototype.filter - values of 'to' are accessed during each iteration when 'selected' is converted to true and not prior to starting the loop",
+ "test": "assertTrue((function testcase() {\n\n var toIndex = [];\n var called = 0;\n\n //By below way, we could verify that 'to' would be setted as 0, 1, ..., length - 1 in order, and each value will be setted one time.\n function callbackfn(val, idx, obj) {\n called++;\n //Each position should be visited one time, which means 'to' is accessed one time during iterations.\n if (toIndex[idx] === undefined) {\n //when current position is visited, its previous index should has been visited.\n if (idx !== 0 && toIndex[idx - 1] === undefined) {\n return false;\n }\n toIndex[idx] = 1;\n return true;\n } else {\n return false;\n }\n }\n var newArr = [11, 12, 13, 14].filter(callbackfn, undefined);\n\n return newArr.length === 4 && called === 4;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-1",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-1.js",
+ "description": "Array.prototype.filter - getOwnPropertyDescriptor(all true) of returned array element",
+ "test": "assertTrue((function testcase() {\n \n function callbackfn(val, idx, obj){\n if(val % 2)\n return true; \n else\n return false;\n }\n var srcArr = [0,1,2,3,4];\n var resArr = srcArr.filter(callbackfn);\n if (resArr.length > 0){\n var desc = Object.getOwnPropertyDescriptor(resArr, 1) \n if(desc.value === 3 && //srcArr[1] = true\n desc.writable === true &&\n desc.enumerable === true &&\n desc.configurable === true){\n return true;\n }\n }\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-10",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-10.js",
+ "description": "Array.prototype.filter return value of callbackfn is a number (value is negative number)",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return -5;\n }\n\n var newArr = [11].filter(callbackfn);\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-11",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-11.js",
+ "description": "Array.prototype.filter return value of callbackfn is a number (value is Infinity)",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return Infinity;\n }\n\n var newArr = [11].filter(callbackfn);\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-12",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-12.js",
+ "description": "Array.prototype.filter return value of callbackfn is a number (value is -Infinity)",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return -Infinity;\n }\n\n var newArr = [11].filter(callbackfn);\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-13",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-13.js",
+ "description": "Array.prototype.filter return value of callbackfn is a number (value is NaN)",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n\n function callbackfn(val, idx, obj) {\n accessed = true;\n return NaN;\n }\n\n var newArr = [11].filter(callbackfn);\n return newArr.length === 0 && accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-14",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-14.js",
+ "description": "Array.prototype.filter return value of callbackfn is an empty string",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n\n function callbackfn(val, idx, obj) {\n accessed = true;\n return \"\";\n }\n\n var newArr = [11].filter(callbackfn);\n return newArr.length === 0 && accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-15",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-15.js",
+ "description": "Array.prototype.filter return value of callbackfn is a non-empty string",
+ "test": "assertTrue((function testcase() {\n \n function callbackfn(val, idx, obj) {\n return \"non-empty string\";\n }\n\n var newArr = [11].filter(callbackfn);\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-16",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-16.js",
+ "description": "Array.prototype.filter return value of callbackfn is a Function object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return function () { };\n }\n\n var newArr = [11].filter(callbackfn);\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-17",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-17.js",
+ "description": "Array.prototype.filter return value of callbackfn is an Array object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return new Array(10);\n }\n\n var newArr = [11].filter(callbackfn);\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-18",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-18.js",
+ "description": "Array.prototype.filter return value of callbackfn is a String object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return new String();\n }\n\n var newArr = [11].filter(callbackfn);\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-19",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-19.js",
+ "description": "Array.prototype.filter return value of callbackfn is a Boolean object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return new Boolean();\n }\n\n var newArr = [11].filter(callbackfn);\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-2",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-2.js",
+ "description": "Array.prototype.filter - return value of callbackfn is undefined",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n\n function callbackfn(val, idx, o) {\n accessed = true;\n return undefined;\n }\n\n var obj = { 0: 11, length: 1 };\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n return newArr.length === 0 && accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-20",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-20.js",
+ "description": "Array.prototype.filter - return value of callbackfn is a Number object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return new Number();\n }\n\n var newArr = [11].filter(callbackfn);\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-21",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-21.js",
+ "description": "Array.prototype.filter - return value of callbackfn is the Math object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return Math;\n }\n\n var newArr = [11].filter(callbackfn);\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-22",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-22.js",
+ "description": "Array.prototype.filter - return value of callbackfn is a Date object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return new Date();\n }\n\n var newArr = [11].filter(callbackfn);\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-23",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-23.js",
+ "description": "Array.prototype.filter - return value of callbackfn is a RegExp object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return new RegExp();\n }\n\n var newArr = [11].filter(callbackfn);\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-24",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-24.js",
+ "description": "Array.prototype.filter - return value of callbackfn is the JSON object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return JSON;\n }\n\n var newArr = [11].filter(callbackfn);\n return newArr.length === 1 && newArr[0] === 11;\n\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-25",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-25.js",
+ "description": "Array.prototype.filter - return value of callbackfn is an Error object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return new EvalError();\n }\n\n var newArr = [11].filter(callbackfn);\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-26",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-26.js",
+ "description": "Array.prototype.filter - return value of callbackfn is the Arguments object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return arguments;\n }\n\n var newArr = [11].filter(callbackfn);\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-28",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-28.js",
+ "description": "Array.prototype.filter - return value of callbackfn is the global object",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return fnGlobalObject();\n }\n\n var newArr = [11].filter(callbackfn);\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-29",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-29.js",
+ "description": "Array.prototype.filter - false prevents element added to output Array",
+ "test": "assertTrue((function testcase() {\n\n var called = 0;\n\n function callbackfn(val, idx, obj) {\n called++;\n return val > 10;\n }\n\n var obj = { 0: 11, 1: 8, length: 20 };\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n return newArr.length === 1 && newArr[0] !== 8 && called === 2;\n\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-3",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-3.js",
+ "description": "Array.prototype.filter - return value of callbackfn is null",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n\n function callbackfn(val, idx, obj) {\n accessed = true;\n return null;\n }\n\n var obj = { 0: 11, length: 1 };\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n return newArr.length === 0 && accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-30",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-30.js",
+ "description": "Array.prototype.filter - return value (new Boolean(false)) of callbackfn is treated as true value",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return new Boolean(false);\n }\n\n var newArr = [11].filter(callbackfn);\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-4",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-4.js",
+ "description": "Array.prototype.filter - return value of callbackfn is a boolean (value is false)",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n\n function callbackfn(val, idx, obj) {\n accessed = true;\n return false;\n }\n\n var obj = { 0: 11, length: 1 };\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n return newArr.length === 0 && accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-5",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-5.js",
+ "description": "Array.prototype.filter - return value of callbackfn is a boolean (value is true)",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return true;\n }\n\n var obj = { 0: 11, length: 1 };\n\n var newArr = Array.prototype.filter.call(obj, callbackfn);\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-6",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-6.js",
+ "description": "Array.prototype.filter - return value of callbackfn is a number (value is 0)",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n\n function callbackfn(val, idx, obj) {\n accessed = true;\n return 0;\n }\n\n var newArr = [11].filter(callbackfn);\n return newArr.length === 0 && accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-7",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-7.js",
+ "description": "Array.prototype.filter - return value of callbackfn is a number (value is +0)",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n\n function callbackfn(val, idx, obj) {\n accessed = true;\n return +0;\n }\n\n var newArr = [11].filter(callbackfn);\n return newArr.length === 0 && accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-8",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-8.js",
+ "description": "Array.prototype.filter - return value of callbackfn is a nunmber (value is -0)",
+ "test": "assertTrue((function testcase() {\n\n var accessed = false;\n\n function callbackfn(val, idx, obj) {\n accessed = true;\n return -0;\n }\n\n var newArr = [11].filter(callbackfn);\n return newArr.length === 0 && accessed;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ },
+ {
+ "id": "15.4.4.20-9-c-iii-9",
+ "path": "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-iii-9.js",
+ "description": "Array.prototype.filter - return value of callbackfn is a number (value is positive number)",
+ "test": "assertTrue((function testcase() {\n\n function callbackfn(val, idx, obj) {\n return 5;\n }\n\n var newArr = [11].filter(callbackfn);\n return newArr.length === 1 && newArr[0] === 11;\n }).call(this));\n",
+ "precondition": "(fnExists(Array.prototype.filter))"
+ }
+ ]
+ }
+}