I have a simple function that I want to test. The function is performed as follows:
void func()
{
...
if(error_detected)
{
fatal_error("failure...");
exit(1);
}
}
Now I need to write a test that generates an error. Only output (1) does the test fail, however!
How is this case usually handled?
I can rewrite / change the function code, since I have full control over the entire project. However, I am using cppunit and hope that I will succeed as one of the tests in the package.
Update:
, : , - , , , , , ? , , . , . , 100% ( , .)