How to use the qunit.assert.strictEqual function in qunit

To help you get started, we’ve selected a few qunit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gpujs / gpu.js / test / issues / 174-webgl-context-warning.js View on Github external
const gpu = new GPU({ mode });
  const kernel = gpu.createKernel(function(inp) {
    return inp[this.thread.y][this.thread.x];
  }, {
    output: [3, 3]
  });
  const kernel2 = gpu.createKernel(function() {
    return this.thread.y * this.thread.x;
  }, {
    output: [1024, 1024],
    pipeline: true
  });
  kernel(input);
  kernel2();
  assert.strictEqual(kernel.context, kernel2.context, "contexts should be the same object");
  manyKernels(mode, kernelCount, t);
  const canvas = kernel.canvas;
  const eventListener = canvas.addEventListener('webglcontextlost', (e) => {
    canvas.removeEventListener('webglcontextlost', eventListener);
    done();
  });

  gpu.destroy();
}
github gpujs / gpu.js / test / features / to-string.js View on Github external
});
  const numberKernel = gpu.createKernel(function(a) {
    return a[this.thread.x];
  }, {
    output: [6]
  });
  const textureResult = textureKernel(a);
  assert.equal(textureResult.constructor, Texture);
  const originalResult = numberKernel(textureResult);
  assert.equal(originalResult.constructor, Float32Array);
  assert.equal(originalResult.length, expected.length);
  for(let i = 0; i < expected.length; ++i) {
    assert.equal(originalResult[i], expected[i], 'Result index: ' + i);
  }
  assert.strictEqual(textureKernel.canvas, numberKernel.canvas);
  assert.strictEqual(textureKernel.context, numberKernel.context);

  const textureKernelString = textureKernel.toString();
  const numberKernelString = numberKernel.toString();
  const newTextureKernel = new Function('return ' + textureKernelString)()();
  const newNumberKernel = new Function('return ' + numberKernelString)()();
  const canvas = textureKernel.canvas;
  const context = textureKernel.context;
  newTextureKernel
    .setTexture(Texture)
    .setContext(context)
    .setCanvas(canvas);
  newNumberKernel
    .setTexture(Texture)
    .setContext(context)
    .setCanvas(canvas);
github gpujs / gpu.js / test / features / to-string.js View on Github external
});
  const numberKernel = gpu.createKernel(function(a) {
    return a[this.thread.x];
  }, {
    output: [6],
    precision: 'single',
  });
  const textureResult = textureKernel(a);
  assert.equal(textureResult.constructor.name, 'GLTextureFloat');
  const originalResult = numberKernel(textureResult);
  assert.equal(originalResult.constructor, Float32Array);
  assert.equal(originalResult.length, expected.length);
  for(let i = 0; i < expected.length; ++i) {
    assert.equal(originalResult[i], expected[i], 'Result index: ' + i);
  }
  assert.strictEqual(textureKernel.canvas, numberKernel.canvas);
  assert.strictEqual(textureKernel.context, numberKernel.context);

  const textureKernelString = textureKernel.toString(a);
  const numberKernelString = numberKernel.toString(textureResult);
  const newTextureKernel = new Function('return ' + textureKernelString)()(context);
  const newNumberKernel = new Function('return ' + numberKernelString)()(context);
  const newKernelResult = newTextureKernel(a);
  assert.equal(textureResult.constructor.name, 'GLTextureFloat');
  const newResult = newNumberKernel(newKernelResult);
  assert.equal(newResult.constructor, Float32Array);
  assert.equal(newResult.length, expected.length);
  for(let i = 0; i < expected.length; ++i) {
    assert.equal(newResult[i], expected[i], 'Result index: ' + i);
  }

  gpu.destroy();
github gpujs / gpu.js / test / features / to-string.js View on Github external
});
  const numberKernel = gpu.createKernel(function(a) {
    return a[this.thread.x];
  }, {
    output: [6],
    precision: 'unsigned',
  });
  const textureResult = textureKernel(a);
  assert.equal(textureResult.constructor.name, 'GLTextureUnsigned');
  const originalResult = numberKernel(textureResult);
  assert.equal(originalResult.constructor, Float32Array);
  assert.equal(originalResult.length, expected.length);
  for(let i = 0; i < expected.length; ++i) {
    assert.equal(originalResult[i], expected[i], 'Result index: ' + i);
  }
  assert.strictEqual(textureKernel.canvas, numberKernel.canvas);
  assert.strictEqual(textureKernel.context, numberKernel.context);

  const textureKernelString = textureKernel.toString(a);
  const numberKernelString = numberKernel.toString(textureResult);
  const newTextureKernel = new Function('return ' + textureKernelString)()(context);
  const newNumberKernel = new Function('return ' + numberKernelString)()(context);
  const newKernelResult = newTextureKernel(a);
  assert.equal(textureResult.constructor.name, 'GLTextureUnsigned');
  const newResult = newNumberKernel(newKernelResult);
  assert.equal(newResult.constructor, Float32Array);
  assert.equal(newResult.length, expected.length);
  for(let i = 0; i < expected.length; ++i) {
    assert.equal(newResult[i], expected[i], 'Result index: ' + i);
  }

  gpu.destroy();
github gpujs / gpu.js / test / features / to-string.js View on Github external
pipeline: true
  });
  const numberKernel = gpu.createKernel(function(a) {
    return a[this.thread.x];
  }, {
    output: [6]
  });
  const textureResult = textureKernel(a);
  assert.equal(textureResult.constructor, Texture);
  const originalResult = numberKernel(textureResult);
  assert.equal(originalResult.constructor, Float32Array);
  assert.equal(originalResult.length, expected.length);
  for(let i = 0; i < expected.length; ++i) {
    assert.equal(originalResult[i], expected[i], 'Result index: ' + i);
  }
  assert.strictEqual(textureKernel.canvas, numberKernel.canvas);
  assert.strictEqual(textureKernel.context, numberKernel.context);

  const textureKernelString = textureKernel.toString();
  const numberKernelString = numberKernel.toString();
  const newTextureKernel = new Function('return ' + textureKernelString)()();
  const newNumberKernel = new Function('return ' + numberKernelString)()();
  const canvas = textureKernel.canvas;
  const context = textureKernel.context;
  newTextureKernel
    .setTexture(Texture)
    .setContext(context)
    .setCanvas(canvas);
  newNumberKernel
    .setTexture(Texture)
    .setContext(context)
    .setCanvas(canvas);
github gpujs / gpu.js / test / features / to-string.js View on Github external
const numberKernel = gpu.createKernel(function(a) {
    return a[this.thread.x];
  }, {
    output: [6],
    precision: 'single',
  });
  const textureResult = textureKernel(a);
  assert.equal(textureResult.constructor.name, 'GLTextureFloat');
  const originalResult = numberKernel(textureResult);
  assert.equal(originalResult.constructor, Float32Array);
  assert.equal(originalResult.length, expected.length);
  for(let i = 0; i < expected.length; ++i) {
    assert.equal(originalResult[i], expected[i], 'Result index: ' + i);
  }
  assert.strictEqual(textureKernel.canvas, numberKernel.canvas);
  assert.strictEqual(textureKernel.context, numberKernel.context);

  const textureKernelString = textureKernel.toString(a);
  const numberKernelString = numberKernel.toString(textureResult);
  const newTextureKernel = new Function('return ' + textureKernelString)()(context);
  const newNumberKernel = new Function('return ' + numberKernelString)()(context);
  const newKernelResult = newTextureKernel(a);
  assert.equal(textureResult.constructor.name, 'GLTextureFloat');
  const newResult = newNumberKernel(newKernelResult);
  assert.equal(newResult.constructor, Float32Array);
  assert.equal(newResult.length, expected.length);
  for(let i = 0; i < expected.length; ++i) {
    assert.equal(newResult[i], expected[i], 'Result index: ' + i);
  }

  gpu.destroy();
}
github gpujs / gpu.js / test / features / to-string.js View on Github external
const numberKernel = gpu.createKernel(function(a) {
    return a[this.thread.x];
  }, {
    output: [6],
    precision: 'unsigned',
  });
  const textureResult = textureKernel(a);
  assert.equal(textureResult.constructor.name, 'GLTextureUnsigned');
  const originalResult = numberKernel(textureResult);
  assert.equal(originalResult.constructor, Float32Array);
  assert.equal(originalResult.length, expected.length);
  for(let i = 0; i < expected.length; ++i) {
    assert.equal(originalResult[i], expected[i], 'Result index: ' + i);
  }
  assert.strictEqual(textureKernel.canvas, numberKernel.canvas);
  assert.strictEqual(textureKernel.context, numberKernel.context);

  const textureKernelString = textureKernel.toString(a);
  const numberKernelString = numberKernel.toString(textureResult);
  const newTextureKernel = new Function('return ' + textureKernelString)()(context);
  const newNumberKernel = new Function('return ' + numberKernelString)()(context);
  const newKernelResult = newTextureKernel(a);
  assert.equal(textureResult.constructor.name, 'GLTextureUnsigned');
  const newResult = newNumberKernel(newKernelResult);
  assert.equal(newResult.constructor, Float32Array);
  assert.equal(newResult.length, expected.length);
  for(let i = 0; i < expected.length; ++i) {
    assert.equal(newResult[i], expected[i], 'Result index: ' + i);
  }

  gpu.destroy();
}