Let's say I have a simple HelloWorld
class with a hi()
method with the following single line of code:
void HelloWorld::hi(){
printf("Hi!\n");
}
Now let's say I want to test that method with CppUnit.
void HelloWorldTests::testHi() {
HelloWorld hw;
hw.hi(); // <------ ????
// <------ ?????
CPPUNIT_ASSERT(/*????*/);
}
How would I catch the output of the hi()
method so that I can compare it to a fixed value in CppUnit?