Class Output¶
Defined in File Output.hpp
Inheritance Relationships¶
Derived Types¶
public mu::tiny::test::ConsoleOutput(Class ConsoleOutput)public mu::tiny::test::StringBufferOutput(Class StringBufferOutput)
Class Documentation¶
-
class Output¶
[source] Abstract base class for all test output sinks.
Implement print_buffer() in a subclass to direct output anywhere. All higher-level printing methods (print_failure(), print_test_run(), etc.) are built on top of print_buffer(). The static function pointers (stdout_, fopen_, fputs_, fclose_) allow ConsoleOutput to redirect file I/O without a virtual dispatch.
Subclassed by mu::tiny::test::ConsoleOutput, mu::tiny::test::StringBufferOutput
Public Types
-
enum class MutinyVerbosityLevel¶
Controls how much detail is printed per test.
Values:
-
enumerator quiet¶
Only failures and the summary line.
-
enumerator verbose¶
One line per test.
-
enumerator very_verbose¶
Full per-test detail including test properties.
-
enumerator quiet¶
-
using File = void*¶
Replaceable stdout handle used by ConsoleOutput.
-
using FOpenFunc = File (*)(const char *filename, const char *flag)¶
Replaceable fopen function used by ConsoleOutput.
-
using FPutsFunc = void (*)(const char *str, File file)¶
Replaceable fputs function used by ConsoleOutput.
-
using FCloseFunc = void (*)(File file)¶
Replaceable fclose function used by ConsoleOutput.
Public Functions
-
virtual void print_tests_ended(const Result &result)¶
Called once after all tests have run.
- Parameters:
result – The final result summary.
-
virtual void print_current_test_started(const Shell &test)¶
Called before each test body begins.
- Parameters:
test – The test about to run.
-
virtual void print_current_test_ended(const Result &res)¶
Called after each test body completes.
- Parameters:
res – The result state at the end of the test.
-
virtual void print_current_group_started(const Shell &test)¶
Called when execution enters a new test group.
- Parameters:
test – A test from the group that is starting.
-
virtual void print_current_group_ended(const Result &res)¶
Called when execution leaves a test group.
- Parameters:
res – The result state at the end of the group.
-
virtual void verbose(MutinyVerbosityLevel level)¶
Set the verbosity level.
- Parameters:
level – Desired verbosity.
-
virtual void print_buffer(const char *s) = 0¶
Write
sdirectly to the underlying output medium.This is the only pure-virtual method; all other print methods call it.
- Parameters:
s – Null-terminated string to write.
-
virtual void print(int n)¶
Print a signed integer.
- Parameters:
n – Value to print.
-
virtual void print(unsigned int n)¶
Print an unsigned integer.
- Parameters:
n – Value to print.
-
virtual void print(long n)¶
Print a signed integer.
- Parameters:
n – Value to print.
-
virtual void print(double d)¶
Print a floating-point value.
- Parameters:
d – Value to print.
-
virtual void print_failure(const Failure &failure)¶
Print a test failure message.
- Parameters:
failure – The failure to describe.
-
virtual void print_test_property(const char *name, const char *value)¶
Print a test property key/value pair.
- Parameters:
name – Property name.
value – Property value.
-
virtual void print_skipped(const char *message)¶
Mark the current test as skipped.
- Parameters:
message – Human-readable reason (may be empty).
-
virtual void print_test_run(unsigned int number, unsigned int total)¶
Print the current repetition progress.
- Parameters:
number – Current repetition (1-based).
total – Total number of repetitions.
-
virtual void set_progress_indicator(const char *indicator)¶
Override the per-test progress indicator character.
- Parameters:
indicator – Null-terminated indicator string (default:
.).
-
virtual void print_very_verbose(const char *s)¶
Print a very-verbose detail line.
- Parameters:
s – Detail string to print.
-
inline virtual bool needs_console_companion() const¶
- Returns:
true if this output needs a ConsoleOutput companion for interactive output (e.g. JUnitOutputPlugin paired with a console).
Public Static Attributes
-
static FCloseFunc fclose_¶
Protected Functions
Protected Attributes
-
int dot_count_ = {0}¶
-
MutinyVerbosityLevel verbose_ = {MutinyVerbosityLevel::quiet}¶
-
bool color_ = {false}¶
-
const char *progress_indication_ = {"."}¶
-
enum class MutinyVerbosityLevel¶