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

Function tests

loader/tests/src/test_dump_ext_elf_files.cpp:46–70  ·  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_ext_elf_files};
51
52 bsl::ut_scenario{"success"} = [&]() noexcept {
53 bsl::ut_given{} = [&]() noexcept {
54 bsl::array<elf_file_t, HYPERVISOR_MAX_EXTENSIONS> mut_files{};
55 bfelf_elf64_ehdr_t const ehdr{};
56 bsl::ut_when{} = [&]() noexcept {
57 mut_files.front().addr = &ehdr;
58 mut_files.front().size = sizeof(bfelf_elf64_ehdr_t);
59 bsl::ut_then{} = [&]() noexcept {
60 func(mut_files.data());
61 };
62 bsl::ut_cleanup{} = [&]() noexcept {
63 helpers::reset();
64 };
65 };
66 };
67 };
68
69 return helpers::fini();
70 }
71}
72
73/// <!-- description -->

Callers 1

mainFunction · 0.70

Calls 4

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

Tested by

no test coverage detected