xtd 0.2.0
Loading...
Searching...
No Matches
test_cleanup_attribute.h
Go to the documentation of this file.
1
4#pragma once
5#include "test.h"
6
8namespace xtd {
10 namespace tunit {
22 public:
24
30 template<typename test_class_t>
31 test_cleanup_attribute(const std::string& name, test_class_t& test_class, void (*method)()) noexcept : test_cleanup_attribute(name, test_class, method, xtd::diagnostics::stack_frame()) {}
32
38 template<typename test_class_t>
39 test_cleanup_attribute(const std::string& name, test_class_t& test_class, void (*method)(), const xtd::diagnostics::stack_frame& stack_frame) noexcept {test_class.add_test_cleanup({name, method, stack_frame});}
41 };
42 }
43}
44
51#define test_cleanup_(method_name) \
52 __##method_name##_unused() = delete; \
53 class __test_cleanup_attribute : public xtd::tunit::test_cleanup_attribute { \
54 public:\
55 template<typename test_class> __test_cleanup_attribute(test_class& test) : test_cleanup_attribute(#method_name, test, &test_class::method_name, {__FILE__, __LINE__, __func__}) {} \
56 } __test_cleanup_attribute {*this}; \
57 static void method_name()
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition stack_frame.h:47
Represents a test class.
Definition test_class.h:39
void add_test_cleanup(const xtd::tunit::test &test_cleanup) noexcept
Adds the test cleanup method.
Represents a test cleanup attribute.
Definition test_cleanup_attribute.h:21
test_cleanup_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_cleanup_attribute with specified name, test class, method and stack fr...
Definition test_cleanup_attribute.h:39
test_cleanup_attribute(const std::string &name, test_class_t &test_class, void(*method)()) noexcept
Creates a new instance of test_cleanup_attribute with specified name, test_class and method.
Definition test_cleanup_attribute.h:31
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::tunit::test class.