Browse Source
flattening JANI models appears to be working, started adding tests
tempestpy_adaptions
flattening JANI models appears to be working, started adding tests
tempestpy_adaptions
dehnert
8 years ago
17 changed files with 470 additions and 32 deletions
-
2src/storm/cli/cli.cpp
-
9src/storm/storage/jani/Automaton.cpp
-
5src/storm/storage/jani/Automaton.h
-
4src/storm/storage/jani/Location.cpp
-
7src/storm/storage/jani/Location.h
-
255src/storm/storage/jani/Model.cpp
-
13src/storm/storage/jani/Model.h
-
8src/storm/storage/jani/OrderedAssignments.cpp
-
5src/storm/storage/jani/OrderedAssignments.h
-
7src/storm/storage/jani/TemplateEdge.cpp
-
5src/storm/storage/jani/TemplateEdge.h
-
4src/storm/storage/jani/TemplateEdgeDestination.cpp
-
7src/storm/storage/jani/TemplateEdgeDestination.h
-
9src/storm/storage/jani/VariableSet.cpp
-
5src/storm/storage/jani/VariableSet.h
-
2src/storm/utility/storm.h
-
155src/test/storage/JaniModelTest.cpp
@ -0,0 +1,155 @@ |
|||
#include "gtest/gtest.h"
|
|||
#include "storm-config.h"
|
|||
#include "storm/parser/PrismParser.h"
|
|||
|
|||
#include "storm/utility/solver.h"
|
|||
|
|||
#include "storm/storage/jani/Model.h"
|
|||
|
|||
#ifdef STORM_HAVE_MSAT
|
|||
TEST(JaniModelTest, FlattenModules) { |
|||
storm::prism::Program program; |
|||
ASSERT_NO_THROW(program = storm::parser::PrismParser::parse(STORM_TEST_RESOURCES_DIR "/mdp/leader3.nm")); |
|||
storm::jani::Model janiModel = program.toJani(); |
|||
|
|||
std::shared_ptr<storm::utility::solver::SmtSolverFactory> smtSolverFactory = std::make_shared<storm::utility::solver::MathsatSmtSolverFactory>(); |
|||
|
|||
ASSERT_NO_THROW(model = model.flattenComposition(smtSolverFactory)); |
|||
EXPECT_EQ(1, program.getNumberOfModules()); |
|||
EXPECT_EQ(74, program.getModule(0).getNumberOfCommands()); |
|||
} |
|||
|
|||
TEST(JaniModelTest, FlattenModules_Wlan_Mathsat) { |
|||
storm::prism::Program program; |
|||
ASSERT_NO_THROW(program = storm::parser::PrismParser::parse(STORM_TEST_RESOURCES_DIR "/mdp/wlan0_collide.nm")); |
|||
storm::jani::Model janiModel = program.toJani(); |
|||
|
|||
std::shared_ptr<storm::utility::solver::SmtSolverFactory> smtSolverFactory = std::make_shared<storm::utility::solver::MathsatSmtSolverFactory>(); |
|||
|
|||
ASSERT_NO_THROW(model = model.flattenComposition(smtSolverFactory)); |
|||
EXPECT_EQ(1, program.getNumberOfModules()); |
|||
EXPECT_EQ(179, program.getModule(0).getNumberOfCommands()); |
|||
} |
|||
|
|||
TEST(JaniModelTest, FlattenModules_Csma_Mathsat) { |
|||
storm::prism::Program program; |
|||
ASSERT_NO_THROW(program = storm::parser::PrismParser::parse(STORM_TEST_RESOURCES_DIR "/mdp/csma2_2.nm")); |
|||
storm::jani::Model janiModel = program.toJani(); |
|||
|
|||
std::shared_ptr<storm::utility::solver::SmtSolverFactory> smtSolverFactory = std::make_shared<storm::utility::solver::MathsatSmtSolverFactory>(); |
|||
|
|||
ASSERT_NO_THROW(model = model.flattenComposition(smtSolverFactory)); |
|||
EXPECT_EQ(1, program.getNumberOfModules()); |
|||
EXPECT_EQ(70, program.getModule(0).getNumberOfCommands()); |
|||
} |
|||
|
|||
TEST(JaniModelTest, FlattenModules_Firewire_Mathsat) { |
|||
storm::prism::Program program; |
|||
ASSERT_NO_THROW(program = storm::parser::PrismParser::parse(STORM_TEST_RESOURCES_DIR "/mdp/firewire.nm")); |
|||
storm::jani::Model janiModel = program.toJani(); |
|||
|
|||
std::shared_ptr<storm::utility::solver::SmtSolverFactory> smtSolverFactory = std::make_shared<storm::utility::solver::MathsatSmtSolverFactory>(); |
|||
|
|||
ASSERT_NO_THROW(model = model.flattenComposition(smtSolverFactory)); |
|||
EXPECT_EQ(1, program.getNumberOfModules()); |
|||
EXPECT_EQ(5024, program.getModule(0).getNumberOfCommands()); |
|||
} |
|||
|
|||
TEST(JaniModelTest, FlattenModules_Coin_Mathsat) { |
|||
storm::prism::Program program; |
|||
ASSERT_NO_THROW(program = storm::parser::PrismParser::parse(STORM_TEST_RESOURCES_DIR "/mdp/coin2.nm")); |
|||
storm::jani::Model janiModel = program.toJani(); |
|||
|
|||
std::shared_ptr<storm::utility::solver::SmtSolverFactory> smtSolverFactory = std::make_shared<storm::utility::solver::MathsatSmtSolverFactory>(); |
|||
|
|||
ASSERT_NO_THROW(model = model.flattenComposition(smtSolverFactory)); |
|||
EXPECT_EQ(1, program.getNumberOfModules()); |
|||
EXPECT_EQ(13, program.getModule(0).getNumberOfCommands()); |
|||
} |
|||
|
|||
TEST(JaniModelTest, FlattenModules_Dice_Mathsat) { |
|||
storm::prism::Program program; |
|||
ASSERT_NO_THROW(program = storm::parser::PrismParser::parse(STORM_TEST_RESOURCES_DIR "/mdp/two_dice.nm")); |
|||
storm::jani::Model janiModel = program.toJani(); |
|||
|
|||
std::shared_ptr<storm::utility::solver::SmtSolverFactory> smtSolverFactory = std::make_shared<storm::utility::solver::MathsatSmtSolverFactory>(); |
|||
|
|||
ASSERT_NO_THROW(model = model.flattenComposition(smtSolverFactory)); |
|||
EXPECT_EQ(1, program.getNumberOfModules()); |
|||
EXPECT_EQ(16, program.getModule(0).getNumberOfCommands()); |
|||
} |
|||
#endif
|
|||
|
|||
#ifdef STORM_HAVE_Z3
|
|||
TEST(JaniModelTest, FlattenModules_Leader_Z3) { |
|||
storm::prism::Program program; |
|||
ASSERT_NO_THROW(program = storm::parser::PrismParser::parse(STORM_TEST_RESOURCES_DIR "/mdp/leader3.nm")); |
|||
storm::jani::Model janiModel = program.toJani(); |
|||
|
|||
std::shared_ptr<storm::utility::solver::SmtSolverFactory> smtSolverFactory = std::make_shared<storm::utility::solver::Z3SmtSolverFactory>(); |
|||
|
|||
ASSERT_NO_THROW(model = model.flattenComposition(smtSolverFactory)); |
|||
EXPECT_EQ(1, program.getNumberOfModules()); |
|||
EXPECT_EQ(74, program.getModule(0).getNumberOfCommands()); |
|||
} |
|||
|
|||
TEST(JaniModelTest, FlattenModules_Wlan_Z3) { |
|||
storm::prism::Program program; |
|||
ASSERT_NO_THROW(program = storm::parser::PrismParser::parse(STORM_TEST_RESOURCES_DIR "/mdp/wlan0_collide.nm")); |
|||
storm::jani::Model janiModel = program.toJani(); |
|||
|
|||
std::shared_ptr<storm::utility::solver::SmtSolverFactory> smtSolverFactory = std::make_shared<storm::utility::solver::Z3SmtSolverFactory>(); |
|||
|
|||
ASSERT_NO_THROW(model = model.flattenComposition(smtSolverFactory)); |
|||
EXPECT_EQ(1, program.getNumberOfModules()); |
|||
EXPECT_EQ(179, program.getModule(0).getNumberOfCommands()); |
|||
} |
|||
|
|||
TEST(JaniModelTest, FlattenModules_Csma_Z3) { |
|||
storm::prism::Program program; |
|||
ASSERT_NO_THROW(program = storm::parser::PrismParser::parse(STORM_TEST_RESOURCES_DIR "/mdp/csma2_2.nm")); |
|||
storm::jani::Model janiModel = program.toJani(); |
|||
|
|||
std::shared_ptr<storm::utility::solver::SmtSolverFactory> smtSolverFactory = std::make_shared<storm::utility::solver::Z3SmtSolverFactory>(); |
|||
|
|||
ASSERT_NO_THROW(model = model.flattenComposition(smtSolverFactory)); |
|||
EXPECT_EQ(1, program.getNumberOfModules()); |
|||
EXPECT_EQ(70, program.getModule(0).getNumberOfCommands()); |
|||
} |
|||
|
|||
TEST(JaniModelTest, FlattenModules_Firewire_Z3) { |
|||
storm::prism::Program program; |
|||
ASSERT_NO_THROW(program = storm::parser::PrismParser::parse(STORM_TEST_RESOURCES_DIR "/mdp/firewire.nm")); |
|||
storm::jani::Model janiModel = program.toJani(); |
|||
|
|||
std::shared_ptr<storm::utility::solver::SmtSolverFactory> smtSolverFactory = std::make_shared<storm::utility::solver::Z3SmtSolverFactory>(); |
|||
|
|||
ASSERT_NO_THROW(model = model.flattenComposition(smtSolverFactory)); |
|||
EXPECT_EQ(1, program.getNumberOfModules()); |
|||
EXPECT_EQ(5024, program.getModule(0).getNumberOfCommands()); |
|||
} |
|||
|
|||
TEST(JaniModelTest, FlattenModules_Coin_Z3) { |
|||
storm::prism::Program program; |
|||
ASSERT_NO_THROW(program = storm::parser::PrismParser::parse(STORM_TEST_RESOURCES_DIR "/mdp/coin2.nm")); |
|||
storm::jani::Model janiModel = program.toJani(); |
|||
|
|||
std::shared_ptr<storm::utility::solver::SmtSolverFactory> smtSolverFactory = std::make_shared<storm::utility::solver::Z3SmtSolverFactory>(); |
|||
|
|||
ASSERT_NO_THROW(model = model.flattenComposition(smtSolverFactory)); |
|||
EXPECT_EQ(1, program.getNumberOfModules()); |
|||
EXPECT_EQ(13, program.getModule(0).getNumberOfCommands()); |
|||
} |
|||
|
|||
TEST(JaniModelTest, FlattenModules_Dice_Z3) { |
|||
storm::prism::Program program; |
|||
ASSERT_NO_THROW(program = storm::parser::PrismParser::parse(STORM_TEST_RESOURCES_DIR "/mdp/two_dice.nm")); |
|||
storm::jani::Model janiModel = program.toJani(); |
|||
|
|||
std::shared_ptr<storm::utility::solver::SmtSolverFactory> smtSolverFactory = std::make_shared<storm::utility::solver::Z3SmtSolverFactory>(); |
|||
|
|||
ASSERT_NO_THROW(model = model.flattenComposition(smtSolverFactory)); |
|||
EXPECT_EQ(1, program.getNumberOfModules()); |
|||
EXPECT_EQ(16, program.getModule(0).getNumberOfCommands()); |
|||
} |
|||
#endif
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue