Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
reentry_tests.cpp File Reference
#include <sysio/vm/backend.hpp>
#include <catch2/catch.hpp>
#include "utils.hpp"
Include dependency graph for reentry_tests.cpp:

Go to the source code of this file.

Functions

 BACKEND_TEST_CASE ("test reentry", "[reentry]")
 

Function Documentation

◆ BACKEND_TEST_CASE()

BACKEND_TEST_CASE ( "test reentry" ,
"" [reentry] )

Definition at line 49 of file reentry_tests.cpp.

49 {
50 struct test_runner;
53 struct test_runner {
55 uint32_t test_func_0(uint32_t val) {
56 return bkend->call_with_return(*this, "env", "bar", val)->to_ui32() + 50;
57 }
58 uint32_t test_func_1(uint32_t val) {
59 return bkend->call_with_return(*this, "env", "testbar", val)->to_ui32() + 50;
60 }
61 };
62
64 rhf_t::template add<&test_runner::test_func_0>("env", "test_func_0");
65 rhf_t::template add<&test_runner::test_func_1>("env", "test_func_1");
66
67 test_runner tr;
68 backend_t bkend(reentry_wasm, tr, &wa);
69
70 tr.bkend = &bkend;
71
72 CHECK(bkend.call_with_return(tr, "env", "foo", (uint32_t)10)->to_ui32() == 52);
73 CHECK(bkend.call_with_return(tr, "env", "testbar", (uint32_t)10)->to_ui32() == 110);
74 CHECK(bkend.call_with_return(tr, "env", "testbaz", (uint32_t)10)->to_ui32() == 160);
75}
wasm_allocator wa
Definition main.cpp:10
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)
int add(int a, int b)
unsigned int uint32_t
Definition stdint.h:126
Here is the call graph for this function: