Teuchos - Trilinos Tools Package Version of the Day
Defines
Unit Testing Definition Macros
Unit Testing Support

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_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 three templated types.
#define TEUCHOS_UNIT_TEST_TEMPLATE_4_DECL(TEST_GROUP, TEST_NAME, TYPE1, TYPE2, TYPE3, TYPE4)
 Basic unit test creation macro for templated code on four template parameters.
#define TEUCHOS_UNIT_TEST_TEMPLATE_4_INSTANT(TEST_GROUP, TEST_NAME, TYPE1, TYPE2, TYPE3, TYPE4)
 Template instantiation for four templated types.

Detailed Description

There macros are used to define individual unit test code blocks. For example:

TEUCHOS_UNIT_TEST(SomeTestGroup, SomeTestName)
{
  int i = 1;
  TEST_EQUALITY_CONST(i, 1);
  int j = 2;
  TEST_EQUALITY_CONST(j, 2);
  TEST_INEQUALITY_CONST(i, j);
  ...
}

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 60 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 84 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 106 of file Teuchos_UnitTestHelpers.hpp.

#define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_REAL_SCALAR_TYPES (   TEST_GROUP,
  TEST_NAME 
)
Value:
TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_FLOAT(TEST_GROUP, TEST_NAME) \
  TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_DOUBLE(TEST_GROUP, TEST_NAME)

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

Definition at line 145 of file Teuchos_UnitTestHelpers.hpp.

#define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_SCALAR_TYPES (   TEST_GROUP,
  TEST_NAME 
)
Value:
TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_FLOAT(TEST_GROUP, TEST_NAME) \
  TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_DOUBLE(TEST_GROUP, TEST_NAME) \
  TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_COMPLEX_FLOAT(TEST_GROUP, TEST_NAME) \
  TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_COMPLEX_DOUBLE(TEST_GROUP, TEST_NAME)

Instantiate a whole group of tests for supported Scalar types.

Definition at line 154 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 166 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 191 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 203 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 three templated types.

Definition at line 230 of file Teuchos_UnitTestHelpers.hpp.

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

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

Definition at line 242 of file Teuchos_UnitTestHelpers.hpp.

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

Template instantiation for four templated types.

Definition at line 270 of file Teuchos_UnitTestHelpers.hpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines