2#include "storm-config.h"
9TEST(PrismParser, StandardModelTest) {
22TEST(PrismParser, SimpleTest) {
23 std::string testInput =
27 [a] true -> 1: (b'=true != false = b => false);
54TEST(PrismParser, expressionTest) {
55 std::string testInput = R
"(dtmc
59 [] c = ceil(log(1,2)) -> (c'=1);
69 auto const& guard = result.
getModule(
"test").
getCommands().front().getGuardExpression().getBaseExpression();
70 ASSERT_TRUE(guard.isBinaryRelationExpression());
71 EXPECT_EQ(0ll, guard.asBinaryRelationExpression().getSecondOperand()->evaluateAsInt());
74TEST(PrismParser, ComplexTest) {
75 std::string testInput =
81 const bool d = true | false;
85 formula test = a >= 10 & (max(a,b) > floor(e));
87 formula test3 = (a + b > 10 ? floor(e) : h) + a;
89 global g : bool init false;
97 [a] test&false -> (i'=true)&(k'=1+1) + 1 : (k'=floor(e) + max(k, b) - 1 + k);
102 [] (k > 3) & false & (min(a, 0) < max(h, k)) -> 1-e: (g'=(1-a) * 2 + floor(f) > 2);
105 module mod3 = mod1 [ i = i1, j = j1, k = k1 ] endmodule
107 label "mal" = max(a, 10) > 0;
109 rewards "testrewards"
111 max(f, a) <= 8 : 2*b;
114 rewards "testrewards2"
116 max(f, a) <= 8 : 2*b;
128TEST(PrismParser, UnboundedTest) {
129 std::string testInput =
133 [a] true -> 1: (b'=b+1);
143TEST(PrismParser, POMDPInputTest) {
144 std::string testInput =
154 [] s=0 -> 0.5: (s'=1) & (i'=false) + 0.5: (s'=2) & (i'=false);
155 [] s=1 | s=2 -> 1: (s'=3) & (i'=true);
156 [r] s=1 -> 1: (s'=4) & (i'=true);
157 [r] s=2 -> 1: (s'=3) & (i'=true);
165 std::string testInput2 =
168 observable intermediate = s=1 | s=2;
172 [] s=0 -> 0.5: (s'=1) + 0.5: (s'=2);
173 [l] s=1 -> 1: (s'=3);
174 [l] s=2 -> 1: (s'=4);
175 [r] s=1 -> 1: (s'=4);
176 [r] s=2 -> 1: (s'=3);
184TEST(PrismParser, NAryPredicates) {
185 std::string testInput =
191 [] s=0 -> 0.5: (s'=1) & (i'=false) + 0.5: (s'=2) & (i'=false);
192 [] s=1 | s=2 -> 1: (s'=3) & (i'=true);
193 [r] s=1 -> 1: (s'=4) & (i'=true);
194 [r] s=2 -> 1: (s'=3) & (i'=true);
197 label "test" = atMostOneOf(s=0, s=3, s=4);
198 label "test2" = exactlyOneOf(s=0, i, !i & s=3);
205TEST(PrismParser, IllegalInputTest) {
206 std::string testInput =
214 [] c < 3 -> 2: (c' = c+1);
228 [] a < 3 -> 1: (a' = a+1);
241 [] c < 3 -> 1: (c' = c+1);
257 [] c < 3 -> 1: (c' = c+1);
273 [] c < 3 -> 1: (c' = c+1);
277 [] c < 3 -> 1: (c' = c+1);
287 [] c < 3 -> 1: (c' = c+1)&(c'=c-1);
297 [] c < 3 -> 1: (c' = true || false);
307 [] c + 3 -> 1: (c' = 1);
317 [] c + 3 -> 1: (c' = 1);
320 label "test" = c + 1;
327TEST(PrismParser, IllegalSynchronizedWriteTest) {
329 storm::exceptions::WrongFormatException);
TEST(PrismParser, StandardModelTest)
static storm::prism::Program parseFromString(std::string const &input, std::string const &filename, bool prismCompatability=false)
Parses the given input stream into the PRISM storage classes assuming it complies with the PRISM synt...
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::vector< storm::prism::Command > const & getCommands() const
Retrieves the commands of the module.
std::size_t getNumberOfCommands() const
Retrieves the number of commands of this module.
ModelType getModelType() const
Retrieves the model type of the model.
std::size_t getNumberOfLabels() const
Retrieves the number of labels in the program.
Module const & getModule(uint_fast64_t index) const
Retrieves the module with the given index.
std::size_t getNumberOfRewardModels() const
Retrieves the number of reward models in the program.
bool hasModule(std::string const &moduleName) const
Retrieves whether the program has a module with the given name.
bool hasUnboundedVariables() const
std::size_t getNumberOfModules() const
Retrieves the number of modules in the program.
#define STORM_SILENT_EXPECT_THROW(statement, expected_exception)