blob: 00646eb963413b2f9074e617e195818fc36c3850 [file] [log] [blame]
<html>
<head>
<script type="text/javascript">
<!--
var testArray = new Array("Hello", "Hi", true, 5, 5, 9, null, undefined);
var testArray2 = new Array("Hello", "Hi", true, 5, 5, 9);
var testArray3 = new Object;
testArray3.__proto__ = testArray2.__proto__;
testArray3[0] = "Hello";
testArray3[1] = "Hi";
testArray3[2] = true;
testArray3[3] = 5;
testArray3[4] = 5;
testArray3[5] = 9;
testArray3.length = 6;
var testArray4 = [5, 5, 5, undefined];
delete testArray4[1];
var testArray5 = [5, 5, 5, undefined];
delete testArray5[3];
var testArray6 = new Array(20);
if (window.testRunner)
testRunner.dumpAsText();
// -->
</script>
</head>
<body>
<p>1.0 Direct Testing, no starting at Parameter<br>
* The indexOf String "Hello" is <script>document.write(testArray.indexOf("Hello"))</script><br>
* The indexOf String "Hi" is <script>document.write(testArray.indexOf("Hi"))</script><br>
* The indexOf Boolean 'true' is <script>document.write(testArray.indexOf( true ))</script><br>
* The indexOf Number '5' is <script>document.write(testArray.indexOf( 5 ))</script><br>
* The indexOf Number '9' is <script>document.write(testArray.indexOf( 9 ))</script>
</p>
<p>2.0 A firstIndex parameter of 1 (positive offset test)<br>
* The indexOf String "Hi" is <script>document.write(testArray.indexOf("Hi",1))</script><br>
* The indexOf Boolean 'true' is <script>document.write(testArray.indexOf(true,1))</script><br>
* The indexOf Number 5 is <script>document.write(testArray.indexOf(5,1))</script><br>
* The indexOf Number 9 is <script>document.write(testArray.indexOf(9,1))</script>
</p>
<p>3.0 A firstIndex parameter of -4 (negative offset test)<br>
* The indexOf String "Hi" is <script>document.write(testArray.indexOf("Hi",-4))</script><br>
* The indexOf Boolean 'true' is <script>document.write(testArray.indexOf(true,-4))</script><br>
* The indexOf Number 5 is <script>document.write(testArray.indexOf(5,-4))</script><br>
* The indexOf Number 9 is <script>document.write(testArray.indexOf(9,-4))</script>
</p>
<p>4.0 A big positive firstIndex of 1000, to test the firstIndex > length<br>
* The indexOf Number '9' is <script>document.write(testArray.indexOf(9,1000))</script>
</p>
<p>5.0 A big positive firstIndex of 4294967301, to test when firstIndex > width of int (32-bits)<br>
* The indexOf Boolean 'true' is <script>document.write(testArray.indexOf(true, 4294967301))</script>
</p>
<p>6.0 No arguments<br>
* No arguments passed: <script>document.write(testArray.indexOf())</script><br>
* No arguments passed: <script>document.write(testArray2.indexOf())</script>
</p>
<p>7.0 Looking for null<br>
* The indexOf null is <script>document.write(testArray.indexOf(null))</script><br>
* The indexOf null is <script>document.write(testArray2.indexOf(null))</script>
</p>
<p>8.0 Extra arguments<br>
* The indexOf String "Hello" is <script>document.write(testArray.indexOf("Hello", 0, true))</script>
</p>
<p>9.0 NaN firstIndex<br>
* The indexOf String "Hi" is <script>document.write(testArray.indexOf("Hello", "Hey"))</script>
</p>
<p>10.0 Small firstIndex<br>
* The indexOf Boolean 'true' is <script>document.write(testArray.indexOf(true, 0.45))</script>
</p>
<p>11.0 Negative firstIndex bigger than the length of the array<br>
* The indexOf Boolean 'true' is <script>document.write(testArray.indexOf(true, -1000))</script>
</p>
<p>12.0 Negative firstIndex bigger than 32-bits<br>
* The indexOf Boolean 'true' is <script>document.write(testArray.indexOf(true, -5294967301))</script>
</p>
<p>13.0 Looking for undefined<br>
* The indexOf undefined is <script>document.write(testArray.indexOf(undefined))</script><br>
* The indexOf undefined is <script>document.write(testArray2.indexOf(undefined))</script><br>
* The indexOf undefined is <script>document.write(testArray4.indexOf(undefined))</script><br>
* The indexOf undefined is <script>document.write(testArray5.indexOf(undefined))</script><br>
* The indexOf undefined is <script>document.write(testArray6.indexOf(undefined))</script>
</p>
<p>14.0 Object using the Array prototype<br>
* The indexOf String "Hello" is <script>document.write(testArray3.indexOf("Hello"))</script><br>
* The indexOf String "Hi" is <script>document.write(testArray3.indexOf("Hi"))</script><br>
* The indexOf Boolean 'true' is <script>document.write(testArray3.indexOf(true))</script><br>
* The indexOf Number '5' is <script>document.write(testArray3.indexOf(5))</script><br>
* The indexOf Number '9' is <script>document.write(testArray3.indexOf(9))</script>
</p>
</body>
</html>