xtd 0.2.0
Loading...
Searching...
No Matches
test_method_attribute.h
Go to the documentation of this file.
1
4#pragma once
5#include "test_state.h"
6#include <xtd/diagnostics/stack_frame>
7#include <xtd/string>
8
10namespace xtd {
12 namespace tunit {
24 public:
26
32 template<typename test_class_t>
33 test_method_attribute(const xtd::string& name, test_class_t& test_class, void (test_class_t::*method)()) noexcept : test_method_attribute(name, test_class, method, xtd::tunit::test_state::considered, xtd::diagnostics::stack_frame()) {}
34
40 template<typename test_class_t>
41 test_method_attribute(const xtd::string& name, test_class_t& test_class, void (test_class_t::*method)(), const xtd::diagnostics::stack_frame& stack_frame) noexcept : test_method_attribute(name, test_class, method, xtd::tunit::test_state::considered, stack_frame) {}
42
48 template<typename test_class_t>
49 test_method_attribute(const xtd::string& name, test_class_t& test_class, void (test_class_t::*method)(), xtd::tunit::test_state test_state) noexcept : test_method_attribute(name, test_class, method, test_state, xtd::diagnostics::stack_frame()) {}
50
57 template<typename test_class_t>
58 test_method_attribute(const xtd::string& name, test_class_t& test_class, void (test_class_t::*method)(), xtd::tunit::test_state test_state, const xtd::diagnostics::stack_frame& stack_frame) noexcept {test_class.add_test_method({name, std::bind(method, &test_class), test_state == xtd::tunit::test_state::ignored, stack_frame});}
60 };
61 }
62}
63
73#define ignore_test_method_(method_name) \
74 __##method_name##_unused() = delete; \
75 class __##method_name##_attribute##_class : public xtd::tunit::test_method_attribute { \
76 public: \
77 template<typename test_class> __##method_name##_attribute##_class(test_class& test) : test_method_attribute(#method_name, test, &test_class::method_name, xtd::tunit::test_state::ignored, {__FILE__, __LINE__, __func__}) {} \
78 } __##method_name##_attribute {*this}; \
79 void method_name()
80
89#define test_method_(method_name) \
90 __##method_name##_unused() = delete; \
91 class __##method_name##_attribute##_class : public xtd::tunit::test_method_attribute { \
92 public: \
93 template<typename test_class> __##method_name##_attribute##_class(test_class& test) : test_method_attribute(#method_name, test, &test_class::method_name, {__FILE__, __LINE__, __func__}) {} \
94 } __##method_name##_attribute {*this}; \
95 void method_name()
Represents text as a sequence of character units.
Definition basic_string.h:79
Represents a test class.
Definition test_class.h:39
Represents a test method attribute.
Definition test_method_attribute.h:23
test_method_attribute(const xtd::string &name, test_class_t &test_class, void(test_class_t::*method)()) noexcept
Creates a new instance of test_method_attribute with specified name, test_class, and method.
Definition test_method_attribute.h:33
test_method_attribute(const xtd::string &name, test_class_t &test_class, void(test_class_t::*method)(), xtd::tunit::test_state test_state, const xtd::diagnostics::stack_frame &stack_frame) noexcept
Creates a new instance of test_method_attribute with specified name, test_class, method,...
Definition test_method_attribute.h:58
test_method_attribute(const xtd::string &name, test_class_t &test_class, void(test_class_t::*method)(), const xtd::diagnostics::stack_frame &stack_frame) noexcept
Creates a new instance of test_method_attribute with specified name, test_class, method,...
Definition test_method_attribute.h:41
test_method_attribute(const xtd::string &name, test_class_t &test_class, void(test_class_t::*method)(), xtd::tunit::test_state test_state) noexcept
Creates a new instance of test_method_attribute with specified name, test_class, method,...
Definition test_method_attribute.h:49
test_state
Represent the test state enumeration used bu test.
Definition test_state.h:17
@ considered
Test is considered.
@ ignored
Test is ignored.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::tunit::test_state enum class.