Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
local_set_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 <local_set_0_wasm>", "[local_set_0_wasm_tests]" ) {
20 auto code = read_wasm( std::string(wasm_directory) + "local_set.0.wasm");
21 backend_t bkend( code, &wa );
22
23 CHECK(!bkend.call_with_return("env", "type-local-i32"));
24 CHECK(!bkend.call_with_return("env", "type-local-i64"));
25 CHECK(!bkend.call_with_return("env", "type-local-f32"));
26 CHECK(!bkend.call_with_return("env", "type-local-f64"));
27 CHECK(!bkend.call_with_return("env", "type-param-i32", UINT32_C(2)));
28 CHECK(!bkend.call_with_return("env", "type-param-i64", UINT64_C(3)));
29 CHECK(!bkend.call_with_return("env", "type-param-f32", bit_cast<float>(UINT32_C(1082969293))));
30 CHECK(!bkend.call_with_return("env", "type-param-f64", bit_cast<double>(UINT64_C(4617878467915022336))));
31 CHECK(!bkend.call_with_return("env", "as-block-value", UINT32_C(0)));
32 CHECK(!bkend.call_with_return("env", "as-loop-value", UINT32_C(0)));
33 CHECK(!bkend.call_with_return("env", "as-br-value", UINT32_C(0)));
34 CHECK(!bkend.call_with_return("env", "as-br_if-value", UINT32_C(0)));
35 CHECK(!bkend.call_with_return("env", "as-br_if-value-cond", UINT32_C(0)));
36 CHECK(!bkend.call_with_return("env", "as-br_table-value", UINT32_C(0)));
37 CHECK(!bkend.call_with_return("env", "as-return-value", UINT32_C(0)));
38 CHECK(!bkend.call_with_return("env", "as-if-then", UINT32_C(1)));
39 CHECK(!bkend.call_with_return("env", "as-if-else", UINT32_C(0)));
40 CHECK(!bkend.call_with_return("env", "type-mixed", UINT64_C(1), bit_cast<float>(UINT32_C(1074580685)), bit_cast<double>(UINT64_C(4614613358185178726)), UINT32_C(4), UINT32_C(5)));
41 CHECK(bkend.call_with_return("env", "write", UINT64_C(1), bit_cast<float>(UINT32_C(1073741824)), bit_cast<double>(UINT64_C(4614613358185178726)), UINT32_C(4), UINT32_C(5))->to_ui64() == UINT32_C(56));
42}
43
44BACKEND_TEST_CASE( "Testing wasm <local_set_1_wasm>", "[local_set_1_wasm_tests]" ) {
46 auto code = read_wasm( std::string(wasm_directory) + "local_set.1.wasm");
47 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
48}
49
50BACKEND_TEST_CASE( "Testing wasm <local_set_10_wasm>", "[local_set_10_wasm_tests]" ) {
52 auto code = read_wasm( std::string(wasm_directory) + "local_set.10.wasm");
53 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
54}
55
56BACKEND_TEST_CASE( "Testing wasm <local_set_11_wasm>", "[local_set_11_wasm_tests]" ) {
58 auto code = read_wasm( std::string(wasm_directory) + "local_set.11.wasm");
59 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
60}
61
62BACKEND_TEST_CASE( "Testing wasm <local_set_12_wasm>", "[local_set_12_wasm_tests]" ) {
64 auto code = read_wasm( std::string(wasm_directory) + "local_set.12.wasm");
65 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
66}
67
68BACKEND_TEST_CASE( "Testing wasm <local_set_13_wasm>", "[local_set_13_wasm_tests]" ) {
70 auto code = read_wasm( std::string(wasm_directory) + "local_set.13.wasm");
71 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
72}
73
74BACKEND_TEST_CASE( "Testing wasm <local_set_14_wasm>", "[local_set_14_wasm_tests]" ) {
76 auto code = read_wasm( std::string(wasm_directory) + "local_set.14.wasm");
77 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
78}
79
80BACKEND_TEST_CASE( "Testing wasm <local_set_15_wasm>", "[local_set_15_wasm_tests]" ) {
82 auto code = read_wasm( std::string(wasm_directory) + "local_set.15.wasm");
83 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
84}
85
86BACKEND_TEST_CASE( "Testing wasm <local_set_16_wasm>", "[local_set_16_wasm_tests]" ) {
88 auto code = read_wasm( std::string(wasm_directory) + "local_set.16.wasm");
89 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
90}
91
92BACKEND_TEST_CASE( "Testing wasm <local_set_17_wasm>", "[local_set_17_wasm_tests]" ) {
94 auto code = read_wasm( std::string(wasm_directory) + "local_set.17.wasm");
95 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
96}
97
98BACKEND_TEST_CASE( "Testing wasm <local_set_18_wasm>", "[local_set_18_wasm_tests]" ) {
100 auto code = read_wasm( std::string(wasm_directory) + "local_set.18.wasm");
101 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
102}
103
104BACKEND_TEST_CASE( "Testing wasm <local_set_19_wasm>", "[local_set_19_wasm_tests]" ) {
106 auto code = read_wasm( std::string(wasm_directory) + "local_set.19.wasm");
107 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
108}
109
110BACKEND_TEST_CASE( "Testing wasm <local_set_2_wasm>", "[local_set_2_wasm_tests]" ) {
112 auto code = read_wasm( std::string(wasm_directory) + "local_set.2.wasm");
113 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
114}
115
116BACKEND_TEST_CASE( "Testing wasm <local_set_20_wasm>", "[local_set_20_wasm_tests]" ) {
118 auto code = read_wasm( std::string(wasm_directory) + "local_set.20.wasm");
119 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
120}
121
122BACKEND_TEST_CASE( "Testing wasm <local_set_21_wasm>", "[local_set_21_wasm_tests]" ) {
124 auto code = read_wasm( std::string(wasm_directory) + "local_set.21.wasm");
125 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
126}
127
128BACKEND_TEST_CASE( "Testing wasm <local_set_22_wasm>", "[local_set_22_wasm_tests]" ) {
130 auto code = read_wasm( std::string(wasm_directory) + "local_set.22.wasm");
131 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
132}
133
134BACKEND_TEST_CASE( "Testing wasm <local_set_23_wasm>", "[local_set_23_wasm_tests]" ) {
136 auto code = read_wasm( std::string(wasm_directory) + "local_set.23.wasm");
137 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
138}
139
140BACKEND_TEST_CASE( "Testing wasm <local_set_24_wasm>", "[local_set_24_wasm_tests]" ) {
142 auto code = read_wasm( std::string(wasm_directory) + "local_set.24.wasm");
143 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
144}
145
146BACKEND_TEST_CASE( "Testing wasm <local_set_25_wasm>", "[local_set_25_wasm_tests]" ) {
148 auto code = read_wasm( std::string(wasm_directory) + "local_set.25.wasm");
149 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
150}
151
152BACKEND_TEST_CASE( "Testing wasm <local_set_26_wasm>", "[local_set_26_wasm_tests]" ) {
154 auto code = read_wasm( std::string(wasm_directory) + "local_set.26.wasm");
155 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
156}
157
158BACKEND_TEST_CASE( "Testing wasm <local_set_27_wasm>", "[local_set_27_wasm_tests]" ) {
160 auto code = read_wasm( std::string(wasm_directory) + "local_set.27.wasm");
161 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
162}
163
164BACKEND_TEST_CASE( "Testing wasm <local_set_28_wasm>", "[local_set_28_wasm_tests]" ) {
166 auto code = read_wasm( std::string(wasm_directory) + "local_set.28.wasm");
167 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
168}
169
170BACKEND_TEST_CASE( "Testing wasm <local_set_29_wasm>", "[local_set_29_wasm_tests]" ) {
172 auto code = read_wasm( std::string(wasm_directory) + "local_set.29.wasm");
173 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
174}
175
176BACKEND_TEST_CASE( "Testing wasm <local_set_3_wasm>", "[local_set_3_wasm_tests]" ) {
178 auto code = read_wasm( std::string(wasm_directory) + "local_set.3.wasm");
179 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
180}
181
182BACKEND_TEST_CASE( "Testing wasm <local_set_30_wasm>", "[local_set_30_wasm_tests]" ) {
184 auto code = read_wasm( std::string(wasm_directory) + "local_set.30.wasm");
185 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
186}
187
188BACKEND_TEST_CASE( "Testing wasm <local_set_31_wasm>", "[local_set_31_wasm_tests]" ) {
190 auto code = read_wasm( std::string(wasm_directory) + "local_set.31.wasm");
191 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
192}
193
194BACKEND_TEST_CASE( "Testing wasm <local_set_32_wasm>", "[local_set_32_wasm_tests]" ) {
196 auto code = read_wasm( std::string(wasm_directory) + "local_set.32.wasm");
197 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
198}
199
200BACKEND_TEST_CASE( "Testing wasm <local_set_33_wasm>", "[local_set_33_wasm_tests]" ) {
202 auto code = read_wasm( std::string(wasm_directory) + "local_set.33.wasm");
203 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
204}
205
206BACKEND_TEST_CASE( "Testing wasm <local_set_4_wasm>", "[local_set_4_wasm_tests]" ) {
208 auto code = read_wasm( std::string(wasm_directory) + "local_set.4.wasm");
209 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
210}
211
212BACKEND_TEST_CASE( "Testing wasm <local_set_5_wasm>", "[local_set_5_wasm_tests]" ) {
214 auto code = read_wasm( std::string(wasm_directory) + "local_set.5.wasm");
215 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
216}
217
218BACKEND_TEST_CASE( "Testing wasm <local_set_6_wasm>", "[local_set_6_wasm_tests]" ) {
220 auto code = read_wasm( std::string(wasm_directory) + "local_set.6.wasm");
221 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
222}
223
224BACKEND_TEST_CASE( "Testing wasm <local_set_7_wasm>", "[local_set_7_wasm_tests]" ) {
226 auto code = read_wasm( std::string(wasm_directory) + "local_set.7.wasm");
227 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
228}
229
230BACKEND_TEST_CASE( "Testing wasm <local_set_8_wasm>", "[local_set_8_wasm_tests]" ) {
232 auto code = read_wasm( std::string(wasm_directory) + "local_set.8.wasm");
233 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
234}
235
236BACKEND_TEST_CASE( "Testing wasm <local_set_9_wasm>", "[local_set_9_wasm_tests]" ) {
238 auto code = read_wasm( std::string(wasm_directory) + "local_set.9.wasm");
239 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
240}
241
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 UINT64_C(val)
Definition stdint.h:284
#define BACKEND_TEST_CASE(name, tags)
Definition utils.hpp:59
T bit_cast(const U &u)
Definition utils.hpp:35