diff options
author | vng <viktor.govako@gmail.com> | 2014-10-14 12:40:28 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:30:52 +0300 |
commit | 9c448faaf31a6f5be849dec8208584a138213485 (patch) | |
tree | fa91e1694526c5ebe0e463ac18f0148b041087ce /testing | |
parent | 4cc9fd6914d548e2649d6e7c01835d3ab67993ad (diff) |
Removed unused includes in base files.
Diffstat (limited to 'testing')
-rw-r--r-- | testing/testing.hpp | 5 | ||||
-rw-r--r-- | testing/testingmain.cpp | 14 | ||||
-rw-r--r-- | testing/testregister.hpp | 49 |
3 files changed, 37 insertions, 31 deletions
diff --git a/testing/testing.hpp b/testing/testing.hpp index bd62c4d15b..df678f7219 100644 --- a/testing/testing.hpp +++ b/testing/testing.hpp @@ -1,13 +1,14 @@ #pragma once #include "testregister.hpp" -#include "../base/assert.hpp" -#include "../base/base.hpp" + #include "../base/exception.hpp" #include "../base/math.hpp" #include "../base/src_point.hpp" + #include "../std/iostream.hpp" #include "../std/string.hpp" + #define UNIT_TEST(name) \ void UnitTest_##name(); \ TestRegister g_TestRegister_##name(#name, __FILE__, &UnitTest_##name); \ diff --git a/testing/testingmain.cpp b/testing/testingmain.cpp index 1216cc9390..dda353a36e 100644 --- a/testing/testingmain.cpp +++ b/testing/testingmain.cpp @@ -1,12 +1,14 @@ #include "testregister.hpp" #include "testing.hpp" + #include "../base/logging.hpp" -#include "../std/algorithm.hpp" + #include "../std/iostream.hpp" #include "../std/string.hpp" #include "../std/vector.hpp" #include "../std/target_os.hpp" + #ifdef OMIM_UNIT_TEST_WITH_QT_EVENT_LOOP #include <Qt> #ifdef OMIM_OS_MAC // on Mac OS X native run loop works only for QApplication :( @@ -68,6 +70,7 @@ int main(int argc, char * argv[]) cerr << "\n\nSOMETHING IS REALLY WRONG IN THE UNIT TEST FRAMEWORK!!!" << endl; return 5; } + try { // Run the test. @@ -85,16 +88,19 @@ int main(int argc, char * argv[]) ++numFailedTests; } - } catch (TestFailureException const & ) + } + catch (TestFailureException const & ) { testResults[iTest] = false; ++numFailedTests; - } catch (std::exception const & ex) + } + catch (std::exception const & ex) { cerr << "FAILED" << endl << "<<<Exception thrown [" << ex.what() << "].>>>" << endl; testResults[iTest] = false; ++numFailedTests; - } catch (...) + } + catch (...) { cerr << "FAILED" << endl << "<<<Unknown exception thrown.>>>" << endl; testResults[iTest] = false; diff --git a/testing/testregister.hpp b/testing/testregister.hpp index 803413473a..0c2ab2351c 100644 --- a/testing/testregister.hpp +++ b/testing/testregister.hpp @@ -1,36 +1,35 @@ #pragma once -#include "../base/base.hpp" class TestRegister { public: - TestRegister(char const * testName, char const * fileName, void (* fnTest)()) - : m_TestName(testName), m_FileName(fileName), m_Fn(fnTest), m_pNext(NULL) + TestRegister(char const * testName, char const * fileName, void (* fnTest)()) + : m_TestName(testName), m_FileName(fileName), m_Fn(fnTest), m_pNext(0) + { + if (FirstRegister() == 0) + FirstRegister() = this; + else { - if (FirstRegister() == NULL) - FirstRegister() = this; - else - { - TestRegister * pLast = FirstRegister(); - while (pLast->m_pNext) - pLast = pLast->m_pNext; - pLast->m_pNext = this; - } + TestRegister * pLast = FirstRegister(); + while (pLast->m_pNext) + pLast = pLast->m_pNext; + pLast->m_pNext = this; } + } - // Test name. - char const * m_TestName; - // File name. - char const * m_FileName; - // Function to run test. - void (* m_Fn)(); - // Next test in chain. - TestRegister * m_pNext; + // Test name. + char const * m_TestName; + // File name. + char const * m_FileName; + // Function to run test. + void (* m_Fn)(); + // Next test in chain. + TestRegister * m_pNext; - static TestRegister * & FirstRegister() - { - static TestRegister * s_pRegister = 0; - return s_pRegister; - } + static TestRegister * & FirstRegister() + { + static TestRegister * s_pRegister = 0; + return s_pRegister; + } }; |