src/internal/logger_test_seams.hpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #ifndef DETOURMODKIT_INTERNAL_LOGGER_TEST_SEAMS_HPP | ||
| 2 | #define DETOURMODKIT_INTERNAL_LOGGER_TEST_SEAMS_HPP | ||
| 3 | |||
| 4 | /** | ||
| 5 | * @file internal/logger_test_seams.hpp | ||
| 6 | * @brief Test-only white-box access to Logger process-default state. | ||
| 7 | * @details Non-installed friend accessor: the installed Logger definition stays token-stable while tests read the | ||
| 8 | * private snapshot through this header. This header exists only in test-seam builds. See the gate rule in | ||
| 9 | * docs/design/testing.md. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include "DetourModKit/logger.hpp" | ||
| 13 | |||
| 14 | #include <memory> | ||
| 15 | |||
| 16 | #if defined(DMK_ENABLE_TEST_SEAMS) | ||
| 17 | |||
| 18 | namespace DetourModKit::detail | ||
| 19 | { | ||
| 20 | /** | ||
| 21 | * @class LoggerTestSeams | ||
| 22 | * @brief Provides private process-default snapshot access to failure-atomicity tests. | ||
| 23 | */ | ||
| 24 | class LoggerTestSeams | ||
| 25 | { | ||
| 26 | public: | ||
| 27 | /// Returns the current process-default snapshot for failure-atomicity tests. | ||
| 28 | 25 | [[nodiscard]] static std::shared_ptr<const Logger::StaticConfig> static_config_for_test() | |
| 29 | { | ||
| 30 | 25 | return Logger::get_static_config(); | |
| 31 | } | ||
| 32 | |||
| 33 | private: | ||
| 34 | LoggerTestSeams() = delete; | ||
| 35 | }; | ||
| 36 | } // namespace DetourModKit::detail | ||
| 37 | |||
| 38 | #endif // DMK_ENABLE_TEST_SEAMS | ||
| 39 | |||
| 40 | #endif // DETOURMODKIT_INTERNAL_LOGGER_TEST_SEAMS_HPP | ||
| 41 |