5 #include "../tunit_export.h"
36 bool also_run_ignored_tests() const noexcept {
return also_run_ignored_tests_;}
57 const std::string&
filter_tests() const noexcept {
return filter_tests_;}
66 bool is_match_test_name(
const std::string& test_class_name,
const std::string& test_name)
const noexcept {
return pattern_compare(test_class_name +
"." + test_name, filter_tests_);}
140 std::chrono::time_point<std::chrono::system_clock>
end_time() const noexcept {
return end_time_;}
144 std::chrono::time_point<std::chrono::system_clock>
start_time() const noexcept {
return start_time_;}
149 bool pattern_compare(
const std::string& name,
const std::string& pattern)
const noexcept {
150 if (pattern ==
"")
return name ==
"";
151 if (name ==
"")
return false;
152 if (pattern ==
"*" || pattern ==
"*.*")
return true;
153 if (pattern[0] ==
'*')
return pattern_compare(name, pattern.substr(1)) || pattern_compare(name.substr(1), pattern);
154 return ((pattern[0] ==
'?') || (name[0] == pattern[0])) && pattern_compare(name.substr(1), pattern.substr(1));
157 void end_time(
const std::chrono::time_point<std::chrono::system_clock>& end_time) noexcept {start_time_ = end_time;}
158 void start_time(
const std::chrono::time_point<std::chrono::system_clock>& start_time) noexcept {start_time_ = start_time;}
160 bool also_run_ignored_tests_ =
false;
161 std::string filter_tests_ =
"*.*";
162 int exit_status_ = EXIT_SUCCESS;
163 bool list_tests_ =
false;
164 bool output_color_ =
true;
166 std::string output_xml_path_ =
"tests.xml";
167 bool show_duration_ =
true;
168 bool shuffle_tests_ =
false;
169 int random_seed_ = 0;
170 int repeat_tests_ = 1;
171 std::chrono::time_point<std::chrono::system_clock> start_time_;
172 std::chrono::time_point<std::chrono::system_clock> end_time_;
The settings class contains xtd.tunit settings.
Definition: settings.h:20
void output_color(bool output_color) noexcept
Sets output color.
Definition: settings.h:82
std::string output_xml_path() const noexcept
Gets output xml path.
Definition: settings.h:94
int exit_status() const noexcept
Gets exit status.
Definition: settings.h:46
void random_seed(int random_seed) noexcept
Sets random seed value.
Definition: settings.h:118
void output_xml_path(const std::string &output_xml_path) noexcept
Sets output xml path.
Definition: settings.h:98
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:66
std::chrono::time_point< std::chrono::system_clock > end_time() const noexcept
Gets unit test end time.
Definition: settings.h:140
void list_tests(bool list_tests) noexcept
Sets list tests.
Definition: settings.h:74
void also_run_ignored_tests(bool also_run_ignored_tests) noexcept
Sets also run ignored test.
Definition: settings.h:40
static xtd::tunit::settings & default_settings() noexcept
Get default settings instance.
bool shuffle_test() const noexcept
Gets shuffle tests.
Definition: settings.h:103
settings()=default
Creates new instance of settings.
void shuffle_test(bool shuffle_test) noexcept
Sets shuffle tests.
Definition: settings.h:108
bool output_xml() const noexcept
Gets output xml.
Definition: settings.h:86
std::chrono::time_point< std::chrono::system_clock > start_time() const noexcept
Gets unit test start time.
Definition: settings.h:144
void output_xml(bool output_xml) noexcept
Sets output xml.
Definition: settings.h:90
bool show_duration() const noexcept
Gets if show duration for each test.
Definition: settings.h:132
bool output_color() const noexcept
Gets output color.
Definition: settings.h:78
const std::string & filter_tests() const noexcept
Gets filter tests.
Definition: settings.h:57
void show_duration(bool show_duration) noexcept
Sets if show duration for each test.
Definition: settings.h:136
void repeat_tests(int repeat_tests) noexcept
Sets repeat tests count.
Definition: settings.h:128
int random_seed() const noexcept
Gets random seed value.
Definition: settings.h:113
bool list_tests() const noexcept
Gets list tests.
Definition: settings.h:70
int repeat_test() const noexcept
Gets repeat tests count.
Definition: settings.h:123
void exit_status(int exit_status) noexcept
Sets exit status.
Definition: settings.h:52
void filter_tests(const std::string &filter_tests) noexcept
Sets filter tests.
Definition: settings.h:62
The template class.
Definition: unit_test.h:32
#define tunit_export_
Define shared library export.
Definition: tunit_export.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17