Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
left-to-right_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 <left-to-right_0_wasm>", "[left-to-right_0_wasm_tests]" ) {
20 auto code = read_wasm( std::string(wasm_directory) + "left-to-right.0.wasm");
21 backend_t bkend( code, &wa );
22
23 CHECK(bkend.call_with_return("env", "i32_add")->to_ui32() == UINT32_C(258));
24 CHECK(bkend.call_with_return("env", "i64_add")->to_ui32() == UINT32_C(258));
25 CHECK(bkend.call_with_return("env", "i32_sub")->to_ui32() == UINT32_C(258));
26 CHECK(bkend.call_with_return("env", "i64_sub")->to_ui32() == UINT32_C(258));
27 CHECK(bkend.call_with_return("env", "i32_mul")->to_ui32() == UINT32_C(258));
28 CHECK(bkend.call_with_return("env", "i64_mul")->to_ui32() == UINT32_C(258));
29 CHECK(bkend.call_with_return("env", "i32_div_s")->to_ui32() == UINT32_C(258));
30 CHECK(bkend.call_with_return("env", "i64_div_s")->to_ui32() == UINT32_C(258));
31 CHECK(bkend.call_with_return("env", "i32_div_u")->to_ui32() == UINT32_C(258));
32 CHECK(bkend.call_with_return("env", "i64_div_u")->to_ui32() == UINT32_C(258));
33 CHECK(bkend.call_with_return("env", "i32_rem_s")->to_ui32() == UINT32_C(258));
34 CHECK(bkend.call_with_return("env", "i64_rem_s")->to_ui32() == UINT32_C(258));
35 CHECK(bkend.call_with_return("env", "i32_rem_u")->to_ui32() == UINT32_C(258));
36 CHECK(bkend.call_with_return("env", "i64_rem_u")->to_ui32() == UINT32_C(258));
37 CHECK(bkend.call_with_return("env", "i32_and")->to_ui32() == UINT32_C(258));
38 CHECK(bkend.call_with_return("env", "i64_and")->to_ui32() == UINT32_C(258));
39 CHECK(bkend.call_with_return("env", "i32_or")->to_ui32() == UINT32_C(258));
40 CHECK(bkend.call_with_return("env", "i64_or")->to_ui32() == UINT32_C(258));
41 CHECK(bkend.call_with_return("env", "i32_xor")->to_ui32() == UINT32_C(258));
42 CHECK(bkend.call_with_return("env", "i64_xor")->to_ui32() == UINT32_C(258));
43 CHECK(bkend.call_with_return("env", "i32_shl")->to_ui32() == UINT32_C(258));
44 CHECK(bkend.call_with_return("env", "i64_shl")->to_ui32() == UINT32_C(258));
45 CHECK(bkend.call_with_return("env", "i32_shr_u")->to_ui32() == UINT32_C(258));
46 CHECK(bkend.call_with_return("env", "i64_shr_u")->to_ui32() == UINT32_C(258));
47 CHECK(bkend.call_with_return("env", "i32_shr_s")->to_ui32() == UINT32_C(258));
48 CHECK(bkend.call_with_return("env", "i64_shr_s")->to_ui32() == UINT32_C(258));
49 CHECK(bkend.call_with_return("env", "i32_eq")->to_ui32() == UINT32_C(258));
50 CHECK(bkend.call_with_return("env", "i64_eq")->to_ui32() == UINT32_C(258));
51 CHECK(bkend.call_with_return("env", "i32_ne")->to_ui32() == UINT32_C(258));
52 CHECK(bkend.call_with_return("env", "i64_ne")->to_ui32() == UINT32_C(258));
53 CHECK(bkend.call_with_return("env", "i32_lt_s")->to_ui32() == UINT32_C(258));
54 CHECK(bkend.call_with_return("env", "i64_lt_s")->to_ui32() == UINT32_C(258));
55 CHECK(bkend.call_with_return("env", "i32_le_s")->to_ui32() == UINT32_C(258));
56 CHECK(bkend.call_with_return("env", "i64_le_s")->to_ui32() == UINT32_C(258));
57 CHECK(bkend.call_with_return("env", "i32_lt_u")->to_ui32() == UINT32_C(258));
58 CHECK(bkend.call_with_return("env", "i64_lt_u")->to_ui32() == UINT32_C(258));
59 CHECK(bkend.call_with_return("env", "i32_le_u")->to_ui32() == UINT32_C(258));
60 CHECK(bkend.call_with_return("env", "i64_le_u")->to_ui32() == UINT32_C(258));
61 CHECK(bkend.call_with_return("env", "i32_gt_s")->to_ui32() == UINT32_C(258));
62 CHECK(bkend.call_with_return("env", "i64_gt_s")->to_ui32() == UINT32_C(258));
63 CHECK(bkend.call_with_return("env", "i32_ge_s")->to_ui32() == UINT32_C(258));
64 CHECK(bkend.call_with_return("env", "i64_ge_s")->to_ui32() == UINT32_C(258));
65 CHECK(bkend.call_with_return("env", "i32_gt_u")->to_ui32() == UINT32_C(258));
66 CHECK(bkend.call_with_return("env", "i64_gt_u")->to_ui32() == UINT32_C(258));
67 CHECK(bkend.call_with_return("env", "i32_ge_u")->to_ui32() == UINT32_C(258));
68 CHECK(bkend.call_with_return("env", "i64_ge_u")->to_ui32() == UINT32_C(258));
69 CHECK(bkend.call_with_return("env", "i32_store")->to_ui32() == UINT32_C(258));
70 CHECK(bkend.call_with_return("env", "i64_store")->to_ui32() == UINT32_C(258));
71 CHECK(bkend.call_with_return("env", "i32_store8")->to_ui32() == UINT32_C(258));
72 CHECK(bkend.call_with_return("env", "i64_store8")->to_ui32() == UINT32_C(258));
73 CHECK(bkend.call_with_return("env", "i32_store16")->to_ui32() == UINT32_C(258));
74 CHECK(bkend.call_with_return("env", "i64_store16")->to_ui32() == UINT32_C(258));
75 CHECK(bkend.call_with_return("env", "i64_store32")->to_ui32() == UINT32_C(258));
76 CHECK(bkend.call_with_return("env", "i32_call")->to_ui32() == UINT32_C(258));
77 CHECK(bkend.call_with_return("env", "i64_call")->to_ui32() == UINT32_C(258));
78 CHECK(bkend.call_with_return("env", "i32_call_indirect")->to_ui32() == UINT32_C(66052));
79 CHECK(bkend.call_with_return("env", "i64_call_indirect")->to_ui32() == UINT32_C(66052));
80 CHECK(bkend.call_with_return("env", "i32_select")->to_ui32() == UINT32_C(66053));
81 CHECK(bkend.call_with_return("env", "i64_select")->to_ui32() == UINT32_C(66053));
82 CHECK(bkend.call_with_return("env", "f32_add")->to_ui32() == UINT32_C(258));
83 CHECK(bkend.call_with_return("env", "f64_add")->to_ui32() == UINT32_C(258));
84 CHECK(bkend.call_with_return("env", "f32_sub")->to_ui32() == UINT32_C(258));
85 CHECK(bkend.call_with_return("env", "f64_sub")->to_ui32() == UINT32_C(258));
86 CHECK(bkend.call_with_return("env", "f32_mul")->to_ui32() == UINT32_C(258));
87 CHECK(bkend.call_with_return("env", "f64_mul")->to_ui32() == UINT32_C(258));
88 CHECK(bkend.call_with_return("env", "f32_div")->to_ui32() == UINT32_C(258));
89 CHECK(bkend.call_with_return("env", "f64_div")->to_ui32() == UINT32_C(258));
90 CHECK(bkend.call_with_return("env", "f32_copysign")->to_ui32() == UINT32_C(258));
91 CHECK(bkend.call_with_return("env", "f64_copysign")->to_ui32() == UINT32_C(258));
92 CHECK(bkend.call_with_return("env", "f32_eq")->to_ui32() == UINT32_C(258));
93 CHECK(bkend.call_with_return("env", "f64_eq")->to_ui32() == UINT32_C(258));
94 CHECK(bkend.call_with_return("env", "f32_ne")->to_ui32() == UINT32_C(258));
95 CHECK(bkend.call_with_return("env", "f64_ne")->to_ui32() == UINT32_C(258));
96 CHECK(bkend.call_with_return("env", "f32_lt")->to_ui32() == UINT32_C(258));
97 CHECK(bkend.call_with_return("env", "f64_lt")->to_ui32() == UINT32_C(258));
98 CHECK(bkend.call_with_return("env", "f32_le")->to_ui32() == UINT32_C(258));
99 CHECK(bkend.call_with_return("env", "f64_le")->to_ui32() == UINT32_C(258));
100 CHECK(bkend.call_with_return("env", "f32_gt")->to_ui32() == UINT32_C(258));
101 CHECK(bkend.call_with_return("env", "f64_gt")->to_ui32() == UINT32_C(258));
102 CHECK(bkend.call_with_return("env", "f32_ge")->to_ui32() == UINT32_C(258));
103 CHECK(bkend.call_with_return("env", "f64_ge")->to_ui32() == UINT32_C(258));
104 CHECK(bkend.call_with_return("env", "f32_min")->to_ui32() == UINT32_C(258));
105 CHECK(bkend.call_with_return("env", "f64_min")->to_ui32() == UINT32_C(258));
106 CHECK(bkend.call_with_return("env", "f32_max")->to_ui32() == UINT32_C(258));
107 CHECK(bkend.call_with_return("env", "f64_max")->to_ui32() == UINT32_C(258));
108 CHECK(bkend.call_with_return("env", "f32_store")->to_ui32() == UINT32_C(258));
109 CHECK(bkend.call_with_return("env", "f64_store")->to_ui32() == UINT32_C(258));
110 CHECK(bkend.call_with_return("env", "f32_call")->to_ui32() == UINT32_C(258));
111 CHECK(bkend.call_with_return("env", "f64_call")->to_ui32() == UINT32_C(258));
112 CHECK(bkend.call_with_return("env", "f32_call_indirect")->to_ui32() == UINT32_C(66052));
113 CHECK(bkend.call_with_return("env", "f64_call_indirect")->to_ui32() == UINT32_C(66052));
114 CHECK(bkend.call_with_return("env", "f32_select")->to_ui32() == UINT32_C(66053));
115 CHECK(bkend.call_with_return("env", "f64_select")->to_ui32() == UINT32_C(66053));
116 CHECK(bkend.call_with_return("env", "br_if")->to_ui32() == UINT32_C(258));
117 CHECK(bkend.call_with_return("env", "br_table")->to_ui32() == UINT32_C(258));
118}
119
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)
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