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