32 #ifndef LOGICALSPARSEUNITTESTS_HPP
33 #define LOGICALSPARSEUNITTESTS_HPP
43 #include <cppunit/extensions/HelperMacros.h>
45 #define BINARY_OP_TEST(TESTNAME,OP) \
47 c_dfad = a_dfad OP b_dfad; \
48 c_ls = a_ls OP b_ls; \
49 compareFads(c_dfad, c_ls); \
51 double val = urand.number(); \
52 c_dfad = a_dfad OP val; \
54 compareFads(c_dfad, c_ls); \
56 c_dfad = val OP b_dfad; \
58 compareFads(c_dfad, c_ls); \
61 #define RELOP_TEST(TESTNAME,OP) \
63 bool r1 = a_dfad OP b_dfad; \
64 bool r2 = a_ls OP b_ls; \
65 CPPUNIT_ASSERT(r1 == r2); \
67 double val = urand.number(); \
70 CPPUNIT_ASSERT(r1 == r2); \
74 CPPUNIT_ASSERT(r1 == r2); \
77 #define BINARY_FUNC_TEST(TESTNAME,FUNC) \
79 c_dfad = FUNC (a_dfad,b_dfad); \
80 c_ls = FUNC (a_ls,b_ls); \
81 compareFads(c_dfad, c_ls); \
83 double val = urand.number(); \
84 c_dfad = FUNC (a_dfad,val); \
85 c_ls = FUNC (a_ls,val); \
86 compareFads(c_dfad, c_ls); \
88 c_dfad = FUNC (val,b_dfad); \
89 c_ls = FUNC (val,b_ls); \
90 compareFads(c_dfad, c_ls); \
93 #define UNARY_OP_TEST(TESTNAME,OP) \
97 compareFads(c_dfad, c_ls); \
100 #define UNARY_FUNC_TEST(TESTNAME,FUNC) \
102 c_dfad = FUNC (a_dfad); \
103 c_ls = FUNC (a_ls); \
104 compareFads(c_dfad, c_ls); \
107 #define UNARY_ASSIGNOP_TEST(TESTNAME,OP) \
111 compareFads(c_dfad, c_ls); \
113 double val = urand.number(); \
116 compareFads(c_dfad, c_ls); \
178 double relative_tolerance);
237 template <
typename ScalarT>
262 aa_dfad = aa_dfad +
b_dfad;
263 aa_ls = aa_ls +
b_ls;
272 aa_dfad = aa_dfad -
b_dfad;
273 aa_ls = aa_ls -
b_ls;
282 aa_dfad = aa_dfad *
b_dfad;
283 aa_ls = aa_ls *
b_ls;
292 aa_dfad = aa_dfad /
b_dfad;
293 aa_ls = aa_ls /
b_ls;
Sacado::LFad::LogicalSparse< double, bool > LSType
Sacado::Fad::DFad< double > DFadType
CPPUNIT_TEST(testUnaryMinus)
void compareBools(bool a, bool b)
UNARY_FUNC_TEST(testSqrt, sqrt)
CPPUNIT_TEST(testDivideLR)
UNARY_ASSIGNOP_TEST(testDivideEquals,/=)
CPPUNIT_TEST(testComposite1)
UNARY_FUNC_TEST(testSinh, sinh)
CPPUNIT_TEST(testDivision)
CPPUNIT_TEST(testAddition)
CPPUNIT_TEST(testPlusEquals)
RELOP_TEST(testEquals,==)
BINARY_OP_TEST(testMultiplication, *)
UNARY_FUNC_TEST(testCosh, cosh)
CPPUNIT_TEST(testGreaterThan)
void compareFads(const DFadType &x_dfad, const LSType &x_ls)
RELOP_TEST(testNotEquals, !=)
UNARY_ASSIGNOP_TEST(testPlusEquals,+=)
UNARY_FUNC_TEST(testAbs, abs)
UNARY_FUNC_TEST(testSin, sin)
Sacado::Random< double > urand
BINARY_FUNC_TEST(testPow, pow)
CPPUNIT_TEST(testMinusLR)
CPPUNIT_TEST(testSubtraction)
UNARY_FUNC_TEST(testACos, acos)
LogicalSparseOpsUnitTest()
UNARY_FUNC_TEST(testFAbs, fabs)
UNARY_FUNC_TEST(testLog, log)
UNARY_FUNC_TEST(testTan, tan)
UNARY_FUNC_TEST(testCos, cos)
CPPUNIT_TEST(testDivideEquals)
CPPUNIT_TEST(testMultiplication)
CPPUNIT_TEST(testLessThan)
CPPUNIT_TEST(testUnaryPlus)
CPPUNIT_TEST(testTimesLR)
UNARY_FUNC_TEST(testTanh, tanh)
UNARY_FUNC_TEST(testATan, atan)
UNARY_OP_TEST(testUnaryMinus, -)
ScalarT composite1(const ScalarT &a, const ScalarT &b)
UNARY_FUNC_TEST(testLog10, log10)
UNARY_ASSIGNOP_TEST(testTimesEquals, *=)
void compareDoubles(double a, double b)
RELOP_TEST(testGreaterThanOrEquals, >=)
BINARY_OP_TEST(testSubtraction, -)
CPPUNIT_TEST_SUITE(LogicalSparseOpsUnitTest)
CPPUNIT_TEST(testNotEquals)
RELOP_TEST(testGreaterThan, >)
UNARY_OP_TEST(testUnaryPlus,+)
RELOP_TEST(testLessThan,<)
UNARY_FUNC_TEST(testASin, asin)
CPPUNIT_TEST(testGreaterThanOrEquals)
BINARY_OP_TEST(testDivision,/)
UNARY_ASSIGNOP_TEST(testMinusEquals, -=)
CPPUNIT_TEST(testTimesEquals)
RELOP_TEST(testLessThanOrEquals,<=)
CPPUNIT_TEST(testLessThanOrEquals)
BINARY_OP_TEST(testAddition,+)
void compareDx(double a, bool b)
UNARY_FUNC_TEST(testExp, exp)
CPPUNIT_TEST(testMinusEquals)
KOKKOS_INLINE_FUNCTION mpl::enable_if_c< ExprLevel< Expr< T1 > >::value==ExprLevel< Expr< T2 > >::value, Expr< PowerOp< Expr< T1 >, Expr< T2 > > > >::type pow(const Expr< T1 > &expr1, const Expr< T2 > &expr2)