OLD | NEW |
1 function createArrayBufferContainingHelloWorld() | 1 function createArrayBufferContainingHelloWorld() |
2 { | 2 { |
3 var hello = "Hello, world!"; | 3 var hello = "Hello, world!"; |
4 var array = new Uint8Array(hello.length); | 4 var array = new Uint8Array(hello.length); |
5 for (var i = 0; i < hello.length; ++i) | 5 for (var i = 0; i < hello.length; ++i) |
6 array[i] = hello.charCodeAt(i); | 6 array[i] = hello.charCodeAt(i); |
7 return array.buffer; | 7 return array.buffer; |
8 } | 8 } |
9 | 9 |
10 function createEmptyArrayBuffer() | 10 function createEmptyArrayBuffer() |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 postMessage("FAIL: actualArray.length should be " + expectedArray.length
+ " but was " + actualArray.length); | 67 postMessage("FAIL: actualArray.length should be " + expectedArray.length
+ " but was " + actualArray.length); |
68 // Print only the first mismatched byte in order not to flood console. | 68 // Print only the first mismatched byte in order not to flood console. |
69 for (var i = 0; i < expectedArray.length; ++i) { | 69 for (var i = 0; i < expectedArray.length; ++i) { |
70 if (actualArray[i] != expectedArray[i]) { | 70 if (actualArray[i] != expectedArray[i]) { |
71 postMessage("FAIL: Value mismatch: actualArray[" + i + "] = " + actu
alArray[i] + ", expectedArray[" + i + "] = " + expectedArray[i]); | 71 postMessage("FAIL: Value mismatch: actualArray[" + i + "] = " + actu
alArray[i] + ", expectedArray[" + i + "] = " + expectedArray[i]); |
72 return; | 72 return; |
73 } | 73 } |
74 } | 74 } |
75 postMessage("PASS: Passed: Message #" + testIndex + "."); | 75 postMessage("PASS: Passed: Message #" + testIndex + "."); |
76 } | 76 } |
OLD | NEW |