gpu.js/test/issues/263-to-string.js
Robert Plummer b2df0ab604 fix #316
Change `HTMLImageArray` render strategy to `gl.NEAREST`, like all the others
Let `WebGL2FunctionNode` extend `WebGLFunctionNode` and lighten
Remove all the different html pages associated with tests, and just use one file to handle them and use qunit for filtering them
Bump version number
2018-06-12 14:07:41 -04:00

34 lines
1006 B
JavaScript

function buildToStringKernelResult(mode) {
const gpu = new GPU({ mode });
const kernel = gpu.createKernel(function() {
return 1;
}, {
output: [1]
});
kernel.build();
const string = kernel.toString();
const kernel2 = eval(string)();
return kernel2
.setWebGl(kernel._webGl)
.setCanvas(kernel._canvas)();
}
QUnit.test('Issue #263 toString single function - (auto)', () => {
QUnit.assert.equal(buildToStringKernelResult()[0], 1);
});
QUnit.test('Issue #263 toString single function - (gpu)', () => {
QUnit.assert.equal(buildToStringKernelResult('gpu')[0], 1);
});
QUnit.test('Issue #263 toString single function - (webgl)', () => {
QUnit.assert.equal(buildToStringKernelResult('webgl')[0], 1);
});
QUnit.test('Issue #263 toString single function - (webgl2)', () => {
QUnit.assert.equal(buildToStringKernelResult('webgl2')[0], 1);
});
QUnit.test('Issue #263 toString single function - (cpu)', () => {
QUnit.assert.equal(buildToStringKernelResult('cpu')[0], 1);
});