xtd 0.2.0
Loading...
Searching...
No Matches
test_initialize_attribute.h
Go to the documentation of this file.
1
4#pragma once
5#include <xtd/diagnostics/stack_frame>
6#include <xtd/string>
7
9namespace xtd {
11 namespace tunit {
18 public:
20
27 template<typename test_class_t>
28 test_initialize_attribute(const xtd::string& name, test_class_t& test_class, void (*method)(), const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) noexcept {test_class.add_test_initialize({name, method, stack_frame});}
30 };
31 }
32}
33
40#define test_initialize_(method_name) \
41 __##method_name##_unused() = delete; \
42 class __test_initialize_attribute : public xtd::tunit::test_initialize_attribute { \
43 public:\
44 template<typename test_class> __test_initialize_attribute(test_class& test) : test_initialize_attribute(#method_name, test, &test_class::method_name) {} \
45 } __test_initialize_attribute {*this}; \
46 static void method_name()
47
Represents text as a sequence of character units.
Definition basic_string.h:79
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition stack_frame.h:47
static stack_frame current(const xtd::source_location &value=xtd::source_location::current()) noexcept
Crates a new xtd::diagnostics::stack_frame object corresponding to the location of the call site.
Represents a test class.
Definition test_class.h:39
void add_test_initialize(const xtd::tunit::test &test_initialize) noexcept
Adds the test initialize method.
Represents a test initialize attribute.
Definition test_initialize_attribute.h:17
test_initialize_attribute(const xtd::string &name, test_class_t &test_class, void(*method)(), const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current()) noexcept
Creates a new instance of test_initialize_attribute with specified name, test_class and method.
Definition test_initialize_attribute.h:28
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10