mirror of
https://github.com/gpujs/gpu.js.git
synced 2026-01-18 16:04:10 +00:00
fix: Added test suite for arrays and inputs for webgl and webgl2 fix: Rename "floatOutput" feature to "precision". Values can be "unsigned" or "single" fix: Add input and Input to typings fix: Use Int32Array for input.size
131 lines
5.0 KiB
JavaScript
131 lines
5.0 KiB
JavaScript
const { assert, skip, test, module: describe, only } = require('qunit');
|
|
const { utils } = require('../../src');
|
|
|
|
describe('internal: utils');
|
|
|
|
test('systemEndianness not null', () => {
|
|
assert.ok(utils.systemEndianness() !== null, 'not null check');
|
|
assert.ok(utils.systemEndianness() === 'LE' || utils.systemEndianness() === 'BE', 'value = ' + utils.systemEndianness());
|
|
});
|
|
|
|
test('isFunction', () => {
|
|
assert.ok(utils.isFunction(function() { }));
|
|
assert.notOk(utils.isFunction({}));
|
|
});
|
|
|
|
test('isFunctionString', () => {
|
|
assert.ok(utils.isFunctionString('function() { }'));
|
|
assert.notOk(utils.isFunctionString({}));
|
|
});
|
|
|
|
test('getFunctionName_fromString', () => {
|
|
assert.equal('test', utils.getFunctionNameFromString('function test() { }'));
|
|
});
|
|
|
|
test('getParamNames_fromString', () => {
|
|
assert.deepEqual(['a','b','c'], utils.getArgumentNamesFromString('function test(a,b,c) { }'));
|
|
});
|
|
|
|
test('closestSquareDimensions 2', () => {
|
|
assert.deepEqual(Array.from(utils.closestSquareDimensions(2)), [1,2]);
|
|
});
|
|
|
|
test('closestSquareDimensions 5', () => {
|
|
assert.deepEqual(Array.from(utils.closestSquareDimensions(5)), [2,3]);
|
|
});
|
|
|
|
test('closestSquareDimensions 6', () => {
|
|
assert.deepEqual(Array.from(utils.closestSquareDimensions(6)), [2,3]);
|
|
});
|
|
|
|
test('closestSquareDimensions 7', () => {
|
|
assert.deepEqual(Array.from(utils.closestSquareDimensions(7)), [4,2]);
|
|
});
|
|
|
|
test('getDimensions Array of 6, padded', () => {
|
|
assert.deepEqual(Array.from(utils.getDimensions(new Array(6).fill(1), true)), [6,1,1]);
|
|
});
|
|
|
|
test('getDimensions Array of 6,1,1, padded', () => {
|
|
assert.deepEqual(Array.from(utils.getDimensions([[[1,1,1,1,1,1]]], true)), [6,1,1]);
|
|
});
|
|
|
|
test('getDimensions Array of 1,6,1, padded', () => {
|
|
assert.deepEqual(Array.from(utils.getDimensions([[[1],[1],[1],[1],[1],[1]]], true)), [1,6,1]);
|
|
});
|
|
|
|
test('getDimensions Array of 1,1,6, padded', () => {
|
|
assert.deepEqual(Array.from(utils.getDimensions([[[1]],[[1]],[[1]],[[1]],[[1]],[[1]]], true)), [1,1,6]);
|
|
});
|
|
|
|
test('getMemoryOptimizedFloatTextureSize [6,1,1], bitRatio 4', () => {
|
|
assert.deepEqual(Array.from(utils.getMemoryOptimizedFloatTextureSize([6, 1, 1], 4)), [1, 2]);
|
|
});
|
|
|
|
test('getMemoryOptimizedFloatTextureSize [1,6,1], bitRatio 4', () => {
|
|
assert.deepEqual(Array.from(utils.getMemoryOptimizedFloatTextureSize([1, 6, 1], 4)), [1, 2]);
|
|
});
|
|
|
|
test('getMemoryOptimizedFloatTextureSize [1,1,6], bitRatio 4', () => {
|
|
assert.deepEqual(Array.from(utils.getMemoryOptimizedFloatTextureSize([1, 1, 6], 4)), [1, 2]);
|
|
});
|
|
|
|
test('getMemoryOptimizedFloatTextureSize [6,1,1], bitRatio 2', () => {
|
|
assert.deepEqual(Array.from(utils.getMemoryOptimizedFloatTextureSize([6, 1, 1], 2)), [2, 2]);
|
|
});
|
|
|
|
test('getMemoryOptimizedFloatTextureSize [1,6,1], bitRatio 2', () => {
|
|
assert.deepEqual(Array.from(utils.getMemoryOptimizedFloatTextureSize([1, 6, 1], 2)), [2, 2]);
|
|
});
|
|
|
|
test('getMemoryOptimizedFloatTextureSize [1,1,6], bitRatio 2', () => {
|
|
assert.deepEqual(Array.from(utils.getMemoryOptimizedFloatTextureSize([1, 1, 6], 2)), [2, 2]);
|
|
});
|
|
|
|
test('getMemoryOptimizedFloatTextureSize [6,1,1], bitRatio 1', () => {
|
|
assert.deepEqual(Array.from(utils.getMemoryOptimizedFloatTextureSize([6, 1, 1], 1)), [4, 2]);
|
|
});
|
|
|
|
test('getMemoryOptimizedFloatTextureSize [1,6,1], bitRatio 1', () => {
|
|
assert.deepEqual(Array.from(utils.getMemoryOptimizedFloatTextureSize([1, 6, 1], 1)), [4, 2]);
|
|
});
|
|
|
|
test('getMemoryOptimizedFloatTextureSize [1,1,6], bitRatio 1', () => {
|
|
assert.deepEqual(Array.from(utils.getMemoryOptimizedFloatTextureSize([1, 1, 6], 1)), [4, 2]);
|
|
});
|
|
|
|
test('getMemoryOptimizedPackedTextureSize [6,1,1], bitRatio 4', () => {
|
|
assert.deepEqual(Array.from(utils.getMemoryOptimizedPackedTextureSize([6, 1, 1], 4)), [4, 2]);
|
|
});
|
|
|
|
test('getMemoryOptimizedPackedTextureSize [1,6,1], bitRatio 4', () => {
|
|
assert.deepEqual(Array.from(utils.getMemoryOptimizedPackedTextureSize([1, 6, 1], 4)), [4, 2]);
|
|
});
|
|
|
|
test('getMemoryOptimizedPackedTextureSize [1,1,6], bitRatio 4', () => {
|
|
assert.deepEqual(Array.from(utils.getMemoryOptimizedPackedTextureSize([1, 1, 6], 4)), [4, 2]);
|
|
});
|
|
|
|
test('getMemoryOptimizedPackedTextureSize [6,1,1], bitRatio 2', () => {
|
|
assert.deepEqual(Array.from(utils.getMemoryOptimizedPackedTextureSize([6, 1, 1], 2)), [2, 2]);
|
|
});
|
|
|
|
test('getMemoryOptimizedPackedTextureSize [1,6,1], bitRatio 2', () => {
|
|
assert.deepEqual(Array.from(utils.getMemoryOptimizedPackedTextureSize([1, 6, 1], 2)), [2, 2]);
|
|
});
|
|
|
|
test('getMemoryOptimizedPackedTextureSize [1,1,6], bitRatio 2', () => {
|
|
assert.deepEqual(Array.from(utils.getMemoryOptimizedPackedTextureSize([1, 1, 6], 2)), [2, 2]);
|
|
});
|
|
test('getMemoryOptimizedPackedTextureSize [6,1,1], bitRatio 1', () => {
|
|
assert.deepEqual(Array.from(utils.getMemoryOptimizedPackedTextureSize([6, 1, 1], 1)), [1, 2]);
|
|
});
|
|
|
|
test('getMemoryOptimizedPackedTextureSize [1,6,1], bitRatio 1', () => {
|
|
assert.deepEqual(Array.from(utils.getMemoryOptimizedPackedTextureSize([1, 6, 1], 1)), [1, 2]);
|
|
});
|
|
|
|
test('getMemoryOptimizedPackedTextureSize [1,1,6], bitRatio 1', () => {
|
|
assert.deepEqual(Array.from(utils.getMemoryOptimizedPackedTextureSize([1, 1, 6], 1)), [1, 2]);
|
|
});
|