Each push() results in one call to operator new and each stack copy results in a call to operator new (via push() ) per node in the original stack. To achieve full coverage operator new needs to return a null pointer (simulating an out of memory error). The previously unexecuted false branch of the if statement will then be used and the new_error exception thrown. To force such a return, and thus exercise complete control of the execution of the software under test, the call to operator new is wrapped. That is, additional functions are introduced which intercept the parameters sent and manipulate the data returned.

To use wrappers, a wrapper template file is produced.

Next: Generating Wrapper Templates