42 #ifndef THYRA_TESTING_TOOLS_DECL_HPP
43 #define THYRA_TESTING_TOOLS_DECL_HPP
45 #include "Thyra_OperatorVectorTypes.hpp"
46 #include "Teuchos_VerbosityLevel.hpp"
47 #include "Teuchos_TestingHelpers.hpp"
56 inline const std::string
passfail(
const bool result)
66 template <
class Scalar>
69 relErr(
const Scalar &s1,
const Scalar &s2 )
71 return Teuchos::relErr<Scalar>(s1, s2);
81 template <
class Scalar>
83 relVectorErr(
const VectorBase<Scalar> &v1,
const VectorBase<Scalar> &v2 );
96 template<
class Scalar1,
class Scalar2,
class ScalarMag>
98 const std::string &v1_name,
99 const ArrayView<const Scalar1> &v1,
100 const std::string &v2_name,
101 const ArrayView<const Scalar2> &v2,
102 const std::string &maxRelErr_error_name,
103 const ScalarMag &maxRelErr_error,
104 const std::string &maxRelErr_warning_name,
105 const ScalarMag &maxRelErr_warning,
106 const Ptr<std::ostream> &out,
107 const std::string &leadingIndent = std::string(
"")
121 template<
class Scalar>
123 const std::string &v1_name,
124 const VectorBase<Scalar> &v1,
125 const std::string &v2_name,
126 const VectorBase<Scalar> &v2,
127 const std::string &maxRelErr_error_name,
129 const std::string &maxRelErr_warning_name,
133 const std::string &leadingIndent = std::string(
"")
143 template<
class Scalar>
145 const std::string &error_name,
147 const std::string &max_error_name,
149 const std::string &max_warning_name,
152 const std::string &leadingIndent = std::string(
"")
164 template<
class Scalar>
166 const std::string &error_name,
168 const std::string &max_error_name,
170 const std::string &max_warning_name,
172 const Ptr<std::ostream> &out,
173 const std::string &leadingIndent = std::string(
"")
184 const std::string &boolExprName,
185 const bool &boolExpr,
186 const bool &boolExpected,
187 const Ptr<std::ostream> &out,
188 const std::string &leadingIndent = std::string(
"")
216 void printTestResults(
218 const std::string &test_summary,
219 const bool show_all_tests,
220 const Ptr<bool> &success,
221 const Ptr<std::ostream> &out
255 bool show_all_tests_;
256 std::ostringstream ossStore_;
258 bool printedTestResults_;
271 template<
class Scalar>
272 std::ostream& operator<<( std::ostream& o, const VectorBase<Scalar>& v );
282 template<
class Scalar>
283 std::ostream& operator<<( std::ostream& o, const LinearOpBase<Scalar>& M );
288 #endif // THYRA_TESTING_TOOLS_DECL_HPP
Control printing of test results.
bool testMaxErrors(const std::string &error_name, const ArrayView< const typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &errors, const std::string &max_error_name, const typename Teuchos::ScalarTraits< Scalar >::magnitudeType &max_error, const std::string &max_warning_name, const typename Teuchos::ScalarTraits< Scalar >::magnitudeType &max_warning, const Ptr< std::ostream > &out, const std::string &leadingIndent=std::string(""))
Check that an array of errors is less than some error tolerence.
const std::string passfail(const bool result)
bool testRelNormDiffErr(const std::string &v1_name, const VectorBase< Scalar > &v1, const std::string &v2_name, const VectorBase< Scalar > &v2, const std::string &maxRelErr_error_name, const typename Teuchos::ScalarTraits< Scalar >::magnitudeType &maxRelErr_error, const std::string &maxRelErr_warning_name, const typename Teuchos::ScalarTraits< Scalar >::magnitudeType &maxRelErr_warning, std::ostream *out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::VERB_LOW, const std::string &leadingIndent=std::string(""))
Compute, check and optionally print the relative errors in two vectors.
bool testMaxErr(const std::string &error_name, const Scalar &error, const std::string &max_error_name, const typename Teuchos::ScalarTraits< Scalar >::magnitudeType &max_error, const std::string &max_warning_name, const typename Teuchos::ScalarTraits< Scalar >::magnitudeType &max_warning, std::ostream *out, const std::string &leadingIndent=std::string(""))
Check that an error is less than some error tolerence.
RCP< FancyOStream > replaceOStream(const RCP< FancyOStream > &out)
Replace the underlying output stream (used for unit testing this class).
ScalarTraits< Scalar >::magnitudeType relErr(const Scalar &s1, const Scalar &s2)
void printTestResults(const bool this_result, const Ptr< bool > &success)
Print the test result.
~TestResultsPrinter()
Print the test results on destruction if not already printed.
Teuchos::ScalarTraits< Scalar >::magnitudeType relVectorErr(const VectorBase< Scalar > &v1, const VectorBase< Scalar > &v2)
Return relative error of two vectors.
RCP< FancyOStream > getTestOStream()
Return the stream used for testing.
bool testRelErrors(const std::string &v1_name, const ArrayView< const Scalar1 > &v1, const std::string &v2_name, const ArrayView< const Scalar2 > &v2, const std::string &maxRelErr_error_name, const ScalarMag &maxRelErr_error, const std::string &maxRelErr_warning_name, const ScalarMag &maxRelErr_warning, const Ptr< std::ostream > &out, const std::string &leadingIndent=std::string(""))
Compute, check and optionally print the relative errors in two scalar arays.
bool testBoolExpr(const std::string &boolExprName, const bool &boolExpr, const bool &boolExpected, const Ptr< std::ostream > &out, const std::string &leadingIndent=std::string(""))
Check a boolean result against expected result.