Skip to content
Snippets Groups Projects
Commit 4d1073cf authored by webmanue's avatar webmanue
Browse files

compare result to reference with tolerance 1e-17

- fixes test on Euler
parent 35d2629b
No related branches found
No related tags found
No related merge requests found
Pipeline #132946 failed
......@@ -98,6 +98,32 @@ MATCHER_P3(ScalarEqIfLocal, row, col, reference,
almost_equal_to_reference(arg(row, col), reference, result_listener);
}
/**
* @brief Check that the value at index row is almost equal to reference (if it
* is available locally).
*/
MATCHER_P3(ScalarNearIfLocal, row, reference, tolerance,
std::string(negation ? "not " : "") + "equal to " +
::testing::PrintToString(reference) + " at (" +
::testing::PrintToString(row) + ")") {
return !isLocal(arg, row) ||
near_to_reference(arg(row), reference, tolerance, result_listener);
}
/**
* @brief Check that the value at index (row, col) is almost equal to reference
* (if it is available locally).
*/
MATCHER_P4(ScalarNearIfLocal, row, col, reference, tolerance,
std::string(negation ? "not " : "") + "equal to " +
::testing::PrintToString(reference) + " at (" +
::testing::PrintToString(row) + ", " +
::testing::PrintToString(col) + ")") {
return !isLocal(arg, row) ||
near_to_reference(arg(row, col), reference, tolerance, result_listener);
}
/**
* @brief Check that the value has the given address.
*/
......@@ -136,4 +162,4 @@ MATCHER_P2(ScalarNear, reference, tolerance,
}
} // namespace
} // namespace cppptest
} // namespace ae108
\ No newline at end of file
} // namespace ae108
......@@ -22,6 +22,7 @@
#include <array>
#include <gmock/gmock.h>
using ae108::cppptest::ScalarNearIfLocal;
using ae108::cppptest::ScalarEqIfLocal;
using testing::DoubleEq;
using testing::Eq;
......@@ -176,10 +177,10 @@ TYPED_TEST(boundaryConditionsToEquations_Test,
const auto image = apply(result, displacements);
for (auto row = size_type{0}; row < image.unwrap().size(); ++row) {
EXPECT_THAT(image.unwrap(), ScalarEqIfLocal(row, 0.));
EXPECT_THAT(image.unwrap(), ScalarNearIfLocal(row, 0., 1e-17));
}
}
} // namespace
} // namespace solve
} // namespace ae108
\ No newline at end of file
} // namespace ae108
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment