From 6719224567c11211df7b239c13fa0025ae2a062c Mon Sep 17 00:00:00 2001 From: Ken Museth <1495380+kmuseth@users.noreply.github.com> Date: Fri, 16 Aug 2024 19:00:39 -0700 Subject: [PATCH] fixed precision issue in unit-test on OSX M3 (#1875) Signed-off-by: kmuseth --- openvdb/openvdb/unittest/TestLinearInterp.cc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/openvdb/openvdb/unittest/TestLinearInterp.cc b/openvdb/openvdb/unittest/TestLinearInterp.cc index 944f0ef60b..137c81f7de 100644 --- a/openvdb/openvdb/unittest/TestLinearInterp.cc +++ b/openvdb/openvdb/unittest/TestLinearInterp.cc @@ -999,7 +999,7 @@ template void TestLinearInterp::testStencilsMatch() { - typedef typename GridType::ValueType ValueType; + using ValueType = typename GridType::ValueType; GridType grid; typename GridType::TreeType& tree = grid.tree(); @@ -1022,14 +1022,13 @@ TestLinearInterp::testStencilsMatch() openvdb::tools::GridSampler interpolator(grid); - openvdb::math::BoxStencil - stencil(grid); - - typename GridType::ValueType val1 = interpolator.sampleVoxel(pos.x(), pos.y(), pos.z()); + openvdb::math::BoxStencil stencil(grid); + const ValueType val1 = interpolator.sampleVoxel(pos.x(), pos.y(), pos.z()); stencil.moveTo(pos); - typename GridType::ValueType val2 = stencil.interpolation(pos); - EXPECT_EQ(val1, val2); + const ValueType val2 = stencil.interpolation(pos); + static const ValueType epsilon = openvdb::math::Delta::value(); + EXPECT_NEAR(val1, val2, epsilon); } } TEST_F(TestLinearInterp, testStencilsMatchFloat) { testStencilsMatch(); }