Browse Source

test: add typed arrays regression test

Ensure that uint8 values >= 128 are correctly promoted to int8 <= -1.
v0.8.13-release
Ben Noordhuis 12 years ago
parent
commit
b6b881378a
  1. 8
      test/simple/test-typed-arrays.js

8
test/simple/test-typed-arrays.js

@ -174,3 +174,11 @@ uint8c.set(1, 260);
assert.equal(uint8c[0], 0);
assert.equal(uint8c[1], 255);
(function() {
var numbers = [];
for (var i = 128; i <= 255; ++i) numbers.push(i);
var array = new Uint8Array(numbers);
var view = new DataView(array.buffer);
for (var i = 128; i <= 255; ++i) assert.equal(view.getInt8(i - 128), i - 256);
})();

Loading…
Cancel
Save