mirror of
https://github.com/gpujs/gpu.js.git
synced 2026-01-18 16:04:10 +00:00
refactored webgl for statements, to be more performant added unit tests for "for" statements will do the same for cpu for statements next fixed some issues in typings file exposed FunctionNode from standard importer
26 lines
694 B
JavaScript
26 lines
694 B
JavaScript
const { assert, test, module: describe, only } = require('qunit');
|
|
const { FunctionNode } = require(process.cwd() + '/src');
|
|
|
|
describe('FunctionNode.isSafe()');
|
|
|
|
test('calls this.getDependencies(ast) and then this.isSafeDependencies()', () => {
|
|
const mockAst = {};
|
|
const dependenciesMock = {
|
|
dependencies: []
|
|
};
|
|
let calls = 0;
|
|
FunctionNode.prototype.isSafe.call({
|
|
getDependencies: (ast) => {
|
|
assert.equal(ast, mockAst);
|
|
assert.equal(calls++, 0);
|
|
return dependenciesMock;
|
|
},
|
|
isSafeDependencies: (dependencies) => {
|
|
assert.equal(calls++, 1);
|
|
assert.equal(dependencies, dependenciesMock);
|
|
}
|
|
}, mockAst);
|
|
|
|
assert.equal(calls, 2);
|
|
});
|