So, imagine we have a class like this
class Testee
{
public:
void Func()
private:
void auxFunc()
};
and we want to do white-box unit-testing on it. Which do you think is a better approach? To declare the tester class a friend of the testee class? Or use the preprocessor like this:
class Testee
{
public:
void Func()
#ifndef UNITTEST_SYMBOL
private:
#elif
public:
#endif
void auxFunc()
};
and later in the testing file
#define UNITTEST_SYMBOL
#include "Testee.h"
#undef UNITTEST_SYMBOL
So, again, which do you think is a better approach? Or maybe you could suggest another approach. Thanks in advance.