xtd - Reference Guide  0.1.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
test_method_attribute.h
Go to the documentation of this file.
1
4#pragma once
5#include "test.h"
6#include "test_state.h"
7
9namespace xtd {
11 namespace tunit {
13 public:
14 template<typename test_class_t>
15 test_method_attribute(const std::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()) {}
16
17 template<typename test_class_t>
18 test_method_attribute(const std::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) {}
19
20 template<typename test_class_t>
21 test_method_attribute(const std::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()) {}
22
23 template<typename test_class_t>
24 test_method_attribute(const std::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});}
25 };
26 }
27}
28
29#define ignore_test_method_(method_name) \
30 __##method_name##_unused() = delete; \
31 class __##method_name##_attribute##_class : public xtd::tunit::test_method_attribute { \
32 public:\
33 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__}) {} \
34 } __##method_name##_attribute {*this}; \
35 void method_name()
36
37#define test_method_(method_name) \
38 __##method_name##_unused() = delete; \
39 class __##method_name##_attribute##_class : public xtd::tunit::test_method_attribute { \
40 public:\
41 template<typename test_class> __##method_name##_attribute##_class(test_class& test) : test_method_attribute(#method_name, test, &test_class::method_name, {__FILE__, __LINE__, __func__}) {} \
42 } __##method_name##_attribute {*this}; \
43 void method_name()
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition: stack_frame.h:29
Definition: test_class.h:25
Definition: test_method_attribute.h:12
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: system_report.h:17
Contains xtd::tunit::test class.
Contains xtd::tunit::test_state enum class.