<!-- 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_init}; |
| 49 | |
| 50 | bsl::ut_scenario{"success"} = [&]() noexcept { |
| 51 | bsl::ut_then{} = [&]() noexcept { |
| 52 | helpers::ut_check(func()); |
| 53 | }; |
| 54 | bsl::ut_cleanup{} = [&]() noexcept { |
| 55 | helpers::ut_check(loader_fini()); |
| 56 | helpers::reset(); |
| 57 | }; |
| 58 | }; |
| 59 | |
| 60 | bsl::ut_scenario{"alloc_mk_debug_ring fails"} = [&]() noexcept { |
| 61 | bsl::ut_when{} = [&]() noexcept { |
| 62 | helpers::g_mut_platform_alloc = 1; |
| 63 | bsl::ut_then{} = [&]() noexcept { |
| 64 | helpers::ut_fails(func()); |
| 65 | }; |
| 66 | bsl::ut_cleanup{} = [&]() noexcept { |
| 67 | helpers::reset(); |
| 68 | }; |
| 69 | }; |
| 70 | }; |
| 71 | |
| 72 | bsl::ut_scenario{"alloc_and_copy_mk_code_aliases fails"} = [&]() noexcept { |
| 73 | bsl::ut_when{} = [&]() noexcept { |
| 74 | helpers::g_mut_alloc_and_copy_mk_code_aliases = 1; |
| 75 | bsl::ut_then{} = [&]() noexcept { |
| 76 | helpers::ut_fails(func()); |
| 77 | }; |
| 78 | bsl::ut_cleanup{} = [&]() noexcept { |
| 79 | helpers::reset(); |
| 80 | }; |
| 81 | }; |
| 82 | }; |
| 83 | |
| 84 | bsl::ut_scenario{"corrupt vmm fails"} = [&]() noexcept { |
| 85 | bsl::ut_when{} = [&]() noexcept { |
| 86 | g_mut_vmm_status = VMM_STATUS_CORRUPT; |
| 87 | bsl::ut_then{} = [&]() noexcept { |
| 88 | helpers::ut_fails(func()); |
| 89 | }; |
| 90 | bsl::ut_cleanup{} = [&]() noexcept { |
| 91 | helpers::reset(); |
| 92 | }; |
| 93 | }; |
| 94 | }; |
| 95 | |
| 96 | return helpers::fini(); |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | /// <!-- description --> |