From 2551994863403b2cad56ea0a1b122cb5713bf597 Mon Sep 17 00:00:00 2001 From: Piet Jarmatz Date: Sat, 18 Nov 2023 00:59:53 +0100 Subject: [PATCH] Floating point error tolerance for testInitialisedOK --- test/unit/coupling/solvers/PintableLBCouetteSolverTest.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/unit/coupling/solvers/PintableLBCouetteSolverTest.cpp b/test/unit/coupling/solvers/PintableLBCouetteSolverTest.cpp index 4578bf592..40a2cdbc7 100644 --- a/test/unit/coupling/solvers/PintableLBCouetteSolverTest.cpp +++ b/test/unit/coupling/solvers/PintableLBCouetteSolverTest.cpp @@ -1,4 +1,5 @@ #include "coupling/solvers/LBCouetteSolver.h" +#include #include #include #include @@ -92,15 +93,15 @@ class PintableLBCouetteSolverTest : public CppUnit::TestFixture { void testInitialisedOK() { std::unique_ptr u0 = F->getState(); double v0 = F->get_avg_vel(u0); - CPPUNIT_ASSERT_MESSAGE(std::to_string(v0), v0 == 0); + CPPUNIT_ASSERT_MESSAGE(std::to_string(v0), std::abs(v0) < 1e-9); u0 = G->getState(); v0 = G->get_avg_vel(u0); - CPPUNIT_ASSERT_MESSAGE(std::to_string(v0), v0 == 0); + CPPUNIT_ASSERT_MESSAGE(std::to_string(v0), std::abs(v0) < 1e-9); u0 = G2->getState(); v0 = G2->get_avg_vel(u0); - CPPUNIT_ASSERT_MESSAGE(std::to_string(v0), v0 == 0); + CPPUNIT_ASSERT_MESSAGE(std::to_string(v0), std::abs(v0) < 1e-9); } void testReturnToZero() {