diff options
author | sanine <sanine.not@pm.me> | 2022-10-01 20:59:36 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2022-10-01 20:59:36 -0500 |
commit | c5fc66ee58f2c60f2d226868bb1cf5b91badaf53 (patch) | |
tree | 277dd280daf10bf77013236b8edfa5f88708c7e0 /libs/ode-0.16.1/tests/UnitTest++/src/Test.cpp | |
parent | 1cf9cc3408af7008451f9133fb95af66a9697d15 (diff) |
add ode
Diffstat (limited to 'libs/ode-0.16.1/tests/UnitTest++/src/Test.cpp')
-rw-r--r-- | libs/ode-0.16.1/tests/UnitTest++/src/Test.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/libs/ode-0.16.1/tests/UnitTest++/src/Test.cpp b/libs/ode-0.16.1/tests/UnitTest++/src/Test.cpp new file mode 100644 index 0000000..943fced --- /dev/null +++ b/libs/ode-0.16.1/tests/UnitTest++/src/Test.cpp @@ -0,0 +1,62 @@ +#include "Config.h" +#include "Test.h" +#include "TestList.h" +#include "TestResults.h" +#include "AssertException.h" +#include "MemoryOutStream.h" + +#ifdef UNITTEST_POSIX + #include "Posix/SignalTranslator.h" +#endif + +namespace UnitTest { + +TestList& Test::GetTestList() +{ + static TestList s_list; + return s_list; +} + +Test::Test(char const* testName, char const* suiteName, char const* filename, int const lineNumber) + : m_details(testName, suiteName, filename, lineNumber) + , next(0) + , m_timeConstraintExempt(false) +{ +} + +Test::~Test() +{ +} + +void Test::Run(TestResults& testResults) const +{ + try + { +#ifdef UNITTEST_POSIX + UNITTEST_THROW_SIGNALS +#endif + RunImpl(testResults); + } + catch (AssertException const& e) + { + testResults.OnTestFailure( TestDetails(m_details.testName, m_details.suiteName, e.Filename(), e.LineNumber()), e.what()); + } + catch (std::exception const& e) + { + MemoryOutStream stream; + stream << "Unhandled exception: " << e.what(); + testResults.OnTestFailure(m_details, stream.GetText()); + } + catch (...) + { + testResults.OnTestFailure(m_details, "Unhandled exception: Crash!"); + } +} + + +void Test::RunImpl(TestResults&) const +{ +} + + +} |