44 delete (*i).second; |
44 delete (*i).second; |
45 i = m_tests.erase (i); |
45 i = m_tests.erase (i); |
46 } |
46 } |
47 } |
47 } |
48 void |
48 void |
49 TestManager::add (Test *test, char const *name) |
49 TestManager::Add (Test *test, char const *name) |
50 { |
50 { |
51 get ()->m_tests.push_back (std::make_pair (test, new std::string (name))); |
51 Get ()->m_tests.push_back (std::make_pair (test, new std::string (name))); |
52 } |
52 } |
53 void |
53 void |
54 TestManager::enableVerbose (void) |
54 TestManager::EnableVerbose (void) |
55 { |
55 { |
56 get ()->m_verbose = true; |
56 Get ()->m_verbose = true; |
57 } |
57 } |
58 std::ostream & |
58 std::ostream & |
59 TestManager::failure (void) |
59 TestManager::Failure (void) |
60 { |
60 { |
61 return std::cerr; |
61 return std::cerr; |
62 } |
62 } |
63 bool |
63 bool |
64 TestManager::runTests (void) |
64 TestManager::RunTests (void) |
65 { |
65 { |
66 return get ()->realRunTests (); |
66 return Get ()->RealRunTests (); |
67 } |
67 } |
68 bool |
68 bool |
69 TestManager::realRunTests (void) |
69 TestManager::RealRunTests (void) |
70 { |
70 { |
71 bool isSuccess = true; |
71 bool isSuccess = true; |
72 for (TestsCI i = m_tests.begin (); i != m_tests.end (); i++) { |
72 for (TestsCI i = m_tests.begin (); i != m_tests.end (); i++) { |
73 std::string *testName = (*i).second; |
73 std::string *testName = (*i).second; |
74 if (!(*i).first->runTests ()) { |
74 if (!(*i).first->RunTests ()) { |
75 isSuccess = false; |
75 isSuccess = false; |
76 if (m_verbose) { |
76 if (m_verbose) { |
77 std::cerr << "FAIL " << *testName << std::endl; |
77 std::cerr << "FAIL " << *testName << std::endl; |
78 } |
78 } |
79 } else { |
79 } else { |