From bb6fb04f72256da82a1a6d19bd1c5c8559a2e0b3 Mon Sep 17 00:00:00 2001 From: dehnert Date: Thu, 26 Apr 2018 09:26:17 +0200 Subject: [PATCH] fixing volatile k-shortest path test that returns different (yet correct) results on different machines/compilers because of double imprecisions --- src/test/storm/utility/KSPTest.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/test/storm/utility/KSPTest.cpp b/src/test/storm/utility/KSPTest.cpp index 35b449f01..5ac954314 100644 --- a/src/test/storm/utility/KSPTest.cpp +++ b/src/test/storm/utility/KSPTest.cpp @@ -80,23 +80,26 @@ TEST(KSPTest, kspStateSet) { auto model = buildExampleModel(); storm::utility::ksp::ShortestPathsGenerator spg(*model, testState); - storm::storage::BitVector referenceBV(model->getNumberOfStates(), false); - for (auto s : std::vector{0, 1, 2, 4, 6, 9, 12, 17, 22, 30, 37, 45, 52, 58, 65, 70, 74, 77, 81, 85, 92, 98, 104, 112, 119, 127, 134, 140, 146, 154, 161, 169, 176, 182, 188, 196, 203, 211, 218, 224, 230, 238, 245, 253, 260, 266, 272, 281, 288, 296}) { - referenceBV.set(s, true); - } - auto bv = spg.getStates(7); - - EXPECT_EQ(referenceBV, bv); + EXPECT_EQ(50, bv.getNumberOfSetBits()); + + // The result may sadly depend on the compiler/system, so checking a particular outcome is not feasible. +// storm::storage::BitVector referenceBV(model->getNumberOfStates(), false); +// for (auto s : std::vector{0, 1, 2, 4, 6, 9, 12, 17, 22, 30, 37, 45, 52, 58, 65, 70, 74, 77, 81, 85, 92, 98, 104, 112, 119, 127, 134, 140, 146, 154, 161, 169, 176, 182, 188, 196, 203, 211, 218, 224, 230, 238, 245, 253, 260, 266, 272, 281, 288, 296}) { +// referenceBV.set(s, true); +// } +// +// EXPECT_EQ(referenceBV, bv); } TEST(KSPTest, kspPathAsList) { auto model = buildExampleModel(); storm::utility::ksp::ShortestPathsGenerator spg(*model, testState); - // TODO: use path that actually has a loop or something to make this more interesting - auto reference = storm::utility::ksp::OrderedStateList{296, 288, 281, 272, 266, 260, 253, 245, 238, 230, 224, 218, 211, 203, 196, 188, 182, 176, 169, 161, 154, 146, 140, 134, 127, 119, 112, 104, 98, 92, 85, 77, 70, 81, 74, 65, 58, 52, 45, 37, 30, 22, 17, 12, 9, 6, 4, 2, 1, 0}; auto list = spg.getPathAsList(7); + EXPECT_EQ(50, list.size()); - EXPECT_EQ(reference, list); + // TODO: use path that actually has a loop or something to make this more interesting +// auto reference = storm::utility::ksp::OrderedStateList{296, 288, 281, 272, 266, 260, 253, 245, 238, 230, 224, 218, 211, 203, 196, 188, 182, 176, 169, 161, 154, 146, 140, 134, 127, 119, 112, 104, 98, 92, 85, 77, 70, 81, 74, 65, 58, 52, 45, 37, 30, 22, 17, 12, 9, 6, 4, 2, 1, 0}; +// EXPECT_EQ(reference, list); }