Sidetracked by the Reality of Legacy Code

Our test suite fails! For each test, CppUTest compares memory at the start of its execution with memory at its completion and fails if there’s a mismatch. With a bit of probing, we discover the leaker culprit to be either the third-party logging library, rlog, or our WavReader application’s use of rlog. Dealing with the leak isn’t our primary goal. We need a way to move forward.

CppUTest allows us to turn off leak detection, but it’s a highly useful feature that we want to keep. Further, even if we turned off leak detection, the logging code—which appears throughout WavReader—spews messages onto the console every time we run tests. It’s a nuisance. What might we do other than grin and bear it? It’s possible ...

Get Modern C++ Programming with Test-Driven Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.