37 int list_tests(
const std::vector<std::string>& tests)
override {
38 for (
auto name : tests)
39 os_ << name << std::endl;
40 return unit_test::list_tests(tests);
43 bool parse_arguments(
const std::vector<std::string>& args)
override {
45 if (arg ==
"--help") {
49 return unit_test::parse_arguments(args);
53 os_ <<
"This program contains tests written using xtd::tunit. You can use the" << std::endl;
54 os_ <<
"following command line flags to control its behavior:" << std::endl;
56 os_ <<
"Test selection:" << std::endl;
57 os_ << __foreground_color(__console_color::green);
58 os_ <<
" --list_tests" << std::endl;
59 os_ << __reset_color();
60 os_ <<
" List the names of all tests instead of running them." << std::endl;
61 os_ << __foreground_color(__console_color::green);
62 os_ <<
" --filter_tests=";
63 os_ << __reset_color();
64 os_ << __foreground_color(__console_color::yellow);
65 os_ <<
"[PATTERN]" << std::endl;
66 os_ << __reset_color();
67 os_ <<
" Run only the tests whose name matches one of the pattern." << std::endl;
68 os_ <<
" '?' matches any single character; '*' matches any substring." << std::endl;
69 os_ << __foreground_color(__console_color::green);
70 os_ <<
" --also_run_ignored_tests" << std::endl;
71 os_ << __reset_color();
72 os_ <<
" Run all ignored tests too." << std::endl;
74 os_ <<
"Test execution:" << std::endl;
75 os_ << __foreground_color(__console_color::green);
76 os_ <<
" --repeat_tests=";
77 os_ << __reset_color();
78 os_ << __foreground_color(__console_color::yellow);
79 os_ <<
"[COUNT]" << std::endl;
80 os_ << __reset_color();
81 os_ <<
" Run the tests repeatedly; use a negative count to repeat forever." << std::endl;
82 os_ << __foreground_color(__console_color::green);
83 os_ <<
" --shuffle_tests" << std::endl;
84 os_ << __reset_color();
85 os_ <<
" Randomize tests' orders on every iteration." << std::endl;
86 os_ << __foreground_color(__console_color::green);
87 os_ <<
" --random_seed=";
88 os_ << __reset_color();
89 os_ << __foreground_color(__console_color::yellow);
90 os_ <<
"[NUMBER]" << std::endl;
91 os_ << __reset_color();
92 os_ <<
" Random number seed to use for shuffling test order. (any number" << std::endl;
93 os_ <<
" or 0 to use a seed based on the current time)." << std::endl;
95 os_ <<
"Test output:" << std::endl;
96 os_ << __foreground_color(__console_color::green);
97 os_ <<
" --output_color=";
98 os_ << __reset_color();
99 os_ << __foreground_color(__console_color::yellow);
100 os_ <<
"(true|false)" << std::endl;
101 os_ << __reset_color();
102 os_ <<
" Enable/disable colored output." << std::endl;
103 os_ << __foreground_color(__console_color::green);
104 os_ <<
" --show_duration=";
105 os_ << __reset_color();
106 os_ << __foreground_color(__console_color::yellow);
107 os_ <<
"(true|false)" << std::endl;
108 os_ << __reset_color();
109 os_ <<
" Enable/disable the elapsed time of each test display." << std::endl;
110 os_ << __foreground_color(__console_color::green);
111 os_ <<
" --output_xml=xml";
112 os_ << __reset_color();
113 os_ << __foreground_color(__console_color::yellow);
114 os_ <<
"[=PATH]" << std::endl;
115 os_ << __reset_color();
116 os_ <<
" Generate an xml report in the given directory or with the given file" << std::endl;
117 os_ <<
" name. PATH defaults to tests.xml." << std::endl;
The ostream_unit_test class is a specialisation of event_listener class for writing events in std::os...
Definition ostream_event_listener.h:24
The ostream_unit_test class is ostream unit test interface.
Definition ostream_unit_test.h:20
ostream_unit_test(std::ostream &os) noexcept
Create a new console unit test with ostream specified.
Definition ostream_unit_test.h:24
ostream_unit_test(std::ostream &os, int argc, char *argv[])
Create a new console unit test with ostream specified, argv specified and argc specified.
Definition ostream_unit_test.h:30
std::ostream & ostream()
Gets the ostream used by this instance.
Definition ostream_unit_test.h:35
The template class.
Definition unit_test.h:32
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition system_report.h:17
Contains xtd::tunit::ostream_event_listener class.
Contains xtd::tunit::unit_test class.