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

Function tests

loader/tests/src/test_map_mk_elf_file.cpp:45–66  ·  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

43 /// @return Always returns bsl::exit_success.
44 ///
45 [[nodiscard]] constexpr auto
46 tests() noexcept -> bsl::exit_code
47 {
48 helpers::init();
49 constexpr auto func{&map_mk_elf_file};
50
51 bsl::ut_scenario{"success"} = [&]() noexcept {
52 bsl::ut_given{} = [&]() noexcept {
53 elf_file_t mut_file{};
54 bfelf_elf64_ehdr_t const ehdr{};
55 root_page_table_t mut_rpt{};
56 bsl::ut_when{} = [&]() noexcept {
57 mut_file.addr = &ehdr;
58 mut_file.size = sizeof(ehdr);
59 bsl::ut_then{} = [&]() noexcept {
60 helpers::ut_check(func(&mut_file, &mut_rpt));
61 };
62 bsl::ut_cleanup{} = [&]() noexcept {
63 helpers::reset();
64 };
65 };
66 };
67 };
68
69 bsl::ut_scenario{"map_4k_page fails"} = [&]() noexcept {

Callers 1

mainFunction · 0.70

Calls 3

initFunction · 0.85
ut_checkFunction · 0.85
resetFunction · 0.85

Tested by

no test coverage detected