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

Function tests

loader/tests/src/test_loader_fini.cpp:44–82  ·  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

42 /// @return Always returns bsl::exit_success.
43 ///
44 [[nodiscard]] constexpr auto
45 tests() noexcept -> bsl::exit_code
46 {
47 helpers::init();
48 constexpr auto func{&loader_fini};
49
50 bsl::ut_scenario{"success"} = [&]() noexcept {
51 bsl::ut_then{} = [&]() noexcept {
52 helpers::ut_check(loader_init());
53 helpers::ut_check(func());
54 };
55 bsl::ut_cleanup{} = [&]() noexcept {
56 helpers::reset();
57 };
58 };
59
60 bsl::ut_scenario{"fini without init"} = [&]() noexcept {
61 bsl::ut_then{} = [&]() noexcept {
62 helpers::ut_check(func());
63 };
64 bsl::ut_cleanup{} = [&]() noexcept {
65 helpers::reset();
66 };
67 };
68
69 bsl::ut_scenario{"corrupt vmm fails"} = [&]() noexcept {
70 bsl::ut_when{} = [&]() noexcept {
71 g_mut_vmm_status = VMM_STATUS_CORRUPT;
72 bsl::ut_then{} = [&]() noexcept {
73 helpers::ut_fails(func());
74 };
75 bsl::ut_cleanup{} = [&]() noexcept {
76 helpers::reset();
77 };
78 };
79 };
80
81 return helpers::fini();
82 }
83}
84
85/// <!-- description -->

Callers 1

mainFunction · 0.70

Calls 6

initFunction · 0.85
ut_checkFunction · 0.85
loader_initFunction · 0.85
resetFunction · 0.85
ut_failsFunction · 0.85
finiFunction · 0.85

Tested by

no test coverage detected