Skip to content

Commit

Permalink
Floating point error tolerance for testInitialisedOK
Browse files Browse the repository at this point in the history
  • Loading branch information
Thinkpiet committed Nov 17, 2023
1 parent f2357de commit 2551994
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/unit/coupling/solvers/PintableLBCouetteSolverTest.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "coupling/solvers/LBCouetteSolver.h"
#include <cmath>
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cstdlib>
Expand Down Expand Up @@ -92,15 +93,15 @@ class PintableLBCouetteSolverTest : public CppUnit::TestFixture {
void testInitialisedOK() {
std::unique_ptr<State> 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() {
Expand Down

0 comments on commit 2551994

Please sign in to comment.