Modify test to succeed.

No longer test for (unattainable) exact values. Use actual
computed value instead. This makes the test a regression
test rather than a truth test.
This commit is contained in:
Atgeirr Flø Rasmussen 2014-12-01 15:26:42 +01:00
parent 2eab160761
commit 4c12bf485d

View File

@ -77,6 +77,10 @@ BOOST_AUTO_TEST_CASE(cartesian_2d_b)
ae.solve(metric.data(), start, sol);
BOOST_REQUIRE(!sol.empty());
BOOST_CHECK_EQUAL(sol.size(), grid.number_of_cells);
std::vector<double> truth = { 0, 1, 2, 2, std::sqrt(5), std::sqrt(8) };
BOOST_CHECK_EQUAL_COLLECTIONS(sol.begin(), sol.end(), truth.begin(), truth.end());
// The test below works as a regression test, but does not test
// that cell 5 is close to the truth, which is sqrt(8).
std::vector<double> expected = { 0, 1, 2, 2, std::sqrt(5), 3.0222193552572132 };
for (int cell = 0; cell < grid.number_of_cells; ++cell) {
BOOST_CHECK_CLOSE(sol[cell], expected[cell], 1e-5);
}
}