xtd 0.2.0
test_initialize_attribute.h
Go to the documentation of this file.
1 #pragma once
5 #include "test.h"
6 
8 namespace xtd {
10  namespace tunit {
17  public:
19 
25  template<typename test_class_t>
26  test_initialize_attribute(const std::string& name, test_class_t& test_class, void (*method)()) noexcept : test_initialize_attribute(name, test_class, method, xtd::diagnostics::stack_frame()) {}
27 
33  template<typename test_class_t>
34  test_initialize_attribute(const std::string& name, test_class_t& test_class, void (*method)(), const xtd::diagnostics::stack_frame& stack_frame) noexcept {test_class.add_test_initialize({name, method, stack_frame});}
36  };
37  }
38 }
39 
46 #define test_initialize_(method_name) \
47  __##method_name##_unused() = delete; \
48  class __test_initialize_attribute : public xtd::tunit::test_initialize_attribute { \
49  public:\
50  template<typename test_class> __test_initialize_attribute(test_class& test) : test_initialize_attribute(#method_name, test, &test_class::method_name, {__FILE__, __LINE__, __func__}) {} \
51  } __test_initialize_attribute {*this}; \
52  static void method_name()
53 
test_initialize_attribute(const std::string &name, test_class_t &test_class, void(*method)()) noexcept
Creates a new instance of test_initialize_attribute with specified name, test_class and method...
Definition: test_initialize_attribute.h:26
Contains xtd::tunit::test class.
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
test_initialize_attribute(const std::string &name, test_class_t &test_class, void(*method)(), const xtd::diagnostics::stack_frame &stack_frame) noexcept
Creates a new instance of test_initialize_attribute with specified name, test_class and method...
Definition: test_initialize_attribute.h:34
Represents a test class.
Definition: test_class.h:39
Represents a test initialize attribute.
Definition: test_initialize_attribute.h:16
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition: stack_frame.h:37