Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
load_tests.cpp
Go to the documentation of this file.
1// Generated by spec_test_generator. DO NOT MODIFY THIS FILE.
2
3#include <algorithm>
4#include <vector>
5#include <iostream>
6#include <iterator>
7#include <cmath>
8#include <cstdlib>
9#include <catch2/catch.hpp>
10#include <utils.hpp>
11#include <wasm_config.hpp>
12#include <sysio/vm/backend.hpp>
13
14using namespace sysio;
15using namespace sysio::vm;
16extern wasm_allocator wa;
17
18BACKEND_TEST_CASE( "Testing wasm <load_0_wasm>", "[load_0_wasm_tests]" ) {
20 auto code = read_wasm( std::string(wasm_directory) + "load.0.wasm");
21 backend_t bkend( code, &wa );
22
23 CHECK(bkend.call_with_return("env", "as-br-value")->to_ui32() == UINT32_C(0));
24 CHECK(!bkend.call_with_return("env", "as-br_if-cond"));
25 CHECK(bkend.call_with_return("env", "as-br_if-value")->to_ui32() == UINT32_C(0));
26 CHECK(bkend.call_with_return("env", "as-br_if-value-cond")->to_ui32() == UINT32_C(7));
27 CHECK(!bkend.call_with_return("env", "as-br_table-index"));
28 CHECK(bkend.call_with_return("env", "as-br_table-value")->to_ui32() == UINT32_C(0));
29 CHECK(bkend.call_with_return("env", "as-br_table-value-index")->to_ui32() == UINT32_C(6));
30 CHECK(bkend.call_with_return("env", "as-return-value")->to_ui32() == UINT32_C(0));
31 CHECK(bkend.call_with_return("env", "as-if-cond")->to_ui32() == UINT32_C(1));
32 CHECK(bkend.call_with_return("env", "as-if-then")->to_ui32() == UINT32_C(0));
33 CHECK(bkend.call_with_return("env", "as-if-else")->to_ui32() == UINT32_C(0));
34 CHECK(bkend.call_with_return("env", "as-select-first", UINT32_C(0), UINT32_C(1))->to_ui32() == UINT32_C(0));
35 CHECK(bkend.call_with_return("env", "as-select-second", UINT32_C(0), UINT32_C(0))->to_ui32() == UINT32_C(0));
36 CHECK(bkend.call_with_return("env", "as-select-cond")->to_ui32() == UINT32_C(1));
37 CHECK(bkend.call_with_return("env", "as-call-first")->to_ui32() == UINT32_C(4294967295));
38 CHECK(bkend.call_with_return("env", "as-call-mid")->to_ui32() == UINT32_C(4294967295));
39 CHECK(bkend.call_with_return("env", "as-call-last")->to_ui32() == UINT32_C(4294967295));
40 CHECK(bkend.call_with_return("env", "as-call_indirect-first")->to_ui32() == UINT32_C(4294967295));
41 CHECK(bkend.call_with_return("env", "as-call_indirect-mid")->to_ui32() == UINT32_C(4294967295));
42 CHECK(bkend.call_with_return("env", "as-call_indirect-last")->to_ui32() == UINT32_C(4294967295));
43 CHECK(bkend.call_with_return("env", "as-call_indirect-index")->to_ui32() == UINT32_C(4294967295));
44 CHECK(!bkend.call_with_return("env", "as-local.set-value"));
45 CHECK(bkend.call_with_return("env", "as-local.tee-value")->to_ui32() == UINT32_C(0));
46 CHECK(!bkend.call_with_return("env", "as-global.set-value"));
47 CHECK(bkend.call_with_return("env", "as-load-address")->to_ui32() == UINT32_C(0));
48 CHECK(bkend.call_with_return("env", "as-loadN-address")->to_ui32() == UINT32_C(0));
49 CHECK(!bkend.call_with_return("env", "as-store-address"));
50 CHECK(!bkend.call_with_return("env", "as-store-value"));
51 CHECK(!bkend.call_with_return("env", "as-storeN-address"));
52 CHECK(!bkend.call_with_return("env", "as-storeN-value"));
53 CHECK(bkend.call_with_return("env", "as-unary-operand")->to_ui32() == UINT32_C(32));
54 CHECK(bkend.call_with_return("env", "as-binary-left")->to_ui32() == UINT32_C(10));
55 CHECK(bkend.call_with_return("env", "as-binary-right")->to_ui32() == UINT32_C(10));
56 CHECK(bkend.call_with_return("env", "as-test-operand")->to_ui32() == UINT32_C(1));
57 CHECK(bkend.call_with_return("env", "as-compare-left")->to_ui32() == UINT32_C(1));
58 CHECK(bkend.call_with_return("env", "as-compare-right")->to_ui32() == UINT32_C(1));
59 CHECK(bkend.call_with_return("env", "as-memory.grow-size")->to_ui32() == UINT32_C(1));
60}
61
62BACKEND_TEST_CASE( "Testing wasm <load_14_wasm>", "[load_14_wasm_tests]" ) {
64 auto code = read_wasm( std::string(wasm_directory) + "load.14.wasm");
65 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
66}
67
68BACKEND_TEST_CASE( "Testing wasm <load_15_wasm>", "[load_15_wasm_tests]" ) {
70 auto code = read_wasm( std::string(wasm_directory) + "load.15.wasm");
71 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
72}
73
74BACKEND_TEST_CASE( "Testing wasm <load_16_wasm>", "[load_16_wasm_tests]" ) {
76 auto code = read_wasm( std::string(wasm_directory) + "load.16.wasm");
77 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
78}
79
80BACKEND_TEST_CASE( "Testing wasm <load_17_wasm>", "[load_17_wasm_tests]" ) {
82 auto code = read_wasm( std::string(wasm_directory) + "load.17.wasm");
83 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
84}
85
86BACKEND_TEST_CASE( "Testing wasm <load_18_wasm>", "[load_18_wasm_tests]" ) {
88 auto code = read_wasm( std::string(wasm_directory) + "load.18.wasm");
89 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
90}
91
92BACKEND_TEST_CASE( "Testing wasm <load_19_wasm>", "[load_19_wasm_tests]" ) {
94 auto code = read_wasm( std::string(wasm_directory) + "load.19.wasm");
95 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
96}
97
98BACKEND_TEST_CASE( "Testing wasm <load_20_wasm>", "[load_20_wasm_tests]" ) {
100 auto code = read_wasm( std::string(wasm_directory) + "load.20.wasm");
101 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
102}
103
104BACKEND_TEST_CASE( "Testing wasm <load_21_wasm>", "[load_21_wasm_tests]" ) {
106 auto code = read_wasm( std::string(wasm_directory) + "load.21.wasm");
107 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
108}
109
110BACKEND_TEST_CASE( "Testing wasm <load_22_wasm>", "[load_22_wasm_tests]" ) {
112 auto code = read_wasm( std::string(wasm_directory) + "load.22.wasm");
113 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
114}
115
116BACKEND_TEST_CASE( "Testing wasm <load_23_wasm>", "[load_23_wasm_tests]" ) {
118 auto code = read_wasm( std::string(wasm_directory) + "load.23.wasm");
119 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
120}
121
122BACKEND_TEST_CASE( "Testing wasm <load_24_wasm>", "[load_24_wasm_tests]" ) {
124 auto code = read_wasm( std::string(wasm_directory) + "load.24.wasm");
125 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
126}
127
128BACKEND_TEST_CASE( "Testing wasm <load_25_wasm>", "[load_25_wasm_tests]" ) {
130 auto code = read_wasm( std::string(wasm_directory) + "load.25.wasm");
131 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
132}
133
134BACKEND_TEST_CASE( "Testing wasm <load_26_wasm>", "[load_26_wasm_tests]" ) {
136 auto code = read_wasm( std::string(wasm_directory) + "load.26.wasm");
137 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
138}
139
140BACKEND_TEST_CASE( "Testing wasm <load_27_wasm>", "[load_27_wasm_tests]" ) {
142 auto code = read_wasm( std::string(wasm_directory) + "load.27.wasm");
143 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
144}
145
146BACKEND_TEST_CASE( "Testing wasm <load_28_wasm>", "[load_28_wasm_tests]" ) {
148 auto code = read_wasm( std::string(wasm_directory) + "load.28.wasm");
149 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
150}
151
152BACKEND_TEST_CASE( "Testing wasm <load_29_wasm>", "[load_29_wasm_tests]" ) {
154 auto code = read_wasm( std::string(wasm_directory) + "load.29.wasm");
155 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
156}
157
158BACKEND_TEST_CASE( "Testing wasm <load_30_wasm>", "[load_30_wasm_tests]" ) {
160 auto code = read_wasm( std::string(wasm_directory) + "load.30.wasm");
161 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
162}
163
164BACKEND_TEST_CASE( "Testing wasm <load_31_wasm>", "[load_31_wasm_tests]" ) {
166 auto code = read_wasm( std::string(wasm_directory) + "load.31.wasm");
167 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
168}
169
170BACKEND_TEST_CASE( "Testing wasm <load_32_wasm>", "[load_32_wasm_tests]" ) {
172 auto code = read_wasm( std::string(wasm_directory) + "load.32.wasm");
173 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
174}
175
176BACKEND_TEST_CASE( "Testing wasm <load_33_wasm>", "[load_33_wasm_tests]" ) {
178 auto code = read_wasm( std::string(wasm_directory) + "load.33.wasm");
179 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
180}
181
182BACKEND_TEST_CASE( "Testing wasm <load_34_wasm>", "[load_34_wasm_tests]" ) {
184 auto code = read_wasm( std::string(wasm_directory) + "load.34.wasm");
185 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
186}
187
188BACKEND_TEST_CASE( "Testing wasm <load_35_wasm>", "[load_35_wasm_tests]" ) {
190 auto code = read_wasm( std::string(wasm_directory) + "load.35.wasm");
191 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
192}
193
194BACKEND_TEST_CASE( "Testing wasm <load_36_wasm>", "[load_36_wasm_tests]" ) {
196 auto code = read_wasm( std::string(wasm_directory) + "load.36.wasm");
197 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
198}
199
200BACKEND_TEST_CASE( "Testing wasm <load_37_wasm>", "[load_37_wasm_tests]" ) {
202 auto code = read_wasm( std::string(wasm_directory) + "load.37.wasm");
203 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
204}
205
206BACKEND_TEST_CASE( "Testing wasm <load_38_wasm>", "[load_38_wasm_tests]" ) {
208 auto code = read_wasm( std::string(wasm_directory) + "load.38.wasm");
209 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
210}
211
212BACKEND_TEST_CASE( "Testing wasm <load_39_wasm>", "[load_39_wasm_tests]" ) {
214 auto code = read_wasm( std::string(wasm_directory) + "load.39.wasm");
215 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
216}
217
218BACKEND_TEST_CASE( "Testing wasm <load_40_wasm>", "[load_40_wasm_tests]" ) {
220 auto code = read_wasm( std::string(wasm_directory) + "load.40.wasm");
221 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
222}
223
224BACKEND_TEST_CASE( "Testing wasm <load_41_wasm>", "[load_41_wasm_tests]" ) {
226 auto code = read_wasm( std::string(wasm_directory) + "load.41.wasm");
227 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
228}
229
230BACKEND_TEST_CASE( "Testing wasm <load_42_wasm>", "[load_42_wasm_tests]" ) {
232 auto code = read_wasm( std::string(wasm_directory) + "load.42.wasm");
233 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
234}
235
236BACKEND_TEST_CASE( "Testing wasm <load_43_wasm>", "[load_43_wasm_tests]" ) {
238 auto code = read_wasm( std::string(wasm_directory) + "load.43.wasm");
239 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
240}
241
242BACKEND_TEST_CASE( "Testing wasm <load_44_wasm>", "[load_44_wasm_tests]" ) {
244 auto code = read_wasm( std::string(wasm_directory) + "load.44.wasm");
245 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
246}
247
248BACKEND_TEST_CASE( "Testing wasm <load_45_wasm>", "[load_45_wasm_tests]" ) {
250 auto code = read_wasm( std::string(wasm_directory) + "load.45.wasm");
251 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
252}
253
254BACKEND_TEST_CASE( "Testing wasm <load_46_wasm>", "[load_46_wasm_tests]" ) {
256 auto code = read_wasm( std::string(wasm_directory) + "load.46.wasm");
257 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
258}
259
260BACKEND_TEST_CASE( "Testing wasm <load_47_wasm>", "[load_47_wasm_tests]" ) {
262 auto code = read_wasm( std::string(wasm_directory) + "load.47.wasm");
263 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
264}
265
266BACKEND_TEST_CASE( "Testing wasm <load_48_wasm>", "[load_48_wasm_tests]" ) {
268 auto code = read_wasm( std::string(wasm_directory) + "load.48.wasm");
269 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
270}
271
272BACKEND_TEST_CASE( "Testing wasm <load_49_wasm>", "[load_49_wasm_tests]" ) {
274 auto code = read_wasm( std::string(wasm_directory) + "load.49.wasm");
275 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
276}
277
278BACKEND_TEST_CASE( "Testing wasm <load_50_wasm>", "[load_50_wasm_tests]" ) {
280 auto code = read_wasm( std::string(wasm_directory) + "load.50.wasm");
281 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
282}
283
284BACKEND_TEST_CASE( "Testing wasm <load_51_wasm>", "[load_51_wasm_tests]" ) {
286 auto code = read_wasm( std::string(wasm_directory) + "load.51.wasm");
287 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
288}
289
290BACKEND_TEST_CASE( "Testing wasm <load_52_wasm>", "[load_52_wasm_tests]" ) {
292 auto code = read_wasm( std::string(wasm_directory) + "load.52.wasm");
293 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
294}
295
296BACKEND_TEST_CASE( "Testing wasm <load_53_wasm>", "[load_53_wasm_tests]" ) {
298 auto code = read_wasm( std::string(wasm_directory) + "load.53.wasm");
299 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
300}
301
302BACKEND_TEST_CASE( "Testing wasm <load_54_wasm>", "[load_54_wasm_tests]" ) {
304 auto code = read_wasm( std::string(wasm_directory) + "load.54.wasm");
305 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
306}
307
308BACKEND_TEST_CASE( "Testing wasm <load_55_wasm>", "[load_55_wasm_tests]" ) {
310 auto code = read_wasm( std::string(wasm_directory) + "load.55.wasm");
311 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
312}
313
314BACKEND_TEST_CASE( "Testing wasm <load_56_wasm>", "[load_56_wasm_tests]" ) {
316 auto code = read_wasm( std::string(wasm_directory) + "load.56.wasm");
317 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
318}
319
320BACKEND_TEST_CASE( "Testing wasm <load_57_wasm>", "[load_57_wasm_tests]" ) {
322 auto code = read_wasm( std::string(wasm_directory) + "load.57.wasm");
323 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
324}
325
326BACKEND_TEST_CASE( "Testing wasm <load_58_wasm>", "[load_58_wasm_tests]" ) {
328 auto code = read_wasm( std::string(wasm_directory) + "load.58.wasm");
329 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
330}
331
332BACKEND_TEST_CASE( "Testing wasm <load_59_wasm>", "[load_59_wasm_tests]" ) {
334 auto code = read_wasm( std::string(wasm_directory) + "load.59.wasm");
335 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
336}
337
auto call_with_return(host_t &host, const std::string_view &mod, const std::string_view &func, Args... args)
Definition backend.hpp:178
#define CHECK(cond)
Definition util.h:80
backend_t bkend(hello_wasm, ehm, &wa)
sysio::vm::backend< rhf_t > backend_t
#define CHECK_THROWS_AS(expr, exceptionType)
Definition catch.hpp:203
wasm_allocator wa
Definition main.cpp:10
std::vector< uint8_t > read_wasm(const std::string &fname)
Definition utils.hpp:30
#define UINT32_C(val)
Definition stdint.h:283
#define BACKEND_TEST_CASE(name, tags)
Definition utils.hpp:59