xtd 0.2.0
Loading...
Searching...
No Matches
settings.h
Go to the documentation of this file.
1
4#pragma once
5#include "../tunit_export.h"
6#include <xtd/io/path>
7#include <xtd/date_time>
8#include <xtd/environment>
9#include <xtd/ustring>
10#include <cstdint>
11#include <cstdlib>
12#include <optional>
13
15namespace xtd {
17 namespace tunit {
24 class tunit_export_ settings final {
25 public:
27
30 settings() = default;
32
34 settings(const settings&) = default;
35 settings& operator =(const settings&) = default;
37
39
43 bool also_run_ignored_tests() const noexcept;
44
47 void also_run_ignored_tests(bool also_run_ignored_tests) noexcept;
48
51 bool break_on_failure() const noexcept;
52
55 bool brief() const noexcept;
56
59 void brief(bool brief) noexcept;
60
63 void break_on_failure(bool break_on_failure) noexcept;
64
67 bool throw_on_failure() const noexcept;
68
71 void throw_on_failure(bool break_on_failure) noexcept;
72
75 bool count_tests() const noexcept;
76
79 void count_tests(bool count_tests) noexcept;
80
85 int32 exit_status() const noexcept;
86
92
96 const std::vector<ustring>& filter_tests() const noexcept;
97
101 void filter_tests(const std::vector<ustring>& filter_tests) noexcept;
102
105 bool gtest_compatibility() const noexcept;
106
109 void gtest_compatibility(bool gtest_compatibility) noexcept;
110
113 bool is_match_test_name(const xtd::ustring& test_class_name, const xtd::ustring& test_name) const noexcept;
114
117 bool list_tests() const noexcept;
118
121 void list_tests(bool list_tests) noexcept;
122
125 bool output_color() const noexcept;
126
129 void output_color(bool output_color) noexcept;
130
133 bool output_json() const noexcept;
134
137 void output_json(bool output_json) noexcept;
138
141 bool output_xml() const noexcept;
142
145 void output_xml(bool output_xml) noexcept;
146
149 xtd::ustring output_json_path() const noexcept;
150
153 void output_json_path(const xtd::ustring& output_json_path) noexcept;
154
157 xtd::ustring output_xml_path() const noexcept;
158
161 void output_xml_path(const xtd::ustring& output_xml_path) noexcept;
162
166 bool shuffle_test() const noexcept;
167
171 void shuffle_test(bool shuffle_test) noexcept;
172
176 uint32 random_seed() const noexcept;
177
181 void random_seed(uint32 random_seed) noexcept;
182
186 int32 repeat_test() const noexcept;
187
191 void repeat_tests(int32 repeat_tests) noexcept;
192
195 bool show_duration() const noexcept;
196
199 void show_duration(bool show_duration) noexcept;
200
203 const xtd::date_time& end_time() const noexcept;
204
207 const xtd::date_time& start_time() const noexcept;
208
212 bool enable_stack_trace() const noexcept;
213
217 void enable_stack_trace(bool enable_stack_trace) noexcept;
219
221
225 static xtd::tunit::settings& default_settings() noexcept;
227
228 private:
229 friend class unit_test;
230 friend class ostream_event_listener;
231 friend class ostream_unit_test;
232
233 bool pattern_compare(const xtd::ustring& name, const xtd::ustring& pattern) const noexcept;
234
235 void end_time(const xtd::date_time& end_time) noexcept;
236 void start_time(const xtd::date_time& start_time) noexcept;
237
238 bool also_run_ignored_tests_ = false;
239 bool break_on_failure_ = false;
240 bool brief_ = false;
241 bool throw_on_failure_ = false;
242 std::vector<ustring> filter_tests_;
243 int32 exit_status_ = EXIT_SUCCESS;
244 bool gtest_compatibility_ = false;
245 bool count_tests_ = false;
246 bool list_tests_ = false;
247 bool output_color_ = true;
248 bool output_json_ = false;
249 bool output_xml_ = false;
250 std::optional<xtd::ustring> output_json_path_;
251 std::optional<xtd::ustring> output_xml_path_;
252 xtd::ustring file_name_ = xtd::io::path::get_full_path(xtd::environment::get_command_line_args()[0]);
253 bool show_duration_ = true;
254 bool shuffle_tests_ = false;
255 uint32 random_seed_ = 0;
256 int32 repeat_tests_ = 1;
257 bool enable_stack_trace_ = false;
258 xtd::date_time start_time_;
259 xtd::date_time end_time_;
260 };
261 }
262}
Represents an instant in time, typically expressed as a date and time of day.
Definition date_time.h:79
The environment class.
Definition environment.h:117
The ostream_unit_test class is a specialisation of event_listener class for writing events in std::os...
Definition ostream_event_listener.h:23
The ostream_unit_test class is ostream unit test interface.
Definition ostream_unit_test.h:22
The settings class contains xtd.tunit settings.
Definition settings.h:24
bool also_run_ignored_tests() const noexcept
Gets also run ignored test.
settings()=default
Creates new instance of settings.
The unit_test class is unit test base interface.
Definition unit_test.h:28
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:47
#define tunit_export_
Define shared library export.
Definition tunit_export.h:13
int_least32_t int32
Represents a 32-bit signed integer.
Definition types.h:131
uint_least32_t uint32
Represents a 32-bit unsigned integer.
Definition types.h:241
exit_status
Specifies exit status for the xtd::environment::exit method.
Definition exit_status.h:18
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10