libcopp 2.3.1
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
test_case_base.cpp
Go to the documentation of this file.
1/*
2 * test_case_base.cpp
3 *
4 * Created on: 2014年3月11日
5 * Author: owent
6 *
7 * Released under the MIT license
8 */
9
10#include "test_manager.h"
11
12#include "test_case_base.h"
13
14test_case_base::test_case_base(const std::string& test_name, const std::string& case_name, test_func func) {
15 success_ = 0;
16 failed_ = 0;
17
18 func_ = func;
19
20 test_manager::me().append_test_case(test_name, case_name, this);
21}
22
24
26 success_ = 0;
27 failed_ = 0;
28
30
31#ifndef UTILS_TEST_MACRO_TEST_ENABLE_BOOST_TEST
32 if (nullptr != func_) {
33 (*func_)();
34 }
35#endif
36
37 test_manager::set_counter_ptr(nullptr, nullptr);
38
39 return 0;
40}
41
43
45
47 if (nullptr != func_) {
48 (*func_)();
49 }
50 return 0;
51}
52
54
56
58 if (nullptr != func_) {
59 (*func_)();
60 }
61 return 0;
62}
virtual ~test_case_base()
virtual int run()
test_case_base(const std::string &test_name, const std::string &case_name, test_func func)
static test_manager & me()
void append_event_on_start(const std::string &event_name, on_start_ptr_type)
static void set_counter_ptr(int *success_counter_ptr, int *failed_counter_ptr)
void append_event_on_exit(const std::string &event_name, on_exit_ptr_type)
void append_test_case(const std::string &test_name, const std::string &case_name, case_ptr_type)
virtual ~test_on_exit_base()
on_start_func func_
virtual ~test_on_start_base()