Debian Codegraph @

js/src/jit-test/tests/wasm/spec/memory64/binary0.wast.js

raw
1 /* Copyright 2021 Mozilla Foundation
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 // ./test/core/multi-memory/binary0.wast
17
18 // ./test/core/multi-memory/binary0.wast:2
19 let $0 = instantiate(`(module binary
20 "\\00asm" "\\01\\00\\00\\00"
21 "\\05\\07\\02" ;; Memory section with 2 entries
22 "\\00\\82\\00" ;; no max, minimum 2
23 "\\00\\82\\00" ;; no max, minimum 2
24 )`);
25
26 // ./test/core/multi-memory/binary0.wast:8
27 let $1 = instantiate(`(module binary
28 "\\00asm" "\\01\\00\\00\\00"
29 "\\05\\13\\03" ;; Memory section with 3 entries
30 "\\00\\83\\80\\80\\80\\00" ;; no max, minimum 3
31 "\\00\\84\\80\\80\\80\\00" ;; no max, minimum 4
32 "\\00\\85\\80\\80\\80\\00" ;; no max, minimum 5
33 )`);
34
35 // ./test/core/multi-memory/binary0.wast:16
36 let $2 = instantiate(`(module binary
37 "\\00asm" "\\01\\00\\00\\00"
38 "\\05\\05\\02" ;; Memory section with 2 entries
39 "\\00\\00" ;; no max, minimum 0
40 "\\00\\00" ;; no max, minimum 0
41 "\\0b\\06\\01" ;; Data section with 1 entry
42 "\\00" ;; Memory index 0
43 "\\41\\00\\0b\\00" ;; (i32.const 0) with contents ""
44 )`);
45
46 // ./test/core/multi-memory/binary0.wast:26
47 let $3 = instantiate(`(module binary
48 "\\00asm" "\\01\\00\\00\\00"
49 "\\05\\05\\02" ;; Memory section with 2 entries
50 "\\00\\00" ;; no max, minimum 0
51 "\\00\\01" ;; no max, minimum 1
52 "\\0b\\07\\01" ;; Data section with 1 entry
53 "\\02\\01" ;; Memory index 1
54 "\\41\\00\\0b\\00" ;; (i32.const 0) with contents ""
55 )`);
56
57 // ./test/core/multi-memory/binary0.wast:36
58 let $4 = instantiate(`(module binary
59 "\\00asm" "\\01\\00\\00\\00"
60 "\\05\\05\\02" ;; Memory section with 2 entries
61 "\\00\\00" ;; no max, minimum 0
62 "\\00\\01" ;; no max, minimum 1
63 "\\0b\\0a\\01" ;; Data section with 1 entry
64 "\\02\\81\\80\\80\\00" ;; Memory index 1
65 "\\41\\00\\0b\\00" ;; (i32.const 0) with contents ""
66 )`);
67
68 // ./test/core/multi-memory/binary0.wast:47
69 assert_malformed(
70 () => instantiate(`(module binary
71 "\\00asm" "\\01\\00\\00\\00"
72 "\\05\\10\\02" ;; Memory section with 2 entries
73 "\\00\\01" ;; no max, minimum 1
74 "\\00\\82\\80\\80\\80\\80\\80\\80\\80\\80\\80\\80\\00" ;; no max, minimum 2 with one byte too many
75 )`),
76 `integer representation too long`,
77 );
78
79 // ./test/core/multi-memory/binary0.wast:58
80 assert_malformed(
81 () => instantiate(`(module binary
82 "\\00asm" "\\01\\00\\00\\00"
83 "\\05\\03\\02" ;; memory section with inconsistent count (1 declared, 0 given)
84 "\\00\\00" ;; memory 0 (missed)
85 ;; "\\00\\00" ;; memory 1 (missing)
86 )`),
87 `unexpected end of section or function`,
88 );