Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/ode/ode-0.9/tests/CppTestHarness/Test.cpp @ 216

Last change on this file since 216 was 216, checked in by mathiask, 16 years ago

[Physik] add ode-0.9

File size: 950 bytes
Line 
1#include "Test.h"
2#include "TestResults.h"
3
4#ifdef TRANSLATE_POSIX_SIGNALS
5        #include "SignalTranslator.h"
6#endif
7
8namespace CppTestHarness
9{
10
11Test::Test(std::string const testName, std::string const filename, int const lineNumber)
12        : m_testName(testName)
13        , m_filename(filename)
14        , m_lineNumber(lineNumber)
15{
16}
17
18Test::~Test()
19{
20}
21
22void Test::Run(TestResults& testResults)
23{
24        try
25        {
26#ifdef TRANSLATE_POSIX_SIGNALS
27                //add any signals you want translated into system exceptions here
28                SignalTranslator<SIGSEGV> sigSEGV;
29                SignalTranslator<SIGFPE> sigFPE;
30                SignalTranslator<SIGBUS> sigBUS;
31#endif
32                RunImpl(testResults);
33        }
34        catch (std::exception const& e)
35        {
36                std::string msg = "Unhandled exception: ";
37                msg += e.what();
38                testResults.ReportFailure(m_filename.c_str(), m_lineNumber, msg);
39        }
40        catch (...)
41        {
42                testResults.ReportFailure(m_filename.c_str(), m_lineNumber, "Unhandled exception: crash!");
43        }
44
45
46        testResults.ReportDone(m_testName);
47}
48}
49
Note: See TracBrowser for help on using the repository browser.