From: Hicham Mouline
Because RemoveSimulation(....) takes arguments which are not available inside the SimulatonId object/destructor.
Hi Hicham, In our test suites we deal with this problem by using an own special implementation of the assert() function. In this assert, called dynamicAssert() or runTimeAssert(), we call the real assert() only if the application is not running under test application. If running under test, we throw an special exception type instead, e.g. AssertionEx. This exception can be caught by the UTF and tested by Test-Tools. The exception instance can hold some information from the assert, like file and line, which can be printed out by a special exception handler, that must be registered for the UTF. Some example code: // runtimeAssert.h defines an own assertion macro for the user code struct AssertionEx; extern void runtimeAssert_( const char* exp, const char* file, unsigned long nLineNo ) throw AssertionEx; #define dynamicAssert ( exp ) \ (void)((exp) || (runtimeAssert_(#exp, __FILE__, __LINE__), 0 ) ) // runtimeassert.cpp with special assert() implementation struct AssertionEx { const char* exp_; const char* file_; unsigned long lineNo_; AssertionEx( const char* exp, const char* file, unsigned long line ) : exp_(exp), file_(file), lineNo_(line) {} }; static bool runningUnderTest = false; void runUnderTest() // must be called once by your test application main() { runningUnderTest = true; } extern "C" { #include <assert.h> } void runtimeAssert_( const char* exp, const char* file, unsigned long nLineNo ) throw AssertionEx { if (runningUnderTest) throw AssertionEx( exp, file, lineNo ); else _assert( exp, file, lineNo ); // call your compiler specific assert implementation } *** The information in this e-mail is confidential and intended solely for the individual or entity to whom it is addressed. If you have received this e-mail in error please notify the sender by return e-mail delete this e-mail and refrain from any disclosure or action based on the information. ***