From 1dab4374968dba92d23cb2a8de30210cc1118635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Basg=C3=B6ze?= Date: Thu, 26 Aug 2021 12:47:15 +0200 Subject: [PATCH] Compare floating points upto precision instead == Fixes QuantileQueryTest with CLN Provided by Tim Quatmann --- src/test/storm/modelchecker/prctl/mdp/QuantileQueryTest.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/test/storm/modelchecker/prctl/mdp/QuantileQueryTest.cpp b/src/test/storm/modelchecker/prctl/mdp/QuantileQueryTest.cpp index 9fbf3bffb..65983ef6a 100755 --- a/src/test/storm/modelchecker/prctl/mdp/QuantileQueryTest.cpp +++ b/src/test/storm/modelchecker/prctl/mdp/QuantileQueryTest.cpp @@ -98,6 +98,7 @@ namespace { std::pair compareResult(std::shared_ptr> const& model, std::unique_ptr& result, std::vector const& expected) { bool equal = true; std::string errorMessage = ""; + ValueType comparePrecision = std::is_same::value ? storm::utility::convertNumber(1e-10) : storm::utility::zero(); auto filter = getInitialStateFilter(model); result->filter(*filter); std::vector> resultPoints; @@ -120,7 +121,7 @@ namespace { for (auto const& resPoint : resultPoints) { bool contained = false; for (auto const& expPoint : expectedPoints) { - if (resPoint == expPoint) { + if (storm::utility::vector::equalModuloPrecision(resPoint, expPoint, comparePrecision, true)) { contained = true; break; } @@ -133,7 +134,7 @@ namespace { for (auto const& expPoint : expectedPoints) { bool contained = false; for (auto const& resPoint : resultPoints) { - if (resPoint == expPoint) { + if (storm::utility::vector::equalModuloPrecision(resPoint, expPoint, comparePrecision, true)) { contained = true; break; }