| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
gTestfile = '15.5.4.6-1.js'; |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
var SECTION = "15.5.4.6-1"; |
| 49 |
var VERSION = "ECMA_1"; |
| 50 |
startTest(); |
| 51 |
var TITLE = "String.protoype.indexOf"; |
| 52 |
|
| 53 |
var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" ); |
| 54 |
|
| 55 |
writeHeaderToLog( SECTION + " "+ TITLE); |
| 56 |
|
| 57 |
var j = 0; |
| 58 |
|
| 59 |
for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) { |
| 60 |
new TestCase( SECTION, |
| 61 |
"String.indexOf(" +String.fromCharCode(i)+ ", 0)", |
| 62 |
k, |
| 63 |
TEST_STRING.indexOf( String.fromCharCode(i), 0 ) ); |
| 64 |
} |
| 65 |
|
| 66 |
for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) { |
| 67 |
new TestCase( SECTION, |
| 68 |
"String.indexOf("+String.fromCharCode(i)+ ", "+ k +")", |
| 69 |
k, |
| 70 |
TEST_STRING.indexOf( String.fromCharCode(i), k ) ); |
| 71 |
} |
| 72 |
|
| 73 |
for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) { |
| 74 |
new TestCase( SECTION, |
| 75 |
"String.indexOf("+String.fromCharCode(i)+ ", "+k+1+")", |
| 76 |
-1, |
| 77 |
TEST_STRING.indexOf( String.fromCharCode(i), k+1 ) ); |
| 78 |
} |
| 79 |
|
| 80 |
for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) { |
| 81 |
new TestCase( SECTION, |
| 82 |
"String.indexOf("+(String.fromCharCode(i) + |
| 83 |
String.fromCharCode(i+1)+ |
| 84 |
String.fromCharCode(i+2)) +", "+0+")", |
| 85 |
k, |
| 86 |
TEST_STRING.indexOf( (String.fromCharCode(i)+ |
| 87 |
String.fromCharCode(i+1)+ |
| 88 |
String.fromCharCode(i+2)), |
| 89 |
0 ) ); |
| 90 |
} |
| 91 |
|
| 92 |
for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) { |
| 93 |
new TestCase( SECTION, |
| 94 |
"String.indexOf("+(String.fromCharCode(i) + |
| 95 |
String.fromCharCode(i+1)+ |
| 96 |
String.fromCharCode(i+2)) +", "+ k +")", |
| 97 |
k, |
| 98 |
TEST_STRING.indexOf( (String.fromCharCode(i)+ |
| 99 |
String.fromCharCode(i+1)+ |
| 100 |
String.fromCharCode(i+2)), |
| 101 |
k ) ); |
| 102 |
} |
| 103 |
for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) { |
| 104 |
new TestCase( SECTION, |
| 105 |
"String.indexOf("+(String.fromCharCode(i) + |
| 106 |
String.fromCharCode(i+1)+ |
| 107 |
String.fromCharCode(i+2)) +", "+ k+1 +")", |
| 108 |
-1, |
| 109 |
TEST_STRING.indexOf( (String.fromCharCode(i)+ |
| 110 |
String.fromCharCode(i+1)+ |
| 111 |
String.fromCharCode(i+2)), |
| 112 |
k+1 ) ); |
| 113 |
} |
| 114 |
|
| 115 |
new TestCase( SECTION, "String.indexOf(" +TEST_STRING + ", 0 )", 0, TEST_STRING.indexOf( TEST_STRING, 0 ) ); |
| 116 |
|
| 117 |
new TestCase( SECTION, "String.indexOf(" +TEST_STRING + ", 1 )", -1, TEST_STRING.indexOf( TEST_STRING, 1 )); |
| 118 |
|
| 119 |
print( "TEST_STRING = new String(\" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\")" ); |
| 120 |
|
| 121 |
|
| 122 |
test(); |