// --- Hello, world! For cppunit # include <iostream> # include <cppunit/testrunner. h> # include <cppunit/testresult. h> # include <cppunit/testresultcollector. h> # include <cppunit/extensions/helpermacros. h> # include <cppunit/brieftestprogresslistener. h> # include <cppunit/extensions/testfactoryregistry. h> class test: Public cppunit_ns: testcase {cppunit_test_suite (TEST); cppunit_test (testhelloworld); cppunit_test_suite_end (); Publ IC: void setup (void) {} void teardown (void) {} protected: void testhelloworld (void) {STD: cout <"Hello, world! "<STD: Endl ;}}; cppunit_test_suite_registration (TEST); int main (int ac, char *** AV) {// --- create the event manager and test controller cppunit_ns:: testresult Controller; // --- add a listener that colllects test result cppunit_ns: testresultcollector result; controller. addlistener (& result); // --- add a listener that print dots as test run. cppunit_ns: brieftestprogresslistener progress; contro Roller. addlistener (& progress); // --- add the top suite to the test runner cppunit_ns: testrunner runner; runner. addtest (cppunit_ns: testfactoryregistry: getregistry (). maketest (); runner. run (Controller); return result. wassuccessful ()? 0: 1 ;}