Skip to content

Clean Up Testing Class Instantiations #243

@pbauman

Description

@pbauman

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions