Bridge++
Ver. 1.1.x
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
testManager.h
Go to the documentation of this file.
1
14
#ifndef TESTMANAGER_INCLUDED
15
#define TESTMANAGER_INCLUDED
16
17
#include <iostream>
18
#include <fstream>
19
#include <cmath>
20
#include <string>
21
#include <vector>
22
#include <map>
23
24
#include "
defs.h
"
25
#include "
communicator.h
"
26
#include "
commonParameters.h
"
27
#include "
test.h
"
28
29
#include "
bridgeIO.h
"
30
using
Bridge::vout
;
31
32
// typedef Functor<int> Test_function;
33
typedef
int (*
Test_function
) (void);
34
35
// null function
36
int
DoNothing
();
37
38
#if 0
39
// debug
40
void
hook_preexec();
41
void
hook_postexec();
42
#endif
43
45
63
class
TestManager
64
{
65
public
:
66
void
interactive
();
67
void
batch
(
const
std::string& arg);
68
69
bool
registerTest
(
const
std::string& key,
const
Test_function
func);
70
71
static
TestManager
&
Instance
();
72
73
static
bool
RegisterTest
(
const
std::string& key,
const
Test_function
func)
74
{
return
Instance
().
registerTest
(key, func); }
75
76
// for test result verification
77
int
getCheckPrecision
()
const
78
{
return
m_precision
; }
79
80
private
:
81
// singleton
82
TestManager
();
83
84
TestManager
(
const
TestManager
&);
// not implemented
85
TestManager
&
operator=
(
const
TestManager
&);
// not implemented
86
87
~TestManager
();
88
89
static
void
CreateInstance
();
90
91
static
TestManager
*
s_instance
;
92
93
// bi-directional tree representation of key
94
struct
Node
95
{
96
Node
*
m_prev
;
97
std::vector<Node *>
m_next
;
98
std::string
m_name
;
// key
99
Test_function
m_function
;
// payload
100
101
Node
(
const
std::string& name,
Node
*
const
prev = 0)
102
:
m_prev
(prev),
m_next
(),
m_name
(name),
m_function
(
DoNothing
) {}
103
~Node
()
104
{
105
for
(
size_t
i = 0; i <
m_next
.size(); ++i) {
delete
m_next
[i]; }
106
}
107
};
108
109
Node *
find_node
(Node *p,
const
std::vector<std::string>& v);
110
Node *
append_key
(Node *p,
const
std::vector<std::string>& v);
111
Node *
append_key
(Node *p,
int
argc,
char
**argv);
112
113
// statistics
114
struct
Stat
115
{
116
int
m_num_tests
;
117
int
m_num_failure
;
118
std::vector<std::string>
m_list_failure
;
119
120
void
reset
();
121
void
success
(
const
std::string& test_name);
122
void
failure
(
const
std::string& test_name);
123
};
124
125
void
stat_report
()
const
;
126
127
std::string
find_fullpath
(
const
Node
*p,
const
std::string& path =
""
);
128
129
void
interactive_master
();
130
void
interactive_slave
();
131
132
void
run
(
const
Node
*p);
133
void
run_traversal
(
const
Node
*p);
134
135
bool
menu
(
const
Node
*p,
const
bool
is_top =
false
);
136
void
banner
();
137
138
void
set_precision
();
139
140
// for debug
141
void
traverse
(
const
Node
*p,
const
std::string& indent =
""
);
142
143
144
Bridge::VerboseLevel
m_vl
;
145
146
Node
m_root_node
;
147
148
// for test result verification
149
int
m_precision
;
150
151
// for statistics report
152
Stat
m_stat
;
153
};
154
#endif // TEST_MANAGER_H
src
Tests
testManager.h
Generated on Tue Jul 23 2013 10:48:50 for Bridge++ by
1.8.3.1