20 #ifndef __mast_test_comparisons_h__ 21 #define __mast_test_comparisons_h__ 34 return fabs(v) <=
eps;
55 else if (fabs(v1) > 0)
56 rval = fabs((v1-v2)/v1) <= tol;
70 BOOST_TEST_MESSAGE (
"Failed comparison: " 71 <<
"expected: " << v0<<
" , " 72 <<
"computed: " << v <<
" : " 73 <<
"diff: " << v0 - v <<
" , " 87 v0_size = (
unsigned int) v0.rows();
88 libmesh_assert_equal_to(v0_size, v.size());
92 for (
unsigned int i=0; i<v0_size; i++) {
94 BOOST_TEST_MESSAGE(
"Failed comparison at i = (" 96 <<
"expected: " << v0(i) <<
" , " 97 <<
"computed: " << v(i) <<
" : " 98 <<
"diff: " << v0(i) - v(i) <<
" , " 114 m0_rows = (
unsigned int) m0.rows(),
115 m0_cols = (
unsigned int) m0.cols();
116 libmesh_assert_equal_to(m0_rows, m.rows());
117 libmesh_assert_equal_to(m0_cols, m.cols());
122 for (
unsigned int i=0; i<m0_rows; i++) {
123 for (
unsigned int j=0; j<m0_cols; j++)
126 BOOST_TEST_MESSAGE(
"Failed comparison\n" 127 << std::setw(5) <<
"i" 128 << std::setw(5) <<
"j" 129 << std::setw(20) <<
"expected" 130 << std::setw(20) <<
"computed" 131 << std::setw(20) <<
"diff" 132 << std::setw(20) <<
"tol");
134 BOOST_TEST_MESSAGE(std::setw(5) << i
136 << std::setw(20) << m0(i,j)
137 << std::setw(20) << m(i,j)
138 << std::setw(20) << m0(i,j) - m(i,j)
139 << std::setw(20) << tol);
149 #endif //__mast_test_compasisons_h__ bool compare_vector(const RealVectorX &v0, const RealVectorX &v, const Real tol)
bool compare_matrix(const RealMatrixX &m0, const RealMatrixX &m, const Real tol)
Matrix< Real, Dynamic, Dynamic > RealMatrixX
Matrix< Real, Dynamic, 1 > RealVectorX
bool compare_value(const Real v0, const Real v, const Real tol)
bool is_numerical_zero(const Real v, const Real eps)
bool compare(const Real v1, const Real v2, const Real tol)