Skip to content

Instantly share code, notes, and snippets.

@bnoordhuis
Created February 7, 2013 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bnoordhuis/44994f7a3f366b0dceaa to your computer and use it in GitHub Desktop.
Save bnoordhuis/44994f7a3f366b0dceaa to your computer and use it in GitHub Desktop.
function assert(e) {
if (!e) throw new Error('assert failed');
}
assert.equal = function(a, b) { return assert(a === b) };
assert.notEqual = function(a, b) { return assert(a !== b) };
//(function() {
// Backing store should not be shared.
var a = new Uint8Array(2);
var b = new Uint16Array(a);
a[0] = 0;
a[1] = 0;
b[0] = 257;
assert.equal(a[0], 0);
assert.equal(a[1], 0);
assert.equal(b[0], 257);
assert.notEqual(a, b.buffer);
assert.equal(a.length, 2);
assert.equal(b.length, 2);
//})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment