Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
elem_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 <elem_0_wasm>", "[elem_0_wasm_tests]" ) {
20 auto code = read_wasm( std::string(wasm_directory) + "elem.0.wasm");
21 backend_t bkend( code, &wa );
22
23}
24
25BACKEND_TEST_CASE( "Testing wasm <elem_1_wasm>", "[elem_1_wasm_tests]" ) {
27 auto code = read_wasm( std::string(wasm_directory) + "elem.1.wasm");
28 backend_t bkend( code, &wa );
29
30}
31
32BACKEND_TEST_CASE( "Testing wasm <elem_10_wasm>", "[elem_10_wasm_tests]" ) {
34 auto code = read_wasm( std::string(wasm_directory) + "elem.10.wasm");
35 backend_t bkend( code, &wa );
36
37}
38
39BACKEND_TEST_CASE( "Testing wasm <elem_12_wasm>", "[elem_12_wasm_tests]" ) {
41 auto code = read_wasm( std::string(wasm_directory) + "elem.12.wasm");
42 backend_t bkend( code, &wa );
43
44}
45
46BACKEND_TEST_CASE( "Testing wasm <elem_13_wasm>", "[elem_13_wasm_tests]" ) {
48 auto code = read_wasm( std::string(wasm_directory) + "elem.13.wasm");
49 backend_t bkend( code, &wa );
50
51}
52
53BACKEND_TEST_CASE( "Testing wasm <elem_18_wasm>", "[elem_18_wasm_tests]" ) {
55 auto code = read_wasm( std::string(wasm_directory) + "elem.18.wasm");
56 CHECK_THROWS_AS(backend_t(code, &wa), std::exception);
57}
58
59BACKEND_TEST_CASE( "Testing wasm <elem_19_wasm>", "[elem_19_wasm_tests]" ) {
61 auto code = read_wasm( std::string(wasm_directory) + "elem.19.wasm");
62 CHECK_THROWS_AS(backend_t(code, &wa), std::exception);
63}
64
65BACKEND_TEST_CASE( "Testing wasm <elem_20_wasm>", "[elem_20_wasm_tests]" ) {
67 auto code = read_wasm( std::string(wasm_directory) + "elem.20.wasm");
68 CHECK_THROWS_AS(backend_t(code, &wa), std::exception);
69}
70
71BACKEND_TEST_CASE( "Testing wasm <elem_21_wasm>", "[elem_21_wasm_tests]" ) {
73 auto code = read_wasm( std::string(wasm_directory) + "elem.21.wasm");
74 CHECK_THROWS_AS(backend_t(code, &wa), std::exception);
75}
76
77BACKEND_TEST_CASE( "Testing wasm <elem_22_wasm>", "[elem_22_wasm_tests]" ) {
79 auto code = read_wasm( std::string(wasm_directory) + "elem.22.wasm");
80 CHECK_THROWS_AS(backend_t(code, &wa), std::exception);
81}
82
83BACKEND_TEST_CASE( "Testing wasm <elem_24_wasm>", "[elem_24_wasm_tests]" ) {
85 auto code = read_wasm( std::string(wasm_directory) + "elem.24.wasm");
86 CHECK_THROWS_AS(backend_t(code, &wa), std::exception);
87}
88
89BACKEND_TEST_CASE( "Testing wasm <elem_26_wasm>", "[elem_26_wasm_tests]" ) {
91 auto code = read_wasm( std::string(wasm_directory) + "elem.26.wasm");
92 CHECK_THROWS_AS(backend_t(code, &wa), std::exception);
93}
94
95BACKEND_TEST_CASE( "Testing wasm <elem_28_wasm>", "[elem_28_wasm_tests]" ) {
97 auto code = read_wasm( std::string(wasm_directory) + "elem.28.wasm");
98 CHECK_THROWS_AS(backend_t(code, &wa), std::exception);
99}
100
101BACKEND_TEST_CASE( "Testing wasm <elem_3_wasm>", "[elem_3_wasm_tests]" ) {
103 auto code = read_wasm( std::string(wasm_directory) + "elem.3.wasm");
104 backend_t bkend( code, &wa );
105
106}
107
108BACKEND_TEST_CASE( "Testing wasm <elem_30_wasm>", "[elem_30_wasm_tests]" ) {
110 auto code = read_wasm( std::string(wasm_directory) + "elem.30.wasm");
111 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
112}
113
114BACKEND_TEST_CASE( "Testing wasm <elem_31_wasm>", "[elem_31_wasm_tests]" ) {
116 auto code = read_wasm( std::string(wasm_directory) + "elem.31.wasm");
117 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
118}
119
120BACKEND_TEST_CASE( "Testing wasm <elem_32_wasm>", "[elem_32_wasm_tests]" ) {
122 auto code = read_wasm( std::string(wasm_directory) + "elem.32.wasm");
123 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
124}
125
126BACKEND_TEST_CASE( "Testing wasm <elem_33_wasm>", "[elem_33_wasm_tests]" ) {
128 auto code = read_wasm( std::string(wasm_directory) + "elem.33.wasm");
129 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
130}
131
132BACKEND_TEST_CASE( "Testing wasm <elem_34_wasm>", "[elem_34_wasm_tests]" ) {
134 auto code = read_wasm( std::string(wasm_directory) + "elem.34.wasm");
135 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
136}
137
138BACKEND_TEST_CASE( "Testing wasm <elem_35_wasm>", "[elem_35_wasm_tests]" ) {
140 auto code = read_wasm( std::string(wasm_directory) + "elem.35.wasm");
141 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
142}
143
144BACKEND_TEST_CASE( "Testing wasm <elem_36_wasm>", "[elem_36_wasm_tests]" ) {
146 auto code = read_wasm( std::string(wasm_directory) + "elem.36.wasm");
147 backend_t bkend( code, &wa );
148
149 CHECK(bkend.call_with_return("env", "call-overwritten")->to_ui32() == UINT32_C(66));
150}
151
152BACKEND_TEST_CASE( "Testing wasm <elem_38_wasm>", "[elem_38_wasm_tests]" ) {
154 auto code = read_wasm( std::string(wasm_directory) + "elem.38.wasm");
155 backend_t bkend( code, &wa );
156
157 CHECK_THROWS_AS(bkend("env", "call-7"), std::exception);
158 CHECK(bkend.call_with_return("env", "call-8")->to_ui32() == UINT32_C(65));
159 CHECK(bkend.call_with_return("env", "call-9")->to_ui32() == UINT32_C(66));
160}
161
162BACKEND_TEST_CASE( "Testing wasm <elem_7_wasm>", "[elem_7_wasm_tests]" ) {
164 auto code = read_wasm( std::string(wasm_directory) + "elem.7.wasm");
165 backend_t bkend( code, &wa );
166
167 CHECK(bkend.call_with_return("env", "call-7")->to_ui32() == UINT32_C(65));
168 CHECK(bkend.call_with_return("env", "call-9")->to_ui32() == UINT32_C(66));
169}
170
171BACKEND_TEST_CASE( "Testing wasm <elem_8_wasm>", "[elem_8_wasm_tests]" ) {
173 auto code = read_wasm( std::string(wasm_directory) + "elem.8.wasm");
174 backend_t bkend( code, &wa );
175
176}
177
auto call_with_return(host_t &host, const std::string_view &mod, const std::string_view &func, Args... args)
Definition backend.hpp:178
wasm_allocator wa
Definition main.cpp:10
#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
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