MCPcopy Create free account
hub / github.com/Bareflank/hypervisor / tests

Function tests

loader/tests/src/x64/test_map_mk_code_aliases.cpp:52–73  ·  view source on GitHub ↗

<!-- description --> @brief Used to execute the actual checks. We put the checks in this function so that we can validate the tests both at compile-time and at run-time. If a bsl::ut_check fails, the tests will either fail fast at run-time, or will produce a compile-time error. <!-- inputs/outputs --> @return Always returns bsl::exit_success.

Source from the content-addressed store, hash-verified

50 /// @return Always returns bsl::exit_success.
51 ///
52 [[nodiscard]] constexpr auto
53 tests() noexcept -> bsl::exit_code
54 {
55 helpers::init_x64();
56 constexpr auto func{&map_mk_code_aliases};
57
58 bsl::ut_scenario{"success"} = [&]() noexcept {
59 bsl::ut_given{} = [&]() noexcept {
60 root_page_table_t *pmut_mut_rpt{};
61 code_aliases_t mut_a{};
62 bsl::ut_when{} = [&]() noexcept {
63 helpers::ut_check(alloc_mk_root_page_table(&pmut_mut_rpt));
64 helpers::ut_check(alloc_and_copy_mk_code_aliases(&mut_a));
65 bsl::ut_then{} = [&]() noexcept {
66 helpers::ut_check(func(&mut_a, pmut_mut_rpt));
67 };
68 bsl::ut_cleanup{} = [&]() noexcept {
69 free_mk_code_aliases(&mut_a);
70 free_mk_root_page_table(&pmut_mut_rpt);
71 helpers::reset_x64();
72 };
73 };
74 };
75 };
76

Callers 1

mainFunction · 0.70

Calls 7

init_x64Function · 0.85
ut_checkFunction · 0.85
reset_x64Function · 0.85
alloc_mk_root_page_tableFunction · 0.50
free_mk_code_aliasesFunction · 0.50
free_mk_root_page_tableFunction · 0.50

Tested by

no test coverage detected