Teuchos_UnitTestHelpers.hpp File Reference

Macros for helping to create concrete unit tests. More...

#include "Teuchos_UnitTestBase.hpp"

Go to the source code of this file.

Defines

#define TEUCHOS_UNIT_TEST(TEST_GROUP, TEST_NAME)
 Basic unit test creation macro for non-templated code.
#define TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL(TEST_GROUP, TEST_NAME, TYPE)
 Basic unit test creation macro for templated code on one template parameter.
#define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT(TEST_GROUP, TEST_NAME, TYPE)
 Tempalte instantiation for a single templated type.
#define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_FLOAT(TEST_GROUP, TEST_NAME)   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT(TEST_GROUP, TEST_NAME, float)
#define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_DOUBLE(TEST_GROUP, TEST_NAME)   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT(TEST_GROUP, TEST_NAME, double)
#define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_COMPLEX_FLOAT(TEST_GROUP, TEST_NAME)
#define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_COMPLEX_DOUBLE(TEST_GROUP, TEST_NAME)
#define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_SCALAR_TYPES(TEST_GROUP, TEST_NAME)
 Instantiate a whole group of tests for supported Scalar types.
#define TEUCHOS_UNIT_TEST_TEMPLATE_2_DECL(TEST_GROUP, TEST_NAME, TYPE1, TYPE2)
 Basic unit test creation macro for templated code on one template parameter.
#define TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT(TEST_GROUP, TEST_NAME, TYPE1, TYPE2)
 Tempalte instantiation for a single templated type.
#define TEUCHOS_STATIC_SETUP()
 Run setup code statically in a translation unit.


Detailed Description

Macros for helping to create concrete unit tests.

Definition in file Teuchos_UnitTestHelpers.hpp.


Define Documentation

#define TEUCHOS_UNIT_TEST ( TEST_GROUP,
TEST_NAME   ) 

Value:

class TEST_GROUP##_##TEST_NAME##_UnitTest : public Teuchos::UnitTestBase \
  { \
  public: \
    TEST_GROUP##_##TEST_NAME##_UnitTest() \
      : Teuchos::UnitTestBase( #TEST_GROUP, #TEST_NAME ) \
    {} \
    virtual void runUnitTestImpl( Teuchos::FancyOStream &out, bool &success ) const; \
    virtual std::string unitTestFile() const { return __FILE__; } \
    virtual long int unitTestFileLineNumber() const { return __LINE__; } \
  }; \
  \
  TEST_GROUP##_##TEST_NAME##_UnitTest \
    instance_##TEST_GROUP##_##TEST_NAME##_UnitTest; \
  \
  void TEST_GROUP##_##TEST_NAME##_UnitTest::runUnitTestImpl( \
    Teuchos::FancyOStream &out, bool &success ) const \
Basic unit test creation macro for non-templated code.

Definition at line 43 of file Teuchos_UnitTestHelpers.hpp.

#define TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL ( TEST_GROUP,
TEST_NAME,
TYPE   ) 

Value:

template<class TYPE> \
  class TEST_GROUP##_##TEST_NAME##_UnitTest : public Teuchos::UnitTestBase \
  { \
  public: \
    TEST_GROUP##_##TEST_NAME##_UnitTest(const std::string& typeName) \
      : Teuchos::UnitTestBase( std::string(#TEST_GROUP)+"_"+typeName, #TEST_NAME ) \
    {} \
    void runUnitTestImpl( Teuchos::FancyOStream &out, bool &success ) const; \
    virtual std::string unitTestFile() const { return __FILE__; } \
    virtual long int unitTestFileLineNumber() const { return __LINE__; } \
  }; \
  \
  template<class TYPE> \
  void TEST_GROUP##_##TEST_NAME##_UnitTest<TYPE>::runUnitTestImpl( \
    Teuchos::FancyOStream &out, bool &success ) const \
Basic unit test creation macro for templated code on one template parameter.

Definition at line 63 of file Teuchos_UnitTestHelpers.hpp.

#define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT ( TEST_GROUP,
TEST_NAME,
TYPE   ) 

Value:

\
  template class TEST_GROUP##_##TEST_NAME##_UnitTest<TYPE>; \
  TEST_GROUP##_##TEST_NAME##_UnitTest<TYPE> \
  instance_##TEST_GROUP##_##TYPE##_##TEST_NAME##_UnitTest(#TYPE);
Tempalte instantiation for a single templated type.

Definition at line 81 of file Teuchos_UnitTestHelpers.hpp.

#define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_SCALAR_TYPES ( TEST_GROUP,
TEST_NAME   ) 

Value:

Instantiate a whole group of tests for supported Scalar types.

Definition at line 112 of file Teuchos_UnitTestHelpers.hpp.

#define TEUCHOS_UNIT_TEST_TEMPLATE_2_DECL ( TEST_GROUP,
TEST_NAME,
TYPE1,
TYPE2   ) 

Value:

template<class TYPE1, class TYPE2> \
  class TEST_GROUP##_##TEST_NAME##_UnitTest : public Teuchos::UnitTestBase \
  { \
  public: \
    TEST_GROUP##_##TEST_NAME##_UnitTest( \
      const std::string& type1Name, \
      const std::string& type2Name \
       ) \
      :Teuchos::UnitTestBase( \
         std::string(#TEST_GROUP)+"_"+type1Name+"_"+type2Name, #TEST_NAME ) \
    {} \
    void runUnitTestImpl( Teuchos::FancyOStream &out, bool &success ) const; \
    virtual std::string unitTestFile() const { return __FILE__; } \
    virtual long int unitTestFileLineNumber() const { return __LINE__; } \
  }; \
  \
  template<class TYPE1, class TYPE2> \
  void TEST_GROUP##_##TEST_NAME##_UnitTest<TYPE1,TYPE2>::runUnitTestImpl( \
    Teuchos::FancyOStream &out, bool &success ) const \
Basic unit test creation macro for templated code on one template parameter.

Definition at line 120 of file Teuchos_UnitTestHelpers.hpp.

#define TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT ( TEST_GROUP,
TEST_NAME,
TYPE1,
TYPE2   ) 

Value:

\
  template class TEST_GROUP##_##TEST_NAME##_UnitTest<TYPE1, TYPE2 >; \
  TEST_GROUP##_##TEST_NAME##_UnitTest<TYPE1, TYPE2 > \
  instance_##TEST_GROUP##_##TYPE1##_##TYPE2##_##TEST_NAME##_UnitTest(#TYPE1,#TYPE2);
Tempalte instantiation for a single templated type.

Definition at line 142 of file Teuchos_UnitTestHelpers.hpp.

 
#define TEUCHOS_STATIC_SETUP (  ) 

Value:

class StaticSetup { \
  public: \
    StaticSetup(); \
  } staticSetup; \
  \
  StaticSetup::StaticSetup()
Run setup code statically in a translation unit.

NOTE: Make sure the call this in an anonymous namespace as:

 namespace {

 TEUCHOS_STATIC_SETUP()
 {
   // Some code you want to call before main() runs ...
   ...
 }

 } // namespace

 

Definition at line 168 of file Teuchos_UnitTestHelpers.hpp.


Generated on Wed May 12 21:40:33 2010 for Teuchos - Trilinos Tools Package by  doxygen 1.4.7