#include "gtest/gtest.h" #include "storm-config.h" #include "storm-dft/api/storm-dft.h" #include "storm-dft/builder/ExplicitDFTModelBuilder.h" #include "storm-parsers/api/storm-parsers.h" namespace { TEST(DftModelBuildingTest, RelevantEvents) { // Initialize std::string file = STORM_TEST_RESOURCES_DIR "/dft/dont_care.dft"; std::shared_ptr> dft = storm::api::loadDFTGalileoFile(file); EXPECT_TRUE(storm::api::isWellFormed(*dft).first); std::string property = "Tmin=? [F \"failed\"]"; std::vector> properties = storm::api::extractFormulasFromProperties(storm::api::parseProperties(property)); std::map>> emptySymmetry; storm::storage::DFTIndependentSymmetries symmetries(emptySymmetry); // Set relevant events (none) std::set relevantEvents; // Build model storm::builder::ExplicitDFTModelBuilder builder(*dft, symmetries, relevantEvents, false); builder.buildModel(0, 0.0); std::shared_ptr> model = builder.getModel(); EXPECT_EQ(8ul, model->getNumberOfStates()); EXPECT_EQ(13ul, model->getNumberOfTransitions()); // Set relevant events (all) relevantEvents = dft->getAllIds(); // Build model storm::builder::ExplicitDFTModelBuilder builder2(*dft, symmetries, relevantEvents, false); builder2.buildModel(0, 0.0); model = builder2.getModel(); EXPECT_EQ(512ul, model->getNumberOfStates()); EXPECT_EQ(2305ul, model->getNumberOfTransitions()); // Set relevant events (H) relevantEvents.clear(); relevantEvents.insert(dft->getIndex("H")); // Build model storm::builder::ExplicitDFTModelBuilder builder3(*dft, symmetries, relevantEvents, false); builder3.buildModel(0, 0.0); model = builder3.getModel(); EXPECT_EQ(12ul, model->getNumberOfStates()); EXPECT_EQ(25ul, model->getNumberOfTransitions()); // Set relevant events (H, I) relevantEvents.clear(); relevantEvents.insert(dft->getIndex("H")); relevantEvents.insert(dft->getIndex("I")); // Build model storm::builder::ExplicitDFTModelBuilder builder4(*dft, symmetries, relevantEvents, false); builder4.buildModel(0, 0.0); model = builder4.getModel(); EXPECT_EQ(16ul, model->getNumberOfStates()); EXPECT_EQ(33ul, model->getNumberOfTransitions()); // Set relevant events (none) relevantEvents.clear(); // Build model storm::builder::ExplicitDFTModelBuilder builder5(*dft, symmetries, relevantEvents, true); builder5.buildModel(0, 0.0); model = builder5.getModel(); EXPECT_EQ(8ul, model->getNumberOfStates()); EXPECT_EQ(13ul, model->getNumberOfTransitions()); // Set relevant events (all) relevantEvents = dft->getAllIds(); // Build model storm::builder::ExplicitDFTModelBuilder builder6(*dft, symmetries, relevantEvents, true); builder6.buildModel(0, 0.0); model = builder6.getModel(); EXPECT_EQ(8ul, model->getNumberOfStates()); EXPECT_EQ(13ul, model->getNumberOfTransitions()); // Set relevant events (H, I) relevantEvents.clear(); relevantEvents.insert(dft->getIndex("H")); relevantEvents.insert(dft->getIndex("I")); // Build model storm::builder::ExplicitDFTModelBuilder builder7(*dft, symmetries, relevantEvents, true); builder7.buildModel(0, 0.0); model = builder7.getModel(); EXPECT_EQ(8ul, model->getNumberOfStates()); EXPECT_EQ(13ul, model->getNumberOfTransitions()); } }