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
33 template<typename test_class_t>
34 test_method_attribute(const xtd::string& name, test_class_t& test_class, void (test_class_t::*method)(), const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) noexcept : test_method_attribute(name, test_class, method, xtd::tunit::test_state::considered, stack_frame) {}
41 template<typename test_class_t>
42 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 = xtd::diagnostics::stack_frame::current()) noexcept {test_class.add_test_method({name, std::bind(method, &test_class), test_state == xtd::tunit::test_state::ignored, stack_frame});}
44 };
45 }
46}
47
57#define ignore_test_method_(method_name) \
58 __##method_name##_unused() = delete; \
59 class __##method_name##_attribute##_class : public xtd::tunit::test_method_attribute { \
60 public: \
61 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) {} \
62 } __##method_name##_attribute {*this}; \
63 void method_name()
64
73#define 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) {} \
78 } __##method_name##_attribute {*this}; \
79 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)(), xtd::tunit::test_state test_state, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current()) noexcept
Creates a new instance of test_method_attribute with specified name, test_class, method,...
Definition test_method_attribute.h:42
test_method_attribute(const xtd::string &name, test_class_t &test_class, void(test_class_t::*method)(), const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current()) noexcept
Creates a new instance of test_method_attribute with specified name, test_class, method,...
Definition test_method_attribute.h:34
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.