1#include "storm-config.h"
12class PrismProgramFlattenTest :
public ::testing::TestWithParam<storm::solver::SmtSolverType> {
14 void flattenAndCheck(std::string
const& path, uint64_t expectedNumberOfCommands)
const {
15 storm::prism::Program program;
27TEST_P(PrismProgramFlattenTest, Leader) {
28 flattenAndCheck(STORM_TEST_RESOURCES_DIR
"/mdp/leader3.nm", 74ull);
31TEST_P(PrismProgramFlattenTest, Wlan) {
32 flattenAndCheck(STORM_TEST_RESOURCES_DIR
"/mdp/wlan0_collide.nm", 179ull);
35TEST_P(PrismProgramFlattenTest, Csma) {
36 flattenAndCheck(STORM_TEST_RESOURCES_DIR
"/mdp/csma2_2.nm", 70ull);
40 flattenAndCheck(STORM_TEST_RESOURCES_DIR
"/mdp/firewire.nm", 5024ull);
43TEST_P(PrismProgramFlattenTest, Coin) {
44 flattenAndCheck(STORM_TEST_RESOURCES_DIR
"/mdp/coin2.nm", 13ull);
47TEST_P(PrismProgramFlattenTest, Dice) {
48 flattenAndCheck(STORM_TEST_RESOURCES_DIR
"/mdp/two_dice.nm", 16ull);
55TEST(PrismProgramTest, ConvertToJani) {
60 ASSERT_NO_THROW(janiModel = prismProgram.
toJani());
63 ASSERT_NO_THROW(janiModel = prismProgram.
toJani());
66 ASSERT_NO_THROW(janiModel = prismProgram.
toJani());
69 ASSERT_NO_THROW(janiModel = prismProgram.
toJani());
72 ASSERT_NO_THROW(janiModel = prismProgram.
toJani());
75 ASSERT_NO_THROW(janiModel = prismProgram.
toJani());
78 ASSERT_NO_THROW(janiModel = prismProgram.
toJani());
81TEST(PrismProgramTest, ReplaceInitialStates) {
90TEST(PrismProgramTest, ReplaceConstantByVariable) {
97 EXPECT_FALSE(transformedPrismProgram.
hasConstant(
"CrowdSize"));
TEST(PrismProgramTest, ConvertToJani)
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(PrismProgramFlattenTest)
TEST_P(PrismProgramFlattenTest, Leader)
INSTANTIATE_TEST_SUITE_P(SmtSolvers, PrismProgramFlattenTest, ::testing::ValuesIn(storm::test::smtSolversUnderTest()), storm::test::smtSolverName)
bool isSyntacticallyEqual(storm::expressions::Expression const &other) const
Checks whether the two expressions are syntatically the same.
Expression integer(int_fast64_t value) const
Creates an expression that characterizes the given integer literal.
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.
std::size_t getNumberOfCommands() const
Retrieves the number of commands of this module.
Program replaceConstantByVariable(Constant const &c, expressions::Expression const &lowerBound, expressions::Expression const &upperBound, bool observable=true) const
Substitutes the given constant by a fresh global variable that is bound between lowerBound and upperB...
Module const & getModule(uint_fast64_t index) const
Retrieves the module with the given index.
IntegerVariable const & getGlobalIntegerVariable(std::string const &variableName) const
Retrieves a the global integer variable with the given name.
Constant const & getConstant(std::string const &constantName) const
Retrieves the constant with the given name if it exists.
Program substituteFormulas() const
Substitutes all formulas appearing in the expressions of the program by their defining expressions.
storm::expressions::ExpressionManager & getManager() const
Retrieves the manager responsible for the expressions of this program.
Program replaceVariableInitializationByInitExpression() const
Replace the initialization in variables by an init-expression.
bool hasConstant(std::string const &constantName) const
Retrieves whether the given constant exists in the program.
storm::expressions::Expression getInitialStatesExpression() const
Retrieves an expression characterizing the initial states.
std::size_t getNumberOfModules() const
Retrieves the number of modules in the program.
bool hasInitialConstruct() const
Retrieves whether the program specifies an initial construct.
Program flattenModules(std::shared_ptr< storm::utility::solver::SmtSolverFactory > const &smtSolverFactory=std::shared_ptr< storm::utility::solver::SmtSolverFactory >(new storm::utility::solver::SmtSolverFactory())) const
Creates an equivalent program that contains exactly one module.
storm::jani::Model toJani(bool allVariablesGlobal=true, std::string suffix="") const
Converts the PRISM model into an equivalent JANI model.
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)