using boost::test to test private methods
I've searched a little bit, but having some difficulties finding good examples. So, I have a template class, in which I'm trying to test some private methods. Let's table the philosophical reasons for doing so, I'm just having difficulties setting up the mechanics of it. The best way I've seen, is to make a testing class a friend of class to be tested. My class to be tested is in a namespace, that the test cases are not members of. I'm running into all sorts of compiler errors. Does anyone have sample code about making this work. Strategies for separating the test code from the production code as much as possible? This is a first stab at automatic unit testing for me, so any assistance would be great. Thanks --dw
david.weber@l-3com.com schrieb:
The best way I've seen, is to make a testing class a friend of class to be tested. My class to be tested is in a namespace, that the test cases are not members of. I'm running into all sorts of compiler errors.
Does anyone have sample code about making this work.
Well, if you just want to add a friend which isn't in your namespace, why dont do this: namespace foo { class A { friend ::other_namespace::the_friend; }; } ? Using :: in front of a type gets out of the current namespace. I hope I could help, Max
participants (2)
-
david.weber@l-3com.com
-
Maximilian Matthe