forked from chakra-core/ChakraCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray.js
More file actions
35 lines (34 loc) · 1.03 KB
/
array.js
File metadata and controls
35 lines (34 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft Corporation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
var mod = new WebAssembly.Module(readbuffer('array.wasm'));
var a = new WebAssembly.Instance(mod).exports;
print(a["goodload"](0));
try {
print(a["badload"](0));
}
catch(e) {
print(e.message.includes("out of range") ? "PASSED" : "FAILED");
}
try {
a["badstore"](0);
}
catch(e) {
print(e.message.includes("out of range") ? "PASSED" : "FAILED");
}
a.goodload(65535)
try {
a.goodload(65536)
}
catch(e) {
print(e.message.includes("out of range") ? "PASSED" : "FAILED");
}
a.goodstore(0)
a.goodstore(65535)
try {
a.goodstore(65536)
}
catch(e) {
print(e.message.includes("out of range") ? "PASSED" : "FAILED");
}