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

Function tests

loader/tests/src/test_dump_mk_elf_segments.cpp:47–72  ·  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

45 /// @return Always returns bsl::exit_success.
46 ///
47 [[nodiscard]] constexpr auto
48 tests() noexcept -> bsl::exit_code
49 {
50 helpers::init();
51 constexpr auto func{&dump_mk_elf_segments};
52
53 bsl::ut_scenario{"success"} = [&]() noexcept {
54 bsl::ut_given{} = [&]() noexcept {
55 bsl::array<elf_segment_t, HYPERVISOR_MAX_SEGMENTS> mut_segments{};
56 constexpr auto segment_size{0x2042_umx};
57 bsl::array<bsl::uint8, segment_size.get()> mut_segment{};
58 bsl::ut_when{} = [&]() noexcept {
59 mut_segments.front().addr = mut_segment.data();
60 mut_segments.front().size = mut_segment.size().get();
61 bsl::ut_then{} = [&]() noexcept {
62 func(mut_segments.data());
63 };
64 bsl::ut_cleanup{} = [&]() noexcept {
65 helpers::reset();
66 };
67 };
68 };
69 };
70
71 return helpers::fini();
72 }
73}
74
75/// <!-- description -->

Callers 1

mainFunction · 0.70

Calls 5

initFunction · 0.85
resetFunction · 0.85
finiFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected