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

Function tests

loader/tests/src/test_dump_vmm.cpp:46–87  ·  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

44 /// @return Always returns bsl::exit_success.
45 ///
46 [[nodiscard]] constexpr auto
47 tests() noexcept -> bsl::exit_code
48 {
49 helpers::init();
50 constexpr auto func{&dump_vmm};
51
52 bsl::ut_scenario{"success"} = [&]() noexcept {
53 bsl::ut_given{} = [&]() noexcept {
54 dump_vmm_args_t mut_args{};
55 bsl::ut_when{} = [&]() noexcept {
56 helpers::ut_check(loader_init());
57 mut_args.ver = bsl::safe_u64::magic_1().get();
58 bsl::ut_then{} = [&]() noexcept {
59 helpers::ut_check(func(&mut_args));
60 };
61 bsl::ut_cleanup{} = [&]() noexcept {
62 helpers::ut_check(loader_fini());
63 helpers::reset();
64 };
65 };
66 };
67 };
68
69 bsl::ut_scenario{"invalid version"} = [&]() noexcept {
70 bsl::ut_given{} = [&]() noexcept {
71 dump_vmm_args_t mut_args{};
72 bsl::ut_when{} = [&]() noexcept {
73 helpers::ut_check(loader_init());
74 mut_args.ver = bsl::safe_u64::magic_0().get();
75 bsl::ut_then{} = [&]() noexcept {
76 helpers::ut_fails(func(&mut_args));
77 };
78 bsl::ut_cleanup{} = [&]() noexcept {
79 helpers::ut_check(loader_fini());
80 helpers::reset();
81 };
82 };
83 };
84 };
85
86 return helpers::fini();
87 }
88}
89
90/// <!-- description -->

Callers 15

mainFunction · 0.70
mainFunction · 0.70
mainFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50

Calls 7

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

Tested by

no test coverage detected