17TEST(JaniParser, DieExampleTest) {
20 std::string
const testInput{std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>()};
21 ASSERT_FALSE(testInput.empty());
23 std::pair<storm::jani::Model, std::vector<storm::jani::Property>> result;
26 EXPECT_TRUE(result.first.hasGlobalVariable(
"s"));
27 EXPECT_EQ(1ul, result.first.getNumberOfAutomata());
29 ASSERT_EQ(12ul, result.second.size());
32 EXPECT_EQ(
storm::api::parseJaniModel(STORM_TEST_RESOURCES_DIR
"/dtmc/die_janiproperties.jani").second.size(), result.second.size());
34 auto const& conjunction = result.second[2].getRawFormula()->asProbabilityOperatorFormula().getSubformula();
35 ASSERT_TRUE(conjunction.isBinaryBooleanPathFormula());
37 auto const& disjunction = result.second[3].getRawFormula()->asProbabilityOperatorFormula().getSubformula();
38 ASSERT_TRUE(disjunction.isBinaryBooleanPathFormula());
40 auto const& negation = result.second[4].getRawFormula()->asProbabilityOperatorFormula().getSubformula();
41 ASSERT_TRUE(negation.isUnaryBooleanPathFormula());
43 auto const& implication = result.second[5].getRawFormula()->asProbabilityOperatorFormula().getSubformula();
44 ASSERT_TRUE(implication.isBinaryBooleanPathFormula());
46 auto const& stateConjunction = *result.second[6].getRawFormula();
47 ASSERT_TRUE(stateConjunction.isBinaryBooleanStateFormula());
49 auto const& weakUntil = result.second[7].getRawFormula()->asProbabilityOperatorFormula().getSubformula();
50 ASSERT_TRUE(weakUntil.isWeakUntilFormula());
52 auto const& release = result.second[8].getRawFormula()->asProbabilityOperatorFormula().getSubformula();
53 ASSERT_TRUE(release.isReleaseFormula());
56TEST(JaniParser, DieExampleFragmentTest) {
57 std::pair<storm::jani::Model, std::vector<storm::jani::Property>> result;
59 ASSERT_EQ(12ul, result.second.size());
61 auto const& weakUntil = result.second[7].getRawFormula()->asProbabilityOperatorFormula().getSubformula();
62 auto const& release = result.second[8].getRawFormula()->asProbabilityOperatorFormula().getSubformula();
63 auto const& until = result.second[9].getRawFormula()->asProbabilityOperatorFormula().getSubformula();
66 ASSERT_TRUE(weakUntil.isWeakUntilFormula());
71 ASSERT_TRUE(release.isReleaseFormula());
76 ASSERT_TRUE(until.isUntilFormula());
81TEST(JaniParser, DieArrayExampleTest) {
82 std::pair<storm::jani::Model, std::vector<storm::jani::Property>> result;
85 EXPECT_TRUE(result.first.containsArrayVariables());
86 EXPECT_TRUE(result.first.hasGlobalVariable(
"sd"));
87 EXPECT_EQ(1ul, result.first.getNumberOfAutomata());
90TEST(JaniParser, FTWCTest) {
91 std::pair<storm::jani::Model, std::vector<storm::jani::Property>> result;
94 EXPECT_TRUE(result.first.containsArrayVariables());
95 EXPECT_TRUE(result.first.hasGlobalVariable(
"workstations_up"));
96 EXPECT_TRUE(result.first.hasGlobalVariable(
"workstations_up"));
97 EXPECT_EQ(6ul, result.first.getNumberOfAutomata());
98 EXPECT_TRUE(result.first.getAutomaton(
"Switch").hasVariable(
"id"));
99 EXPECT_TRUE(result.first.getAutomaton(
"Switch_1").hasVariable(
"id"));
100 EXPECT_TRUE(result.first.getAutomaton(
"Workstation").hasVariable(
"id"));
101 EXPECT_TRUE(result.first.getAutomaton(
"Workstation_1").hasVariable(
"id"));
102 EXPECT_TRUE(result.first.getAutomaton(1).hasVariable(
"id"));
105TEST(JaniParser, DieArrayNestedExampleTest) {
106 std::pair<storm::jani::Model, std::vector<storm::jani::Property>> result;
109 EXPECT_TRUE(result.first.containsArrayVariables());
110 EXPECT_TRUE(result.first.hasGlobalVariable(
"sd"));
111 EXPECT_EQ(1ul, result.first.getNumberOfAutomata());
114TEST(JaniParser, UnassignedVariablesTest) {
115 std::pair<storm::jani::Model, std::vector<storm::jani::Property>> result;
118 EXPECT_TRUE(result.first.hasConstant(
"c"));
119 EXPECT_EQ(2ul, result.first.getNumberOfAutomata());
122TEST(JaniParser, TrigonometryAndTranscendentalNumbersTest) {
123 std::pair<storm::jani::Model, std::vector<storm::jani::Property>> result;
125 auto& model = result.first;
126 auto& properties = result.second;
128 EXPECT_EQ(model.getNumberOfAutomata(), 1U);
129 EXPECT_EQ(properties.size(), 2U);
130 EXPECT_NO_THROW(model.substitute({},
true));
133TEST(JaniParser, MultiobjectiveTest) {
134 std::pair<storm::jani::Model, std::vector<storm::jani::Property>> result;
136 auto& model = result.first;
138 auto& properties = result.second;
139 ASSERT_EQ(properties.size(), 6U);
140 for (
size_t i = 0; i < properties.size(); ++i) {
141 auto const& f = properties[i].getRawFormula();
142 ASSERT_TRUE(f->isMultiObjectiveFormula()) <<
"Property #" << i <<
": " << *f;
144 EXPECT_EQ(i < 3, f->asMultiObjectiveFormula().isTradeoff()) <<
"Property #" << i <<
": " << *f;
145 EXPECT_EQ(i >= 3, f->asMultiObjectiveFormula().isLexicographic()) <<
"Property #" << i <<
": " << *f;
147 EXPECT_EQ(i == 0 || i == 3, f->asMultiObjectiveFormula().hasQualitativeResult()) <<
"Property #" << i <<
": " << *f;
149 EXPECT_EQ(i == 2 || i == 5, f->asMultiObjectiveFormula().hasMultiDimensionalResult()) <<
"Property #" << i <<
": " << *f;
void openFile(std::string const &filepath, std::ofstream &filestream, bool append=false, bool silent=false)
Open the given file for writing.