Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean Up Testing Class Instantiations #243

Open
pbauman opened this issue May 13, 2017 · 1 comment
Open

Clean Up Testing Class Instantiations #243

pbauman opened this issue May 13, 2017 · 1 comment

Comments

@pbauman
Copy link
Member

pbauman commented May 13, 2017

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.

@pbauman
Copy link
Member Author

pbauman commented May 13, 2017

Hmm, the mark down is munging the public BaseClass<Scalar>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant