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

Go to the source code of this file.

Functions

 BACKEND_TEST_CASE ("Test max_pages default", "[max_pages_test]")
 
 BACKEND_TEST_CASE ("Test max_pages unlimited", "[max_pages_test]")
 
 BACKEND_TEST_CASE ("Test max_pages static fail", "[max_pages_test]")
 
 BACKEND_TEST_CASE ("Test max_pages static pass", "[max_pages_test]")
 
 BACKEND_TEST_CASE ("Test max_pages dynamic fail", "[max_pages_test]")
 
 BACKEND_TEST_CASE ("Test max_pages dynamic pass", "[max_pages_test]")
 

Variables

wasm_allocator wa
 

Function Documentation

◆ BACKEND_TEST_CASE() [1/6]

BACKEND_TEST_CASE ( "Test max_pages default" ,
"" [max_pages_test] )

Definition at line 41 of file max_pages_tests.cpp.

41 {
43 backend_t backend(mem_wasm, &wa);
44}
wasm_allocator wa
Definition main.cpp:10

◆ BACKEND_TEST_CASE() [2/6]

BACKEND_TEST_CASE ( "Test max_pages dynamic fail" ,
"" [max_pages_test] )

Definition at line 62 of file max_pages_tests.cpp.

62 {
64 CHECK_THROWS_AS(backend_t(mem_wasm, nullptr, dynamic_options{2}), wasm_parse_exception);
65}
sysio::vm::backend< rhf_t > backend_t
#define CHECK_THROWS_AS(expr, exceptionType)
Definition catch.hpp:203

◆ BACKEND_TEST_CASE() [3/6]

BACKEND_TEST_CASE ( "Test max_pages dynamic pass" ,
"" [max_pages_test] )

Definition at line 67 of file max_pages_tests.cpp.

67 {
69 backend_t backend(mem_wasm, &wa, dynamic_options{3});
70 CHECK(backend.call_with_return("env", "f")->to_i32() == -1);
71 backend.initialize(nullptr, dynamic_options{4});
72 CHECK(backend.call_with_return("env", "f")->to_i32() == 3);
73 backend.initialize(nullptr, dynamic_options{3});
74 CHECK_THROWS_AS(backend.initialize(nullptr, dynamic_options{2}), std::exception);
75}
backend & initialize(host_t *host, const Options &new_options)
Definition backend.hpp:118
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
Here is the call graph for this function:

◆ BACKEND_TEST_CASE() [4/6]

BACKEND_TEST_CASE ( "Test max_pages static fail" ,
"" [max_pages_test] )

Definition at line 51 of file max_pages_tests.cpp.

51 {
53 CHECK_THROWS_AS(backend_t(mem_wasm, &wa), wasm_parse_exception);
54}

◆ BACKEND_TEST_CASE() [5/6]

BACKEND_TEST_CASE ( "Test max_pages static pass" ,
"" [max_pages_test] )

Definition at line 56 of file max_pages_tests.cpp.

56 {
58 backend_t backend(mem_wasm, &wa);
59 CHECK(backend.call_with_return("env", "f")->to_i32() == -1);
60}
Here is the call graph for this function:

◆ BACKEND_TEST_CASE() [6/6]

BACKEND_TEST_CASE ( "Test max_pages unlimited" ,
"" [max_pages_test] )

Definition at line 46 of file max_pages_tests.cpp.

Variable Documentation

◆ wa

wasm_allocator wa
extern

Definition at line 10 of file main.cpp.