xtd - Reference Guide  0.1.2
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_cleanup_attribute.h
Go to the documentation of this file.
1
4#pragma once
5#include "test.h"
6
8namespace xtd {
10 namespace tunit {
12 public:
13 template<typename test_class_t>
14 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()) {}
15
16 template<typename test_class_t>
17 test_cleanup_attribute(const std::string& name, test_class_t& test_class, void (*method)(), const xtd::diagnostics::stack_frame& caller) noexcept {test_class.add_test_cleanup({name, method, caller});}
18 };
19 }
20}
21
22#define test_cleanup_(method_name) \
23 __##method_name##_unused() = delete; \
24 class __test_cleanup_attribute : public xtd::tunit::test_cleanup_attribute { \
25 public:\
26 template<typename test_class> __test_cleanup_attribute(test_class& test) : test_cleanup_attribute(#method_name, test, &test_class::method_name, {__FILE__, __LINE__, __func__}) {} \
27 } __test_cleanup_attribute {*this}; \
28 static 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_cleanup_attribute.h:11
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition system_report.h:17
Contains xtd::tunit::test class.