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

Go to the source code of this file.

Macros

#define SECTION_TEST_CASE_DEFS(name)
 
#define SECTION_TEST_CASE_IMPL(name, wasm)
 
#define SECTION_TEST_CASE(name, wasm)
 

Variables

wasm_allocator wa
 

Macro Definition Documentation

◆ SECTION_TEST_CASE

#define SECTION_TEST_CASE ( name,
wasm )
Value:
SECTION_TEST_CASE_IMPL(name, wasm)
std::string name
#define SECTION_TEST_CASE_DEFS(name)

Definition at line 137 of file max_section_elements_tests.cpp.

137#define SECTION_TEST_CASE(name, wasm) \
138 SECTION_TEST_CASE_DEFS(name) \
139 SECTION_TEST_CASE_IMPL(name, wasm)

◆ SECTION_TEST_CASE_DEFS

#define SECTION_TEST_CASE_DEFS ( name)
Value:
namespace { \
struct name ## _dynamic_options { \
std::uint32_t max_ ## name ## _section_elements; \
}; \
struct name ## _static_options_1 { \
static constexpr std::uint32_t max_ ## name ## _section_elements = 1; \
}; \
struct name ## _static_options_2 { \
static constexpr std::uint32_t max_ ## name ## _section_elements = 2; \
}; \
}

Definition at line 109 of file max_section_elements_tests.cpp.

109#define SECTION_TEST_CASE_DEFS(name) \
110namespace { \
111struct name ## _dynamic_options { \
112 std::uint32_t max_ ## name ## _section_elements; \
113}; \
114struct name ## _static_options_1 { \
115 static constexpr std::uint32_t max_ ## name ## _section_elements = 1; \
116}; \
117struct name ## _static_options_2 { \
118 static constexpr std::uint32_t max_ ## name ## _section_elements = 2; \
119}; \
120}

◆ SECTION_TEST_CASE_IMPL

#define SECTION_TEST_CASE_IMPL ( name,
wasm )
Value:
BACKEND_TEST_CASE("Test max_" #name "_section_elements", "[max_section_elements_test]") { \
backend<std::nullptr_t, TestType> backend_default(wasm, &wa); \
CHECK_THROWS_AS((backend<std::nullptr_t, TestType, static_options_1>(wasm, &wa)), wasm_parse_exception); \
backend<std::nullptr_t, TestType, static_options_2> backend_static_fallback(wasm, &wa); \
CHECK_THROWS_AS((backend<std::nullptr_t, TestType, dynamic_options>(wasm, nullptr, {1})), wasm_parse_exception); \
backend<std::nullptr_t, TestType, dynamic_options> backend_dynamic_fallback(wasm, nullptr, {2}); \
\
CHECK_THROWS_AS((backend<std::nullptr_t, TestType, name ## _static_options_1>(wasm, &wa)), wasm_parse_exception); \
CHECK_THROWS_AS((backend<std::nullptr_t, TestType, name ## _dynamic_options>(wasm, nullptr, {1})), wasm_parse_exception); \
backend<std::nullptr_t, TestType, name ## _dynamic_options> backend_dynamic(wasm, nullptr, {2}); \
}
wasm_allocator wa
Definition main.cpp:10
#define BACKEND_TEST_CASE(name, tags)
Definition utils.hpp:59

Definition at line 122 of file max_section_elements_tests.cpp.

122#define SECTION_TEST_CASE_IMPL(name, wasm) \
123BACKEND_TEST_CASE("Test max_" #name "_section_elements", "[max_section_elements_test]") { \
124 backend<std::nullptr_t, TestType> backend_default(wasm, &wa); \
125 backend<std::nullptr_t, TestType, empty_options> backend_empty(wasm, &wa); \
126 CHECK_THROWS_AS((backend<std::nullptr_t, TestType, static_options_1>(wasm, &wa)), wasm_parse_exception); \
127 backend<std::nullptr_t, TestType, static_options_2> backend_static_fallback(wasm, &wa); \
128 CHECK_THROWS_AS((backend<std::nullptr_t, TestType, dynamic_options>(wasm, nullptr, {1})), wasm_parse_exception); \
129 backend<std::nullptr_t, TestType, dynamic_options> backend_dynamic_fallback(wasm, nullptr, {2}); \
130 \
131 CHECK_THROWS_AS((backend<std::nullptr_t, TestType, name ## _static_options_1>(wasm, &wa)), wasm_parse_exception); \
132 backend<std::nullptr_t, TestType, name ## _static_options_2> backend_static(wasm, &wa); \
133 CHECK_THROWS_AS((backend<std::nullptr_t, TestType, name ## _dynamic_options>(wasm, nullptr, {1})), wasm_parse_exception); \
134 backend<std::nullptr_t, TestType, name ## _dynamic_options> backend_dynamic(wasm, nullptr, {2}); \
135}

Variable Documentation

◆ wa

wasm_allocator wa
extern

Definition at line 10 of file main.cpp.