test262/website/resources/scripts/testcases2/15.4.4.15.json

1359 lines
129 KiB
JSON
Raw Blame History

{
"testCollection": {
"name": "15.4.4.15",
"numTests": 193,
"tests": [
{
"id": "15.4.4.15-0-1",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-0-1.js",
"description": "Array.prototype.lastIndexOf must exist as a function",
"test": "assertTrue((function testcase() {\n var f = Array.prototype.lastIndexOf;\n if (typeof(f) === \"function\") {\n return true;\n }\n }).call(this));\n"
},
{
"id": "15.4.4.15-0-2",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-0-2.js",
"description": "Array.prototype.lastIndexOf has a length property whose value is 1.",
"test": "assertTrue((Array.prototype.lastIndexOf.length === 1));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-1-1",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-1-1.js",
"description": "Array.prototype.lastIndexOf applied to undefined throws a TypeError",
"test": "assertTrue((function testcase() {\n\n try {\n Array.prototype.lastIndexOf.call(undefined);\n return false;\n } catch (e) {\n if (e instanceof TypeError) {\n return true;\n }\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-1-10",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-1-10.js",
"description": "Array.prototype.lastIndexOf applied to the Math object",
"test": "assertTrue((function testcase() {\n \n try {\n Math.length = 2;\n Math[1] = 100;\n return 1 === Array.prototype.lastIndexOf.call(Math, 100);\n } finally {\n delete Math.length;\n delete Math[1];\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-1-11",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-1-11.js",
"description": "Array.prototype.lastIndexOf applied to Date object",
"test": "assertTrue((function testcase() {\n\n var obj = new Date();\n obj.length = 2;\n obj[1] = true;\n\n return Array.prototype.lastIndexOf.call(obj, true) === 1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-1-12",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-1-12.js",
"description": "Array.prototype.lastIndexOf applied to RegExp object",
"test": "assertTrue((function testcase() {\n\n var obj = new RegExp(\"afdasf\");\n obj.length = 100;\n obj[1] = \"afdasf\";\n\n return Array.prototype.lastIndexOf.call(obj, \"afdasf\") === 1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-1-13",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-1-13.js",
"description": "Array.prototype.lastIndexOf applied to the JSON object",
"test": "assertTrue((function testcase() {\n\n var targetObj = {};\n try {\n JSON[3] = targetObj;\n JSON.length = 5;\n return 3 === Array.prototype.lastIndexOf.call(JSON, targetObj);\n } finally {\n delete JSON[3];\n delete JSON.length;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-1-14",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-1-14.js",
"description": "Array.prototype.lastIndexOf applied to Error object",
"test": "assertTrue((function testcase() {\n\n var obj = new SyntaxError();\n obj.length = 2;\n obj[1] = Infinity;\n\n return Array.prototype.lastIndexOf.call(obj, Infinity) === 1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-1-15",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-1-15.js",
"description": "Array.prototype.lastIndexOf applied to the Arguments object",
"test": "assertTrue((function testcase() {\n\n var obj = (function fun() {\n return arguments;\n }(1, 2, 3));\n\n return Array.prototype.lastIndexOf.call(obj, 2) === 1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-1-17",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-1-17.js",
"description": "Array.prototype.lastIndexOf applied to the global object",
"test": "assertTrue((function testcase() {\n var targetObj = [\"global\"];\n try {\n var oldLen = fnGlobalObject().length;\n fnGlobalObject()[1] = targetObj;\n fnGlobalObject().length = 3;\n return 1 === Array.prototype.lastIndexOf.call(fnGlobalObject(), targetObj);\n } finally {\n delete fnGlobalObject()[1];\n fnGlobalObject().length = oldLen;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-1-2",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-1-2.js",
"description": "Array.prototype.lastIndexOf applied to null throws a TypeError",
"test": "assertTrue((function testcase() {\n\n try {\n Array.prototype.lastIndexOf.call(null);\n return false;\n } catch (e) {\n if (e instanceof TypeError) {\n return true;\n }\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-1-3",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-1-3.js",
"description": "Array.prototype.lastIndexOf applied to boolean primitive",
"test": "assertTrue((function testcase() {\n\n try {\n Boolean.prototype[1] = true;\n Boolean.prototype.length = 2;\n\n return 1 === Array.prototype.lastIndexOf.call(true, true);\n } finally {\n delete Boolean.prototype[1];\n delete Boolean.prototype.length;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-1-4",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-1-4.js",
"description": "Array.prototype.lastIndexOf applied to Boolean object",
"test": "assertTrue((function testcase() {\n\n var obj = new Boolean(false);\n obj.length = 2;\n obj[1] = true;\n\n return Array.prototype.lastIndexOf.call(obj, true) === 1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-1-5",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-1-5.js",
"description": "Array.prototype.lastIndexOf applied to number primitive",
"test": "assertTrue((function testcase() {\n\n try {\n Number.prototype[1] = isNaN;\n Number.prototype.length = 2;\n return 1 === Array.prototype.lastIndexOf.call(5, isNaN);\n } finally {\n delete Number.prototype[1];\n delete Number.prototype.length;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-1-6",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-1-6.js",
"description": "Array.prototype.lastIndexOf applied to Number object",
"test": "assertTrue((function testcase() {\n\n var obj = new Number(-3);\n obj.length = 2;\n obj[1] = true;\n\n return Array.prototype.lastIndexOf.call(obj, true) === 1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-1-7",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-1-7.js",
"description": "Array.prototype.lastIndexOf applied to string primitive",
"test": "assertTrue((Array.prototype.lastIndexOf.call(\"abc\", \"c\") === 2));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-1-8",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-1-8.js",
"description": "Array.prototype.lastIndexOf applied to String object",
"test": "assertTrue((function testcase() {\n\n var obj = new String(\"undefined\");\n\n return Array.prototype.lastIndexOf.call(obj, \"f\") === 4;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-1-9",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-1-9.js",
"description": "Array.prototype.lastIndexOf applied to Function object",
"test": "assertTrue((function testcase() {\n\n var obj = function (a, b) {\n return a + b;\n };\n obj[1] = true;\n\n return Array.prototype.lastIndexOf.call(obj, true) === 1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-2-1",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-2-1.js",
"description": "Array.prototype.lastIndexOf - 'length' is own data property on an Array-like object",
"test": "assertTrue((function testcase() {\n var obj = { 1: null, 2: undefined, length: 2 };\n\n return Array.prototype.lastIndexOf.call(obj, null) === 1 &&\n Array.prototype.lastIndexOf.call(obj, undefined) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-2-10",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-2-10.js",
"description": "Array.prototype.lastIndexOf - 'length' is inherited accessor property on an Array-like object",
"test": "assertTrue((function testcase() {\n\n var proto = {};\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[1] = 1;\n child[2] = 2;\n\n return Array.prototype.lastIndexOf.call(child, 1) === 1 &&\n Array.prototype.lastIndexOf.call(child, 2) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty))"
},
{
"id": "15.4.4.15-2-11",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-2-11.js",
"description": "Array.prototype.lastIndexOf - 'length' is own accessor property without a get function on an Array-like object",
"test": "assertTrue((function testcase() {\n\n var obj = { 0: 1 };\n Object.defineProperty(obj, \"length\", {\n set: function () { },\n configurable: true\n });\n\n return Array.prototype.lastIndexOf.call(obj, 1) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty))"
},
{
"id": "15.4.4.15-2-12",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-2-12.js",
"description": "Array.prototype.lastIndexOf - 'length' is own accessor property without a get function that overrides an inherited accessor property on an Array-like object",
"test": "assertTrue((function testcase() {\n try {\n Object.defineProperty(Object.prototype, \"length\", {\n get: function () {\n return 20;\n },\n configurable: true\n });\n\n var obj = { 1: 1 };\n Object.defineProperty(obj, \"length\", {\n set: function () { },\n configurable: true\n });\n\n return Array.prototype.lastIndexOf.call(obj, 1) === -1;\n } finally {\n delete Object.prototype.length;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty))"
},
{
"id": "15.4.4.15-2-13",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-2-13.js",
"description": "Array.prototype.lastIndexOf - 'length' is inherited accessor property without a get function on an Array-like object",
"test": "assertTrue((function testcase() {\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] = true;\n\n return Array.prototype.lastIndexOf.call(child, true) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty))"
},
{
"id": "15.4.4.15-2-14",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-2-14.js",
"description": "Array.prototype.lastIndexOf - 'length' is undefined property on an Array-like object",
"test": "assertTrue((function testcase() {\n\n var obj = { 0: null, 1: undefined };\n\n return Array.prototype.lastIndexOf.call(obj, null) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-2-15",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-2-15.js",
"description": "Array.prototype.lastIndexOf - 'length' is property of the global object",
"test": "assertTrue((function testcase() {\n var targetObj = {};\n try {\n var oldLen = fnGlobalObject().length;\n fnGlobalObject().length = 2;\n\n fnGlobalObject()[1] = targetObj;\n if (Array.prototype.lastIndexOf.call(fnGlobalObject(), targetObj) !== 1) {\n return false;\n }\n\n fnGlobalObject()[1] = {};\n fnGlobalObject()[2] = targetObj;\n\n return Array.prototype.lastIndexOf.call(fnGlobalObject(), targetObj) === -1;\n } finally {\n delete fnGlobalObject()[1];\n delete fnGlobalObject()[2];\n fnGlobalObject().length = oldLen;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-2-17",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-2-17.js",
"description": "Array.prototype.lastIndexOf applied to Arguments object which implements its own property get method",
"test": "assertTrue((function testcase() {\n\n var targetObj = function () { };\n var func = function (a, b) {\n arguments[2] = function () { };\n return Array.prototype.lastIndexOf.call(arguments, targetObj) === 1 &&\n Array.prototype.lastIndexOf.call(arguments, arguments[2]) === -1;\n };\n\n return func(0, targetObj);\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-2-18",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-2-18.js",
"description": "Array.prototype.lastIndexOf applied to String object which implements its own property get method",
"test": "assertTrue((function testcase() {\n\n var str = new String(\"012\");\n try {\n String.prototype[3] = \"3\";\n return Array.prototype.lastIndexOf.call(str, \"2\") === 2 &&\n Array.prototype.lastIndexOf.call(str, \"3\") === -1;\n } finally {\n delete String.prototype[3];\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-2-19",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-2-19.js",
"description": "Array.prototype.lastIndexOf applied to String object which implements its own property get method",
"test": "assertTrue((function testcase() {\n\n var obj = function (a, b) {\n return a + b;\n };\n obj[1] = \"b\";\n obj[2] = \"c\";\n\n return Array.prototype.lastIndexOf.call(obj, obj[1]) === 1 &&\n Array.prototype.lastIndexOf.call(obj, obj[2]) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-2-2",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-2-2.js",
"description": "Array.prototype.lastIndexOf - 'length' is own data property on an Array",
"test": "assertTrue((function testcase() {\n var targetObj = {};\n try {\n Array.prototype[2] = targetObj;\n\n return [0, targetObj].lastIndexOf(targetObj) === 1 &&\n [0, 1].lastIndexOf(targetObj) === -1;\n } finally {\n delete Array.prototype[2];\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-2-3",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-2-3.js",
"description": "Array.prototype.lastIndexOf - 'length' is own data property that overrides an inherited data property on an Array-like object",
"test": "assertTrue((function testcase() {\n\n var proto = {length: 0};\n\n var Con = function () {};\n Con.prototype = proto;\n\n var child = new Con();\n child.length = 2;\n child[1] = child;\n\n return Array.prototype.lastIndexOf.call(child, child) === 1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-2-4",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-2-4.js",
"description": "Array.prototype.lastIndexOf when 'length' is own data property that overrides an inherited data property on an Array",
"test": "assertTrue((function testcase() {\n\n var targetObj = {};\n var arrProtoLen;\n try {\n arrProtoLen = Array.prototype.length;\n Array.prototype.length = 0;\n return [0, targetObj, 2].lastIndexOf(targetObj) === 1;\n } finally {\n Array.prototype.length = arrProtoLen;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-2-5",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-2-5.js",
"description": "Array.prototype.lastIndexOf - 'length' is own data property that overrides an inherited accessor property on an Array-like object",
"test": "assertTrue((function testcase() {\n var proto = {};\n Object.defineProperty(proto, \"length\", {\n get: function () {\n return 0;\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 value: 2,\n configurable: true\n });\n child[1] = null;\n\n return Array.prototype.lastIndexOf.call(child, null) === 1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty))"
},
{
"id": "15.4.4.15-2-6",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-2-6.js",
"description": "Array.prototype.lastIndexOf - 'length' is an inherited data property on an Array-like object",
"test": "assertTrue((function testcase() {\n\n var proto = { length: 2 };\n\n var Con = function () {};\n Con.prototype = proto;\n\n var child = new Con();\n child[1] = \"x\";\n child[2] = \"y\";\n\n return Array.prototype.lastIndexOf.call(child, \"x\") === 1 &&\n Array.prototype.lastIndexOf.call(child, \"y\") === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-2-7",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-2-7.js",
"description": "Array.prototype.lastIndexOf - 'length' is own accessor property on an Array-like object",
"test": "assertTrue((function testcase() {\n\n var obj = { 1: true, 2: false };\n\n Object.defineProperty(obj, \"length\", {\n get: function () {\n return 2;\n },\n configurable: true\n });\n\n return Array.prototype.lastIndexOf.call(obj, true) === 1 &&\n Array.prototype.lastIndexOf.call(obj, false) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty))"
},
{
"id": "15.4.4.15-2-8",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-2-8.js",
"description": "Array.prototype.lastIndexOf - 'length' is own accessor property that overrides an inherited data property on an Array-like object",
"test": "assertTrue((function testcase() {\n\n var proto = { length: 0 };\n\n var Con = function () {};\n Con.prototype = proto;\n\n var child = new Con();\n child[1] = eval;\n\n Object.defineProperty(child, \"length\", {\n get: function () {\n return 2;\n },\n configurable: true\n });\n\n return Array.prototype.lastIndexOf.call(child, eval) === 1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty))"
},
{
"id": "15.4.4.15-2-9",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-2-9.js",
"description": "Array.prototype.lastIndexOf - 'length' is own accessor property that overrides an inherited accessor property on an Array-like object",
"test": "assertTrue((function testcase() {\n var proto = {};\n Object.defineProperty(proto, \"length\", {\n get: function () {\n return 0;\n },\n configurable: true\n });\n\n var Con = function () {};\n Con.prototype = proto;\n\n var child = new Con();\n child[1] = true;\n\n Object.defineProperty(child, \"length\", {\n get: function () {\n return 2;\n },\n configurable: true\n });\n\n return Array.prototype.lastIndexOf.call(child, true) === 1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty))"
},
{
"id": "15.4.4.15-3-1",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-3-1.js",
"description": "Array.prototype.lastIndexOf - value of 'length' is undefined",
"test": "assertTrue((function testcase() {\n\n var obj = { 0: 1, 1: 1, length: undefined };\n\n return Array.prototype.lastIndexOf.call(obj, 1) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-3-10",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-3-10.js",
"description": "Array.prototype.lastIndexOf - value of 'length' is a number (value is NaN)",
"test": "assertTrue((function testcase() {\n\n var obj = { 0: 0, length: NaN };\n\n return Array.prototype.lastIndexOf.call(obj, 0) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-3-11",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-3-11.js",
"description": "Array.prototype.lastIndexOf - value of 'length' is a string containing positive number",
"test": "assertTrue((function testcase() {\n\n var obj = {1: true, 2: false, length: \"2\"};\n\n return Array.prototype.lastIndexOf.call(obj, true) === 1 &&\n Array.prototype.lastIndexOf.call(obj, false) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-3-12",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-3-12.js",
"description": "Array.prototype.lastIndexOf - value of 'length' is a string containing negative number",
"test": "assertTrue((function testcase() {\n\n var obj = {1: null, 2: undefined, length: \"-4294967294\"};\n\n return Array.prototype.lastIndexOf.call(obj, null) === 1 &&\n Array.prototype.lastIndexOf.call(obj, undefined) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-3-13",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-3-13.js",
"description": "Array.prototype.lastIndexOf - value of 'length' is a string containing a decimal number",
"test": "assertTrue((function testcase() {\n\n var obj = { 4: 4, 5: 5, length: \"5.512345\" };\n\n return Array.prototype.lastIndexOf.call(obj, 4) === 4 &&\n Array.prototype.lastIndexOf.call(obj, 5) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-3-14",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-3-14.js",
"description": "Array.prototype.lastIndexOf - value of 'length' is a string containing +/-Infinity",
"test": "assertTrue((function testcase() {\n\n var objOne = { 0: true, 1: true, length: \"Infinity\" };\n var objTwo = { 0: true, 1: true, length: \"+Infinity\" };\n var objThree = { 0: true, 1: true, length: \"-Infinity\" };\n\n return Array.prototype.lastIndexOf.call(objOne, true) === -1 &&\n Array.prototype.lastIndexOf.call(objTwo, true) === -1 &&\n Array.prototype.lastIndexOf.call(objThree, true) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-3-15",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-3-15.js",
"description": "Array.prototype.lastIndexOf - value of 'length' is a string containing an exponential number",
"test": "assertTrue((function testcase() {\n\n var obj = {229: 229, 230: 2.3E2, length: \"2.3E2\"};\n\n return Array.prototype.lastIndexOf.call(obj, 229) === 229 &&\n Array.prototype.lastIndexOf.call(obj, 2.3E2) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-3-16",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-3-16.js",
"description": "Array.prototype.lastIndexOf - value of 'length' is a string which is able to be converted into hex number",
"test": "assertTrue((function testcase() {\n\n var obj = { 2573: 2573, 2574: 0x000A0E, length: \"0x000A0E\" };\n\n return Array.prototype.lastIndexOf.call(obj, 2573) === 2573 &&\n Array.prototype.lastIndexOf.call(obj, 0x000A0E) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-3-17",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-3-17.js",
"description": "Array.prototype.lastIndexOf - value of 'length' is a string containing a number with leading zeros",
"test": "assertTrue((function testcase() {\n\n var obj = { 1: 1, 2: 2, length: \"0002.0\" };\n\n return Array.prototype.lastIndexOf.call(obj, 1) === 1 &&\n Array.prototype.lastIndexOf.call(obj, 2) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-3-18",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-3-18.js",
"description": "Array.prototype.lastIndexOf - value of 'length' is a string that can't convert to a number",
"test": "assertTrue((function testcase() {\n var targetObj = new String(\"123abc123\");\n var obj = { 0: targetObj, length: \"123abc123\" };\n\n return Array.prototype.lastIndexOf.call(obj, targetObj) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-3-19",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-3-19.js",
"description": "Array.prototype.lastIndexOf - value of 'length' is an Object which has an own toString method",
"test": "assertTrue((function testcase() {\n\n // objects inherit the default valueOf() method from Object\n // that simply returns 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 var targetObj = fnGlobalObject();\n var obj = {\n 1: targetObj,\n 2: 2,\n\n length: {\n toString: function () {\n return '2';\n }\n }\n };\n\n return Array.prototype.lastIndexOf.call(obj, targetObj) === 1 &&\n Array.prototype.lastIndexOf.call(obj, 2) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-3-2",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-3-2.js",
"description": "Array.prototype.lastIndexOf return -1 when value of 'length' is a boolean (value is true)",
"test": "assertTrue((function testcase() {\n var obj = { 0: 0, 1: 1, length: true };\n return Array.prototype.lastIndexOf.call(obj, 0) === 0 &&\n Array.prototype.lastIndexOf.call(obj, 1) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-3-20",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-3-20.js",
"description": "Array.prototype.lastIndexOf - value of 'length' is an Object which has an own valueOf method",
"test": "assertTrue((function testcase() {\n\n //valueOf method will be invoked first, since hint is Number\n var obj = {\n 1: true,\n 2: 2,\n\n length: {\n valueOf: function () {\n return 2;\n }\n }\n };\n\n return Array.prototype.lastIndexOf.call(obj, true) === 1 &&\n Array.prototype.lastIndexOf.call(obj, 2) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-3-21",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-3-21.js",
"description": "Array.prototype.lastIndexOf - '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 toStringAccessed = false;\n var valueOfAccessed = false;\n\n var targetObj = this;\n var obj = {\n 1: targetObj,\n length: {\n toString: function () {\n toStringAccessed = true;\n return '3';\n },\n\n valueOf: function () {\n valueOfAccessed = true;\n return {};\n }\n }\n };\n\n return Array.prototype.lastIndexOf.call(obj, targetObj) === 1 && toStringAccessed && valueOfAccessed;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-3-22",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-3-22.js",
"description": "Array.prototype.lastIndexOf throws TypeError exception when 'length' is an object with toString and valueOf methods that don<6F>t return primitive values",
"test": "assertTrue((function testcase() {\n\n var toStringAccessed = false;\n var valueOfAccessed = false;\n\n var obj = {\n 1: true,\n length: {\n toString: function () {\n toStringAccessed = true;\n return {};\n },\n\n valueOf: function () {\n valueOfAccessed = true;\n return {};\n }\n }\n };\n\n try {\n Array.prototype.lastIndexOf.call(obj, true);\n return false;\n } catch (e) {\n return toStringAccessed && valueOfAccessed;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-3-23",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-3-23.js",
"description": "Array.prototype.lastIndexOf uses inherited valueOf method when 'length' is an object with an own toString and an inherited valueOf methods",
"test": "assertTrue((function testcase() {\n\n var toStringAccessed = false;\n var valueOfAccessed = false;\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 child.toString = function () {\n toStringAccessed = true;\n return 2;\n };\n\n var obj = {\n 1: child,\n length: child\n };\n\n return Array.prototype.lastIndexOf.call(obj, child) === 1 && valueOfAccessed && !toStringAccessed;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-3-24",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-3-24.js",
"description": "Array.prototype.lastIndexOf - value of 'length' is a positive non-integer, ensure truncation occurs in the proper direction",
"test": "assertTrue((function testcase() {\n\n var obj = { 122: true, 123: false, length: 123.5 };\n\n return Array.prototype.lastIndexOf.call(obj, true) === 122 &&\n Array.prototype.lastIndexOf.call(obj, false) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-3-25",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-3-25.js",
"description": "Array.prototype.lastIndexOf - value of 'length' is a negative non-integer, ensure truncation occurs in the proper direction",
"test": "assertTrue((function testcase() {\n\n var obj = { 1: true, 2: false, length: -4294967294.5 };\n\n return Array.prototype.lastIndexOf.call(obj, true) === 1 &&\n Array.prototype.lastIndexOf.call(obj, false) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-3-28",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-3-28.js",
"description": "Array.prototype.lastIndexOf - value of 'length' is boundary value (2^32)",
"test": "assertTrue((function testcase() {\n\n var targetObj = {};\n var obj = {\n 0: targetObj,\n 4294967294: targetObj,\n 4294967295: targetObj,\n length: 4294967296\n };\n\n return Array.prototype.lastIndexOf.call(obj, targetObj) === -1; //verify length is 0 finally\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-3-29",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-3-29.js",
"description": "Array.prototype.lastIndexOf - value of 'length' is boundary value (2^32 + 1)",
"test": "assertTrue((function testcase() {\n\n var targetObj = {};\n var obj = {\n 0: targetObj,\n 1: 4294967297,\n length: 4294967297\n };\n\n return Array.prototype.lastIndexOf.call(obj, targetObj) === 0 &&\n Array.prototype.lastIndexOf.call(obj, 4294967297) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-3-3",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-3-3.js",
"description": "Array.prototype.lastIndexOf - value of 'length' is a number (value is 0)",
"test": "assertTrue((function testcase() {\n\n var obj = { 0: \"undefined\", length: 0 };\n\n return Array.prototype.lastIndexOf.call(obj, \"undefined\") === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-3-4",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-3-4.js",
"description": "Array.prototype.lastIndexOf - value of 'length' is a number (value is -0)",
"test": "assertTrue((function testcase() {\n\n var obj = { 0: true, length: -0 };\n\n return Array.prototype.lastIndexOf.call(obj, true) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-3-5",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-3-5.js",
"description": "Array.prototype.lastIndexOf - value of 'length' is a number (value is +0)",
"test": "assertTrue((function testcase() {\n\n var obj = { 0: +0, length: +0 };\n\n return Array.prototype.lastIndexOf.call(obj, +0) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-3-6",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-3-6.js",
"description": "Array.prototype.lastIndexOf - value of 'length' is a number (value is a positive number)",
"test": "assertTrue((function testcase() {\n\n var obj = { 99: true, 100: 100, length: 100 };\n\n return Array.prototype.lastIndexOf.call(obj, true) === 99 &&\n Array.prototype.lastIndexOf.call(obj, 100) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-3-7",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-3-7.js",
"description": "Array.prototype.lastIndexOf - value of 'length' is a number (value is a negative number)",
"test": "assertTrue((function testcase() {\n\n var obj = { 4: -Infinity, 5: Infinity, length: 5 - Math.pow(2, 32) };\n\n return Array.prototype.lastIndexOf.call(obj, -Infinity) === 4 &&\n Array.prototype.lastIndexOf.call(obj, Infinity) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-3-8",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-3-8.js",
"description": "Array.prototype.lastIndexOf - value of 'length' is a number (value is Infinity)",
"test": "assertTrue((function testcase() {\n\n var obj = { 0: 0, length: Infinity };\n\n return Array.prototype.lastIndexOf.call(obj, 0) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-3-9",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-3-9.js",
"description": "Array.prototype.lastIndexOf - value of 'length' is a number (value is -Infinity)",
"test": "assertTrue((function testcase() {\n\n var obj = { 0: 0, length: -Infinity };\n\n return Array.prototype.lastIndexOf.call(obj, 0) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-4-1",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-4-1.js",
"description": "Array.prototype.lastIndexOf returns -1 if 'length' is 0 (empty array)",
"test": "assertTrue((function testcase() {\n var i = [].lastIndexOf(42);\n if (i === -1) {\n return true;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-4-10",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-4-10.js",
"description": "Array.prototype.lastIndexOf - 'length' is a number of value -6e-1",
"test": "assertTrue((function testcase() {\n var targetObj = [];\n var obj = { 0: targetObj, 100: targetObj, length: -6e-1 };\n return Array.prototype.lastIndexOf.call(obj, targetObj) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-4-11",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-4-11.js",
"description": "Array.prototype.lastIndexOf - 'length' is an empty string",
"test": "assertTrue((function testcase() {\n var targetObj = [];\n var obj = { 0: targetObj, 100: targetObj, length: \"\" };\n return Array.prototype.lastIndexOf.call(obj, targetObj) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-4-2",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-4-2.js",
"description": "Array.prototype.lastIndexOf returns -1 if 'length' is 0 ( length overridden to null (type conversion))",
"test": "assertTrue((function testcase() {\n \n var i = Array.prototype.lastIndexOf.call({length: null}, 1);\n \n if (i === -1) {\n return true;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-4-3",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-4-3.js",
"description": "Array.prototype.lastIndexOf returns -1 if 'length' is 0 (length overridden to false (type conversion))",
"test": "assertTrue((function testcase() {\n \n var i = Array.prototype.lastIndexOf.call({length: false}, 1);\n \n if (i === -1) {\n return true;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-4-4",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-4-4.js",
"description": "Array.prototype.lastIndexOf returns -1 if 'length' is 0 (generic 'array' with length 0 )",
"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 var i = Array.prototype.lastIndexOf.call({length: 0}, 1);\n \n if (i === -1) {\n return true;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-4-5",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-4-5.js",
"description": "Array.prototype.lastIndexOf returns -1 if 'length' is 0 ( length overridden to '0' (type conversion))",
"test": "assertTrue((function testcase() {\n \n var i = Array.prototype.lastIndexOf.call({length: '0'}, 1);\n \n if (i === -1) {\n return true;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-4-6",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-4-6.js",
"description": "Array.prototype.lastIndexOf returns -1 if 'length' is 0 (subclassed Array, length overridden with obj with valueOf)",
"test": "assertTrue((function testcase() {\n \n var i = Array.prototype.lastIndexOf.call({length: { valueOf: function () { return 0;}}}, 1);\n \n if (i === -1) {\n return true;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-4-7",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-4-7.js",
"description": "Array.prototype.lastIndexOf returns -1 if 'length' is 0 ( length is object 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 var i = Array.prototype.lastIndexOf.call({length: { toString: function () { return '0';}}}, 1);\n \n if (i === -1) {\n return true;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-4-8",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-4-8.js",
"description": "Array.prototype.lastIndexOf returns -1 if 'length' is 0 (length is an empty array)",
"test": "assertTrue((function testcase() {\n\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 var i = Array.prototype.lastIndexOf.call({length: [ ]}, 1);\n \n if (i === -1) {\n return true;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-4-9",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-4-9.js",
"description": "Array.prototype.lastIndexOf - 'length' is a number of value 0.1",
"test": "assertTrue((function testcase() {\n var targetObj = [];\n var obj = { 0: targetObj, 100: targetObj, length: 0.1 };\n return Array.prototype.lastIndexOf.call(obj, targetObj) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-5-1",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-1.js",
"description": "Array.prototype.lastIndexOf when fromIndex is string",
"test": "assertTrue((function testcase() {\n var a = new Array(0,1,1);\n if (a.lastIndexOf(1,\"1\") === 1 && // \"1\" resolves to 1\n a.lastIndexOf(1,\"one\") === -1) { // NaN string resolves to 0\n return true;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-5-10",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-10.js",
"description": "Array.prototype.lastIndexOf - value of 'fromIndex' is a number (value is positive number)",
"test": "assertTrue((function testcase() {\n var targetObj = {};\n return [0, targetObj, true].lastIndexOf(targetObj, 1.5) === 1 &&\n [0, true, targetObj].lastIndexOf(targetObj, 1.5) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-5-11",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-11.js",
"description": "Array.prototype.lastIndexOf - value of 'fromIndex' is a number (value is negative number)",
"test": "assertTrue((function testcase() {\n var targetObj = {};\n return [0, targetObj, true].lastIndexOf(targetObj, -2.5) === 1 &&\n [0, true, targetObj].lastIndexOf(targetObj, -2.5) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-5-12",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-12.js",
"description": "Array.prototype.lastIndexOf - value of 'fromIndex' is a number (value is Infinity)",
"test": "assertTrue((function testcase() {\n var arr = [];\n arr[Math.pow(2, 32) - 2] = null; // length is the max value of Uint type\n return arr.lastIndexOf(null, Infinity) === (Math.pow(2, 32) - 2);\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-5-13",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-13.js",
"description": "Array.prototype.lastIndexOf - value of 'fromIndex' is a number (value is -Infinity)",
"test": "assertTrue(([true].lastIndexOf(true, -Infinity) === -1));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-5-14",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-14.js",
"description": "Array.prototype.lastIndexOf - value of 'fromIndex' is a number (value is NaN)",
"test": "assertTrue(([0, true].lastIndexOf(true, NaN) === -1 && // from Index will be convert to +0\n [true, 0].lastIndexOf(true, NaN) === 0 &&\n [0, true].lastIndexOf(true, -NaN) === -1 &&\n [true, 0].lastIndexOf(true, -NaN) === 0));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-5-15",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-15.js",
"description": "Array.prototype.lastIndexOf - value of 'fromIndex' is a string containing a negative number",
"test": "assertTrue(([0, \"-2\", 2].lastIndexOf(\"-2\", \"-2\") === 1 &&\n [0, 2, \"-2\"].lastIndexOf(\"-2\", \"-2\") === -1));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-5-16",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-16.js",
"description": "Array.prototype.lastIndexOf - value of 'fromIndex' is a string containing Infinity",
"test": "assertTrue((function testcase() {\n var arr = [];\n arr[Math.pow(2, 32) - 2] = true; // length is the max value of Uint type\n return arr.lastIndexOf(true, \"Infinity\") === (Math.pow(2, 32) - 2);\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-5-17",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-17.js",
"description": "Array.prototype.lastIndexOf - value of 'fromIndex' is a string containing -Infinity",
"test": "assertTrue(([true].lastIndexOf(true, \"-Infinity\") === -1));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-5-18",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-18.js",
"description": "Array.prototype.lastIndexOf - value of 'fromIndex' is a string containing an exponential number",
"test": "assertTrue((function testcase() {\n var targetObj = {};\n return [0, NaN, targetObj, 3, false].lastIndexOf(targetObj, \"2E0\") === 2 &&\n [0, NaN, 3, targetObj, false].lastIndexOf(targetObj, \"2E0\") === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-5-19",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-19.js",
"description": "Array.prototype.lastIndexOf - value of 'fromIndex' is a string containing a hex number",
"test": "assertTrue((function testcase() {\n var targetObj = {};\n return [0, true, targetObj, 3, false].lastIndexOf(targetObj, \"0x0002\") === 2 &&\n [0, true, 3, targetObj, false].lastIndexOf(targetObj, \"0x0002\") === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-5-2",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-2.js",
"description": "Array.prototype.lastIndexOf when fromIndex is floating point number",
"test": "assertTrue((function testcase() {\n var a = new Array(1,2,1);\n if (a.lastIndexOf(2,1.49) === 1 && // 1.49 resolves to 1\n a.lastIndexOf(2,0.51) === -1 && // 0.51 resolves to 0\n a.lastIndexOf(1,0.51) === 0){ // 0.51 resolves to 0\n return true;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-5-20",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-20.js",
"description": "Array.prototype.lastIndexOf - value of 'fromIndex' which is a string containing a number with leading zeros",
"test": "assertTrue((function testcase() {\n var targetObj = {};\n return [0, true, targetObj, 3, false].lastIndexOf(targetObj, \"0002.10\") === 2 &&\n [0, true, 3, targetObj, false].lastIndexOf(targetObj, \"0002.10\") === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-5-21",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-21.js",
"description": "Array.prototype.lastIndexOf - value of 'fromIndex' which is an Object, and has an own toString method",
"test": "assertTrue((function testcase() {\n\n // objects inherit the default valueOf() method from Object\n // that simply returns 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 var fromIndex = {\n toString: function () {\n return '2';\n }\n };\n var targetObj = new RegExp();\n\n return [0, true, targetObj, 3, false].lastIndexOf(targetObj, fromIndex) === 2 &&\n [0, true, 3, targetObj, false].lastIndexOf(targetObj, fromIndex) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-5-22",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-22.js",
"description": "Array.prototype.lastIndexOf - value of 'fromIndex' which is an object, and has an own valueOf method",
"test": "assertTrue((function testcase() {\n\n var fromIndex = {\n valueOf: function () {\n return 2;\n }\n };\n\n var targetObj = function () {};\n return [0, true, targetObj, 3, false].lastIndexOf(targetObj, fromIndex) === 2 &&\n [0, true, 3, targetObj, false].lastIndexOf(targetObj, fromIndex) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-5-23",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-23.js",
"description": "Array.prototype.lastIndexOf - value of 'fromIndex' 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 toStringAccessed = false;\n var valueOfAccessed = false;\n\n var fromIndex = {\n toString: function () {\n toStringAccessed = true;\n return '1';\n },\n\n valueOf: function () {\n valueOfAccessed = true;\n return {};\n }\n };\n\n return [0, true].lastIndexOf(true, fromIndex) === 1 && toStringAccessed && valueOfAccessed;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-5-24",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-24.js",
"description": "Array.prototype.lastIndexOf throws TypeError exception when value of 'fromIndex' is an object that both toString and valueOf methods than don't return primitive value",
"test": "assertTrue((function testcase() {\n\n var toStringAccessed = false;\n var valueOfAccessed = false;\n\n var fromIndex = {\n toString: function () {\n toStringAccessed = true;\n return {};\n },\n\n valueOf: function () {\n valueOfAccessed = true;\n return {};\n }\n };\n\n try {\n [0, null].lastIndexOf(null, fromIndex);\n return false;\n } catch (e) {\n return toStringAccessed && valueOfAccessed;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-5-25",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-25.js",
"description": "Array.prototype.lastIndexOf use inherited valueOf method when value of 'fromIndex' is an object with an own toString and inherited valueOf methods",
"test": "assertTrue((function testcase() {\n\n var toStringAccessed = false;\n var valueOfAccessed = false;\n\n var proto = {\n valueOf: function () {\n valueOfAccessed = true;\n return 1;\n }\n };\n\n var Con = function () {};\n Con.prototype = proto;\n\n var child = new Con();\n child.toString = function () {\n toStringAccessed = true;\n return 1;\n };\n\n return [0, true].lastIndexOf(true, child) === 1 && valueOfAccessed && !toStringAccessed;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-5-26",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-26.js",
"description": "Array.prototype.lastIndexOf - side effects produced by step 2 are visible when an exception occurs",
"test": "assertTrue((function testcase() {\n\n var stepTwoOccurs = false;\n var stepFiveOccurs = false;\n var obj = {};\n\n Object.defineProperty(obj, \"length\", {\n get: function () {\n stepTwoOccurs = true;\n if (stepFiveOccurs) {\n throw new Error(\"Step 5 occurred out of order\");\n }\n return 20;\n },\n configurable: true\n });\n\n var fromIndex = {\n valueOf: function () {\n stepFiveOccurs = true;\n return 0;\n }\n };\n\n try {\n Array.prototype.lastIndexOf.call(obj, undefined, fromIndex);\n return stepTwoOccurs && stepFiveOccurs;\n } catch (ex) {\n return false;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty))"
},
{
"id": "15.4.4.15-5-27",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-27.js",
"description": "Array.prototype.lastIndexOf - side effects produced by step 3 are visible when an exception occurs",
"test": "assertTrue((function testcase() {\n\n var stepThreeOccurs = false;\n var stepFiveOccurs = false;\n\n var obj = {};\n\n Object.defineProperty(obj, \"length\", {\n get: function () {\n return {\n valueOf: function () {\n stepThreeOccurs = true;\n if (stepFiveOccurs) {\n throw new Error(\"Step 5 occurred out of order\");\n }\n return 20;\n }\n };\n },\n configurable: true\n });\n\n var fromIndex = {\n valueOf: function () {\n stepFiveOccurs = true;\n return 0;\n }\n };\n\n try {\n Array.prototype.lastIndexOf.call(obj, undefined, fromIndex);\n return stepThreeOccurs && stepFiveOccurs;\n } catch (ex) {\n return false;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty))"
},
{
"id": "15.4.4.15-5-28",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-28.js",
"description": "Array.prototype.lastIndexOf - side effects produced by step 1 are visible when an exception occurs",
"test": "assertTrue((function testcase() {\n\n var stepFiveOccurs = false;\n var fromIndex = {\n valueOf: function () {\n stepFiveOccurs = true;\n return 0;\n }\n };\n\n try {\n Array.prototype.lastIndexOf.call(undefined, undefined, fromIndex);\n return false;\n } catch (e) {\n return (e instanceof TypeError) && !stepFiveOccurs;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-5-29",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-29.js",
"description": "Array.prototype.lastIndexOf - side effects produced by step 2 are visible when an exception occurs",
"test": "assertTrue((function testcase() {\n\n var stepFiveOccurs = false;\n\n var obj = {};\n Object.defineProperty(obj, \"length\", {\n get: function () {\n throw new RangeError();\n },\n configurable: true\n });\n\n var fromIndex = {\n valueOf: function () {\n stepFiveOccurs = true;\n return 0;\n }\n };\n\n try {\n Array.prototype.lastIndexOf.call(obj, undefined, fromIndex);\n return false;\n } catch (e) {\n return (e instanceof RangeError) && !stepFiveOccurs;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty))"
},
{
"id": "15.4.4.15-5-3",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-3.js",
"description": "Array.prototype.lastIndexOf when fromIndex is boolean",
"test": "assertTrue((function testcase() {\n var a = new Array(1,2,1);\n if (a.lastIndexOf(2,true) === 1 && // true resolves to 1\n a.lastIndexOf(2,false) === -1 ) { // false resolves to 0\n return true;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-5-30",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-30.js",
"description": "Array.prototype.lastIndexOf - side effects produced by step 3 are visible when an exception occurs",
"test": "assertTrue((function testcase() {\n\n var stepFiveOccurs = false;\n\n var obj = {};\n Object.defineProperty(obj, \"length\", {\n get: function () {\n return {\n valueOf: function () {\n throw new TypeError();\n }\n };\n },\n configurable: true\n });\n\n var fromIndex = {\n valueOf: function () {\n stepFiveOccurs = true;\n return 0;\n }\n };\n\n try {\n Array.prototype.lastIndexOf.call(obj, undefined, fromIndex);\n return false;\n } catch (e) {\n return (e instanceof TypeError) && !stepFiveOccurs;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty))"
},
{
"id": "15.4.4.15-5-31",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-31.js",
"description": "Array.prototype.lastIndexOf - 'fromIndex' is a positive non-integer, verify truncation occurs in the proper direction",
"test": "assertTrue((function testcase() {\n var targetObj = {};\n return [0, targetObj, true].lastIndexOf(targetObj, 1.5) === 1 &&\n [0, true, targetObj].lastIndexOf(targetObj, 1.5) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-5-32",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-32.js",
"description": "Array.prototype.lastIndexOf - 'fromIndex' is a negative non-integer, verify truncation occurs in the proper direction",
"test": "assertTrue((function testcase() {\n var targetObj = {};\n return [0, targetObj, true].lastIndexOf(targetObj, -2.5) === 1 &&\n [0, true, targetObj].lastIndexOf(targetObj, -2.5) === -1;\n\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-5-33",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-33.js",
"description": "Array.prototype.lastIndexOf - match on the first element, a middle element and the last element when 'fromIndex' is passed",
"test": "assertTrue(([0, 1, 2, 3, 4].lastIndexOf(0, 0) === 0 &&\n [0, 1, 2, 3, 4].lastIndexOf(0, 2) === 0 &&\n [0, 1, 2, 3, 4].lastIndexOf(2, 2) === 2 &&\n [0, 1, 2, 3, 4].lastIndexOf(2, 4) === 2 &&\n [0, 1, 2, 3, 4].lastIndexOf(4, 4) === 4));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-5-4",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-4.js",
"description": "Array.prototype.lastIndexOf when fromIndex is undefined",
"test": "assertTrue((function testcase() {\n var a = new Array(1,2,1);\n if (a.lastIndexOf(2,undefined) === -1 &&\n a.lastIndexOf(1,undefined) === 0 &&\n a.lastIndexOf(1) === 2) { // undefined resolves to 0, no second argument resolves to len\n return true;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-5-5",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-5.js",
"description": "Array.prototype.lastIndexOf when fromIndex is null",
"test": "assertTrue((function testcase() {\n var a = new Array(1,2,1);\n if (a.lastIndexOf(2,null) === -1 && a.lastIndexOf(1,null) === 0) { // null resolves to 0\n return true;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-5-6",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-6.js",
"description": "Array.prototype.lastIndexOf when 'fromIndex' isn't passed",
"test": "assertTrue((function testcase() {\n var arr = [0, 1, 2, 3, 4];\n //'fromIndex' will be set as 4 if not passed by default\n return arr.lastIndexOf(0) === arr.lastIndexOf(0, 4) &&\n arr.lastIndexOf(2) === arr.lastIndexOf(2, 4) &&\n arr.lastIndexOf(4) === arr.lastIndexOf(4, 4);\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-5-7",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-7.js",
"description": "Array.prototype.lastIndexOf - value of 'fromIndex' is a number (value is 0)",
"test": "assertTrue((function testcase() {\n\n return [0, 100].lastIndexOf(100, 0) === -1 && // verify fromIndex is not more than 0\n [200, 0].lastIndexOf(200, 0) === 0; // verify fromIndex is not less than 0\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-5-8",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-8.js",
"description": "Array.prototype.lastIndexOf - value of 'fromIndex' is a number (value is +0)",
"test": "assertTrue(([0, true].lastIndexOf(true, +0) === -1 &&\n [true, 0].lastIndexOf(true, +0) === 0));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-5-9",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-5-9.js",
"description": "Array.prototype.lastIndexOf - value of 'fromIndex' is a number (value is -0)",
"test": "assertTrue(([0, true].lastIndexOf(true, -0) === -1 &&\n [true, 0].lastIndexOf(true, -0) === 0));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-6-1",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-6-1.js",
"description": "Array.prototype.lastIndexOf when fromIndex greater than Array.length",
"test": "assertTrue((function testcase() {\n var a = new Array(1,2,3);\n if (a.lastIndexOf(3,5.4) === 2 && \n a.lastIndexOf(3,3.1) === 2 ) {\n return true;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-6-2",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-6-2.js",
"description": "Array.prototype.lastIndexOf returns correct index when 'fromIndex' is length of array - 1",
"test": "assertTrue(([1, 2, 3].lastIndexOf(3, 2) === 2));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-6-3",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-6-3.js",
"description": "Array.prototype.lastIndexOf returns -1 when 'fromIndex' is length of array - 1",
"test": "assertTrue(([1, 2, 3].lastIndexOf(3, 1) === -1));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-6-4",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-6-4.js",
"description": "Array.prototype.lastIndexOf returns -1 when 'fromIndex' and 'length' are both 0",
"test": "assertTrue(([].lastIndexOf(1, 0) === -1));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-6-5",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-6-5.js",
"description": "Array.prototype.lastIndexOf returns -1 when 'fromIndex' is 1",
"test": "assertTrue(([1, 2, 3].lastIndexOf(3, 1) === -1));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-6-6",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-6-6.js",
"description": "Array.prototype.lastIndexOf returns correct index when 'fromIndex' is 1",
"test": "assertTrue(([1, 2, 3].lastIndexOf(2, 1) === 1));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-7-1",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-7-1.js",
"description": "Array.prototype.lastIndexOf with negative fromIndex ",
"test": "assertTrue((function testcase() {\n var a = new Array(1,2,3);\n \n if (a.lastIndexOf(2,-2) === 1 && \n a.lastIndexOf(2,-3) === -1 && \n a.lastIndexOf(1,-5.3) === -1 ) {\n return true;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-7-2",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-7-2.js",
"description": "Array.prototype.lastIndexOf returns correct index when 'fromIndex' is -1",
"test": "assertTrue(([1, 2, 3, 4].lastIndexOf(4, -1) === 3));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-7-3",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-7-3.js",
"description": "Array.prototype.lastIndexOf returns -1 when abs('fromIndex') is length of array - 1",
"test": "assertTrue(([1, 2, 3, 4].lastIndexOf(3, -3) === -1));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-7-4",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-7-4.js",
"description": "Array.prototype.lastIndexOf returns -1 when abs('fromIndex') is length of array",
"test": "assertTrue(([1, 2, 3, 4].lastIndexOf(2, -4) === -1));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-1",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-1.js",
"description": "Array.prototype.lastIndexOf must return correct index(boolean)",
"test": "assertTrue((function testcase() {\n var obj = {toString:function (){return true}};\n var _false = false;\n var a = new Array(false,true,false,obj,_false,true,\"true\", undefined,0,null,1,\"str\",0,1);\n if (a.lastIndexOf(true) === 5 && //a[5]=true\n a.lastIndexOf(false) === 4) //a[4] =_false\n {\n return true;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-10",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-10.js",
"description": "Array.prototype.lastIndexOf must return correct index (NaN)",
"test": "assertTrue((function testcase() {\n var _NaN = NaN;\n var a = new Array(\"NaN\",_NaN,NaN, undefined,0,false,null,{toString:function (){return NaN}},\"false\");\n if (a.lastIndexOf(NaN) === -1) // NaN matches nothing, not even itself\n {\n return true;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-11",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-11.js",
"description": "Array.prototype.lastIndexOf - the length of iteration isn't changed by adding elements to the array during iteration",
"test": "assertTrue((function testcase() {\n\n var arr = [20];\n\n Object.defineProperty(arr, \"0\", {\n get: function () {\n arr[1] = 1;\n return 0;\n },\n configurable: true\n });\n\n return arr.lastIndexOf(1) === -1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
},
{
"id": "15.4.4.15-8-2",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-2.js",
"description": "Array.prototype.lastIndexOf must return correct index(Number)",
"test": "assertTrue((function testcase() {\n var obj = {toString:function (){return 0}};\n var one = 1;\n var _float = -(4/3);\n var a = new Array(+0,true,0,-0, false,undefined,null,\"0\",obj, _float,-(4/3),-1.3333333333333,\"str\",one, 1, false);\n if (a.lastIndexOf(-(4/3)) === 10 && // a[10]=-(4/3)\n a.lastIndexOf(0) === 3 && // a[3] = -0, but using === -0 and 0 are equal\n a.lastIndexOf(-0) ===3 && // a[3] = -0\n a.lastIndexOf(1) === 14 ) // a[14] = 1\n {\n return true;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-3",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-3.js",
"description": "Array.prototype.lastIndexOf must return correct index(string)",
"test": "assertTrue((function testcase() {\n var obj = {toString:function (){return \"false\"}};\n var szFalse = \"false\";\n var a = new Array(szFalse, \"false\",\"false1\",undefined,0,false,null,1,obj,0);\n if (a.lastIndexOf(\"false\") === 1) \n {\n return true;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-4",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-4.js",
"description": "Array.prototype.lastIndexOf must return correct index(undefined)",
"test": "assertTrue((function testcase() {\n var obj = {toString:function (){return undefined;}};\n var _undefined1 = undefined;\n var _undefined2;\n var a = new Array(_undefined1,_undefined2,undefined,true,0,false,null,1,\"undefined\",obj,1);\n if (a.lastIndexOf(undefined) === 2) \n {\n return true;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-5",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-5.js",
"description": "Array.prototype.lastIndexOf must return correct index(Object)",
"test": "assertTrue((function testcase() {\n var obj1 = {toString:function (){return \"false\"}};\n var obj2 = {toString:function (){return \"false\"}};\n var obj3 = obj1;\n var a = new Array(obj2,obj1,obj3,false,undefined,0,false,null,{toString:function (){return \"false\"}},\"false\");\n if (a.lastIndexOf(obj3) === 2) \n {\n return true;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-6",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-6.js",
"description": "Array.prototype.lastIndexOf must return correct index(null)",
"test": "assertTrue((function testcase() {\n var obj = {toString:function (){return null}};\n var _null = null;\n var a = new Array(true,undefined,0,false,null,1,\"str\",0,1,null,true,false,undefined,_null,\"null\",undefined,\"str\",obj);\n if (a.lastIndexOf(null) === 13 ) \n {\n return true;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-7",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-7.js",
"description": "Array.prototype.lastIndexOf must return correct index (self reference)",
"test": "assertTrue((function testcase() {\n var a = new Array(0,1,2,3); \n a[2] = a;\n if (a.lastIndexOf(a) === 2 && \n a.lastIndexOf(3) === 3 ) \n {\n return true;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-8",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-8.js",
"description": "Array.prototype.lastIndexOf must return correct index (Array)",
"test": "assertTrue((function testcase() {\n var b = new Array(\"0,1\"); \n var a = new Array(0,b,\"0,1\",3); \n if (a.lastIndexOf(b.toString()) === 2 && \n a.lastIndexOf(\"0,1\") === 2 ) \n {\n return true;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-9",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-9.js",
"description": "Array.prototype.lastIndexOf must return correct index (Sparse Array)",
"test": "assertTrue((function testcase() {\n var a = new Array(0,1); \n a[4294967294] = 2; // 2^32-2 - is max array element index\n a[4294967295] = 3; // 2^32-1 added as non-array element property\n a[4294967296] = 4; // 2^32 added as non-array element property\n a[4294967297] = 5; // 2^32+1 added as non-array element property\n // stop searching near the end in case implementation actually tries to test all missing elements!!\n a[4294967200] = 3; \n a[4294967201] = 4; \n a[4294967202] = 5; \n\n\n return (a.lastIndexOf(2) === 4294967294 && \n a.lastIndexOf(3) === 4294967200 &&\n a.lastIndexOf(4) === 4294967201 &&\n a.lastIndexOf(5) === 4294967202) ;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-a-1",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-a-1.js",
"description": "Array.prototype.lastIndexOf - added properties in step 2 are visible here",
"test": "assertTrue((function testcase() {\n\n var arr = { };\n\n Object.defineProperty(arr, \"length\", {\n get: function () {\n arr[2] = \"length\";\n return 3;\n },\n configurable: true\n });\n\n return 2 === Array.prototype.lastIndexOf.call(arr, \"length\");\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty))"
},
{
"id": "15.4.4.15-8-a-10",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-a-10.js",
"description": "Array.prototype.lastIndexOf - properties can be added to prototype after current position are visited on an Array",
"test": "assertTrue((function testcase() {\n\n var arr = [0, , 2];\n\n Object.defineProperty(arr, \"2\", {\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 try {\n return arr.lastIndexOf(6.99) === 1;\n } finally {\n delete Array.prototype[1];\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && ![, 1].hasOwnProperty(0) && fnSupportsArrayIndexGettersOnArrays())"
},
{
"id": "15.4.4.15-8-a-11",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-a-11.js",
"description": "Array.prototype.lastIndexOf - deleting own property causes index property not to be visited on an Array-like object",
"test": "assertTrue((function testcase() {\n\n var arr = { length: 200 };\n\n Object.defineProperty(arr, \"1\", {\n get: function () {\n return 6.99;\n },\n configurable: true\n });\n\n Object.defineProperty(arr, \"100\", {\n get: function () {\n delete arr[1];\n return 0;\n },\n configurable: true\n });\n\n return -1 === Array.prototype.lastIndexOf.call(arr, 6.99);\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
},
{
"id": "15.4.4.15-8-a-12",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-a-12.js",
"description": "Array.prototype.lastIndexOf - deleting own property causes index property not to be visited on an Array",
"test": "assertTrue((function testcase() {\n\n var arr = [1, 2, 3, 4];\n\n Object.defineProperty(arr, \"1\", {\n get: function () {\n return \"6.99\";\n },\n configurable: true\n });\n\n Object.defineProperty(arr, \"3\", {\n get: function () {\n delete arr[1];\n return 0;\n },\n configurable: true\n });\n\n return -1 === arr.lastIndexOf(\"6.99\");\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
},
{
"id": "15.4.4.15-8-a-13",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-a-13.js",
"description": "Array.prototype.lastIndexOf - deleting property of prototype causes prototype index property not to be visited on an Array-like Object",
"test": "assertTrue((function testcase() {\n\n var arr = { 2: 2, length: 20 };\n\n Object.defineProperty(arr, \"3\", {\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 return -1 === Array.prototype.lastIndexOf.call(arr, 1);\n } finally {\n delete Object.prototype[1];\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
},
{
"id": "15.4.4.15-8-a-14",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-a-14.js",
"description": "Array.prototype.lastIndexOf - deleting property of prototype causes prototype index property not to be visited on an Array",
"test": "assertTrue((function testcase() {\n\n var arr = [0, , 2];\n\n Object.defineProperty(arr, \"20\", {\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 return -1 === arr.lastIndexOf(1);\n } finally {\n delete Array.prototype[1];\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && ![, 1].hasOwnProperty(0) && fnSupportsArrayIndexGettersOnArrays())"
},
{
"id": "15.4.4.15-8-a-15",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-a-15.js",
"description": "Array.prototype.lastIndexOf - deleting own property with prototype property causes prototype index property to be visited on an Array-like object",
"test": "assertTrue((function testcase() {\n\n var arr = { 0: 0, 1: 111, 2: 2, length: 10 };\n \n Object.defineProperty(arr, \"6\", {\n get: function () {\n delete arr[1];\n return 0;\n },\n configurable: true\n });\n\n try {\n Object.prototype[1] = 1;\n return 1 === Array.prototype.lastIndexOf.call(arr, 1);\n } finally {\n delete Object.prototype[1];\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
},
{
"id": "15.4.4.15-8-a-16",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-a-16.js",
"description": "Array.prototype.lastIndexOf - deleting own property with prototype property causes prototype index property to be visited on an Array",
"test": "assertTrue((function testcase() {\n\n var arr = [0, 111, 2]; \n \n Object.defineProperty(arr, \"2\", {\n get: function () {\n delete arr[1];\n return 0;\n },\n configurable: true\n });\n\n try {\n Array.prototype[1] = 1;\n return 1 === arr.lastIndexOf(1);\n } finally {\n delete Array.prototype[1];\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
},
{
"id": "15.4.4.15-8-a-17",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-a-17.js",
"description": "Array.prototype.lastIndexOf - decreasing length of array causes index property not to be visited",
"test": "assertTrue((function testcase() {\n\n var arr = [0, 1, 2, \"last\", 4];\n\n Object.defineProperty(arr, \"4\", {\n get: function () {\n arr.length = 3;\n return 0;\n },\n configurable: true\n });\n\n return -1 === arr.lastIndexOf(\"last\");\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
},
{
"id": "15.4.4.15-8-a-18",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-a-18.js",
"description": "Array.prototype.lastIndexOf - decreasing length of array with prototype property causes prototype index property to be visited",
"test": "assertTrue((function testcase() {\n\n var arr = [0, 1, 2, 3, 4];\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, \"3\", {\n get: function () {\n arr.length = 2;\n return 1;\n },\n configurable: true\n });\n\n return 2 === arr.lastIndexOf(\"prototype\");\n } finally {\n delete Array.prototype[2];\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
},
{
"id": "15.4.4.15-8-a-19",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-a-19.js",
"description": "Array.prototype.lastIndexOf - decreasing length of array does not delete non-configurable properties",
"test": "assertTrue((function testcase() {\n\n var arr = [0, 1, 2, 3];\n\n Object.defineProperty(arr, \"2\", {\n get: function () {\n return \"unconfigurable\";\n },\n configurable: false\n });\n\n Object.defineProperty(arr, \"3\", {\n get: function () {\n arr.length = 2;\n return 1;\n },\n configurable: true\n });\n\n return 2 === arr.lastIndexOf(\"unconfigurable\");\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
},
{
"id": "15.4.4.15-8-a-2",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-a-2.js",
"description": "Array.prototype.lastIndexOf - added properties in step 5 are visible here on an Array-like object",
"test": "assertTrue((function testcase() {\n\n var arr = { length: 30 };\n var targetObj = function () { };\n\n var fromIndex = {\n valueOf: function () {\n arr[4] = targetObj;\n return 10;\n }\n };\n \n return 4 === Array.prototype.lastIndexOf.call(arr, targetObj, fromIndex);\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-a-3",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-a-3.js",
"description": "Array.prototype.lastIndexOf - added properties in step 5 are visible here on an Array",
"test": "assertTrue((function testcase() {\n\n var arr = [];\n arr.length = 30;\n var targetObj = function () { };\n\n var fromIndex = {\n valueOf: function () {\n arr[4] = targetObj;\n return 11;\n }\n };\n\n return 4 === arr.lastIndexOf(targetObj, fromIndex);\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-a-4",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-a-4.js",
"description": "Array.prototype.lastIndexOf - deleted properties in step 2 are visible here",
"test": "assertTrue((function testcase() {\n\n var arr = { 2: 6.99 };\n\n Object.defineProperty(arr, \"length\", {\n get: function () {\n delete arr[2];\n return 3;\n },\n configurable: true\n });\n\n return -1 === Array.prototype.lastIndexOf.call(arr, 6.99);\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty))"
},
{
"id": "15.4.4.15-8-a-5",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-a-5.js",
"description": "Array.prototype.lastIndexOf - deleted properties of step 5 are visible here on an Array-like object",
"test": "assertTrue((function testcase() {\n\n var arr = { 10: false, length: 30 };\n\n var fromIndex = {\n valueOf: function () {\n delete arr[10];\n return 15;\n }\n };\n\n return -1 === Array.prototype.lastIndexOf.call(arr, false, fromIndex);\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-a-6",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-a-6.js",
"description": "Array.prototype.lastIndexOf - deleted properties of step 5 are visible here on an Array",
"test": "assertTrue((function testcase() {\n\n var arr = [];\n arr[10] = \"10\";\n arr.length = 20;\n\n var fromIndex = {\n valueOf: function () {\n delete arr[10];\n return 11;\n }\n };\n\n return -1 === arr.lastIndexOf(\"10\", fromIndex);\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-a-7",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-a-7.js",
"description": "Array.prototype.lastIndexOf - properties added into own object after current position are visited on an Array-like object",
"test": "assertTrue((function testcase() {\n \n var arr = { length: 8 };\n\n Object.defineProperty(arr, \"4\", {\n get: function () {\n Object.defineProperty(arr, \"1\", {\n get: function () {\n return 1;\n },\n configurable: true\n });\n return 0;\n },\n configurable: true\n });\n\n return Array.prototype.lastIndexOf.call(arr, 1) === 1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
},
{
"id": "15.4.4.15-8-a-8",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-a-8.js",
"description": "Array.prototype.lastIndexOf - properties added into own object after current position are visited on an Array",
"test": "assertTrue((function testcase() {\n\n var arr = [0, , 2];\n\n Object.defineProperty(arr, \"2\", {\n get: function () {\n Object.defineProperty(arr, \"1\", {\n get: function () {\n return 1;\n },\n configurable: true\n });\n return 0;\n },\n configurable: true\n });\n\n return arr.lastIndexOf(1) === 1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
},
{
"id": "15.4.4.15-8-a-9",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-a-9.js",
"description": "Array.prototype.lastIndexOf - properties can be added to prototype after current position are visited on an Array-like object",
"test": "assertTrue((function testcase() {\n\n var arr = { length: 9 };\n\n Object.defineProperty(arr, \"4\", {\n get: function () {\n Object.defineProperty(Object.prototype, \"1\", {\n get: function () {\n return Infinity;\n },\n configurable: true\n });\n return 0;\n },\n configurable: true\n });\n\n try {\n return Array.prototype.lastIndexOf.call(arr, Infinity) === 1;\n } finally {\n delete Object.prototype[1];\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
},
{
"id": "15.4.4.15-8-b-1",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-1.js",
"description": "Array.prototype.lastIndexOf - undefined property wouldn't be called",
"test": "assertTrue(([0, , 2].lastIndexOf(undefined) === -1));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-b-i-1",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-1.js",
"description": "Array.prototype.lastIndexOf - element to be retrieved is own data property on an Array-like object",
"test": "assertTrue((function testcase() {\n\n var obj = { 0: 0, 1: 1, 2: 2, length: 3 };\n\n return Array.prototype.lastIndexOf.call(obj, 0) === 0 &&\n Array.prototype.lastIndexOf.call(obj, 1) === 1 &&\n Array.prototype.lastIndexOf.call(obj, 2) === 2;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-b-i-10",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-10.js",
"description": "Array.prototype.lastIndexOf - element to be retrieved is own accessor property on an Array-like object",
"test": "assertTrue((function testcase() {\n\n var obj = { length: 3 };\n Object.defineProperty(obj, \"0\", {\n get: function () {\n return 0;\n },\n configurable: true\n });\n\n Object.defineProperty(obj, \"1\", {\n get: function () {\n return 1;\n },\n configurable: true\n });\n\n Object.defineProperty(obj, \"2\", {\n get: function () {\n return 2;\n },\n configurable: true\n });\n\n return 0 === Array.prototype.lastIndexOf.call(obj, 0) &&\n 1 === Array.prototype.lastIndexOf.call(obj, 1) &&\n 2 === Array.prototype.lastIndexOf.call(obj, 2);\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
},
{
"id": "15.4.4.15-8-b-i-11",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-11.js",
"description": "Array.prototype.lastIndexOf - element to be retrieved is own accessor property that overrides an inherited data property on an Array",
"test": "assertTrue((function testcase() {\n\n var arr = [];\n try {\n Array.prototype[0] = false;\n Object.defineProperty(arr, \"0\", {\n get: function () {\n return true;\n },\n configurable: true\n });\n\n return 0 === arr.lastIndexOf(true);\n } finally {\n delete Array.prototype[0]; \n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
},
{
"id": "15.4.4.15-8-b-i-12",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-12.js",
"description": "Array.prototype.lastIndexOf - element to be retrieved is own accessor property that overrides an inherited data property on an Array-like object",
"test": "assertTrue((function testcase() {\n var obj = { length: 1 };\n\n try {\n Object.prototype[0] = false;\n Object.defineProperty(obj, \"0\", {\n get: function () {\n return true;\n },\n configurable: true\n });\n\n return 0 === Array.prototype.lastIndexOf.call(obj, true);\n } finally {\n delete Object.prototype[0];\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
},
{
"id": "15.4.4.15-8-b-i-13",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-13.js",
"description": "Array.prototype.lastIndexOf - element to be retrieved is own accessor property that overrides an inherited accessor property on an Array",
"test": "assertTrue((function testcase() {\n\n var arr = [];\n try {\n Object.defineProperty(Array.prototype, \"0\", {\n get: function () {\n return false;\n },\n configurable: true\n });\n\n Object.defineProperty(arr, \"0\", {\n get: function () {\n return true;\n },\n configurable: true\n });\n\n return 0 === arr.lastIndexOf(true);\n } finally {\n delete Array.prototype[0];\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
},
{
"id": "15.4.4.15-8-b-i-14",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-14.js",
"description": "Array.prototype.lastIndexOf - element to be retrieved is own accessor property that overrides an inherited accessor property on an Array-like object",
"test": "assertTrue((function testcase() {\n\n var obj = { length: 1 };\n\n try {\n Object.defineProperty(Object.prototype, \"0\", {\n get: function () {\n return false;\n },\n configurable: true\n });\n\n Object.defineProperty(obj, \"0\", {\n get: function () {\n return true;\n },\n configurable: true\n });\n\n return 0 === Array.prototype.lastIndexOf.call(obj, true);\n } finally {\n delete Object.prototype[0];\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
},
{
"id": "15.4.4.15-8-b-i-15",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-15.js",
"description": "Array.prototype.lastIndexOf - element to be retrieved is inherited accessor property on an Array",
"test": "assertTrue((function testcase() {\n try {\n Object.defineProperty(Array.prototype, \"0\", {\n get: function () {\n return 10;\n },\n configurable: true\n });\n\n Object.defineProperty(Array.prototype, \"1\", {\n get: function () {\n return 20;\n },\n configurable: true\n });\n\n Object.defineProperty(Array.prototype, \"2\", {\n get: function () {\n return 30;\n },\n configurable: true\n });\n\n return 0 === [, , , ].lastIndexOf(10) &&\n 1 === [, , , ].lastIndexOf(20) &&\n 2 === [, , , ].lastIndexOf(30);\n } finally {\n delete Array.prototype[0];\n delete Array.prototype[1];\n delete Array.prototype[2];\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && ![, 1].hasOwnProperty(0) && fnSupportsArrayIndexGettersOnArrays())"
},
{
"id": "15.4.4.15-8-b-i-16",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-16.js",
"description": "Array.prototype.lastIndexOf - element to be retrieved is inherited accessor property on an Array-like object",
"test": "assertTrue((function testcase() {\n\n try {\n Object.defineProperty(Object.prototype, \"0\", {\n get: function () {\n return 10;\n },\n configurable: true\n });\n\n Object.defineProperty(Object.prototype, \"1\", {\n get: function () {\n return 20;\n },\n configurable: true\n });\n\n Object.defineProperty(Object.prototype, \"2\", {\n get: function () {\n return 30;\n },\n configurable: true\n });\n\n return 0 === Array.prototype.lastIndexOf.call({ length: 3 }, 10) &&\n 1 === Array.prototype.lastIndexOf.call({ length: 3 }, 20) &&\n 2 === Array.prototype.lastIndexOf.call({ length: 3 }, 30);\n } finally {\n delete Object.prototype[0];\n delete Object.prototype[1];\n delete Object.prototype[2];\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
},
{
"id": "15.4.4.15-8-b-i-17",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-17.js",
"description": "Array.prototype.lastIndexOf - element to be retrieved is own accessor property without a get function on an Array",
"test": "assertTrue((function testcase() {\n\n var arr = [];\n Object.defineProperty(arr, \"0\", {\n set: function () { },\n configurable: true\n });\n\n return arr.lastIndexOf(undefined) === 0;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
},
{
"id": "15.4.4.15-8-b-i-18",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-18.js",
"description": "Array.prototype.lastIndexOf - element to be retrieved is own accessor property without a get function on an Array-like object",
"test": "assertTrue((function testcase() {\n\n var obj = { length: 1 };\n Object.defineProperty(obj, \"0\", {\n set: function () { },\n configurable: true\n });\n\n return 0 === Array.prototype.lastIndexOf.call(obj, undefined);\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
},
{
"id": "15.4.4.15-8-b-i-19",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-19.js",
"description": "Array.prototype.lastIndexOf - 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 var obj = { length: 1 };\n try {\n Object.defineProperty(Object.prototype, \"0\", {\n get: function () {\n return 20;\n },\n configurable: true\n });\n Object.defineProperty(obj, \"0\", {\n set: function () { },\n configurable: true\n });\n\n return obj.hasOwnProperty(0) && 0 === Array.prototype.lastIndexOf.call(obj, undefined);\n } finally {\n delete Object.prototype[0];\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
},
{
"id": "15.4.4.15-8-b-i-2",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-2.js",
"description": "Array.prototype.lastIndexOf - element to be retrieved is own data property on an Array",
"test": "assertTrue(([true, true, true].lastIndexOf(true) === 2 &&\n [true, true, false].lastIndexOf(true) === 1 &&\n [true, false, false].lastIndexOf(true) === 0));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-b-i-20",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-20.js",
"description": "Array.prototype.lastIndexOf - element to be retrieved is an own accessor property without a get function that overrides an inherited accessor property on an Array",
"test": "assertTrue((function testcase() {\n\n var arr = [, 1];\n try {\n Object.defineProperty(Array.prototype, \"0\", {\n get: function () {\n return 100;\n },\n configurable: true\n });\n Object.defineProperty(arr, \"0\", {\n set: function () { },\n configurable: true\n });\n\n return arr.hasOwnProperty(0) && arr.lastIndexOf(undefined) === 0;\n } finally {\n delete Array.prototype[0];\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
},
{
"id": "15.4.4.15-8-b-i-21",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-21.js",
"description": "Array.prototype.lastIndexOf - element to be retrieved is inherited accessor property without a get function on an Array",
"test": "assertTrue((function testcase() {\n try {\n Object.defineProperty(Array.prototype, \"0\", {\n set: function () { },\n configurable: true\n });\n return [, ].lastIndexOf(undefined) === 0;\n } finally {\n delete Array.prototype[0];\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && ![, 1].hasOwnProperty(0) && fnSupportsArrayIndexGettersOnArrays())"
},
{
"id": "15.4.4.15-8-b-i-22",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-22.js",
"description": "Array.prototype.lastIndexOf - element to be retrieved is inherited accessor property without a get function on an Array-like object",
"test": "assertTrue((function testcase() {\n\n try {\n Object.defineProperty(Object.prototype, \"0\", {\n set: function () { },\n configurable: true\n });\n return 0 === Array.prototype.lastIndexOf.call({ length: 1 }, undefined);\n } finally {\n delete Object.prototype[0];\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
},
{
"id": "15.4.4.15-8-b-i-23",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-23.js",
"description": "Array.prototype.lastIndexOf - This object is the global object",
"test": "assertTrue((function testcase() {\n\n var targetObj = {};\n try {\n var oldLen = fnGlobalObject().length;\n fnGlobalObject()[0] = targetObj;\n fnGlobalObject()[100] = \"100\";\n fnGlobalObject()[200] = \"200\";\n fnGlobalObject().length = 200;\n return 0 === Array.prototype.lastIndexOf.call(fnGlobalObject(), targetObj) &&\n 100 === Array.prototype.lastIndexOf.call(fnGlobalObject(), \"100\") &&\n -1 === Array.prototype.lastIndexOf.call(fnGlobalObject(), \"200\");\n } finally {\n delete fnGlobalObject()[0];\n delete fnGlobalObject()[100];\n delete fnGlobalObject()[200];\n fnGlobalObject().length = oldLen;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-b-i-25",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-25.js",
"description": "Array.prototype.lastIndexOf applied to Arguments object which implements its own property get method (number of arguments is less than number of parameters)",
"test": "assertTrue((function testcase() {\n\n var func = function (a, b) {\n return 0 === Array.prototype.lastIndexOf.call(arguments, arguments[0]) &&\n -1 === Array.prototype.lastIndexOf.call(arguments, arguments[1]);\n };\n\n return func(true);\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-b-i-26",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-26.js",
"description": "Array.prototype.lastIndexOf applied to Arguments object which implements its own property get method (number of arguments equals to number of parameters)",
"test": "assertTrue((function testcase() {\n\n var func = function (a, b) {\n return 0 === Array.prototype.lastIndexOf.call(arguments, arguments[0]) &&\n 1 === Array.prototype.lastIndexOf.call(arguments, arguments[1]) &&\n -1 === Array.prototype.lastIndexOf.call(arguments, arguments[2]);\n };\n\n return func(0, true);\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-b-i-27",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-27.js",
"description": "Array.prototype.lastIndexOf applied to Arguments object which implements its own property get method (number of arguments is greater than number of parameters)",
"test": "assertTrue((function testcase() {\n\n var func = function (a, b) {\n return 2 === Array.prototype.lastIndexOf.call(arguments, arguments[0]) &&\n 3 === Array.prototype.lastIndexOf.call(arguments, arguments[3]) &&\n -1 === Array.prototype.lastIndexOf.call(arguments, arguments[4]);\n };\n\n return func(0, arguments, 0, Object.prototype);\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-b-i-28",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-28.js",
"description": "Array.prototype.lastIndexOf - side-effects are visible in subsequent iterations on an Array",
"test": "assertTrue((function testcase() {\n\n var preIterVisible = false;\n var arr = [];\n\n Object.defineProperty(arr, \"2\", {\n get: function () {\n preIterVisible = true;\n return false;\n },\n configurable: true\n });\n\n Object.defineProperty(arr, \"1\", {\n get: function () {\n if (preIterVisible) {\n return true;\n } else {\n return false;\n }\n },\n configurable: true\n });\n\n return arr.lastIndexOf(true) === 1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
},
{
"id": "15.4.4.15-8-b-i-29",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-29.js",
"description": "Array.prototype.lastIndexOf - side-effects are visible in subsequent iterations on an Array-like object",
"test": "assertTrue((function testcase() {\n\n var preIterVisible = false;\n var obj = { length: 3 };\n\n Object.defineProperty(obj, \"2\", {\n get: function () {\n preIterVisible = true;\n return false;\n },\n configurable: true\n });\n\n Object.defineProperty(obj, \"1\", {\n get: function () {\n if (preIterVisible) {\n return true;\n } else {\n return false;\n }\n },\n configurable: true\n });\n\n return Array.prototype.lastIndexOf.call(obj, true) === 1;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
},
{
"id": "15.4.4.15-8-b-i-3",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-3.js",
"description": "Array.prototype.lastIndexOf - element to be retrieved is own data property that overrides an inherited data property on an Array",
"test": "assertTrue((function testcase() {\n try {\n Array.prototype[0] = Object;\n return [Object.prototype].lastIndexOf(Object.prototype) === 0;\n } finally {\n delete Array.prototype[0];\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-b-i-30",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-30.js",
"description": "Array.prototype.lastIndexOf terminates iteration on unhandled exception on an Array",
"test": "assertTrue((function testcase() {\n\n var accessed = false;\n var arr = [];\n\n Object.defineProperty(arr, \"2\", {\n get: function () {\n throw new TypeError();\n },\n configurable: true\n });\n\n Object.defineProperty(arr, \"1\", {\n get: function () {\n accessed = true;\n return true;\n },\n configurable: true\n });\n\n try {\n arr.lastIndexOf(true);\n return false;\n } catch (e) {\n return (e instanceof TypeError) && !accessed;\n }\n\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
},
{
"id": "15.4.4.15-8-b-i-31",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-31.js",
"description": "Array.prototype.lastIndexOf terminates iteration on unhandled exception on an Array-like object",
"test": "assertTrue((function testcase() {\n\n var accessed = false;\n var obj = { length: 3 };\n\n Object.defineProperty(obj, \"2\", {\n get: function () {\n throw new TypeError();\n },\n configurable: true\n });\n\n Object.defineProperty(obj, \"1\", {\n get: function () {\n accessed = true;\n return true;\n },\n configurable: true\n });\n\n try {\n Array.prototype.lastIndexOf.call(obj, true);\n return false;\n } catch (e) {\n return (e instanceof TypeError) && !accessed;\n }\n\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
},
{
"id": "15.4.4.15-8-b-i-4",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-4.js",
"description": "Array.prototype.lastIndexOf - 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 try {\n Object.prototype[0] = false;\n return 0 === Array.prototype.lastIndexOf.call({ 0: true, 1: 1, length: 2 }, true);\n } finally {\n delete Object.prototype[0];\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-b-i-5",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-5.js",
"description": "Array.prototype.lastIndexOf - element to be retrieved is own data property that overrides an inherited accessor property on an Array",
"test": "assertTrue((function testcase() {\n try {\n Object.defineProperty(Array.prototype, \"0\", {\n get: function () {\n return false;\n },\n configurable: true\n });\n return 0 === [Number].lastIndexOf(Number);\n } finally {\n delete Array.prototype[0];\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
},
{
"id": "15.4.4.15-8-b-i-6",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-6.js",
"description": "Array.prototype.lastIndexOf - 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 try {\n Object.defineProperty(Object.prototype, \"0\", {\n get: function () {\n return false;\n },\n configurable: true\n });\n return 0 === Array.prototype.lastIndexOf.call({ 0: true, 1: 1, length: 2 }, true);\n } finally {\n delete Object.prototype[0];\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
},
{
"id": "15.4.4.15-8-b-i-7",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-7.js",
"description": "Array.prototype.lastIndexOf - element to be retrieved is inherited data property on an Array",
"test": "assertTrue((function testcase() {\n\n try {\n Array.prototype[0] = true;\n Array.prototype[1] = false;\n Array.prototype[2] = \"true\";\n return 0 === [, , , ].lastIndexOf(true) &&\n 1 === [, , , ].lastIndexOf(false) &&\n 2 === [, , , ].lastIndexOf(\"true\");\n } finally {\n delete Array.prototype[0];\n delete Array.prototype[1];\n delete Array.prototype[2];\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && ![, 1].hasOwnProperty(0))"
},
{
"id": "15.4.4.15-8-b-i-8",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-8.js",
"description": "Array.prototype.lastIndexOf - element to be retrieved is inherited data property on an Array-like object",
"test": "assertTrue((function testcase() {\n\n try {\n Object.prototype[0] = true;\n Object.prototype[1] = false;\n Object.prototype[2] = \"true\";\n return 0 === Array.prototype.lastIndexOf.call({ length: 3 }, true) &&\n 1 === Array.prototype.lastIndexOf.call({ length: 3 }, false) &&\n 2 === Array.prototype.lastIndexOf.call({ length: 3 }, \"true\");\n } finally {\n delete Object.prototype[0];\n delete Object.prototype[1];\n delete Object.prototype[2];\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-b-i-9",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-i-9.js",
"description": "Array.prototype.lastIndexOf - element to be retrieved is own accessor property on an Array",
"test": "assertTrue((function testcase() {\n\n var arr = [, , , ];\n Object.defineProperty(arr, \"0\", {\n get: function () {\n return 0;\n },\n configurable: true\n });\n\n Object.defineProperty(arr, \"1\", {\n get: function () {\n return 1;\n },\n configurable: true\n });\n\n Object.defineProperty(arr, \"2\", {\n get: function () {\n return 2;\n },\n configurable: true\n });\n\n return arr.lastIndexOf(0) === 0 && arr.lastIndexOf(1) === 1 && arr.lastIndexOf(2) === 2;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
},
{
"id": "15.4.4.15-8-b-ii-1",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-ii-1.js",
"description": "Array.prototype.lastIndexOf - type of array element is different from type of search element",
"test": "assertTrue(([\"true\"].lastIndexOf(true) === -1 &&\n [\"0\"].lastIndexOf(0) === -1 &&\n [false].lastIndexOf(0) === -1 &&\n [undefined].lastIndexOf(0) === -1 &&\n [null].lastIndexOf(0) === -1 &&\n [[]].lastIndexOf(0) === -1));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-b-ii-10",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-ii-10.js",
"description": "Array.prototype.lastIndexOf - both array element and search element are booleans, and they have same value",
"test": "assertTrue(([false, true].lastIndexOf(true) === 1));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-b-ii-11",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-ii-11.js",
"description": "Array.prototype.lastIndexOf - both array element and search element are Objects, and they refer to the same object",
"test": "assertTrue((function testcase() {\n\n var obj1 = {};\n var obj2 = {};\n var obj3 = obj2;\n return [obj2, obj1].lastIndexOf(obj3) === 0;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-b-ii-2",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-ii-2.js",
"description": "Array.prototype.lastIndexOf - both type of array element and type of search element are Undefined",
"test": "assertTrue(([undefined].lastIndexOf() === 0 && [undefined].lastIndexOf(undefined) === 0));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-b-ii-3",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-ii-3.js",
"description": "Array.prototype.lastIndexOf - both type of array element and type of search element are Null",
"test": "assertTrue(([null].lastIndexOf(null) === 0));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-b-ii-4",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-ii-4.js",
"description": "Array.prototype.lastIndexOf - search element is NaN",
"test": "assertTrue(([+NaN, NaN, -NaN].lastIndexOf(NaN) === -1));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-b-ii-5",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-ii-5.js",
"description": "Array.prototype.lastIndexOf - search element is -NaN",
"test": "assertTrue(([+NaN, NaN, -NaN].lastIndexOf(-NaN) === -1));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-b-ii-6",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-ii-6.js",
"description": "Array.prototype.lastIndexOf - array element is +0 and search element is -0",
"test": "assertTrue(([+0].lastIndexOf(-0) === 0));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-b-ii-7",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-ii-7.js",
"description": "Array.prototype.lastIndexOf - array element is -0 and search element is +0",
"test": "assertTrue(([-0].lastIndexOf(+0) === 0));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-b-ii-8",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-ii-8.js",
"description": "Array.prototype.lastIndexOf - both array element and search element are numbers, and they have same value",
"test": "assertTrue(([-1, 0, 1].lastIndexOf(-1) === 0));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-b-ii-9",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-ii-9.js",
"description": "Array.prototype.lastIndexOf - both array element and search element are strings, and they have exactly the same sequence of characters",
"test": "assertTrue(([\"abc\", \"ab\", \"bca\", \"\"].lastIndexOf(\"abc\") === 0));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-b-iii-1",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-iii-1.js",
"description": "Array.prototype.lastIndexOf returns index of last one when more than two elements in array are eligible",
"test": "assertTrue(([2, 1, 2, 2, 1].lastIndexOf(2) === 3));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-8-b-iii-2",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-8-b-iii-2.js",
"description": "Array.prototype.lastIndexOf returns without visiting subsequent element once search value is found",
"test": "assertTrue((function testcase() {\n var arr = [2, 1, , 1, 2];\n var elementFirstAccessed = false;\n var elementThirdAccessed = false;\n\n Object.defineProperty(arr, \"2\", {\n get: function () {\n elementThirdAccessed = true;\n return 2;\n },\n configurable: true\n });\n Object.defineProperty(arr, \"0\", {\n get: function () {\n elementFirstAccessed = true;\n return 2;\n },\n configurable: true\n });\n\n arr.lastIndexOf(2);\n return !elementThirdAccessed && !elementFirstAccessed;\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnArrays())"
},
{
"id": "15.4.4.15-9-1",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-9-1.js",
"description": "Array.prototype.lastIndexOf returns -1 for elements not present",
"test": "assertTrue((function testcase() {\n var a = new Array();\n a[100] = 1;\n a[99999] = \"\"; \n a[10] = new Object();\n a[5555] = 5.5;\n a[123456] = \"str\";\n a[5] = 1E+309;\n if (a.lastIndexOf(1) !== 100 ||\n a.lastIndexOf(\"\") !== 99999 ||\n a.lastIndexOf(\"str\") !== 123456 ||\n a.lastIndexOf(5.5) !== 5555 ||\n a.lastIndexOf(1E+309) !== 5 ) \n {\n return false;\n } \n if (a.lastIndexOf(true) === -1 && \n a.lastIndexOf(5) === -1 &&\n a.lastIndexOf(\"str1\") === -1 &&\n a.lastIndexOf(null) === -1 &&\n a.lastIndexOf(new Object()) === -1 ) \n {\n return true;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.lastIndexOf))"
},
{
"id": "15.4.4.15-9-2",
"path": "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-9-2.js",
"description": "Array.prototype.lastIndexOf returns -1 if 'length' is 0 and does not access any other properties",
"test": "assertTrue((function testcase() {\n var accessed = false;\n var f = {length: 0};\n Object.defineProperty(f,\"0\",{get: function () {accessed = true; return 1;}});\n \n var i = Array.prototype.lastIndexOf.call(f,1);\n \n if (i === -1 && accessed==false) {\n return true;\n }\n }).call(this));\n",
"precondition": "(fnExists(Array.prototype.indexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects())"
}
]
}
}