51 const std::string&
filter_tests() const noexcept {
return this->filter_tests_;}
60 bool is_match_test_name(
const std::string& test_class_name,
const std::string& test_name)
const noexcept {
return this->pattern_compare(test_class_name +
"." + test_name, this->filter_tests_);}
64 bool list_tests() const noexcept {
return this->list_tests_;}
80 bool output_xml() const noexcept {
return this->output_xml_;}
134 std::chrono::time_point<std::chrono::system_clock>
end_time() const noexcept {
return this->end_time_;}
138 std::chrono::time_point<std::chrono::system_clock>
start_time() const noexcept {
return this->start_time_;}
143 bool pattern_compare(
const std::string& name,
const std::string& pattern)
const noexcept {
144 if (pattern ==
"")
return name ==
"";
145 if (name ==
"")
return false;
146 if (pattern ==
"*" || pattern ==
"*.*")
return true;
147 if (pattern[0] ==
'*')
return this->pattern_compare(name, pattern.substr(1)) || this->pattern_compare(name.substr(1), pattern);
148 return ((pattern[0] ==
'?') || (name[0] == pattern[0])) && this->pattern_compare(name.substr(1), pattern.substr(1));
151 void end_time(
const std::chrono::time_point<std::chrono::system_clock>&
end_time) noexcept {this->start_time_ =
end_time;}
154 bool also_run_ignored_tests_ =
false;
155 std::string filter_tests_ =
"*.*";
156 int exit_status_ = EXIT_SUCCESS;
157 bool list_tests_ =
false;
158 bool output_color_ =
true;
160 std::string output_xml_path_ =
"tests.xml";
161 bool show_duration_ =
true;
162 bool shuffle_tests_ =
false;
163 int random_seed_ = 0;
164 int repeat_tests_ = 1;
165 std::chrono::time_point<std::chrono::system_clock> start_time_;
166 std::chrono::time_point<std::chrono::system_clock> end_time_;
bool is_match_test_name(const std::string &test_class_name, const std::string &test_name) const noexcept
Return true if a specified test class name and specified test name match with the current filter test...
Definition: settings.h:60
int repeaat_test() const noexcept
Gets repeat tests count.
Definition: settings.h:117
static tunit::settings & default_settings() noexcept
Get default settings intance.
Definition: settings.h:23
settings()=default
Creates new instance of settings.
int exit_status() const noexcept
Gets exit status.
Definition: settings.h:40
std::chrono::time_point< std::chrono::system_clock > end_time() const noexcept
Gets unit test end time.
Definition: settings.h:134
void shuffle_test(bool shuffle_test) noexcept
Sets shuffle tests.
Definition: settings.h:102
The template class.
Definition: unit_test.h:23
void show_duration(bool show_duration) noexcept
Sets if show duration for each test.
Definition: settings.h:130
bool output_color() const noexcept
Gets output color.
Definition: settings.h:72
void repeat_tests(int repeat_tests) noexcept
Sets repeat tests count.
Definition: settings.h:122
std::chrono::time_point< std::chrono::system_clock > start_time() const noexcept
Gets unit test start time.
Definition: settings.h:138
bool also_run_ignored_tests() const noexcept
Gets also run ignored test.
Definition: settings.h:30
void output_xml_path(const std::string &output_xml_path) noexcept
Sets output xml path.
Definition: settings.h:92
void list_tests(bool list_tests) noexcept
Sets list tests.
Definition: settings.h:68
void output_color(bool output_color) noexcept
Sets output color.
Definition: settings.h:76
void output_xml(bool output_xml) noexcept
Sets output xml.
Definition: settings.h:84
bool output_xml() const noexcept
Gets output xml.
Definition: settings.h:80
The tunit namespace contains a unit test library.
Definition: abort_error.h:8
void also_run_ignored_tests(bool also_run_ignored_tests) noexcept
Sets also run ignored test.
Definition: settings.h:34
bool show_duration() const noexcept
Gets if show duration for each test.
Definition: settings.h:126
void exit_status(int exit_status) noexcept
Sets exit status.
Definition: settings.h:46
bool shuffle_test() const noexcept
Gets shuffle tests.
Definition: settings.h:97
std::string output_xml_path() const noexcept
Gets output xml path.
Definition: settings.h:88
The settings class contains tunit settings.
Definition: settings.h:11
void filter_tests(const std::string &filter_tests) noexcept
Sets filter tests.
Definition: settings.h:56
const std::string & filter_tests() const noexcept
Gets filter tests.
Definition: settings.h:51
int random_seed() const noexcept
Gets random seed value.
Definition: settings.h:107
void random_seed(int random_seed) noexcept
Sets random seed value.
Definition: settings.h:112
bool list_tests() const noexcept
Gets list tests.
Definition: settings.h:64