From a9d893d2afa86b067cd503ff61d8a6290db65dea Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Thu, 7 Dec 2023 09:29:43 -0500 Subject: [PATCH] make test more robust By avoiding a floating point equality comparison. This test fails for me in release mode with march=native with a residual of 1e-14. --- tests/mpi/affine_constraints_get_view_01.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/mpi/affine_constraints_get_view_01.cc b/tests/mpi/affine_constraints_get_view_01.cc index def3035761..763a8718f4 100644 --- a/tests/mpi/affine_constraints_get_view_01.cc +++ b/tests/mpi/affine_constraints_get_view_01.cc @@ -192,8 +192,15 @@ test() pressure_constraints.distribute(check_vector_2.block(1)); } - // Now the assertion part: These vectors are the same: - Assert(check_vector_1 == check_vector_2, ExcInternalError()); + // Finally check that these two vectors are the same. Note that + // when we compile with native optimizations we might have a slight + // difference in results: + { + TrilinosWrappers::MPI::BlockVector result = check_vector_1; + result -= check_vector_2; + Assert(result.l2_norm() / check_vector_1.l2_norm() < 1e-8, + ExcInternalError()); + } deallog << "OK" << std::endl; } -- 2.39.5