It would be useful to have a CU_ASSERT_FATAL(_XXX) set of macros which allow a unit test to clean up after itself.
In my code I added a CU_ASSERT_END macro, which, on failure, jumps to the CU_END label (which a unit test function must define) in order to allow a unit test to perform test-specific clean-up (eg, memory deallocation).
This naive implementation only aborts the current function; not the entire call-chain as the _FATAL macros do, but this is sufficient for my current simplistic unit tests.
int _testresult; \ CU_ASSERT( _testresult = (_TEST) ); \ if(!_testresult) { goto CU_END; } \ } while(0)
Thoughts?
Anonymous