5 #include "../tunit_export.h"
20 class registered_test_class;
34 std::chrono::milliseconds elapsed_time()
const noexcept {
35 using namespace std::chrono_literals;
36 if (start_time_point.time_since_epoch() == 0ms && end_time_point.time_since_epoch() == 0ms)
return 0ms;
37 if (end_time_point.time_since_epoch() == 0ms)
return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - start_time_point);
38 return std::chrono::duration_cast<std::chrono::milliseconds>(end_time_point - start_time_point);
41 std::string name()
const noexcept {
return name_;}
43 size_t test_count()
const noexcept {
45 for (
auto method : tests_)
50 size_t aborted_test_count()
const noexcept {
52 for (
auto method : tests_)
57 size_t failed_test_count()
const noexcept {
59 for (
auto method : tests_)
64 size_t ignored_test_count()
const noexcept {
66 for (
auto method : tests_)
71 size_t succeed_test_count()
const noexcept {
73 for (
auto method : tests_)
78 const std::vector<xtd::tunit::test>& tests()
const noexcept {
return tests_;}
85 void add_test_cleanup(
const xtd::tunit::test& test_cleanup) noexcept {test_cleanup_ = test_cleanup;}
87 void add_test_initialize(
const xtd::tunit::test& test_initialize) noexcept {test_initialize_ = test_initialize;}
103 const xtd::tunit::test& test_cleanup()
const noexcept {
return test_cleanup_;}
104 const xtd::tunit::test& test_initialize()
const noexcept {
return test_initialize_;}
105 const std::vector<xtd::tunit::test>& test_methods()
const noexcept {
return tests_;}
111 std::chrono::high_resolution_clock::time_point end_time_point;
113 std::chrono::high_resolution_clock::time_point start_time_point;
116 std::vector<xtd::tunit::test> tests_;
121 #define test_class_(class_name) \
123 xtd::tunit::test_class_attribute<class_name> __##class_name##_attribute {#class_name}; \
124 class class_name : public xtd::tunit::test_class
126 #define test_class_from_(class_name, from_class_name) \
128 xtd::tunit::test_class_attribute<class_name> __##class_name##_attribute {#class_name}; \
129 class class_name : public from_class_name
Contains xtd::tunit::class_cleanup_attribute class.
Contains xtd::tunit::class_initialize_attribute class.
This attribute is use to add cleanup class method to class test attribute.
Definition: class_cleanup_attribute.h:17
This attribute is use to add initialize class method to class test attribute.
Definition: class_initialize_attribute.h:17
Represents the registered test class.
Definition: registered_test_class.h:19
static xtd::tunit::settings & default_settings() noexcept
Get default settings instance.
Definition: test_class.h:25
Definition: test_cleanup_attribute.h:11
Definition: test_initialize_attribute.h:11
Definition: test_method_attribute.h:12
The template class.
Definition: unit_test.h:32
#define tunit_export_
Define shared library export.
Definition: tunit_export.h:13
#define class_initialize_(method_name)
add initialize class method to class test.
Definition: class_initialize_attribute.h:42
#define class_cleanup_(method_name)
Add cleanup class method to class test.
Definition: class_cleanup_attribute.h:42
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17
Contains xtd::tunit::test_cleanup_attribute class.
Contains xtd::tunit::test_initialize_attribute class.
Contains xtd::tunit::test_method_attribute class.
Contains xtd::tunit::settings class.