Bridge++
Ver. 2.0.2
run_testmanager.cpp
Go to the documentation of this file.
1
/*
2
@file run_testmanager.cpp
3
4
@brief
5
6
@author Tatsumi Aoyama (aoym)
7
$LastChangedBy: aoyama $
8
9
@date $LastChangedDate: 2013-04-12 13:28:01 #$
10
11
@version $LastChangedRevision: 1928 $
12
*/
13
14
#include "
testlist.h
"
15
#include "
testManager.h
"
16
17
//====================================================================
18
void
testmanager_usage
(
const
char
*prog)
19
{
20
vout
.
general
(
"\n"
);
21
vout
.
general
(
"usage: %s\n"
, prog);
22
vout
.
general
(
" (without args) -- run tests interactively.\n"
);
23
vout
.
general
(
" test_names -- run specified tests.\n"
);
24
vout
.
general
(
" -a | --all -- run all tests.\n"
);
25
vout
.
general
(
" -l | --list -- list registered tests.\n"
);
26
vout
.
general
(
" -h | --help -- show this message.\n"
);
27
vout
.
general
(
"\n"
);
28
}
29
30
31
//====================================================================
32
int
run_testmanager
(
int
argc,
char
**argv)
33
{
34
TestManager
& testmanager =
TestManager::Instance
();
// find singleton
35
36
#ifdef USE_TESTMANAGER_AUTOREGISTER
37
//- tests are registered automatically at start up.
38
#else
39
//- register tests manually:
40
//
41
// testmanager.registerTest(
42
// "Gauge.Plaquette",
43
// Test_Gauge::plaquette
44
// );
45
#endif
46
47
if
(argc > 1) {
48
const
std::string arg1 = argv[1];
49
50
if
((arg1 ==
"-a"
) || (arg1 ==
"--all"
)) {
// run all tests
51
testmanager.
batch_recursive
();
52
}
else
if
((arg1 ==
"-l"
) || (arg1 ==
"--list"
)) {
// list registered tests
53
testmanager.
list
();
54
}
else
if
((arg1 ==
"-h"
) || (arg1 ==
"--help"
)) {
// show usage and exit
55
testmanager_usage
(argv[0]);
56
return
EXIT_SUCCESS;
57
}
else
{
58
// argv[] = { "./bridge.elf", test1, (test2, ...) }
59
testmanager.
batch_recursive
(argc - 1, argv + 1);
60
}
61
}
else
{
62
testmanager.
interactive
();
63
}
64
65
return
EXIT_SUCCESS;
66
}
67
68
69
//====================================================================
70
//====================================================================
TestManager::interactive
void interactive()
Definition:
testManager.cpp:84
run_testmanager
int run_testmanager(int argc, char **argv)
Definition:
run_testmanager.cpp:32
TestManager::Instance
static TestManager & Instance()
Definition:
testManager.cpp:40
testlist.h
TestManager::list
void list()
Definition:
testManager.cpp:581
TestManager::batch_recursive
void batch_recursive(const std::string &arg="")
Definition:
testManager.cpp:139
testmanager_usage
void testmanager_usage(const char *prog)
Definition:
run_testmanager.cpp:18
TestManager
TestManager class for managing and performing tests.
Definition:
testManager.h:52
testManager.h
Bridge::BridgeIO::general
void general(const char *format,...)
Definition:
bridgeIO.cpp:200
Bridge::vout
BridgeIO vout
Definition:
bridgeIO.cpp:512
tests
src
run_testmanager.cpp
Generated on Sat Feb 10 2024 14:20:01 for Bridge++ by
1.8.17