Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* eslint-disable no-console */
'use strict';
const path = require('path');
const QUnit = require('qunit');
const test = QUnit.test;
QUnit.module('Docs coverage', function(hooks) {
let docs, expected;
hooks.before(function() {
if (!process.env.REUSE_DOCS) {
buildDocs();
}
docs = require(path.join(__dirname, '../../dist/docs/data.json'));
expected = require('../fixtures/expected');
});
QUnit.module('modules', function() {
test('We have all expected modules', function(assert) {
assert.deepEqual(Object.keys(docs.modules), expected.modules, 'We have all modules');
});
});
QUnit.module('classitems', function(hooks) {
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Model | foo', function(hooks) {
setupTest(hooks);
// Replace this with your real tests.
test('it exists', function(assert) {
let store = this.owner.lookup('service:store');
let model = store.createRecord('foo', {});
assert.ok(model);
});
});
hooks.beforeEach(() => {});
hooks.afterEach(() => {});
hooks.after(() => {});
QUnit.test('it blends', function(assert) {
assert.ok(true, 'of course!');
});
});
// http://rwjblue.com/2017/10/23/ember-qunit-simplication/#setuprenderingtest
module('x-foo', function(hooks) {
setupRenderingTest(hooks);
});
// http://rwjblue.com/2017/10/23/ember-qunit-simplication/#setuptest
module('foo service', function(hooks) {
setupTest(hooks);
});
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('<%= friendlyTestDescription %>', function(hooks) {
setupTest(hooks);
// Replace this with your real tests.
test('it exists', function(assert) {
let service = this.owner.lookup('service:<%= dasherizedModuleName %>');
assert.ok(service);
});
});
expectedPixels: new Float32Array([
// NOTE: formatted like rectangle on purpose, so you can see how the texture should look
// NOTE: Packing is 4 per RGBA, so 4 of the 4 channels is used
// NOTE: 3x3
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,0,0,0
]),
expectedDim: new Int32Array([33,1,1]),
expectedSize: new Int32Array([3,3]), // 3 * 3 = 9 * 4 = 36
expectedType: gl.FLOAT,
expectedConstantTextureCount: 1,
});
});
describe('internal WebGL2Kernel.setupConstants Input');
// requires at least 5 entire pixels
test('Input(Array) with unsigned precision 5 length', () => {
setupConstantsTestSuite({
gpuSettings: {
precision: 'unsigned',
output: [4]
},
constant: input([
// NOTE: formatted like rectangle on purpose, so you can see how the texture should look
1, 2, 3, 4,
5, 0
], [2,3]),
expectedBitRatio: 4,
expectedPixels: new Uint8Array(new Float32Array([
// NOTE: formatted like rectangle on purpose, so you can see how the texture should look
1,2,3,4,
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Route | events/view/tickets/access-codes', function(hooks) {
setupTest(hooks);
test('it exists', function(assert) {
let route = this.owner.lookup('route:events/view/tickets/access-codes');
assert.ok(route);
});
});
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Component | base focusable', function(hooks) {
setupRenderingTest(hooks);
test('should set and remove disabled attribute', async function(assert) {
this.set('value', true);
await render(hbs`{{base-focusable id="base-focusable" disabled=value}}`);
assert.equal(this.$('#base-focusable').attr('disabled').trim(), 'disabled');
this.set('value', false);
assert.ok(!this.$('md-checkbox').attr('disabled'));
});
});
});
(GPU.isWebGL2Supported ? test : skip)('webgl2', () => {
whileWithConstantTest('webgl2');
});
(GPU.isHeadlessGLSupported ? test : skip)('headlessgl', () => {
whileWithConstantTest('headlessgl');
});
test('cpu', () => {
whileWithConstantTest('cpu');
});
describe('loops - evil while loop');
function evilWhileLoopTest(mode ) {
function evilWhileKernelFunction(a, b) {
let x = 0;
let i = 0;
//10000000 or 10 million is the approx upper limit on a chrome + GTX 780
while(i<100) {
x = x + 1.0;
++i;
}
return (a[this.thread.x] + b[this.thread.x] + x);
}
const evil_while_a = [1, 2, 3, 5, 6, 7];
const evil_while_b = [4, 5, 6, 1, 2, 3];
export default function(name, options = {}) {
module(name, {
beforeEach() {
this.application = startApp();
if (options.beforeEach) {
return options.beforeEach.apply(this, arguments);
}
},
afterEach() {
let afterEach =
options.afterEach && options.afterEach.apply(this, arguments);
return RSVP.Promise.resolve(afterEach).then(() =>
destroyApp(this.application)
);
}
});
const { assert, skip, test, module: describe, only } = require('qunit');
const { GPU } = require('../../../../../../src');
describe('feature: to-string single precision arguments Array2D(2)');
function testArgument(mode, context, canvas) {
const gpu = new GPU({ mode });
const originalKernel = gpu.createKernel(function(a) {
const array2 = a[this.thread.y][this.thread.x];
return [array2[0] + 1, array2[1] + 1];
}, {
canvas,
context,
output: [2,2],
precision: 'single',
argumentTypes: {
a: 'Array2D(2)'
}
});