Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
elem_tests.cpp File Reference
#include <algorithm>
#include <vector>
#include <iostream>
#include <iterator>
#include <cmath>
#include <cstdlib>
#include <catch2/catch.hpp>
#include <utils.hpp>
#include <wasm_config.hpp>
#include <sysio/vm/backend.hpp>
Include dependency graph for elem_tests.cpp:

Go to the source code of this file.

Functions

 BACKEND_TEST_CASE ("Testing wasm <elem_0_wasm>", "[elem_0_wasm_tests]")
 
 BACKEND_TEST_CASE ("Testing wasm <elem_1_wasm>", "[elem_1_wasm_tests]")
 
 BACKEND_TEST_CASE ("Testing wasm <elem_10_wasm>", "[elem_10_wasm_tests]")
 
 BACKEND_TEST_CASE ("Testing wasm <elem_12_wasm>", "[elem_12_wasm_tests]")
 
 BACKEND_TEST_CASE ("Testing wasm <elem_13_wasm>", "[elem_13_wasm_tests]")
 
 BACKEND_TEST_CASE ("Testing wasm <elem_18_wasm>", "[elem_18_wasm_tests]")
 
 BACKEND_TEST_CASE ("Testing wasm <elem_19_wasm>", "[elem_19_wasm_tests]")
 
 BACKEND_TEST_CASE ("Testing wasm <elem_20_wasm>", "[elem_20_wasm_tests]")
 
 BACKEND_TEST_CASE ("Testing wasm <elem_21_wasm>", "[elem_21_wasm_tests]")
 
 BACKEND_TEST_CASE ("Testing wasm <elem_22_wasm>", "[elem_22_wasm_tests]")
 
 BACKEND_TEST_CASE ("Testing wasm <elem_24_wasm>", "[elem_24_wasm_tests]")
 
 BACKEND_TEST_CASE ("Testing wasm <elem_26_wasm>", "[elem_26_wasm_tests]")
 
 BACKEND_TEST_CASE ("Testing wasm <elem_28_wasm>", "[elem_28_wasm_tests]")
 
 BACKEND_TEST_CASE ("Testing wasm <elem_3_wasm>", "[elem_3_wasm_tests]")
 
 BACKEND_TEST_CASE ("Testing wasm <elem_30_wasm>", "[elem_30_wasm_tests]")
 
 BACKEND_TEST_CASE ("Testing wasm <elem_31_wasm>", "[elem_31_wasm_tests]")
 
 BACKEND_TEST_CASE ("Testing wasm <elem_32_wasm>", "[elem_32_wasm_tests]")
 
 BACKEND_TEST_CASE ("Testing wasm <elem_33_wasm>", "[elem_33_wasm_tests]")
 
 BACKEND_TEST_CASE ("Testing wasm <elem_34_wasm>", "[elem_34_wasm_tests]")
 
 BACKEND_TEST_CASE ("Testing wasm <elem_35_wasm>", "[elem_35_wasm_tests]")
 
 BACKEND_TEST_CASE ("Testing wasm <elem_36_wasm>", "[elem_36_wasm_tests]")
 
 BACKEND_TEST_CASE ("Testing wasm <elem_38_wasm>", "[elem_38_wasm_tests]")
 
 BACKEND_TEST_CASE ("Testing wasm <elem_7_wasm>", "[elem_7_wasm_tests]")
 
 BACKEND_TEST_CASE ("Testing wasm <elem_8_wasm>", "[elem_8_wasm_tests]")
 

Variables

wasm_allocator wa
 

Function Documentation

◆ BACKEND_TEST_CASE() [1/24]

BACKEND_TEST_CASE ( "Testing wasm <elem_0_wasm>" ,
"" [elem_0_wasm_tests] )

Definition at line 18 of file elem_tests.cpp.

18 {
20 auto code = read_wasm( std::string(wasm_directory) + "elem.0.wasm");
21 backend_t bkend( code, &wa );
22
23}
wasm_allocator wa
Definition main.cpp:10
backend_t bkend(hello_wasm, ehm, &wa)
std::vector< uint8_t > read_wasm(const std::string &fname)
Definition utils.hpp:30
Here is the call graph for this function:

◆ BACKEND_TEST_CASE() [2/24]

BACKEND_TEST_CASE ( "Testing wasm <elem_10_wasm>" ,
"" [elem_10_wasm_tests] )

Definition at line 32 of file elem_tests.cpp.

32 {
34 auto code = read_wasm( std::string(wasm_directory) + "elem.10.wasm");
35 backend_t bkend( code, &wa );
36
37}
Here is the call graph for this function:

◆ BACKEND_TEST_CASE() [3/24]

BACKEND_TEST_CASE ( "Testing wasm <elem_12_wasm>" ,
"" [elem_12_wasm_tests] )

Definition at line 39 of file elem_tests.cpp.

39 {
41 auto code = read_wasm( std::string(wasm_directory) + "elem.12.wasm");
42 backend_t bkend( code, &wa );
43
44}
Here is the call graph for this function:

◆ BACKEND_TEST_CASE() [4/24]

BACKEND_TEST_CASE ( "Testing wasm <elem_13_wasm>" ,
"" [elem_13_wasm_tests] )

Definition at line 46 of file elem_tests.cpp.

46 {
48 auto code = read_wasm( std::string(wasm_directory) + "elem.13.wasm");
49 backend_t bkend( code, &wa );
50
51}
Here is the call graph for this function:

◆ BACKEND_TEST_CASE() [5/24]

BACKEND_TEST_CASE ( "Testing wasm <elem_18_wasm>" ,
"" [elem_18_wasm_tests] )

Definition at line 53 of file elem_tests.cpp.

53 {
55 auto code = read_wasm( std::string(wasm_directory) + "elem.18.wasm");
56 CHECK_THROWS_AS(backend_t(code, &wa), std::exception);
57}
sysio::vm::backend< rhf_t > backend_t
#define CHECK_THROWS_AS(expr, exceptionType)
Definition catch.hpp:203
Here is the call graph for this function:

◆ BACKEND_TEST_CASE() [6/24]

BACKEND_TEST_CASE ( "Testing wasm <elem_19_wasm>" ,
"" [elem_19_wasm_tests] )

Definition at line 59 of file elem_tests.cpp.

59 {
61 auto code = read_wasm( std::string(wasm_directory) + "elem.19.wasm");
62 CHECK_THROWS_AS(backend_t(code, &wa), std::exception);
63}
Here is the call graph for this function:

◆ BACKEND_TEST_CASE() [7/24]

BACKEND_TEST_CASE ( "Testing wasm <elem_1_wasm>" ,
"" [elem_1_wasm_tests] )

Definition at line 25 of file elem_tests.cpp.

25 {
27 auto code = read_wasm( std::string(wasm_directory) + "elem.1.wasm");
28 backend_t bkend( code, &wa );
29
30}
Here is the call graph for this function:

◆ BACKEND_TEST_CASE() [8/24]

BACKEND_TEST_CASE ( "Testing wasm <elem_20_wasm>" ,
"" [elem_20_wasm_tests] )

Definition at line 65 of file elem_tests.cpp.

65 {
67 auto code = read_wasm( std::string(wasm_directory) + "elem.20.wasm");
68 CHECK_THROWS_AS(backend_t(code, &wa), std::exception);
69}
Here is the call graph for this function:

◆ BACKEND_TEST_CASE() [9/24]

BACKEND_TEST_CASE ( "Testing wasm <elem_21_wasm>" ,
"" [elem_21_wasm_tests] )

Definition at line 71 of file elem_tests.cpp.

71 {
73 auto code = read_wasm( std::string(wasm_directory) + "elem.21.wasm");
74 CHECK_THROWS_AS(backend_t(code, &wa), std::exception);
75}
Here is the call graph for this function:

◆ BACKEND_TEST_CASE() [10/24]

BACKEND_TEST_CASE ( "Testing wasm <elem_22_wasm>" ,
"" [elem_22_wasm_tests] )

Definition at line 77 of file elem_tests.cpp.

77 {
79 auto code = read_wasm( std::string(wasm_directory) + "elem.22.wasm");
80 CHECK_THROWS_AS(backend_t(code, &wa), std::exception);
81}
Here is the call graph for this function:

◆ BACKEND_TEST_CASE() [11/24]

BACKEND_TEST_CASE ( "Testing wasm <elem_24_wasm>" ,
"" [elem_24_wasm_tests] )

Definition at line 83 of file elem_tests.cpp.

83 {
85 auto code = read_wasm( std::string(wasm_directory) + "elem.24.wasm");
86 CHECK_THROWS_AS(backend_t(code, &wa), std::exception);
87}
Here is the call graph for this function:

◆ BACKEND_TEST_CASE() [12/24]

BACKEND_TEST_CASE ( "Testing wasm <elem_26_wasm>" ,
"" [elem_26_wasm_tests] )

Definition at line 89 of file elem_tests.cpp.

89 {
91 auto code = read_wasm( std::string(wasm_directory) + "elem.26.wasm");
92 CHECK_THROWS_AS(backend_t(code, &wa), std::exception);
93}
Here is the call graph for this function:

◆ BACKEND_TEST_CASE() [13/24]

BACKEND_TEST_CASE ( "Testing wasm <elem_28_wasm>" ,
"" [elem_28_wasm_tests] )

Definition at line 95 of file elem_tests.cpp.

95 {
97 auto code = read_wasm( std::string(wasm_directory) + "elem.28.wasm");
98 CHECK_THROWS_AS(backend_t(code, &wa), std::exception);
99}
Here is the call graph for this function:

◆ BACKEND_TEST_CASE() [14/24]

BACKEND_TEST_CASE ( "Testing wasm <elem_30_wasm>" ,
"" [elem_30_wasm_tests] )

Definition at line 108 of file elem_tests.cpp.

108 {
110 auto code = read_wasm( std::string(wasm_directory) + "elem.30.wasm");
111 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
112}
Here is the call graph for this function:

◆ BACKEND_TEST_CASE() [15/24]

BACKEND_TEST_CASE ( "Testing wasm <elem_31_wasm>" ,
"" [elem_31_wasm_tests] )

Definition at line 114 of file elem_tests.cpp.

114 {
116 auto code = read_wasm( std::string(wasm_directory) + "elem.31.wasm");
117 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
118}
Here is the call graph for this function:

◆ BACKEND_TEST_CASE() [16/24]

BACKEND_TEST_CASE ( "Testing wasm <elem_32_wasm>" ,
"" [elem_32_wasm_tests] )

Definition at line 120 of file elem_tests.cpp.

120 {
122 auto code = read_wasm( std::string(wasm_directory) + "elem.32.wasm");
123 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
124}
Here is the call graph for this function:

◆ BACKEND_TEST_CASE() [17/24]

BACKEND_TEST_CASE ( "Testing wasm <elem_33_wasm>" ,
"" [elem_33_wasm_tests] )

Definition at line 126 of file elem_tests.cpp.

126 {
128 auto code = read_wasm( std::string(wasm_directory) + "elem.33.wasm");
129 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
130}
Here is the call graph for this function:

◆ BACKEND_TEST_CASE() [18/24]

BACKEND_TEST_CASE ( "Testing wasm <elem_34_wasm>" ,
"" [elem_34_wasm_tests] )

Definition at line 132 of file elem_tests.cpp.

132 {
134 auto code = read_wasm( std::string(wasm_directory) + "elem.34.wasm");
135 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
136}
Here is the call graph for this function:

◆ BACKEND_TEST_CASE() [19/24]

BACKEND_TEST_CASE ( "Testing wasm <elem_35_wasm>" ,
"" [elem_35_wasm_tests] )

Definition at line 138 of file elem_tests.cpp.

138 {
140 auto code = read_wasm( std::string(wasm_directory) + "elem.35.wasm");
141 CHECK_THROWS_AS(backend_t(code, nullptr), std::exception);
142}
Here is the call graph for this function:

◆ BACKEND_TEST_CASE() [20/24]

BACKEND_TEST_CASE ( "Testing wasm <elem_36_wasm>" ,
"" [elem_36_wasm_tests] )

Definition at line 144 of file elem_tests.cpp.

144 {
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}
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
#define UINT32_C(val)
Definition stdint.h:283
Here is the call graph for this function:

◆ BACKEND_TEST_CASE() [21/24]

BACKEND_TEST_CASE ( "Testing wasm <elem_38_wasm>" ,
"" [elem_38_wasm_tests] )

Definition at line 152 of file elem_tests.cpp.

152 {
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}
Here is the call graph for this function:

◆ BACKEND_TEST_CASE() [22/24]

BACKEND_TEST_CASE ( "Testing wasm <elem_3_wasm>" ,
"" [elem_3_wasm_tests] )

Definition at line 101 of file elem_tests.cpp.

101 {
103 auto code = read_wasm( std::string(wasm_directory) + "elem.3.wasm");
104 backend_t bkend( code, &wa );
105
106}
Here is the call graph for this function:

◆ BACKEND_TEST_CASE() [23/24]

BACKEND_TEST_CASE ( "Testing wasm <elem_7_wasm>" ,
"" [elem_7_wasm_tests] )

Definition at line 162 of file elem_tests.cpp.

162 {
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}
Here is the call graph for this function:

◆ BACKEND_TEST_CASE() [24/24]

BACKEND_TEST_CASE ( "Testing wasm <elem_8_wasm>" ,
"" [elem_8_wasm_tests] )

Definition at line 171 of file elem_tests.cpp.

171 {
173 auto code = read_wasm( std::string(wasm_directory) + "elem.8.wasm");
174 backend_t bkend( code, &wa );
175
176}
Here is the call graph for this function:

Variable Documentation

◆ wa

wasm_allocator wa
extern

Definition at line 10 of file main.cpp.