xtd 0.2.0
Loading...
Searching...
No Matches
test_cleanup_attribute.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "test.hpp"
6
8namespace xtd {
10 namespace tunit {
22 public:
24
31 template<typename test_class_t>
32 test_cleanup_attribute(const std::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_cleanup({name, method, stack_frame});}
34 };
35 }
36}
37
44#define test_cleanup_(method_name) \
45 __##method_name##_unused() = delete; \
46 class __test_cleanup_attribute : public xtd::tunit::test_cleanup_attribute { \
47 public:\
48 template<typename test_class> __test_cleanup_attribute(test_class& test) : test_cleanup_attribute(#method_name, test, &test_class::method_name) {} \
49 } __test_cleanup_attribute {*this}; \
50 static void method_name()
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition stack_frame.hpp: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.hpp: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.hpp:21
test_cleanup_attribute(const std::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_cleanup_attribute with specified name, test class, method and stack fr...
Definition test_cleanup_attribute.hpp:32
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Contains xtd::tunit::test class.