Debian Codegraph @

js/src/tests/test262/built-ins/SharedArrayBuffer/init-zero.js

raw
1 // |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
2 // Copyright (C) 2016 the V8 project authors. All rights reserved.
3 // Copyright (C) 2017 Mozilla Corporation. All rights reserved.
4 // This code is governed by the BSD license found in the LICENSE file.
5
6 /*---
7 esid: sec-createsharedbytedatablock
8 description: All bytes are initialized to zero
9 features: [SharedArrayBuffer, DataView]
10 ---*/
11
12 var view = new DataView(new SharedArrayBuffer(9));
13
14 assert.sameValue(view.getUint8(0), 0, 'index 0');
15 assert.sameValue(view.getUint8(1), 0, 'index 1');
16 assert.sameValue(view.getUint8(2), 0, 'index 2');
17 assert.sameValue(view.getUint8(3), 0, 'index 3');
18 assert.sameValue(view.getUint8(4), 0, 'index 4');
19 assert.sameValue(view.getUint8(5), 0, 'index 5');
20 assert.sameValue(view.getUint8(6), 0, 'index 6');
21 assert.sameValue(view.getUint8(7), 0, 'index 7');
22 assert.sameValue(view.getUint8(8), 0, 'index 8');
23
24 reportCompare(0, 0);