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

Function tests

loader/tests/src/x64/test_send_command_stop.cpp:43–89  ·  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

41 /// @return Always returns bsl::exit_success.
42 ///
43 [[nodiscard]] constexpr auto
44 tests() noexcept -> bsl::exit_code
45 {
46 helpers::init_x64();
47 constexpr auto func{&send_command_stop};
48
49 bsl::ut_scenario{"success"} = [&]() noexcept {
50 bsl::ut_given{} = [&]() noexcept {
51 bsl::ut_then{} = [&]() noexcept {
52 helpers::ut_check(func());
53 };
54 bsl::ut_cleanup{} = [&]() noexcept {
55 helpers::reset_x64();
56 };
57 };
58 };
59
60 bsl::ut_scenario{"stop failed"} = [&]() noexcept {
61 bsl::ut_given{} = [&]() noexcept {
62 bsl::ut_when{} = [&]() noexcept {
63 helpers::g_mut_intrinsic_cpuid = 1;
64 bsl::ut_then{} = [&]() noexcept {
65 helpers::ut_fails(func());
66 };
67 bsl::ut_cleanup{} = [&]() noexcept {
68 helpers::reset_x64();
69 };
70 };
71 };
72 };
73
74 bsl::ut_scenario{"stop was corrupt"} = [&]() noexcept {
75 bsl::ut_given{} = [&]() noexcept {
76 bsl::ut_when{} = [&]() noexcept {
77 helpers::g_mut_intrinsic_cpuid = -1;
78 bsl::ut_then{} = [&]() noexcept {
79 helpers::ut_fails(func());
80 };
81 bsl::ut_cleanup{} = [&]() noexcept {
82 helpers::reset_x64();
83 };
84 };
85 };
86 };
87
88 return helpers::fini();
89 }
90}
91
92/// <!-- description -->

Callers 1

mainFunction · 0.70

Calls 5

init_x64Function · 0.85
ut_checkFunction · 0.85
reset_x64Function · 0.85
ut_failsFunction · 0.85
finiFunction · 0.85

Tested by

no test coverage detected