#include "gtest/gtest.h" #include "storm-config.h" #include "src/parser/AutoParser.h" #include "src/storage/StronglyConnectedComponentDecomposition.h" TEST(StronglyConnectedComponentDecomposition, Crowds) { storm::parser::AutoParser parser(STORM_CPP_BASE_PATH "/examples/dtmc/crowds/crowds20_5.tra", STORM_CPP_BASE_PATH "/examples/dtmc/crowds/crowds20_5.lab", "", ""); std::shared_ptr> dtmc = parser.getModel>(); storm::storage::StronglyConnectedComponentDecomposition sccDecomposition; ASSERT_NO_THROW(sccDecomposition = storm::storage::StronglyConnectedComponentDecomposition(*dtmc)); ASSERT_EQ(1290297ull, sccDecomposition.size()); ASSERT_NO_THROW(sccDecomposition = storm::storage::StronglyConnectedComponentDecomposition(*dtmc, true)); ASSERT_EQ(1290297, sccDecomposition.size()); ASSERT_NO_THROW(sccDecomposition = storm::storage::StronglyConnectedComponentDecomposition(*dtmc, true, true)); ASSERT_EQ(425040, sccDecomposition.size()); dtmc = nullptr; } TEST(StronglyConnectedComponentDecomposition, SynchronousLeader) { storm::parser::AutoParser parser(STORM_CPP_BASE_PATH "/examples/dtmc/synchronous_leader/leader6_9.tra", STORM_CPP_BASE_PATH "/examples/dtmc/synchronous_leader/leader6_9.lab", "", ""); std::shared_ptr> dtmc = parser.getModel>(); storm::storage::StronglyConnectedComponentDecomposition sccDecomposition; ASSERT_NO_THROW(sccDecomposition = storm::storage::StronglyConnectedComponentDecomposition(*dtmc)); ASSERT_EQ(2611835, sccDecomposition.size()); ASSERT_NO_THROW(sccDecomposition = storm::storage::StronglyConnectedComponentDecomposition(*dtmc, true)); ASSERT_EQ(2611835, sccDecomposition.size()); ASSERT_NO_THROW(sccDecomposition = storm::storage::StronglyConnectedComponentDecomposition(*dtmc, true, true)); ASSERT_EQ(1, sccDecomposition.size()); dtmc = nullptr; } TEST(StronglyConnectedComponentDecomposition, AsynchronousLeader) { storm::parser::AutoParser parser(STORM_CPP_BASE_PATH "/examples/mdp/asynchronous_leader/leader7.tra", STORM_CPP_BASE_PATH "/examples/mdp/asynchronous_leader/leader7.lab", "", ""); std::shared_ptr> mdp = parser.getModel>(); storm::storage::StronglyConnectedComponentDecomposition sccDecomposition; ASSERT_NO_THROW(sccDecomposition = storm::storage::StronglyConnectedComponentDecomposition(*mdp)); ASSERT_EQ(1461930, sccDecomposition.size()); ASSERT_NO_THROW(sccDecomposition = storm::storage::StronglyConnectedComponentDecomposition(*mdp, true)); ASSERT_EQ(127, sccDecomposition.size()); ASSERT_NO_THROW(sccDecomposition = storm::storage::StronglyConnectedComponentDecomposition(*mdp, true)); ASSERT_EQ(127, sccDecomposition.size()); mdp = nullptr; } TEST(StronglyConnectedComponentDecomposition, Consensus) { storm::parser::AutoParser parser(STORM_CPP_BASE_PATH "/examples/mdp/consensus/coin6_4.tra", STORM_CPP_BASE_PATH "/examples/mdp/consensus/coin6_4.lab", "", ""); std::shared_ptr> mdp = parser.getModel>(); storm::storage::StronglyConnectedComponentDecomposition sccDecomposition; ASSERT_NO_THROW(sccDecomposition = storm::storage::StronglyConnectedComponentDecomposition(*mdp)); ASSERT_EQ(121251, sccDecomposition.size()); ASSERT_NO_THROW(sccDecomposition = storm::storage::StronglyConnectedComponentDecomposition(*mdp, true)); ASSERT_EQ(1049, sccDecomposition.size()); ASSERT_NO_THROW(sccDecomposition = storm::storage::StronglyConnectedComponentDecomposition(*mdp, true, true)); ASSERT_EQ(384, sccDecomposition.size()); mdp = nullptr; }