(mode)
| 63 | describe('never above 1'); |
| 64 | |
| 65 | function mathRandomNeverAboveOne(mode) { |
| 66 | const gpu = new GPU({ mode }); |
| 67 | const checkCount = 20; |
| 68 | const checkSource = []; |
| 69 | |
| 70 | for (let i = 0; i < checkCount; i++) { |
| 71 | checkSource.push(`const check${ i } = Math.random();`); |
| 72 | } |
| 73 | |
| 74 | for (let i = 0; i < checkCount; i++) { |
| 75 | for (let j = 0; j < checkCount; j++) { |
| 76 | if (i === j) continue; |
| 77 | checkSource.push(`if (check${i} >= 1) return 1;`); |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | const kernel = gpu.createKernel(`function() { |
| 82 | ${checkSource.join('\n')} |
| 83 | return 0; |
| 84 | }`, { output: [1] }); |
| 85 | |
| 86 | const result = kernel(); |
| 87 | assert.ok(result.every(value => value === 0)); |
| 88 | } |
| 89 | |
| 90 | test('never above 1 every time auto', () => { |
| 91 | mathRandomNeverAboveOne(); |
no test coverage detected
searching dependent graphs…