25#include "sequoia/TestFramework/TestMode.hpp"
30namespace sequoia::testing
37 std::filesystem::path recovery_file{};
38 std::filesystem::path dump_file{};
46 caught_exception_messages;
53 performance_failures{},
82 const test_results& results()
const noexcept {
return m_Results; }
84 void reset_results()
noexcept { m_Results = {}; }
92 std::string_view top_level_message()
const noexcept
94 return !m_SentinelDepth.empty() ? std::string_view{m_SentinelDepth.front().message} :
"";
100 return m_Results.exception_info;
106 : m_Recovery{std::move(recovery)}
114 explicit level_message(std::string_view m)
122 enum class is_critical{yes, no};
125 std::vector<level_message> m_SentinelDepth;
129 std::size_t depth()
const noexcept {
return m_SentinelDepth.size(); }
131 void log_check()
noexcept { ++m_Results.deep_checks; }
133 void log_top_level_check()
noexcept { ++m_Results.top_level_checks; }
135 void log_performance_check()
noexcept
138 ++m_Results.performance_checks;
141 void failure_message(test_mode mode, std::string_view message, is_critical isCritical);
143 void log_failure(test_mode mode, std::string_view message)
145 ++m_Results.failures;
149 void log_performance_failure(test_mode mode, std::string_view message)
151 ++m_Results.performance_failures;
152 log_failure(mode, message);
155 void log_critical_failure(test_mode mode, std::string_view message);
157 void log_top_level_failure(test_mode mode, std::string message);
159 void log_caught_exception_message(std::string_view message);
161 void append_to_diagnostics_output(std::string message);
163 void increment_depth(std::string_view message);
165 void decrement_depth();
167 void end_message(test_mode mode, is_critical isCritical);
170 failure_output& output_channel(test_mode mode, is_critical isCritical)
noexcept;
172 failure_output& add_to_output(failure_output& output, std::string_view message);
181 template<test_mode Mode>
185 constexpr static test_mode mode{Mode};
208 void log_performance_check() { get().log_performance_check(); }
210 void log_check() { get().log_check(); }
212 void log_failure(std::string_view message) { get().log_failure(m_Mode, message); }
214 void log_performance_failure(std::string_view message) { get().log_performance_failure(m_Mode, message); }
216 void log_critical_failure(std::string_view message) { get().log_critical_failure(m_Mode, message); }
218 void log_caught_exception_message(std::string_view message) { get().log_caught_exception_message(message); }
221 bool critical_failure_detected()
const noexcept {
return get().results().critical_failures != m_PriorCriticalFailures; }
224 bool failure_detected()
const noexcept {
return get().results().failures != m_PriorFailures; }
227 bool checks_registered()
const noexcept {
return get().results().deep_checks != m_PriorDeepChecks; }
245 std::string m_Message;
248 m_PriorCriticalFailures{},
275 template<test_mode Mode>
279 constexpr static test_mode mode{Mode};
301 using duration = std::chrono::steady_clock::duration;
307 template<test_mode Mode>
312 void clear()
noexcept;
315 std::size_t standard_top_level_checks()
const noexcept {
return m_StandardTopLevelChecks; }
318 std::size_t standard_deep_checks()
const noexcept {
return m_StandardDeepChecks; }
321 std::size_t standard_performance_checks()
const noexcept {
return m_StandardPerformanceChecks; }
324 std::size_t false_positive_checks()
const noexcept {
return m_FalsePositiveChecks; }
327 std::size_t false_positive_performance_checks()
const noexcept {
return m_FalsePositivePerformanceChecks; }
330 std::size_t false_negative_checks()
const noexcept {
return m_FalseNegativeChecks; }
333 std::size_t false_negative_performance_checks()
const noexcept {
return m_FalseNegativePerformanceChecks; }
336 std::size_t standard_deep_failures()
const noexcept {
return m_StandardDeepFailures; }
339 std::size_t standard_top_level_failures()
const noexcept {
return m_StandardTopLevelFailures; }
342 std::size_t standard_performance_failures()
const noexcept {
return m_StandardPerformanceFailures; }
345 std::size_t false_positive_failures()
const noexcept {
return m_FalsePositiveFailures; }
348 std::size_t false_positive_performance_failures()
const noexcept {
return m_FalsePositivePerformanceFailures; }
351 std::size_t false_negative_failures()
const noexcept {
return m_FalseNegativeFailures; }
354 std::size_t false_negative_performance_failures()
const noexcept {
return m_FalseNegativePerformanceFailures; }
357 std::size_t critical_failures()
const noexcept {
return m_CriticalFailures; }
360 std::size_t soft_failures()
const noexcept;
363 const std::string& diagnostics_output()
const noexcept {
return m_DiagnosticsOutput; }
365 void diagnostics_output(std::string output)
367 m_DiagnosticsOutput = std::move(output);
371 const std::string& caught_exceptions_output()
const noexcept {
return m_CaughtExceptionMessages; }
374 duration execution_time()
const noexcept {
return m_Duration; }
376 void execution_time(
const duration delta) { m_Duration = delta; }
381 const std::string& name()
const noexcept {
return m_Name; }
384 const std::string& failure_messages()
const noexcept {
return m_FailureMessages; }
392 m_CaughtExceptionMessages;
395 m_StandardTopLevelChecks{},
396 m_StandardDeepChecks{},
397 m_StandardPerformanceChecks{},
398 m_FalsePositiveChecks{},
399 m_FalseNegativeChecks{},
400 m_FalsePositivePerformanceChecks{},
401 m_FalseNegativePerformanceChecks{},
402 m_StandardTopLevelFailures{},
403 m_StandardDeepFailures{},
404 m_StandardPerformanceFailures{},
405 m_FalsePositiveFailures{},
406 m_FalseNegativeFailures{},
407 m_FalsePositivePerformanceFailures{},
408 m_FalseNegativePerformanceFailures{},
409 m_CriticalFailures{};
411 int m_ExceptionsInFlight{};
413 duration m_Duration{};
Utilities for recording information from test failures.
A collection of functions for formatting test output.
std::string failure_message(is_final_message_t, T, T)
To prevent implicit conversions to bool.
Definition: Output.hpp:146
Traits which are sufficiently general to appear in the sequoia namespace.
Summaries data generated by the logger, for the purposes of reporting.
Definition: TestLogger.hpp:299
Definition: TestLogger.hpp:203
Definition: TestLogger.hpp:277
Definition: TestLogger.hpp:75
Definition: TestLogger.hpp:183
Holds paths to files where recovery information will be written if the path is not empty.
Definition: TestLogger.hpp:36
Definition: TestLogger.hpp:42
Definition: CoreInfrastructure.hpp:99