25 Jun
2015
25 Jun
'15
9:02 p.m.
On 6/25/2015 3:52 PM, Jürgen Hunold wrote:
In my opinion, a test should never access private data. But there are times and legacy code where I had no other choice, too. The classes I am testing use the PIMPL idiom. Therefore, at a bare minimum, the tests have to access the private pointer in the public class that points to the accompanying private class. Since all of the class's data is inside the private class, it make it extremely difficult to write unit tests that determine if the class state is correct. I see no value in the purist notion that I should have to jump through hundreds of hoops deducing the internal state /just/ so I can say my test never accessed any private data.