Sacado Package Browser (Single Doxygen Collection) Version of the Day
Classes | Defines
FadUnitTests.hpp File Reference
#include "Sacado.hpp"
#include "Sacado_Random.hpp"
#include "Fad/fad.h"
#include <cppunit/extensions/HelperMacros.h>
Include dependency graph for FadUnitTests.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  FadOpsUnitTest< FadType, ScalarType >

Defines

#define COMPARE_VALUES(a, b)   CPPUNIT_ASSERT( std::abs(a-b) < this->tol_a + this->tol_r*std::abs(a) );
#define COMPARE_FADS(a, b)
#define BINARY_OP_TEST(TESTNAME, OP)
#define RELOP_TEST(TESTNAME, OP)
#define BINARY_FUNC_TEST(TESTNAME, FUNC)
#define UNARY_OP_TEST(TESTNAME, OP)
#define UNARY_FUNC_TEST(TESTNAME, FUNC)
#define UNARY_ASSIGNOP_TEST(TESTNAME, OP)

Define Documentation

#define COMPARE_VALUES (   a,
 
)    CPPUNIT_ASSERT( std::abs(a-b) < this->tol_a + this->tol_r*std::abs(a) );

Definition at line 45 of file FadUnitTests.hpp.

#define COMPARE_FADS (   a,
 
)
Value:
CPPUNIT_ASSERT(a.size() == b.size());     \
CPPUNIT_ASSERT(a.hasFastAccess() == b.hasFastAccess()); \
COMPARE_VALUES(a.val(), b.val());     \
for (int i=0; i<a.size(); i++) {      \
  COMPARE_VALUES(a.dx(i), b.dx(i));     \
  COMPARE_VALUES(a.fastAccessDx(i), b.fastAccessDx(i)); \
 }              \
 ;

Definition at line 48 of file FadUnitTests.hpp.

#define BINARY_OP_TEST (   TESTNAME,
  OP 
)
Value:
void TESTNAME () {        \
    c_dfad = a_dfad OP b_dfad;      \
    c_fad = a_fad OP b_fad;     \
    COMPARE_FADS(c_dfad, c_fad);      \
            \
    double val = urand.number();    \
    c_dfad = a_dfad OP val;     \
    c_fad = a_fad OP val;     \
    COMPARE_FADS(c_dfad, c_fad);      \
            \
    c_dfad = val OP b_dfad;     \
    c_fad = val OP b_fad;     \
    COMPARE_FADS(c_dfad, c_fad);      \
  }

Definition at line 58 of file FadUnitTests.hpp.

#define RELOP_TEST (   TESTNAME,
  OP 
)
Value:
void TESTNAME () {        \
    bool r1 = a_dfad OP b_dfad;     \
    bool r2 = a_fad OP b_fad;     \
    CPPUNIT_ASSERT(r1 == r2);     \
            \
    double val = urand.number();    \
    r1 = a_dfad OP val;             \
    r2 = a_fad OP val;              \
    CPPUNIT_ASSERT(r1 == r2);     \
            \
    r1 = val OP b_dfad;             \
    r2 = val OP b_fad;              \
    CPPUNIT_ASSERT(r1 == r2);     \
  }

Definition at line 74 of file FadUnitTests.hpp.

#define BINARY_FUNC_TEST (   TESTNAME,
  FUNC 
)
Value:
void TESTNAME () {      \
    c_dfad = FUNC (a_dfad,b_dfad);  \
    c_fad = FUNC (a_fad,b_fad);   \
    COMPARE_FADS(c_dfad, c_fad);    \
              \
    double val = urand.number();  \
    c_dfad = FUNC (a_dfad,val);   \
    c_fad = FUNC (a_fad,val);   \
    COMPARE_FADS(c_dfad, c_fad);    \
              \
    c_dfad = FUNC (val,b_dfad);   \
    c_fad = FUNC (val,b_fad);   \
    COMPARE_FADS(c_dfad, c_fad);    \
  }

Definition at line 90 of file FadUnitTests.hpp.

#define UNARY_OP_TEST (   TESTNAME,
  OP 
)
Value:
void TESTNAME () {          \
    c_dfad = OP a_dfad;         \
    c_fad = OP a_fad;         \
    COMPARE_FADS(c_dfad, c_fad);        \
  }

Definition at line 106 of file FadUnitTests.hpp.

#define UNARY_FUNC_TEST (   TESTNAME,
  FUNC 
)
Value:
void TESTNAME () {          \
    c_dfad = FUNC (a_dfad);       \
    c_fad = FUNC (a_fad);       \
    COMPARE_FADS(c_dfad, c_fad);        \
  }

Definition at line 113 of file FadUnitTests.hpp.

#define UNARY_ASSIGNOP_TEST (   TESTNAME,
  OP 
)
Value:
void TESTNAME () {          \
    c_dfad OP a_dfad;         \
    c_fad OP a_fad;         \
    COMPARE_FADS(c_dfad, c_fad);        \
              \
    double val = urand.number();      \
    c_dfad OP val;          \
    c_fad OP val;         \
    COMPARE_FADS(c_dfad, c_fad);        \
  }

Definition at line 120 of file FadUnitTests.hpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines