xtd 0.2.0
Loading...
Searching...
No Matches
settings.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "../tunit_export.hpp"
6#include <xtd/reflection/assembly>
7#include <xtd/io/path>
8#include <xtd/date_time>
9#include <xtd/string>
10#include <cstdint>
11#include <cstdlib>
12#include <xtd/optional>
13
15namespace xtd {
17 namespace tunit {
19 class ostream_event_listener;
20 class ostream_unit_test;
21 class unit_test;
23
30 class tunit_export_ settings final {
31 public:
33
59 settings() = default;
61
63 settings(const settings&) = default;
64 settings& operator =(const settings&) = default;
66
68
72 bool also_run_ignored_tests() const noexcept;
73
76 void also_run_ignored_tests(bool also_run_ignored_tests) noexcept;
77
80 bool break_on_failure() const noexcept;
81
84 void break_on_failure(bool break_on_failure) noexcept;
85
88 bool brief() const noexcept;
89
92 void brief(bool brief) noexcept;
93
96 bool count_tests() const noexcept;
97
100 void count_tests(bool count_tests) noexcept;
101
105 bool enable_stack_trace() const noexcept;
106
110 void enable_stack_trace(bool enable_stack_trace) noexcept;
111
114 const xtd::date_time& end_time() const noexcept;
115
119 int32 exit_status() const noexcept;
120
125
128 const std::vector<string>& filter_tests() const noexcept;
129
132 void filter_tests(const std::vector<string>& filter_tests) noexcept;
133
136 bool gtest_compatibility() const noexcept;
137
140 void gtest_compatibility(bool gtest_compatibility) noexcept;
141
144 bool is_match_test_name(const xtd::string& test_class_name, const xtd::string& test_name) const noexcept;
145
148 bool list_tests() const noexcept;
149
152 void list_tests(bool list_tests) noexcept;
153
156 bool output_color() const noexcept;
157
160 void output_color(bool output_color) noexcept;
161
164 bool output_json() const noexcept;
165
168 void output_json(bool output_json) noexcept;
169
172 xtd::string output_json_path() const noexcept;
173
176 void output_json_path(const xtd::string& output_json_path) noexcept;
177
180 bool output_xml() const noexcept;
181
184 void output_xml(bool output_xml) noexcept;
185
188 xtd::string output_xml_path() const noexcept;
189
192 void output_xml_path(const xtd::string& output_xml_path) noexcept;
193
196 uint32 random_seed() const noexcept;
197
200 void random_seed(uint32 random_seed) noexcept;
201
204 int32 repeat_test() const noexcept;
205
208 void repeat_tests(int32 repeat_tests) noexcept;
209
212 bool show_duration() const noexcept;
213
216 void show_duration(bool show_duration) noexcept;
217
220 bool shuffle_test() const noexcept;
221
224 void shuffle_test(bool shuffle_test) noexcept;
225
228 const xtd::date_time& start_time() const noexcept;
229
232 bool throw_on_failure() const noexcept;
233
236 void throw_on_failure(bool break_on_failure) noexcept;
238
240
267 static xtd::tunit::settings& default_settings() noexcept;
269
270 private:
271 friend class xtd::tunit::ostream_event_listener;
272 friend class xtd::tunit::ostream_unit_test;
273 friend class xtd::tunit::unit_test;
274
275 void end_time(const xtd::date_time& end_time) noexcept;
276 void start_time(const xtd::date_time& start_time) noexcept;
277
278 bool also_run_ignored_tests_ = false;
279 bool break_on_failure_ = false;
280 bool brief_ = false;
281 bool count_tests_ = false;
282 bool enable_stack_trace_ = false;
283 xtd::date_time end_time_;
284 int32 exit_status_ = EXIT_SUCCESS;
285 xtd::string file_name_ = xtd::io::path::get_full_path(xtd::reflection::assembly::get_executing_assembly().location());
286 std::vector<string> filter_tests_ = {"*.*"};
287 bool gtest_compatibility_ = false;
288 bool list_tests_ = false;
289 bool output_color_ = true;
290 bool output_json_ = false;
291 std::optional<xtd::string> output_json_path_;
292 bool output_xml_ = false;
293 std::optional<xtd::string> output_xml_path_;
294 uint32 random_seed_ = 0;
295 int32 repeat_tests_ = 1;
296 bool show_duration_ = true;
297 bool shuffle_tests_ = false;
298 xtd::date_time start_time_;
299 bool throw_on_failure_ = false;
300 };
301 }
302}
Represents an instant in time, typically expressed as a date and time of day.
Definition date_time.hpp:85
The ostream_unit_test class is a specialisation of event_listener class for writing events in std::os...
Definition ostream_event_listener.hpp:23
The ostream_unit_test class is ostream unit test interface.
Definition ostream_unit_test.hpp:22
The settings class contains xtd.tunit settings.
Definition settings.hpp:30
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.hpp:28
#define tunit_export_
Define shared library export.
Definition tunit_export.hpp:13
int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
uint32_t uint32
Represents a 32-bit unsigned integer.
Definition uint32.hpp:23
exit_status
Specifies exit status for the xtd::environment::exit method.
Definition exit_status.hpp:18
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10