Storm 2.0.0.3
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
JaniModelTest.cpp
Go to the documentation of this file.
1#include "storm-config.h"
2#include "test/storm_gtest.h"
3
8
9namespace {
10
11class JaniModelFlattenTest : public ::testing::TestWithParam<storm::solver::SmtSolverType> {
12 protected:
13 void flattenAndCheck(std::string const& path, uint64_t expectedNumberOfEdges) const {
14 storm::prism::Program program;
15 ASSERT_NO_THROW(program = storm::parser::PrismParser::parse(path));
16 storm::jani::Model janiModel = program.toJani();
17
19 janiModel.substituteFunctions();
20 ASSERT_NO_THROW(janiModel = janiModel.flattenComposition(smtSolverFactory));
21 EXPECT_EQ(1ull, janiModel.getNumberOfAutomata());
22 EXPECT_EQ(expectedNumberOfEdges, janiModel.getAutomaton(0).getNumberOfEdges());
23 }
24};
25
26} // namespace
27
28TEST_P(JaniModelFlattenTest, Leader) {
29 flattenAndCheck(STORM_TEST_RESOURCES_DIR "/mdp/leader3.nm", 74ull);
30}
31
32TEST_P(JaniModelFlattenTest, Wlan) {
33 flattenAndCheck(STORM_TEST_RESOURCES_DIR "/mdp/wlan0_collide.nm", 179ull);
34}
35
36TEST_P(JaniModelFlattenTest, Csma) {
37 flattenAndCheck(STORM_TEST_RESOURCES_DIR "/mdp/csma2_2.nm", 70ull);
38}
39
40STORM_EXPENSIVE_TEST_P(JaniModelFlattenTest, Firewire) {
41 flattenAndCheck(STORM_TEST_RESOURCES_DIR "/mdp/firewire.nm", 5024ull);
42}
43
44TEST_P(JaniModelFlattenTest, Coin) {
45 flattenAndCheck(STORM_TEST_RESOURCES_DIR "/mdp/coin2.nm", 13ull);
46}
47
48TEST_P(JaniModelFlattenTest, Dice) {
49 flattenAndCheck(STORM_TEST_RESOURCES_DIR "/mdp/two_dice.nm", 16ull);
50}
51
52INSTANTIATE_TEST_SUITE_P(SmtSolvers, JaniModelFlattenTest, ::testing::ValuesIn(storm::test::smtSolversUnderTest()), storm::test::smtSolverName);
53// The suite is empty if no SMT solver was compiled in.
TEST_P(JaniModelFlattenTest, Leader)
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(JaniModelFlattenTest)
INSTANTIATE_TEST_SUITE_P(SmtSolvers, JaniModelFlattenTest, ::testing::ValuesIn(storm::test::smtSolversUnderTest()), storm::test::smtSolverName)
uint64_t getNumberOfEdges() const
Retrieves the number of edges.
void substituteFunctions()
Substitutes all function calls with the corresponding function definition.
Definition Model.cpp:1216
Model flattenComposition(std::shared_ptr< storm::utility::solver::SmtSolverFactory > const &smtSolverFactory=std::make_shared< storm::utility::solver::SmtSolverFactory >()) const
Flatten the composition to obtain an equivalent model that contains exactly one automaton that has th...
Definition Model.cpp:438
std::size_t getNumberOfAutomata() const
Retrieves the number of automata in this model.
Definition Model.cpp:910
Automaton & getAutomaton(std::string const &name)
Retrieves the automaton with the given name.
Definition Model.cpp:884
static storm::prism::Program parse(std::string const &filename, bool prismCompatability=false)
Parses the given file into the PRISM storage classes assuming it complies with the PRISM syntax.
storm::jani::Model toJani(bool allVariablesGlobal=true, std::string suffix="") const
Converts the PRISM model into an equivalent JANI model.
Definition Program.cpp:2350
std::string smtSolverName(testing::TestParamInfo< storm::solver::SmtSolverType > const &info)
std::shared_ptr< storm::utility::solver::SmtSolverFactory > smtSolverFactory(storm::solver::SmtSolverType type)
std::vector< storm::solver::SmtSolverType > smtSolversUnderTest()
#define STORM_EXPENSIVE_TEST_P(test_suite_name, test_name)
Definition storm_gtest.h:32