
Is there a way to test the private functions of a class without moving them into public scope during test?
What are some strategies for this?
I was hoping to add "friend class boost::unit_test::test_suite;" to my class but that didn't work.
Putting aside "why would you need that" question, simple answer is: define test case as a friend to your class. For example if you want to implement test case as free function: class Foo { friend void foo_test(); void private_method(); }; void foo_test() { Foo f; f.private_method(); } If you need multiple test cases having access to the internals you could define test class and make it friend of your class. Next all your test cases will instantiate test class and run test methods. Gennadiy