
[Please do not mail me a copy of your followup] boost-users@lists.boost.org spake the secret code <87pqfhijjd.fsf@avasys.jp> thusly:
Chris Cleeland
writes: I'm using the boost unit test framework to implement unit tests for code. I'm wondering if there is a best-practice for doing white-box testing/internal state inspection of types under test. My hack right now is to strip out "protected" and "private" from the header, but I hold my nose as I do that.
I don't use private members in the header file and put a subclass in the test implementation that makes the parent class' protected API public. [...]
I do this with legacy code, i.e. code that wasn't designed with testing in mind. However, I find that I don't need to do this when I practice TDD because the classes were designed to be testable in the first place. -- "The Direct3D Graphics Pipeline" -- DirectX 9 version available for download http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/ Legalize Adulthood! http://legalizeadulthood.wordpress.com