Classes | |
class | Teuchos::RelErrSmallNumber< hasMachineParameters, Scalar > |
More... | |
class | Teuchos::RelErrSmallNumber< false, Scalar > |
More... | |
class | Teuchos::RelErrSmallNumber< true, Scalar > |
More... | |
Defines | |
#define | TEUCHOS_TEST_EQUALITY_CONST(v1, v2, out, success) |
Test that an object is equal to a given constant. | |
#define | TEUCHOS_TEST_EQUALITY(v1, v2, out, success) |
Test that two values are equal. | |
#define | TEUCHOS_TEST_INEQUALITY_CONST(v1, v2, out, success) |
Test that an object is not equal to a given constant. | |
#define | TEUCHOS_TEST_INEQUALITY(v1, v2, out, success) |
Test that two values are not equal. | |
#define | TEUCHOS_TEST_FLOATING_EQUALITY(v1, v2, tol, out, success) |
Test if two floating point values are equal to a given tolerance. | |
#define | TEUCHOS_TEST_ITER_EQUALITY(iter1, iter2, out, success) |
Test if two iterators are equal or not. | |
#define | TEUCHOS_TEST_ARRAY_ELE_EQUALITY(a, i, val, printPass, out, success) |
Test that an array element value is equal to a given constant. | |
#define | TEUCHOS_TEST_ARRAY_ELE_INEQUALITY(a, i, val, printPass, out, success) |
Test that an array element value is not equal to a given constant. | |
#define | TEUCHOS_TEST_MATRIX_ELE_FLOATING_EQUALITY(a, i, j, val, tol, printPass, out, success) |
Test if a floating-point array element value is equal to a given constant for a given tolerance. | |
#define | TEUCHOS_TEST_MATRIX_ELE_EQUALITY(a, i, j, val, printPass, out, success) |
Test if a matrix element value is equal to a given constant. | |
#define | TEUCHOS_TEST_COMPARE(v1, comp, v2, out, success) |
Compare two objects using an input comparion operator. | |
#define | TEUCHOS_TEST_THROW(code, ExceptType, out, success) |
Test that a chunk of code throws an expected exception. | |
#define | TEUCHOS_TEST_NOTHROW(code, out, success) |
Test that a chunk of code does not throw any exceptions. | |
Functions | |
const std::string | Teuchos::passfail (const bool result) |
Return "passed" for "failed". | |
template<class Scalar > | |
Scalar | Teuchos::defaultSmallNumber () |
| |
template<class Scalar > | |
ScalarTraits< Scalar > ::magnitudeType | Teuchos::relErr (const Scalar &s1, const Scalar &s2) |
Return relative error of two scalars. | |
template<class Array1 , class Array2 > | |
bool | Teuchos::compareArrays (const Array1 &a1, const std::string &a1_name, const Array2 &a2, const std::string &a2_name, Teuchos::FancyOStream &out) |
Compare if two array objects are the same or not. | |
template<class Array1 , class Array2 , class ScalarMag > | |
bool | Teuchos::compareFloatingArrays (const Array1 &a1, const std::string &a1_name, const Array2 &a2, const std::string &a2_name, const ScalarMag &tol, Teuchos::FancyOStream &out) |
Compare if two array objects are the same or not up to a relative floating point precision. |
#define TEUCHOS_TEST_ARRAY_ELE_EQUALITY | ( | a, | |||
i, | |||||
val, | |||||
printPass, | |||||
out, | |||||
success | ) |
Value:
{ \ const bool l_result = ( (a)[i] == (val) ); \ if (!l_result) (success) = false; \ if (printPass || !(l_result)) { \ out << #a"["<<i<<"] = " << (a)[i] << " == "#val" = " << (val) \ << " : " << Teuchos::passfail(l_result) << "\n"; \ } \ }
This macro is not complicated so take a look for yourself!
Definition at line 279 of file Teuchos_TestingHelpers.hpp.
#define TEUCHOS_TEST_ARRAY_ELE_INEQUALITY | ( | a, | |||
i, | |||||
val, | |||||
printPass, | |||||
out, | |||||
success | ) |
Value:
{ \ const bool l_result = ( (a)[i] != (val) ); \ if (!l_result) (success) = false; \ if (printPass || !(l_result)) { \ out << #a"["<<i<<"] = " << (a)[i] << " != "#val" = " << (val) \ << " : " << Teuchos::passfail(l_result) << "\n"; \ } \ }
This macro is not complicated so take a look for yourself!
Definition at line 296 of file Teuchos_TestingHelpers.hpp.
#define TEUCHOS_TEST_COMPARE | ( | v1, | |||
comp, | |||||
v2, | |||||
out, | |||||
success | ) |
Value:
{ \ out << #v1" = "<<(v1)<<" "#comp" "#v2" = "<<(v2)<<" : "; \ const bool l_result = (v1) comp (v2); \ if (!l_result) (success) = false; \ (out) << Teuchos::passfail(l_result) << "\n"; \ }
This macro is not complicated so take a look for yourself!
Definition at line 348 of file Teuchos_TestingHelpers.hpp.
#define TEUCHOS_TEST_EQUALITY | ( | v1, | |||
v2, | |||||
out, | |||||
success | ) |
Value:
{ \ (out) << #v1" = "<<(v1)<<" == "#v2" = "<<(v2)<<" : "; \ const bool l_result = (v1) == (v2); \ if (!l_result) (success) = false; \ (out) << Teuchos::passfail(l_result) << "\n"; \ }
This macro is not complicated so take a look for yourself!
Definition at line 202 of file Teuchos_TestingHelpers.hpp.
#define TEUCHOS_TEST_EQUALITY_CONST | ( | v1, | |||
v2, | |||||
out, | |||||
success | ) |
Value:
{ \ (out) << #v1" = "<<(v1)<<" == "<<(v2)<<" : "; \ const bool l_result = (v1) == (v2); \ (out) << Teuchos::passfail(l_result) << "\n"; \ if (!l_result) (success) = false; \ }
This macro is not complicated so take a look for yourself!
Definition at line 187 of file Teuchos_TestingHelpers.hpp.
#define TEUCHOS_TEST_FLOATING_EQUALITY | ( | v1, | |||
v2, | |||||
tol, | |||||
out, | |||||
success | ) |
Value:
{ \ const bool l_result = Teuchos::testRelErr( \ #v1, v1, #v2, v2, "tol", tol, "tol", tol, Teuchos::outArg(out) ); \ if (!l_result) (success) = false; \ }
This macro is not complicated so take a look for yourself!
Definition at line 247 of file Teuchos_TestingHelpers.hpp.
#define TEUCHOS_TEST_INEQUALITY | ( | v1, | |||
v2, | |||||
out, | |||||
success | ) |
Value:
{ \ (out) << #v1" = "<<(v1)<<" != "#v2" = "<<(v2)<<" : "; \ const bool l_result = (v1) != (v2); \ if (!l_result) (success) = false; \ (out) << Teuchos::passfail(l_result) << "\n"; \ }
This macro is not complicated so take a look for yourself!
Definition at line 232 of file Teuchos_TestingHelpers.hpp.
#define TEUCHOS_TEST_INEQUALITY_CONST | ( | v1, | |||
v2, | |||||
out, | |||||
success | ) |
Value:
{ \ (out) << #v1" = "<<(v1)<<" != "<<(v2)<<" : "; \ const bool l_result = (v1) != (v2); \ (out) << Teuchos::passfail(l_result) << "\n"; \ if (!l_result) (success) = false; \ }
This macro is not complicated so take a look for yourself!
Definition at line 217 of file Teuchos_TestingHelpers.hpp.
#define TEUCHOS_TEST_ITER_EQUALITY | ( | iter1, | |||
iter2, | |||||
out, | |||||
success | ) |
Value:
{ \ (out) << #iter1" == "#iter2" = : "; \ const bool l_result = (iter1) == (iter2); \ if (!l_result) (success) = false; \ (out) << Teuchos::passfail(l_result) << "\n"; \ }
This macro does not try to print the iterators so it is more portable (in terms of types).
This macro is not complicated so take a look for yourself!
Definition at line 264 of file Teuchos_TestingHelpers.hpp.
#define TEUCHOS_TEST_MATRIX_ELE_EQUALITY | ( | a, | |||
i, | |||||
j, | |||||
val, | |||||
printPass, | |||||
out, | |||||
success | ) |
Value:
{ \ const bool l_result = ( (a)(i,j) == (val) ); \ if (!l_result) (success) = false; \ if (printPass || !(l_result)) { \ out << #a"("<<i<<","<<j<<") = " << (a)(i,j) << " == "#val" = " << (val) \ << " : " << Teuchos::passfail(l_result) << "\n"; \ } \ }
This macro is not complicated so take a look for yourself!
Definition at line 331 of file Teuchos_TestingHelpers.hpp.
#define TEUCHOS_TEST_MATRIX_ELE_FLOATING_EQUALITY | ( | a, | |||
i, | |||||
j, | |||||
val, | |||||
tol, | |||||
printPass, | |||||
out, | |||||
success | ) |
Value:
{ \ std::ostringstream a_i_str; \ a_i_str <<#a<<"("<<i<<","<<j<<")"; \ const bool l_result = Teuchos::testRelErr( \ a_i_str.str(), (a)(i,j), #val, val, "tol", tol, "tol", tol, \ (printPass) ? Teuchos::outArg(out) : Teuchos::null ); \ if (!l_result) (success) = false; \ }
This macro is not complicated so take a look for yourself!
Definition at line 314 of file Teuchos_TestingHelpers.hpp.
#define TEUCHOS_TEST_NOTHROW | ( | code, | |||
out, | |||||
success | ) |
Value:
try { \ (out) << "Test that code {"#code";} does not throw : "; \ code; \ (out) << "passes\n"; \ } \ catch (...) { \ (success) = false; \ out << "failed\n"; \ }
This macro is not complicated so take a look for yourself!
Definition at line 387 of file Teuchos_TestingHelpers.hpp.
#define TEUCHOS_TEST_THROW | ( | code, | |||
ExceptType, | |||||
out, | |||||
success | ) |
Value:
try { \ (out) << "Test that code {"#code";} throws " \ <<Teuchos::TypeNameTraits<ExceptType>::name()<<": "; \ code; \ (success) = false; \ (out) << "failed\n"; \ } \ catch (const ExceptType& except) { \ out << "passed\n"; \ out << "\nException message for expected exception:\n\n"; \ { \ Teuchos::OSTab tab(out); \ out << except.what() << "\n\n"; \ } \ }
This macro is not complicated so take a look for yourself!
Definition at line 363 of file Teuchos_TestingHelpers.hpp.
bool Teuchos::compareArrays | ( | const Array1 & | a1, | |
const std::string & | a1_name, | |||
const Array2 & | a2, | |||
const std::string & | a2_name, | |||
Teuchos::FancyOStream & | out | |||
) | [inline] |
Compare if two array objects are the same or not.
This function works with any two array objects are the same size and have the same element value types. The funtion is templated on the container types and therefore can compare any two objects that have size() and operator[](i) defined.
true
if the compare and false
otherwise. Definition at line 472 of file Teuchos_TestingHelpers.hpp.
bool Teuchos::compareFloatingArrays | ( | const Array1 & | a1, | |
const std::string & | a1_name, | |||
const Array2 & | a2, | |||
const std::string & | a2_name, | |||
const ScalarMag & | tol, | |||
Teuchos::FancyOStream & | out | |||
) | [inline] |
Compare if two array objects are the same or not up to a relative floating point precision.
This function works with any two array objects are the same size and have the same element value types. The funtion is templated on the container types and therefore can compare any two objects that have size() and operator[](i) defined.
true
if the compare and false
otherwise. Definition at line 511 of file Teuchos_TestingHelpers.hpp.
Scalar Teuchos::defaultSmallNumber | ( | ) | [inline] |
const std::string Teuchos::passfail | ( | const bool | result | ) | [inline] |
Teuchos::ScalarTraits< Scalar >::magnitudeType Teuchos::relErr | ( | const Scalar & | s1, | |
const Scalar & | s2 | |||
) | [inline] |
Return relative error of two scalars.
ToDo: Finish documentation!
Definition at line 416 of file Teuchos_TestingHelpers.hpp.