[Cppunit-devel] CPPUnit Cookbook Bug
Brought to you by:
blep
From: Loh, C. W. <Cho...@au...> - 2002-05-30 05:16:04
|
In the line, #include <cppunit/extensions/HelperMacros.h > CPPUNIT_TEST_SUITE_REGISTRATION( ComplexNumber ); Behind the scene, a static variable type of AutoRegisterSuite is declared. On construction, it will register a TestSuiteFactory into the TestFactoryRegistry. The TestSuiteFactory returns the TestSuite returned by ComplexNumber::suite(). should be corrected as (highlighted in bold) :- #include <cppunit/extensions/HelperMacros.h > CPPUNIT_TEST_SUITE_REGISTRATION( ComplexNumberTest ); Behind the scene, a static variable type of AutoRegisterSuite is declared. On construction, it will register a TestSuiteFactory into the TestFactoryRegistry. The TestSuiteFactory returns the TestSuite returned by ComplexNumberTest::suite(). As a suggestion, you could improve the final example to use the other helper macros as well :- CPPUNIT_TEST_SUITE_REGISTRATION( ComplexNumberTest ); CPPUNIT_TEST_SUITE( ComplexNumberTest ); CPPUNIT_TEST( testEquality ); CPPUNIT_TEST( testAddition ); CPPUNIT_TEST_SUITE_END(); Cheers, Choo ACUS UNISYS Sydney, Australia Phone +61-2-9736-5524 Fax +61-2-9736-5600 NET2 780 5524 Internet mail address Cho...@au... |