(taConstr, f, oobValue, offset)
| 73 | } |
| 74 | |
| 75 | function testElementType(taConstr, f, oobValue, offset) { |
| 76 | clearArray(); |
| 77 | |
| 78 | var ta = new taConstr(sab, offset); |
| 79 | var name = Object.prototype.toString.call(ta); |
| 80 | assertEquals(0, ta[0]); |
| 81 | assertEquals(0, f(0, 0, 50), name); |
| 82 | assertEquals(50, ta[0]); |
| 83 | // Value is not equal to 0, so compareExchange won't store 100 |
| 84 | assertEquals(50, f(0, 0, 100), name); |
| 85 | assertEquals(50, ta[0]); |
| 86 | // out of bounds |
| 87 | assertThrows(function() { f(-1, 0, 0); }); |
| 88 | assertThrows(function() { f(ta.length, 0, 0); }); |
| 89 | } |
| 90 | |
| 91 | function testElement(m, offset) { |
| 92 | testElementType(Int8Array, m.compareExchangei8, 0, offset); |
no test coverage detected