antioch
antioch copied to clipboard
Clean Up Testing Class Instantiations
Before it occurred to me to use a macro, there's at least 3 different testing classes to get registered with CppUnit (float, double, long double). Of course, this make it easy to add a test to one and forget the others. In #240, it occurred to me we can use a macro along these lines:
#define DEFINE_NASA7XMLPARSING_SCALAR_TEST(Classname,BaseClass,Scalar) \ class Classname : public BaseClass\ { \ public: \ CPPUNIT_TEST_SUITE( Classname ); \ CPPUNIT_TEST(test_supplied_species); \ CPPUNIT_TEST(test_parsed_species_list); \ CPPUNIT_TEST(test_gri30_xml); \ CPPUNIT_TEST_SUITE_END(); \ } DEFINE_NASA7XMLPARSING_SCALAR_TEST(NASA7XMLParsingTestFloat,NASA7XMLParsingTest,float); DEFINE_NASA7XMLPARSING_SCALAR_TEST(NASA7XMLParsingTestDouble,NASA7XMLParsingTest,double); DEFINE_NASA7XMLPARSING_SCALAR_TEST(NASA7XMLParsingTestLongDouble,NASA7XMLParsingTest,long double); CPPUNIT_TEST_SUITE_REGISTRATION( NASA7XMLParsingTestFloat ); CPPUNIT_TEST_SUITE_REGISTRATION( NASA7XMLParsingTestDouble ); CPPUNIT_TEST_SUITE_REGISTRATION( NASA7XMLParsingTestLongDouble );
where the base testing class is templated on the Scalar
type.
So let's go back and clean up all the other tests that aren't doing this.