forked from fingerecho/gpu.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path147-missing-constant.js
More file actions
48 lines (40 loc) · 1.28 KB
/
147-missing-constant.js
File metadata and controls
48 lines (40 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
(function() {
var gpu;
function getValue(mode) {
gpu = new GPU({ mode: mode });
const kernel = gpu.createKernel(function() {
return getPi();
})
.setOutput([1])
.setConstants({ pi: Math.PI });
gpu.addFunction(function getPi() {
return this.constants.pi;
});
return kernel();
}
QUnit.test( "Issue #130 - missing constant (cpu)", function() {
var value = getValue('cpu');
QUnit.assert.equal((value[0]).toFixed(7), Math.PI.toFixed(7));
gpu.destroy();
});
QUnit.test( "Issue #130 - missing constant (auto)", function() {
var value = getValue(null);
QUnit.assert.equal((value[0]).toFixed(7), Math.PI.toFixed(7));
gpu.destroy();
});
QUnit.test( "Issue #130 - missing constant (gpu)", function() {
var value = getValue('gpu');
QUnit.assert.equal((value[0]).toFixed(7), Math.PI.toFixed(7));
gpu.destroy();
});
QUnit.test( "Issue #130 - missing constant (webgl)", function() {
var value = getValue('webgl');
QUnit.assert.equal((value[0]).toFixed(7), Math.PI.toFixed(7));
gpu.destroy();
});
QUnit.test( "Issue #130 - missing constant (webgl2)", function() {
var value = getValue('webgl2');
QUnit.assert.equal((value[0]).toFixed(7), Math.PI.toFixed(7));
gpu.destroy();
});
})();