(mode)
| 50 | }); |
| 51 | |
| 52 | function testMatrix3(mode) { |
| 53 | const gpu = new GPU({ mode }); |
| 54 | function getMatrix() { |
| 55 | const matrix = [ |
| 56 | [1,2,3], |
| 57 | [4,5,6], |
| 58 | [7,8,9], |
| 59 | ]; |
| 60 | return matrix; |
| 61 | } |
| 62 | gpu.addFunction(getMatrix); |
| 63 | const kernel = gpu.createKernel(function(y, x) { |
| 64 | return getMatrix()[y][x]; |
| 65 | }, { output: [1] }); |
| 66 | |
| 67 | assert.equal(kernel(0, 0)[0], 1); |
| 68 | assert.equal(kernel(0, 1)[0], 2); |
| 69 | assert.equal(kernel(0, 2)[0], 3); |
| 70 | assert.equal(kernel(1, 0)[0], 4); |
| 71 | assert.equal(kernel(1, 1)[0], 5); |
| 72 | assert.equal(kernel(1, 2)[0], 6); |
| 73 | assert.equal(kernel(2, 0)[0], 7); |
| 74 | assert.equal(kernel(2, 1)[0], 8); |
| 75 | assert.equal(kernel(2, 2)[0], 9); |
| 76 | |
| 77 | gpu.destroy(); |
| 78 | } |
| 79 | |
| 80 | test('matrix3 auto', () => { |
| 81 | testMatrix3(); |
no test coverage detected
searching dependent graphs…