anonymous{reporter.cpp} Namespace
Local helpers of the reporter base class. More...
Definition
Functions Index
| void | format_skipped (size_t count, char(&message)[fragment_size]) |
|
Formats the number of items skipped by the filter. More... | |
| constexpr const char * | plural (size_t count) noexcept |
|
Returns the plural suffix for a count. More... | |
| void | write_without_colours (FILE *file, std::string_view text) |
|
Writes a text to a file, without the ANSI colour sequences. More... | |
Variables Index
| constexpr size_t | fragment_size = 21 + (std::numeric_limits<size_t>::digits10 + 1) |
|
Size of the array that receives a fragment of the totals. More... | |
Description
Local helpers of the reporter base class.
The unnamed namespace gives the helpers internal linkage, so that they are visible only in this translation unit, and cannot conflict with the names of the application or of the other source files of the framework. They are not declared in any header.
The namespace is opened twice in this file, each time before the code that uses its helpers; Doxygen merges the two parts. The first part contains write_without_colours(), which copies the console output to the output file. The second part contains the helpers of the totals lines: fragment_size, plural(), and format_skipped().
Functions
format_skipped()
|
Formats the number of items skipped by the filter.
The text is ", <count> skipped", appended to the count of the items, or empty when no item was skipped, so that the totals lines of the runs without a filter are not longer.
- Parameters
-
count The number of skipped items.
message The character array that receives the null-terminated text.
- Returns
Nothing.
Definition at line 874 of file reporter.cpp.
References format_skipped, fragment_size and MICRO_OS_PLUS_MICRO_TEST_PLUS_PRI_SIZE.
Referenced by format_skipped.
plural()
| constexpr noexcept |
Returns the plural suffix for a count.
The totals lines are in English, where only the count 1 takes the singular form.
- Parameters
-
count The count that precedes the noun.
- Returns
"" for 1, and "s" otherwise.
Definition at line 854 of file reporter.cpp.
Reference plural.
Referenced by plural.
write_without_colours()
|
Writes a text to a file, without the ANSI colour sequences.
The text may contain ANSI colour sequences, added when the console is a terminal, which must not reach the file. They are removed while writing: each ESC [, followed by any digits and semicolons, and terminated by m, is skipped, and the text between the sequences is written unchanged. Any other use of ESC is written as is. No line ending is appended.
- Parameters
-
file The file to write to; must not be null.
text The text to write.
- Returns
Nothing.
Definition at line 113 of file reporter.cpp.
Reference write_without_colours.
Referenced by write_without_colours.
Variables
fragment_size
| constexpr |
Size of the array that receives a fragment of the totals.
Large enough for ", N test cases failed", the longest fragment (20 characters and the count), and the terminator, with the count of the largest size_t value (10 digits on 32-bit targets, 20 on 64-bit ones, as in ", 18446744073709551615 test cases failed").
Definition at line 840 of file reporter.cpp.
Referenced by format_skipped.
The documentation for this namespace was generated from the following file:
Generated via doxygen2docusaurus 2.2.8 by Doxygen 1.18.0.