Debian Codegraph @

js/src/jit-test/tests/typedarray/resizable-arraybuffer-bytelength.js

raw
1 function testResizableArrayBuffer() {
2 for (let i = 0; i < 4; ++i) {
3 let ab = new ArrayBuffer(i, {maxByteLength: i + 1});
4 for (let j = 0; j < 100; ++j) {
5 ab.resize(i);
6 assertEq(ab.byteLength, i);
7
8 ab.resize(i + 1);
9 assertEq(ab.byteLength, i + 1);
10
11 if (i > 0) {
12 ab.resize(i - 1);
13 assertEq(ab.byteLength, i - 1);
14 }
15 }
16 }
17 }
18 for (let i = 0; i < 2; ++i) testResizableArrayBuffer();