<!-- 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.
| 42 | /// @return Always returns bsl::exit_success. |
| 43 | /// |
| 44 | [[nodiscard]] constexpr auto |
| 45 | tests() noexcept -> bsl::exit_code |
| 46 | { |
| 47 | helpers::init(); |
| 48 | constexpr auto func{&loader_fini}; |
| 49 | |
| 50 | bsl::ut_scenario{"success"} = [&]() noexcept { |
| 51 | bsl::ut_then{} = [&]() noexcept { |
| 52 | helpers::ut_check(loader_init()); |
| 53 | helpers::ut_check(func()); |
| 54 | }; |
| 55 | bsl::ut_cleanup{} = [&]() noexcept { |
| 56 | helpers::reset(); |
| 57 | }; |
| 58 | }; |
| 59 | |
| 60 | bsl::ut_scenario{"fini without init"} = [&]() noexcept { |
| 61 | bsl::ut_then{} = [&]() noexcept { |
| 62 | helpers::ut_check(func()); |
| 63 | }; |
| 64 | bsl::ut_cleanup{} = [&]() noexcept { |
| 65 | helpers::reset(); |
| 66 | }; |
| 67 | }; |
| 68 | |
| 69 | bsl::ut_scenario{"corrupt vmm fails"} = [&]() noexcept { |
| 70 | bsl::ut_when{} = [&]() noexcept { |
| 71 | g_mut_vmm_status = VMM_STATUS_CORRUPT; |
| 72 | bsl::ut_then{} = [&]() noexcept { |
| 73 | helpers::ut_fails(func()); |
| 74 | }; |
| 75 | bsl::ut_cleanup{} = [&]() noexcept { |
| 76 | helpers::reset(); |
| 77 | }; |
| 78 | }; |
| 79 | }; |
| 80 | |
| 81 | return helpers::fini(); |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | /// <!-- description --> |