66TEST(PropertyTest, NamedPropertyWithFilterInitStates) {
67 std::string
const name =
"p";
68 std::string
const formula =
"P=? [F \"target\"]";
69 std::string
const statesFormula =
"\"init\"";
70 std::string
const expected =
"\"" + name +
"\": filter(max, " + formula +
", " + statesFormula +
");";
74 EXPECT_EQ(expected, property.asPrismSyntax());
78 ASSERT_EQ(1ull, reparsed.size());
79 EXPECT_EQ(expected, reparsed.front().asPrismSyntax());
82TEST(PropertyTest, FilterTypeKeywords) {
83 std::set<std::string> keywords;
85 for (
auto const& ft : allFilterTypes) {
87 EXPECT_FALSE(keyword.empty());
88 keywords.insert(keyword);
90 EXPECT_EQ(allFilterTypes.size(), keywords.size());
93TEST(PropertyTest, FilterTypeKeywordsRoundTrip) {
94 std::string
const name =
"p";
95 std::string
const formula =
"P=? [F \"a\"]";
96 std::string
const statesFormula =
"\"b\"";
100 for (
auto const& ft : allFilterTypes) {
104 ASSERT_EQ(1ull, properties.size()) << expected;
105 EXPECT_EQ(ft, properties.front().getFilter().getFilterType()) << expected;
106 EXPECT_EQ(expected, properties.front().asPrismSyntax());
111TEST(PropertyTest, FilterKeywordValuesAlias) {
112 std::string
const name =
"p";
113 std::string
const formula =
"P=? [F \"a\"]";
114 std::string
const statesFormula =
"\"b\"";
115 std::string
const input =
"\"" + name +
"\": filter(values, " + formula +
", " + statesFormula +
");";
116 std::string
const expected =
"\"" + name +
"\": filter(printall, " + formula +
", " + statesFormula +
");";
120 ASSERT_EQ(1ull, properties.size());
122 EXPECT_EQ(expected, properties.front().asPrismSyntax());
125TEST(PropertyTest, CommentIsSeparate) {
126 std::string
const name =
"p";
127 std::string
const formula =
"P=? [F \"target\"]";
128 std::string
const comment =
"very important property";
129 std::string
const expected =
"\"" + name +
"\": " + formula +
";";
131 auto const property = plainProperty(name, formula, comment);
133 EXPECT_EQ(expected, property.asPrismSyntax());
134 EXPECT_EQ(comment, property.getComment());
137TEST(PropertyTest, StreamAndStringEqual) {
138 std::string
const name =
"p";
139 std::string
const formula =
"P=? [F \"target\"]";
140 std::string
const statesFormula =
"\"a\"";
144 std::stringstream stream;
145 property.asPrismSyntax(stream);
147 EXPECT_EQ(property.asPrismSyntax(), stream.str());