1 #ifndef UNITTEST_EXECUTE_TEST_H
2 #define UNITTEST_EXECUTE_TEST_H
5 #include "ExceptionMacros.h"
6 #include "TestDetails.h"
7 #include "TestResults.h"
8 #include "MemoryOutStream.h"
9 #include "AssertException.h"
10 #include "CurrentTest.h"
12 #ifdef UNITTEST_NO_EXCEPTIONS
13 #include "ReportAssertImpl.h"
17 #include "Posix/SignalTranslator.h"
22 template<
typename T >
23 void ExecuteTest(T& testObject, TestDetails
const& details,
bool isMockTest)
25 if (isMockTest ==
false)
26 CurrentTest::Details() = &details;
28 #ifdef UNITTEST_NO_EXCEPTIONS
29 if (UNITTEST_SET_ASSERT_JUMP_TARGET() == 0)
32 #ifndef UNITTEST_POSIX
33 UT_TRY({ testObject.RunImpl(); })
37 UNITTEST_THROW_SIGNALS_POSIX_ONLY
41 UT_CATCH(AssertException, e, { (void)e; })
42 UT_CATCH(std::exception, e,
44 MemoryOutStream stream;
45 stream <<
"Unhandled exception: " << e.what();
46 CurrentTest::Results()->OnTestFailure(details, stream.GetText());
50 CurrentTest::Results()->OnTestFailure(details,
"Unhandled exception: test crashed");
52 #ifdef UNITTEST_NO_EXCEPTIONS