gpu.js/test/features/function-return.js
Robert Plummer 8bf362ad9a feat: No failing tests locally, only skipping and passing
Also:
feat: Typescript typings
feat: api cleanup and exports
feat: removal of building for node, only browser
2019-01-29 21:41:21 -05:00

41 lines
850 B
JavaScript

const { assert, skip, test, module: describe } = require('qunit');
const { GPU } = require('../../src');
describe('function return');
function functionReturn( mode ) {
const gpu = new GPU({ mode });
const f = gpu.createKernel(function() {
return 42.0;
}, {
output : [1]
});
assert.ok( f !== null, "function generated test");
assert.equal(f()[0], 42.0, "basic return function test");
gpu.destroy();
}
test("auto", () => {
functionReturn(null);
});
test("gpu", () => {
functionReturn("gpu");
});
(GPU.isWebGLSupported ? test : skip)("webgl", () => {
functionReturn("webgl");
});
(GPU.isWebGL2Supported ? test : skip)("webgl2", () => {
functionReturn("webgl2");
});
(GPU.isHeadlessGLSupported ? test : skip)("headlessgl", () => {
functionReturn("headlessgl");
});
test("cpu", () => {
functionReturn("cpu");
});