Wire Sysio
Wire Sysion 1.0.0
Loading...
Searching...
No Matches
endianness_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
14
using namespace
sysio
;
15
using namespace
sysio::vm
;
16
extern
wasm_allocator
wa
;
17
18
BACKEND_TEST_CASE
(
"Testing wasm <endianness_0_wasm>"
,
"[endianness_0_wasm_tests]"
) {
19
using
backend_t
=
backend<standalone_function_t, TestType>
;
20
auto
code =
read_wasm
( std::string(wasm_directory) +
"endianness.0.wasm"
);
21
backend_t
bkend
( code, &
wa
);
22
23
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i32_load16_s"
,
UINT32_C
(4294967295))->to_ui32() ==
UINT32_C
(4294967295));
24
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i32_load16_s"
,
UINT32_C
(4294963054))->to_ui32() ==
UINT32_C
(4294963054));
25
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i32_load16_s"
,
UINT32_C
(42))->to_ui32() ==
UINT32_C
(42));
26
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i32_load16_s"
,
UINT32_C
(12816))->to_ui32() ==
UINT32_C
(12816));
27
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i32_load16_u"
,
UINT32_C
(4294967295))->to_ui32() ==
UINT32_C
(65535));
28
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i32_load16_u"
,
UINT32_C
(4294963054))->to_ui32() ==
UINT32_C
(61294));
29
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i32_load16_u"
,
UINT32_C
(42))->to_ui32() ==
UINT32_C
(42));
30
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i32_load16_u"
,
UINT32_C
(51966))->to_ui32() ==
UINT32_C
(51966));
31
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i32_load"
,
UINT32_C
(4294967295))->to_ui32() ==
UINT32_C
(4294967295));
32
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i32_load"
,
UINT32_C
(4252543054))->to_ui32() ==
UINT32_C
(4252543054));
33
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i32_load"
,
UINT32_C
(42424242))->to_ui32() ==
UINT32_C
(42424242));
34
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i32_load"
,
UINT32_C
(2880249322))->to_ui32() ==
UINT32_C
(2880249322));
35
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_load16_s"
,
UINT64_C
(18446744073709551615))->to_ui64() ==
UINT32_C
(18446744073709551615));
36
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_load16_s"
,
UINT64_C
(18446744073709547374))->to_ui64() ==
UINT32_C
(18446744073709547374));
37
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_load16_s"
,
UINT64_C
(42))->to_ui64() ==
UINT32_C
(42));
38
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_load16_s"
,
UINT64_C
(12816))->to_ui64() ==
UINT32_C
(12816));
39
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_load16_u"
,
UINT64_C
(18446744073709551615))->to_ui64() ==
UINT32_C
(65535));
40
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_load16_u"
,
UINT64_C
(18446744073709547374))->to_ui64() ==
UINT32_C
(61294));
41
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_load16_u"
,
UINT64_C
(42))->to_ui64() ==
UINT32_C
(42));
42
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_load16_u"
,
UINT64_C
(51966))->to_ui64() ==
UINT32_C
(51966));
43
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_load32_s"
,
UINT64_C
(18446744073709551615))->to_ui64() ==
UINT32_C
(18446744073709551615));
44
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_load32_s"
,
UINT64_C
(18446744073667127374))->to_ui64() ==
UINT32_C
(18446744073667127374));
45
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_load32_s"
,
UINT64_C
(42424242))->to_ui64() ==
UINT32_C
(42424242));
46
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_load32_s"
,
UINT64_C
(305419896))->to_ui64() ==
UINT32_C
(305419896));
47
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_load32_u"
,
UINT64_C
(18446744073709551615))->to_ui64() ==
UINT32_C
(4294967295));
48
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_load32_u"
,
UINT64_C
(18446744073667127374))->to_ui64() ==
UINT32_C
(4252543054));
49
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_load32_u"
,
UINT64_C
(42424242))->to_ui64() ==
UINT32_C
(42424242));
50
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_load32_u"
,
UINT64_C
(2880249322))->to_ui64() ==
UINT32_C
(2880249322));
51
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_load"
,
UINT64_C
(18446744073709551615))->to_ui64() ==
UINT32_C
(18446744073709551615));
52
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_load"
,
UINT64_C
(18446744073667127374))->to_ui64() ==
UINT32_C
(18446744073667127374));
53
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_load"
,
UINT64_C
(2880249322))->to_ui64() ==
UINT32_C
(2880249322));
54
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_load"
,
UINT64_C
(12370766947463011818))->to_ui64() ==
UINT32_C
(12370766947463011818));
55
CHECK
(
bit_cast<uint32_t>
(
bkend
.
call_with_return
(
"env"
,
"f32_load"
,
bit_cast<float>
(
UINT32_C
(3212836864)))->to_f32()) ==
UINT32_C
(3212836864));
56
CHECK
(
bit_cast<uint32_t>
(
bkend
.
call_with_return
(
"env"
,
"f32_load"
,
bit_cast<float>
(
UINT32_C
(1011494326)))->to_f32()) ==
UINT32_C
(1011494326));
57
CHECK
(
bit_cast<uint32_t>
(
bkend
.
call_with_return
(
"env"
,
"f32_load"
,
bit_cast<float>
(
UINT32_C
(1166316389)))->to_f32()) ==
UINT32_C
(1166316389));
58
CHECK
(
bit_cast<uint32_t>
(
bkend
.
call_with_return
(
"env"
,
"f32_load"
,
bit_cast<float>
(
UINT32_C
(2139095039)))->to_f32()) ==
UINT32_C
(2139095039));
59
CHECK
(
bit_cast<uint64_t>
(
bkend
.
call_with_return
(
"env"
,
"f64_load"
,
bit_cast<double>
(
UINT64_C
(13830554455654793216)))->to_f64()) ==
UINT64_C
(13830554455654793216));
60
CHECK
(
bit_cast<uint64_t>
(
bkend
.
call_with_return
(
"env"
,
"f64_load"
,
bit_cast<double>
(
UINT64_C
(4653144502447687399)))->to_f64()) ==
UINT64_C
(4653144502447687399));
61
CHECK
(
bit_cast<uint64_t>
(
bkend
.
call_with_return
(
"env"
,
"f64_load"
,
bit_cast<double>
(
UINT64_C
(4691032041816096430)))->to_f64()) ==
UINT64_C
(4691032041816096430));
62
CHECK
(
bit_cast<uint64_t>
(
bkend
.
call_with_return
(
"env"
,
"f64_load"
,
bit_cast<double>
(
UINT64_C
(9218868437227405311)))->to_f64()) ==
UINT64_C
(9218868437227405311));
63
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i32_store16"
,
UINT32_C
(4294967295))->to_ui32() ==
UINT32_C
(65535));
64
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i32_store16"
,
UINT32_C
(4294963054))->to_ui32() ==
UINT32_C
(61294));
65
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i32_store16"
,
UINT32_C
(42))->to_ui32() ==
UINT32_C
(42));
66
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i32_store16"
,
UINT32_C
(51966))->to_ui32() ==
UINT32_C
(51966));
67
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i32_store"
,
UINT32_C
(4294967295))->to_ui32() ==
UINT32_C
(4294967295));
68
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i32_store"
,
UINT32_C
(4294963054))->to_ui32() ==
UINT32_C
(4294963054));
69
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i32_store"
,
UINT32_C
(42424242))->to_ui32() ==
UINT32_C
(42424242));
70
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i32_store"
,
UINT32_C
(3735931646))->to_ui32() ==
UINT32_C
(3735931646));
71
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_store16"
,
UINT64_C
(18446744073709551615))->to_ui64() ==
UINT32_C
(65535));
72
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_store16"
,
UINT64_C
(18446744073709547374))->to_ui64() ==
UINT32_C
(61294));
73
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_store16"
,
UINT64_C
(42))->to_ui64() ==
UINT32_C
(42));
74
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_store16"
,
UINT64_C
(51966))->to_ui64() ==
UINT32_C
(51966));
75
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_store32"
,
UINT64_C
(18446744073709551615))->to_ui64() ==
UINT32_C
(4294967295));
76
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_store32"
,
UINT64_C
(18446744073709547374))->to_ui64() ==
UINT32_C
(4294963054));
77
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_store32"
,
UINT64_C
(42424242))->to_ui64() ==
UINT32_C
(42424242));
78
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_store32"
,
UINT64_C
(3735931646))->to_ui64() ==
UINT32_C
(3735931646));
79
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_store"
,
UINT64_C
(18446744073709551615))->to_ui64() ==
UINT32_C
(18446744073709551615));
80
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_store"
,
UINT64_C
(18446744073667127374))->to_ui64() ==
UINT32_C
(18446744073667127374));
81
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_store"
,
UINT64_C
(2880249322))->to_ui64() ==
UINT32_C
(2880249322));
82
CHECK
(
bkend
.
call_with_return
(
"env"
,
"i64_store"
,
UINT64_C
(12370766947463011818))->to_ui64() ==
UINT32_C
(12370766947463011818));
83
CHECK
(
bit_cast<uint32_t>
(
bkend
.
call_with_return
(
"env"
,
"f32_store"
,
bit_cast<float>
(
UINT32_C
(3212836864)))->to_f32()) ==
UINT32_C
(3212836864));
84
CHECK
(
bit_cast<uint32_t>
(
bkend
.
call_with_return
(
"env"
,
"f32_store"
,
bit_cast<float>
(
UINT32_C
(1011494326)))->to_f32()) ==
UINT32_C
(1011494326));
85
CHECK
(
bit_cast<uint32_t>
(
bkend
.
call_with_return
(
"env"
,
"f32_store"
,
bit_cast<float>
(
UINT32_C
(1166316389)))->to_f32()) ==
UINT32_C
(1166316389));
86
CHECK
(
bit_cast<uint32_t>
(
bkend
.
call_with_return
(
"env"
,
"f32_store"
,
bit_cast<float>
(
UINT32_C
(2139095039)))->to_f32()) ==
UINT32_C
(2139095039));
87
CHECK
(
bit_cast<uint64_t>
(
bkend
.
call_with_return
(
"env"
,
"f64_store"
,
bit_cast<double>
(
UINT64_C
(13830554455654793216)))->to_f64()) ==
UINT64_C
(13830554455654793216));
88
CHECK
(
bit_cast<uint64_t>
(
bkend
.
call_with_return
(
"env"
,
"f64_store"
,
bit_cast<double>
(
UINT64_C
(4653144502447687399)))->to_f64()) ==
UINT64_C
(4653144502447687399));
89
CHECK
(
bit_cast<uint64_t>
(
bkend
.
call_with_return
(
"env"
,
"f64_store"
,
bit_cast<double>
(
UINT64_C
(4691032041816096430)))->to_f64()) ==
UINT64_C
(4691032041816096430));
90
CHECK
(
bit_cast<uint64_t>
(
bkend
.
call_with_return
(
"env"
,
"f64_store"
,
bit_cast<double>
(
UINT64_C
(9218868437227405311)))->to_f64()) ==
UINT64_C
(9218868437227405311));
91
}
92
sysio::vm::backend
Definition
backend.hpp:62
sysio::vm::backend::call_with_return
auto call_with_return(host_t &host, const std::string_view &mod, const std::string_view &func, Args... args)
Definition
backend.hpp:178
sysio::vm::wasm_allocator
Definition
allocator.hpp:409
wa
wasm_allocator wa
Definition
main.cpp:10
CHECK
#define CHECK(cond)
Definition
util.h:80
bkend
backend_t bkend(hello_wasm, ehm, &wa)
sysio::vm
Definition
controller.hpp:23
sysio::vm::read_wasm
std::vector< uint8_t > read_wasm(const std::string &fname)
Definition
utils.hpp:30
sysio
Definition
abi_serializer.cpp:8
catch.hpp
UINT32_C
#define UINT32_C(val)
Definition
stdint.h:283
UINT64_C
#define UINT64_C(val)
Definition
stdint.h:284
BACKEND_TEST_CASE
#define BACKEND_TEST_CASE(name, tags)
Definition
utils.hpp:59
bit_cast
T bit_cast(const U &u)
Definition
utils.hpp:35
wasm_config.hpp
libraries
sys-vm
tests
spec
endianness_tests.cpp
Generated by
1.12.0