Teuchos_UnitTestHelpers.hpp File Reference

Macros for expanding code. More...

#include "Teuchos_UnitTestBase.hpp"
Include dependency graph for Teuchos_UnitTestHelpers.hpp:
This graph shows which files directly or indirectly include this file:

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)
 Template instantiation for a single templated type.
#define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_FLOAT(TEST_GROUP, TEST_NAME)
#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_REAL_SCALAR_TYPES(TEST_GROUP, TEST_NAME)
 Instantiate a whole group of tests for supported real Scalar types.
#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 two template parameters.
#define TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT(TEST_GROUP, TEST_NAME, TYPE1, TYPE2)
 Template instantiation for two templated types.
#define TEUCHOS_UNIT_TEST_TEMPLATE_3_DECL(TEST_GROUP, TEST_NAME, TYPE1, TYPE2, TYPE3)
 Basic unit test creation macro for templated code on three template parameters.
#define TEUCHOS_UNIT_TEST_TEMPLATE_3_INSTANT(TEST_GROUP, TEST_NAME, TYPE1, TYPE2, TYPE3)
 Template instantiation for two templated types.
#define TEUCHOS_STATIC_SETUP()
 Run setup code statically in a translation unit.

Detailed Description

Macros for expanding code.

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);

Template instantiation for a single templated type.

Definition at line 81 of file Teuchos_UnitTestHelpers.hpp.

#define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_FLOAT ( TEST_GROUP,
TEST_NAME   ) 

Definition at line 92 of file Teuchos_UnitTestHelpers.hpp.

#define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_DOUBLE ( TEST_GROUP,
TEST_NAME   )     TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT(TEST_GROUP, TEST_NAME, double)

Definition at line 95 of file Teuchos_UnitTestHelpers.hpp.

#define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_COMPLEX_FLOAT ( TEST_GROUP,
TEST_NAME   ) 

Definition at line 103 of file Teuchos_UnitTestHelpers.hpp.

#define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_COMPLEX_DOUBLE ( TEST_GROUP,
TEST_NAME   ) 

Definition at line 111 of file Teuchos_UnitTestHelpers.hpp.

#define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_REAL_SCALAR_TYPES ( TEST_GROUP,
TEST_NAME   ) 
Value:

Instantiate a whole group of tests for supported real Scalar types.

Definition at line 118 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 124 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 two template parameters.

Definition at line 132 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);

Template instantiation for two templated types.

Definition at line 154 of file Teuchos_UnitTestHelpers.hpp.

#define TEUCHOS_UNIT_TEST_TEMPLATE_3_DECL ( TEST_GROUP,
TEST_NAME,
TYPE1,
TYPE2,
TYPE3   ) 
Value:
template<class TYPE1, class TYPE2, class TYPE3> \
  class TEST_GROUP##_##TEST_NAME##_UnitTest : public Teuchos::UnitTestBase \
  { \
  public: \
    TEST_GROUP##_##TEST_NAME##_UnitTest( \
      const std::string& type1Name, \
      const std::string& type2Name, \
      const std::string& type3Name \
       ) \
      :Teuchos::UnitTestBase( \
         std::string(#TEST_GROUP)+"_"+type1Name+"_"+type2Name+"_"+type3Name, #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, class TYPE3> \
  void TEST_GROUP##_##TEST_NAME##_UnitTest<TYPE1,TYPE2,TYPE3>::runUnitTestImpl( \
    Teuchos::FancyOStream &out, bool &success ) const \

Basic unit test creation macro for templated code on three template parameters.

Definition at line 161 of file Teuchos_UnitTestHelpers.hpp.

#define TEUCHOS_UNIT_TEST_TEMPLATE_3_INSTANT ( TEST_GROUP,
TEST_NAME,
TYPE1,
TYPE2,
TYPE3   ) 
Value:
\
  template class TEST_GROUP##_##TEST_NAME##_UnitTest<TYPE1, TYPE2, TYPE3 >; \
  TEST_GROUP##_##TEST_NAME##_UnitTest<TYPE1, TYPE2, TYPE3 > \
  instance_##TEST_GROUP##_##TYPE1##_##TYPE2##_##TYPE3##_##TEST_NAME##_UnitTest(#TYPE1,#TYPE2,#TYPE3);

Template instantiation for two templated types.

Definition at line 184 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 210 of file Teuchos_UnitTestHelpers.hpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Tue Oct 20 10:14:02 2009 for Teuchos Package Browser (Single Doxygen Collection) by  doxygen 1.6.1