Musings from work
I admit that I do a terrible job in writing unit test to test out things and I am much more skillful at debugging massive systems (across > 100 machines). The other day my co-worker asked me how to test a C++ class' private method. I didn't know the answer and decided to google it. My eyes hurt after looking a some proposed solution -- some random internet dude suggested to do the following in unit tests:
#define private public
I almost died on the spot when I saw it. The better solution turns out to add the tester class as a friend class to the class to be tested.
Man, I wish I have more time to write more code.
Labels: programming

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home