Browse Source

fixed some issues with testing

tempestpy_adaptions
Stefan Pranger 3 years ago
parent
commit
2c22a1e90a
  1. 4
      src/storm/logic/ShieldExpression.cpp
  2. 1
      src/storm/logic/ShieldExpression.h
  3. 9
      src/test/storm/parser/GameShieldingParserTest.cpp
  4. 9
      src/test/storm/parser/MdpShieldingParserTest.cpp

4
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;
}

1
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;

9
src/test/storm/parser/GameShieldingParserTest.cpp

@ -20,8 +20,8 @@ TEST(GameShieldingParserTest, PreSafetyShieldTest) {
std::shared_ptr<storm::logic::ShieldExpression const> 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<storm::logic::ShieldExpression const> 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<storm::logic::ShieldExpression const> 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());
}

9
src/test/storm/parser/MdpShieldingParserTest.cpp

@ -18,7 +18,7 @@ TEST(MdpShieldingParserTest, PreSafetyShieldTest) {
std::shared_ptr<storm::logic::ShieldExpression const> 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<storm::logic::Formula const> formula(nullptr);
std::vector<storm::jani::Property> property;
@ -40,7 +40,7 @@ TEST(MdpShieldingParserTest, PostShieldTest) {
std::shared_ptr<storm::logic::ShieldExpression const> 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<storm::logic::ShieldExpression const> 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());
}
Loading…
Cancel
Save