mirror of
https://github.com/gpujs/gpu.js.git
synced 2025-12-08 20:35:56 +00:00
Also: feat: Typescript typings feat: api cleanup and exports feat: removal of building for node, only browser
41 lines
850 B
JavaScript
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");
|
|
});
|