xtd 0.2.0
Loading...
Searching...
No Matches
class_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
31 template<typename test_class_t>
32 class_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_class_cleanup({name, method, stack_frame});}
34 };
35 }
36}
37
46#define class_cleanup_(method_name) \
47 __##method_name##_static() {} \
48 class __class_cleanup_attribute : public xtd::tunit::class_cleanup_attribute { \
49 public: \
50 template<typename test_class> __class_cleanup_attribute(test_class& test) : class_cleanup_attribute(#method_name, test, &method_name) {__##method_name##_static();} \
51 } __class_cleanup_attribute {*this}; \
52 static void method_name()
53
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.
This attribute is use to add cleanup class method to class test attribute.
Definition class_cleanup_attribute.h:21
class_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 new instance of class_cleanup_attribute attribute.
Definition class_cleanup_attribute.h:32
Represents a test class.
Definition test_class.h:39
void add_class_cleanup(const xtd::tunit::test &class_cleanup) noexcept
Adds the class cleanup method.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::tunit::test class.