Class Result¶
Defined in File Result.hpp
Class Documentation¶
-
class Result¶
[source] Collects test run statistics and delegates output to an Output sink.
A single Result is created per test run and passed through the Registry and Shell to accumulate counts of tests run, checks made, failures encountered, and execution time.
Public Functions
-
Result(Output &output)¶
Construct a Result that writes through
output.- Parameters:
output – The output sink to use for printing.
-
virtual void current_group_started(Shell *test)¶
Signal that a new test group is starting.
- Parameters:
test – A test from the group.
-
virtual void current_group_ended(Shell *test)¶
Signal that the current test group has finished.
- Parameters:
test – A test from the group.
-
virtual void current_test_started(Shell *test)¶
Signal that an individual test is starting.
- Parameters:
test – The test about to run.
-
virtual void current_test_ended(Shell *test)¶
Signal that an individual test has finished.
- Parameters:
test – The test that just ran.
-
virtual void skip_test(const char *message)¶
Mark the current test as skipped with an optional message.
- Parameters:
message – Human-readable reason (may be empty).
-
virtual void add_failure(const Failure &failure)¶
Record a test failure and increment the failure counter.
- Parameters:
failure – The failure to record.
-
virtual void add_test_property(const char *name, const char *value)¶
Record a test property key/value pair.
- Parameters:
name – Property name.
value – Property value.
-
virtual void print(const char *text)¶
Print
textto the output sink.- Parameters:
text – Null-terminated string to print.
-
virtual void print_very_verbose(const char *text)¶
Print a very-verbose detail line.
- Parameters:
text – Null-terminated string to print.
-
inline unsigned int get_test_count() const¶
- Returns:
Total number of registered tests.
-
inline unsigned int get_run_count() const¶
- Returns:
Number of tests that actually ran.
-
inline unsigned int get_check_count() const¶
- Returns:
Number of assertions checked.
-
inline unsigned int get_filtered_out_count() const¶
- Returns:
Number of tests filtered out.
-
inline unsigned int get_skipped_count() const¶
- Returns:
Number of ignored tests.
-
inline unsigned int get_failure_count() const¶
- Returns:
Number of test failures.
-
inline bool is_failure() const¶
- Returns:
true if there were any failures, or if no tests ran and none were ignored.
-
uint_least64_t get_total_execution_time() const¶
- Returns:
Total elapsed time (ms) for the entire run.
-
void set_total_execution_time(uint_least64_t ex_time)¶
Set the total elapsed time for the run.
- Parameters:
ex_time – Elapsed milliseconds.
-
uint_least64_t get_current_test_total_execution_time() const¶
- Returns:
Elapsed time (ms) for the most recent test.
-
uint_least64_t get_current_group_total_execution_time() const¶
- Returns:
Elapsed time (ms) for the most recent test group.
-
Result(Output &output)¶