From 2c22a1e90a4f03ba3b9f409a7e705f0084ada6d9 Mon Sep 17 00:00:00 2001 From: Stefan Pranger Date: Wed, 3 Nov 2021 12:09:27 +0100 Subject: [PATCH] fixed some issues with testing --- src/storm/logic/ShieldExpression.cpp | 4 ++++ src/storm/logic/ShieldExpression.h | 1 + src/test/storm/parser/GameShieldingParserTest.cpp | 9 ++++----- src/test/storm/parser/MdpShieldingParserTest.cpp | 9 ++++----- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/storm/logic/ShieldExpression.cpp b/src/storm/logic/ShieldExpression.cpp index 74a86e79f..841d1a400 100644 --- a/src/storm/logic/ShieldExpression.cpp +++ b/src/storm/logic/ShieldExpression.cpp @@ -26,6 +26,10 @@ namespace storm { return type == storm::logic::ShieldingType::PostSafety; } + bool ShieldExpression::isOptimalShield() const { + return type == storm::logic::ShieldingType::OptimalPre || type == storm::logic::ShieldingType::OptimalPost; + } + bool ShieldExpression::isOptimalPreShield() const { return type == storm::logic::ShieldingType::OptimalPre; } diff --git a/src/storm/logic/ShieldExpression.h b/src/storm/logic/ShieldExpression.h index f13575591..808ebddf9 100644 --- a/src/storm/logic/ShieldExpression.h +++ b/src/storm/logic/ShieldExpression.h @@ -24,6 +24,7 @@ namespace storm { bool isRelative() const; bool isPreSafetyShield() const; bool isPostSafetyShield() const; + bool isOptimalShield() const; bool isOptimalPreShield() const; bool isOptimalPostShield() const; diff --git a/src/test/storm/parser/GameShieldingParserTest.cpp b/src/test/storm/parser/GameShieldingParserTest.cpp index 6279efc42..a6ed3cb88 100644 --- a/src/test/storm/parser/GameShieldingParserTest.cpp +++ b/src/test/storm/parser/GameShieldingParserTest.cpp @@ -20,8 +20,8 @@ TEST(GameShieldingParserTest, PreSafetyShieldTest) { std::shared_ptr shieldExpression(nullptr); ASSERT_NO_THROW(shieldExpression = property.at(0).getShieldingExpression()); - EXPECT_TRUE(shieldExpression->isPreShield()); - EXPECT_FALSE(shieldExpression->isPostShield()); + EXPECT_TRUE(shieldExpression->isPreSafetyShield()); + EXPECT_FALSE(shieldExpression->isPostSafetyShield()); EXPECT_FALSE(shieldExpression->isOptimalShield()); EXPECT_TRUE(shieldExpression->isRelative()); EXPECT_EQ(std::stod(value), shieldExpression->getValue()); @@ -46,7 +46,7 @@ TEST(GameShieldingParserTest, PostShieldTest) { std::shared_ptr shieldExpression(nullptr); ASSERT_NO_THROW(shieldExpression = property.at(0).getShieldingExpression()); EXPECT_FALSE(shieldExpression->isPreSafetyShield()); - EXPECT_TRUE(shieldExpression->isPostShield()); + EXPECT_TRUE(shieldExpression->isPostSafetyShield()); EXPECT_FALSE(shieldExpression->isOptimalShield()); EXPECT_FALSE(shieldExpression->isRelative()); EXPECT_EQ(std::stod(value), shieldExpression->getValue()); @@ -74,8 +74,7 @@ TEST(GameShieldingParserTest, OptimalShieldTest) { std::shared_ptr shieldExpression(nullptr); ASSERT_NO_THROW(shieldExpression = property.at(0).getShieldingExpression()); EXPECT_FALSE(shieldExpression->isPreSafetyShield()); - EXPECT_FALSE(shieldExpression->isPostShield()); + EXPECT_FALSE(shieldExpression->isPostSafetyShield()); EXPECT_TRUE(shieldExpression->isOptimalShield()); - EXPECT_FALSE(shieldExpression->isRelative()); EXPECT_EQ(filename, shieldExpression->getFilename()); } diff --git a/src/test/storm/parser/MdpShieldingParserTest.cpp b/src/test/storm/parser/MdpShieldingParserTest.cpp index 85ffe9883..84b69d6db 100644 --- a/src/test/storm/parser/MdpShieldingParserTest.cpp +++ b/src/test/storm/parser/MdpShieldingParserTest.cpp @@ -18,7 +18,7 @@ TEST(MdpShieldingParserTest, PreSafetyShieldTest) { std::shared_ptr shieldExpression(nullptr); ASSERT_NO_THROW(shieldExpression = property.at(0).getShieldingExpression()); EXPECT_TRUE(shieldExpression->isPreSafetyShield()); - EXPECT_FALSE(shieldExpression->isPostShield()); + EXPECT_FALSE(shieldExpression->isPostSafetyShield()); EXPECT_FALSE(shieldExpression->isOptimalShield()); EXPECT_FALSE(shieldExpression->isRelative()); EXPECT_EQ(std::stod(value), shieldExpression->getValue()); @@ -30,7 +30,7 @@ TEST(MdpShieldingParserTest, PostShieldTest) { std::string filename = "postSafetyShieldFileName"; std::string value = "0.95"; - std::string input = "<" + filename + ", Post, lambda=" + value + "> Pmin=? [X !\"label\"]"; + std::string input = "<" + filename + ", PostSafety, lambda=" + value + "> Pmin=? [X !\"label\"]"; std::shared_ptr formula(nullptr); std::vector property; @@ -40,7 +40,7 @@ TEST(MdpShieldingParserTest, PostShieldTest) { std::shared_ptr shieldExpression(nullptr); ASSERT_NO_THROW(shieldExpression = property.at(0).getShieldingExpression()); EXPECT_FALSE(shieldExpression->isPreSafetyShield()); - EXPECT_TRUE(shieldExpression->isPostShield()); + EXPECT_TRUE(shieldExpression->isPostSafetyShield()); EXPECT_FALSE(shieldExpression->isOptimalShield()); EXPECT_TRUE(shieldExpression->isRelative()); EXPECT_EQ(std::stod(value), shieldExpression->getValue()); @@ -65,8 +65,7 @@ TEST(MdpShieldingParserTest, OptimalShieldTest) { std::shared_ptr shieldExpression(nullptr); ASSERT_NO_THROW(shieldExpression = property.at(0).getShieldingExpression()); EXPECT_FALSE(shieldExpression->isPreSafetyShield()); - EXPECT_FALSE(shieldExpression->isPostShield()); + EXPECT_FALSE(shieldExpression->isPostSafetyShield()); EXPECT_TRUE(shieldExpression->isOptimalShield()); - EXPECT_FALSE(shieldExpression->isRelative()); EXPECT_EQ(filename, shieldExpression->getFilename()); }