10 #ifndef THYRA_TESTING_TOOLS_DECL_HPP
11 #define THYRA_TESTING_TOOLS_DECL_HPP
13 #include "Thyra_OperatorVectorTypes.hpp"
14 #include "Teuchos_VerbosityLevel.hpp"
15 #include "Teuchos_TestingHelpers.hpp"
24 inline const std::string
passfail(
const bool result)
34 template <
class Scalar>
37 relErr(
const Scalar &s1,
const Scalar &s2 )
39 return Teuchos::relErr<Scalar>(s1, s2);
49 template <
class Scalar>
51 relVectorErr(
const VectorBase<Scalar> &v1,
const VectorBase<Scalar> &v2 );
64 template<
class Scalar1,
class Scalar2,
class ScalarMag>
66 const std::string &v1_name,
67 const ArrayView<const Scalar1> &v1,
68 const std::string &v2_name,
69 const ArrayView<const Scalar2> &v2,
70 const std::string &maxRelErr_error_name,
71 const ScalarMag &maxRelErr_error,
72 const std::string &maxRelErr_warning_name,
73 const ScalarMag &maxRelErr_warning,
74 const Ptr<std::ostream> &out,
75 const std::string &leadingIndent = std::string(
"")
89 template<
class Scalar>
91 const std::string &v1_name,
92 const VectorBase<Scalar> &v1,
93 const std::string &v2_name,
94 const VectorBase<Scalar> &v2,
95 const std::string &maxRelErr_error_name,
97 const std::string &maxRelErr_warning_name,
101 const std::string &leadingIndent = std::string(
"")
111 template<
class Scalar>
113 const std::string &error_name,
115 const std::string &max_error_name,
117 const std::string &max_warning_name,
120 const std::string &leadingIndent = std::string(
"")
132 template<
class Scalar>
134 const std::string &error_name,
136 const std::string &max_error_name,
138 const std::string &max_warning_name,
140 const Ptr<std::ostream> &out,
141 const std::string &leadingIndent = std::string(
"")
152 const std::string &boolExprName,
153 const bool &boolExpr,
154 const bool &boolExpected,
155 const Ptr<std::ostream> &out,
156 const std::string &leadingIndent = std::string(
"")
184 void printTestResults(
186 const std::string &test_summary,
187 const bool show_all_tests,
188 const Ptr<bool> &success,
189 const Ptr<std::ostream> &out
223 bool show_all_tests_;
224 std::ostringstream ossStore_;
226 bool printedTestResults_;
239 template<
class Scalar>
240 std::ostream& operator<<( std::ostream& o, const VectorBase<Scalar>& v );
250 template<
class Scalar>
251 std::ostream& operator<<( std::ostream& o, const LinearOpBase<Scalar>& M );
256 #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).
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.
Teuchos::ScalarTraits< typename std::common_type< Scalar1, Scalar2 >::type >::magnitudeType relErr(const Scalar1 &s1, const Scalar2 &s2)
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.