Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
unreachable_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 unreachable_tests.cpp:

Go to the source code of this file.

Functions

 BACKEND_TEST_CASE ("Testing wasm <unreachable_0_wasm>", "[unreachable_0_wasm_tests]")
 

Variables

wasm_allocator wa
 

Function Documentation

◆ BACKEND_TEST_CASE()

BACKEND_TEST_CASE ( "Testing wasm <unreachable_0_wasm>" ,
"" [unreachable_0_wasm_tests] )

Definition at line 18 of file unreachable_tests.cpp.

18 {
20 auto code = read_wasm( std::string(wasm_directory) + "unreachable.0.wasm");
21 backend_t bkend( code, &wa );
22
23 CHECK_THROWS_AS(bkend("env", "type-i32"), std::exception);
24 CHECK_THROWS_AS(bkend("env", "type-i64"), std::exception);
25 CHECK_THROWS_AS(bkend("env", "type-f32"), std::exception);
26 CHECK_THROWS_AS(bkend("env", "type-f64"), std::exception);
27 CHECK_THROWS_AS(bkend("env", "as-func-first"), std::exception);
28 CHECK_THROWS_AS(bkend("env", "as-func-mid"), std::exception);
29 CHECK_THROWS_AS(bkend("env", "as-func-last"), std::exception);
30 CHECK_THROWS_AS(bkend("env", "as-func-value"), std::exception);
31 CHECK_THROWS_AS(bkend("env", "as-block-first"), std::exception);
32 CHECK_THROWS_AS(bkend("env", "as-block-mid"), std::exception);
33 CHECK_THROWS_AS(bkend("env", "as-block-last"), std::exception);
34 CHECK_THROWS_AS(bkend("env", "as-block-value"), std::exception);
35 CHECK(bkend.call_with_return("env", "as-block-broke")->to_ui32() == UINT32_C(1));
36 CHECK_THROWS_AS(bkend("env", "as-loop-first"), std::exception);
37 CHECK_THROWS_AS(bkend("env", "as-loop-mid"), std::exception);
38 CHECK_THROWS_AS(bkend("env", "as-loop-last"), std::exception);
39 CHECK(bkend.call_with_return("env", "as-loop-broke")->to_ui32() == UINT32_C(1));
40 CHECK_THROWS_AS(bkend("env", "as-br-value"), std::exception);
41 CHECK_THROWS_AS(bkend("env", "as-br_if-cond"), std::exception);
42 CHECK_THROWS_AS(bkend("env", "as-br_if-value"), std::exception);
43 CHECK_THROWS_AS(bkend("env", "as-br_if-value-cond"), std::exception);
44 CHECK_THROWS_AS(bkend("env", "as-br_table-index"), std::exception);
45 CHECK_THROWS_AS(bkend("env", "as-br_table-value"), std::exception);
46 CHECK_THROWS_AS(bkend("env", "as-br_table-value-2"), std::exception);
47 CHECK_THROWS_AS(bkend("env", "as-br_table-value-index"), std::exception);
48 CHECK_THROWS_AS(bkend("env", "as-br_table-value-and-index"), std::exception);
49 CHECK_THROWS_AS(bkend("env", "as-return-value"), std::exception);
50 CHECK_THROWS_AS(bkend("env", "as-if-cond"), std::exception);
51 CHECK_THROWS_AS(bkend("env", "as-if-then", UINT32_C(1), UINT32_C(6)), std::exception);
52 CHECK(bkend.call_with_return("env", "as-if-then", UINT32_C(0), UINT32_C(6))->to_ui32() == UINT32_C(6));
53 CHECK_THROWS_AS(bkend("env", "as-if-else", UINT32_C(0), UINT32_C(6)), std::exception);
54 CHECK(bkend.call_with_return("env", "as-if-else", UINT32_C(1), UINT32_C(6))->to_ui32() == UINT32_C(6));
55 CHECK_THROWS_AS(bkend("env", "as-select-first", UINT32_C(0), UINT32_C(6)), std::exception);
56 CHECK_THROWS_AS(bkend("env", "as-select-first", UINT32_C(1), UINT32_C(6)), std::exception);
57 CHECK_THROWS_AS(bkend("env", "as-select-second", UINT32_C(0), UINT32_C(6)), std::exception);
58 CHECK_THROWS_AS(bkend("env", "as-select-second", UINT32_C(1), UINT32_C(6)), std::exception);
59 CHECK_THROWS_AS(bkend("env", "as-select-cond"), std::exception);
60 CHECK_THROWS_AS(bkend("env", "as-call-first"), std::exception);
61 CHECK_THROWS_AS(bkend("env", "as-call-mid"), std::exception);
62 CHECK_THROWS_AS(bkend("env", "as-call-last"), std::exception);
63 CHECK_THROWS_AS(bkend("env", "as-call_indirect-func"), std::exception);
64 CHECK_THROWS_AS(bkend("env", "as-call_indirect-first"), std::exception);
65 CHECK_THROWS_AS(bkend("env", "as-call_indirect-mid"), std::exception);
66 CHECK_THROWS_AS(bkend("env", "as-call_indirect-last"), std::exception);
67 CHECK_THROWS_AS(bkend("env", "as-local.set-value"), std::exception);
68 CHECK_THROWS_AS(bkend("env", "as-local.tee-value"), std::exception);
69 CHECK_THROWS_AS(bkend("env", "as-global.set-value"), std::exception);
70 CHECK_THROWS_AS(bkend("env", "as-load-address"), std::exception);
71 CHECK_THROWS_AS(bkend("env", "as-loadN-address"), std::exception);
72 CHECK_THROWS_AS(bkend("env", "as-store-address"), std::exception);
73 CHECK_THROWS_AS(bkend("env", "as-store-value"), std::exception);
74 CHECK_THROWS_AS(bkend("env", "as-storeN-address"), std::exception);
75 CHECK_THROWS_AS(bkend("env", "as-storeN-value"), std::exception);
76 CHECK_THROWS_AS(bkend("env", "as-unary-operand"), std::exception);
77 CHECK_THROWS_AS(bkend("env", "as-binary-left"), std::exception);
78 CHECK_THROWS_AS(bkend("env", "as-binary-right"), std::exception);
79 CHECK_THROWS_AS(bkend("env", "as-test-operand"), std::exception);
80 CHECK_THROWS_AS(bkend("env", "as-compare-left"), std::exception);
81 CHECK_THROWS_AS(bkend("env", "as-compare-right"), std::exception);
82 CHECK_THROWS_AS(bkend("env", "as-convert-operand"), std::exception);
83 CHECK_THROWS_AS(bkend("env", "as-memory.grow-size"), std::exception);
84}
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)
#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
wasm_allocator wa
Definition main.cpp:10
Here is the call graph for this function:

Variable Documentation

◆ wa

wasm_allocator wa
extern

Definition at line 10 of file main.cpp.