gpu.js/test/features/function-return.js
Robert Plummer 3005828b86 fix: Migrating tests, and build
This was a good resting point.
Delete unneeded files.
2019-01-18 08:32:10 -05:00

47 lines
1.1 KiB
JavaScript

var GPU = require('../../src/index');
require('qunit-assert-close');
(function() {
function functionReturn( mode ) {
var gpu = new GPU({ mode: mode });
var f = gpu.createKernel(function() {
return 42.0;
}, {
output : [1]
});
QUnit.assert.ok( f !== null, "function generated test");
QUnit.assert.close(f()[0], 42.0, 0.01, "basic return function test");
gpu.destroy();
}
QUnit.test( "functionReturn (auto)", function() {
functionReturn(null);
});
QUnit.test( "functionReturn (gpu)", function() {
functionReturn("gpu");
});
if (GPU.isWebGlSupported()) {
QUnit.test("functionReturn (webgl)", function () {
functionReturn("webgl");
});
}
if (GPU.isWebGl2Supported()) {
QUnit.test("functionReturn (webgl2)", function () {
functionReturn("webgl2");
});
}
if (GPU.isHeadlessGlSupported()) {
QUnit.test("functionReturn (headlessgl)", function () {
functionReturn("headlessgl");
});
}
QUnit.test( "functionReturn (CPU)", function() {
functionReturn("cpu");
});
})();