You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

334 lines
22 KiB

  1. #include <map>
  2. #include <string>
  3. #include "gtest/gtest.h"
  4. #include "src/storage/expressions/Expression.h"
  5. #include "src/storage/expressions/SimpleValuation.h"
  6. #include "src/exceptions/InvalidTypeException.h"
  7. TEST(Expression, FactoryMethodTest) {
  8. EXPECT_NO_THROW(storm::expressions::Expression::createBooleanLiteral(true));
  9. EXPECT_NO_THROW(storm::expressions::Expression::createTrue());
  10. EXPECT_NO_THROW(storm::expressions::Expression::createFalse());
  11. EXPECT_NO_THROW(storm::expressions::Expression::createIntegerLiteral(3));
  12. EXPECT_NO_THROW(storm::expressions::Expression::createDoubleLiteral(3.14));
  13. EXPECT_NO_THROW(storm::expressions::Expression::createBooleanVariable("x"));
  14. EXPECT_NO_THROW(storm::expressions::Expression::createIntegerVariable("y"));
  15. EXPECT_NO_THROW(storm::expressions::Expression::createDoubleVariable("z"));
  16. }
  17. TEST(Expression, AccessorTest) {
  18. storm::expressions::Expression trueExpression;
  19. storm::expressions::Expression falseExpression;
  20. storm::expressions::Expression threeExpression;
  21. storm::expressions::Expression piExpression;
  22. storm::expressions::Expression boolVarExpression;
  23. storm::expressions::Expression intVarExpression;
  24. storm::expressions::Expression doubleVarExpression;
  25. ASSERT_NO_THROW(trueExpression = storm::expressions::Expression::createTrue());
  26. ASSERT_NO_THROW(falseExpression = storm::expressions::Expression::createFalse());
  27. ASSERT_NO_THROW(threeExpression = storm::expressions::Expression::createIntegerLiteral(3));
  28. ASSERT_NO_THROW(piExpression = storm::expressions::Expression::createDoubleLiteral(3.14));
  29. ASSERT_NO_THROW(boolVarExpression = storm::expressions::Expression::createBooleanVariable("x"));
  30. ASSERT_NO_THROW(intVarExpression = storm::expressions::Expression::createIntegerVariable("y"));
  31. ASSERT_NO_THROW(doubleVarExpression = storm::expressions::Expression::createDoubleVariable("z"));
  32. EXPECT_TRUE(trueExpression.getReturnType() == storm::expressions::ExpressionReturnType::Bool);
  33. EXPECT_TRUE(trueExpression.isLiteral());
  34. EXPECT_TRUE(trueExpression.isTrue());
  35. EXPECT_FALSE(trueExpression.isFalse());
  36. EXPECT_TRUE(trueExpression.getVariables() == std::set<std::string>());
  37. EXPECT_TRUE(falseExpression.getReturnType() == storm::expressions::ExpressionReturnType::Bool);
  38. EXPECT_TRUE(falseExpression.isLiteral());
  39. EXPECT_FALSE(falseExpression.isTrue());
  40. EXPECT_TRUE(falseExpression.isFalse());
  41. EXPECT_TRUE(falseExpression.getVariables() == std::set<std::string>());
  42. EXPECT_TRUE(threeExpression.getReturnType() == storm::expressions::ExpressionReturnType::Int);
  43. EXPECT_TRUE(threeExpression.isLiteral());
  44. EXPECT_FALSE(threeExpression.isTrue());
  45. EXPECT_FALSE(threeExpression.isFalse());
  46. EXPECT_TRUE(threeExpression.getVariables() == std::set<std::string>());
  47. EXPECT_TRUE(piExpression.getReturnType() == storm::expressions::ExpressionReturnType::Double);
  48. EXPECT_TRUE(piExpression.isLiteral());
  49. EXPECT_FALSE(piExpression.isTrue());
  50. EXPECT_FALSE(piExpression.isFalse());
  51. EXPECT_TRUE(piExpression.getVariables() == std::set<std::string>());
  52. EXPECT_TRUE(boolVarExpression.getReturnType() == storm::expressions::ExpressionReturnType::Bool);
  53. EXPECT_FALSE(boolVarExpression.isLiteral());
  54. EXPECT_FALSE(boolVarExpression.isTrue());
  55. EXPECT_FALSE(boolVarExpression.isFalse());
  56. EXPECT_TRUE(boolVarExpression.getVariables() == std::set<std::string>({"x"}));
  57. EXPECT_TRUE(intVarExpression.getReturnType() == storm::expressions::ExpressionReturnType::Int);
  58. EXPECT_FALSE(intVarExpression.isLiteral());
  59. EXPECT_FALSE(intVarExpression.isTrue());
  60. EXPECT_FALSE(intVarExpression.isFalse());
  61. EXPECT_TRUE(intVarExpression.getVariables() == std::set<std::string>({"y"}));
  62. EXPECT_TRUE(doubleVarExpression.getReturnType() == storm::expressions::ExpressionReturnType::Double);
  63. EXPECT_FALSE(doubleVarExpression.isLiteral());
  64. EXPECT_FALSE(doubleVarExpression.isTrue());
  65. EXPECT_FALSE(doubleVarExpression.isFalse());
  66. EXPECT_TRUE(doubleVarExpression.getVariables() == std::set<std::string>({"z"}));
  67. }
  68. TEST(Expression, OperatorTest) {
  69. storm::expressions::Expression trueExpression;
  70. storm::expressions::Expression falseExpression;
  71. storm::expressions::Expression threeExpression;
  72. storm::expressions::Expression piExpression;
  73. storm::expressions::Expression boolVarExpression;
  74. storm::expressions::Expression intVarExpression;
  75. storm::expressions::Expression doubleVarExpression;
  76. ASSERT_NO_THROW(trueExpression = storm::expressions::Expression::createTrue());
  77. ASSERT_NO_THROW(falseExpression = storm::expressions::Expression::createFalse());
  78. ASSERT_NO_THROW(threeExpression = storm::expressions::Expression::createIntegerLiteral(3));
  79. ASSERT_NO_THROW(piExpression = storm::expressions::Expression::createDoubleLiteral(3.14));
  80. ASSERT_NO_THROW(boolVarExpression = storm::expressions::Expression::createBooleanVariable("x"));
  81. ASSERT_NO_THROW(intVarExpression = storm::expressions::Expression::createIntegerVariable("y"));
  82. ASSERT_NO_THROW(doubleVarExpression = storm::expressions::Expression::createDoubleVariable("z"));
  83. storm::expressions::Expression tempExpression;
  84. ASSERT_THROW(tempExpression = trueExpression.ite(falseExpression, piExpression), storm::exceptions::InvalidTypeException);
  85. ASSERT_NO_THROW(tempExpression = boolVarExpression.ite(threeExpression, doubleVarExpression));
  86. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Double);
  87. ASSERT_NO_THROW(tempExpression = boolVarExpression.ite(threeExpression, intVarExpression));
  88. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Int);
  89. ASSERT_NO_THROW(tempExpression = boolVarExpression.ite(trueExpression, falseExpression));
  90. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Bool);
  91. ASSERT_THROW(tempExpression = trueExpression + piExpression, storm::exceptions::InvalidTypeException);
  92. ASSERT_NO_THROW(tempExpression = threeExpression + threeExpression);
  93. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Int);
  94. ASSERT_NO_THROW(tempExpression = threeExpression + piExpression);
  95. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Double);
  96. ASSERT_NO_THROW(tempExpression = doubleVarExpression + doubleVarExpression);
  97. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Double);
  98. ASSERT_THROW(tempExpression = trueExpression - piExpression, storm::exceptions::InvalidTypeException);
  99. ASSERT_NO_THROW(tempExpression = threeExpression - threeExpression);
  100. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Int);
  101. ASSERT_NO_THROW(tempExpression = threeExpression - piExpression);
  102. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Double);
  103. ASSERT_NO_THROW(tempExpression = doubleVarExpression - doubleVarExpression);
  104. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Double);
  105. ASSERT_THROW(tempExpression = -trueExpression, storm::exceptions::InvalidTypeException);
  106. ASSERT_NO_THROW(tempExpression = -threeExpression);
  107. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Int);
  108. ASSERT_NO_THROW(tempExpression = -piExpression);
  109. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Double);
  110. ASSERT_NO_THROW(tempExpression = -doubleVarExpression);
  111. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Double);
  112. ASSERT_THROW(tempExpression = trueExpression * piExpression, storm::exceptions::InvalidTypeException);
  113. ASSERT_NO_THROW(tempExpression = threeExpression * threeExpression);
  114. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Int);
  115. ASSERT_NO_THROW(tempExpression = threeExpression * piExpression);
  116. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Double);
  117. ASSERT_NO_THROW(tempExpression = intVarExpression * intVarExpression);
  118. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Int);
  119. ASSERT_THROW(tempExpression = trueExpression / piExpression, storm::exceptions::InvalidTypeException);
  120. ASSERT_NO_THROW(tempExpression = threeExpression / threeExpression);
  121. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Int);
  122. ASSERT_NO_THROW(tempExpression = threeExpression / piExpression);
  123. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Double);
  124. ASSERT_NO_THROW(tempExpression = doubleVarExpression / intVarExpression);
  125. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Double);
  126. ASSERT_THROW(tempExpression = trueExpression && piExpression, storm::exceptions::InvalidTypeException);
  127. ASSERT_NO_THROW(tempExpression = trueExpression && falseExpression);
  128. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Bool);
  129. ASSERT_NO_THROW(tempExpression = boolVarExpression && boolVarExpression);
  130. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Bool);
  131. ASSERT_THROW(tempExpression = trueExpression || piExpression, storm::exceptions::InvalidTypeException);
  132. ASSERT_NO_THROW(tempExpression = trueExpression || falseExpression);
  133. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Bool);
  134. ASSERT_NO_THROW(tempExpression = boolVarExpression || boolVarExpression);
  135. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Bool);
  136. ASSERT_THROW(tempExpression = !threeExpression, storm::exceptions::InvalidTypeException);
  137. ASSERT_NO_THROW(tempExpression = !trueExpression);
  138. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Bool);
  139. ASSERT_NO_THROW(tempExpression = !boolVarExpression);
  140. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Bool);
  141. ASSERT_THROW(tempExpression = trueExpression == piExpression, storm::exceptions::InvalidTypeException);
  142. ASSERT_NO_THROW(tempExpression = threeExpression == threeExpression);
  143. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Bool);
  144. ASSERT_NO_THROW(tempExpression = intVarExpression == doubleVarExpression);
  145. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Bool);
  146. ASSERT_THROW(tempExpression = trueExpression != piExpression, storm::exceptions::InvalidTypeException);
  147. ASSERT_NO_THROW(tempExpression = threeExpression != threeExpression);
  148. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Bool);
  149. ASSERT_NO_THROW(tempExpression = intVarExpression != doubleVarExpression);
  150. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Bool);
  151. ASSERT_THROW(tempExpression = trueExpression > piExpression, storm::exceptions::InvalidTypeException);
  152. ASSERT_NO_THROW(tempExpression = threeExpression > threeExpression);
  153. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Bool);
  154. ASSERT_NO_THROW(tempExpression = intVarExpression > doubleVarExpression);
  155. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Bool);
  156. ASSERT_THROW(tempExpression = trueExpression >= piExpression, storm::exceptions::InvalidTypeException);
  157. ASSERT_NO_THROW(tempExpression = threeExpression >= threeExpression);
  158. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Bool);
  159. ASSERT_NO_THROW(tempExpression = intVarExpression >= doubleVarExpression);
  160. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Bool);
  161. ASSERT_THROW(tempExpression = trueExpression < piExpression, storm::exceptions::InvalidTypeException);
  162. ASSERT_NO_THROW(tempExpression = threeExpression < threeExpression);
  163. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Bool);
  164. ASSERT_NO_THROW(tempExpression = intVarExpression < doubleVarExpression);
  165. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Bool);
  166. ASSERT_THROW(tempExpression = trueExpression <= piExpression, storm::exceptions::InvalidTypeException);
  167. ASSERT_NO_THROW(tempExpression = threeExpression <= threeExpression);
  168. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Bool);
  169. ASSERT_NO_THROW(tempExpression = intVarExpression <= doubleVarExpression);
  170. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Bool);
  171. ASSERT_THROW(tempExpression = storm::expressions::Expression::minimum(trueExpression, piExpression), storm::exceptions::InvalidTypeException);
  172. ASSERT_NO_THROW(tempExpression = storm::expressions::Expression::minimum(threeExpression, threeExpression));
  173. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Int);
  174. ASSERT_NO_THROW(tempExpression = storm::expressions::Expression::minimum(intVarExpression, doubleVarExpression));
  175. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Double);
  176. ASSERT_THROW(tempExpression = storm::expressions::Expression::maximum(trueExpression, piExpression), storm::exceptions::InvalidTypeException);
  177. ASSERT_NO_THROW(tempExpression = storm::expressions::Expression::maximum(threeExpression, threeExpression));
  178. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Int);
  179. ASSERT_NO_THROW(tempExpression = storm::expressions::Expression::maximum(intVarExpression, doubleVarExpression));
  180. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Double);
  181. ASSERT_THROW(tempExpression = trueExpression.implies(piExpression), storm::exceptions::InvalidTypeException);
  182. ASSERT_NO_THROW(tempExpression = trueExpression.implies(falseExpression));
  183. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Bool);
  184. ASSERT_NO_THROW(tempExpression = boolVarExpression.implies(boolVarExpression));
  185. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Bool);
  186. ASSERT_THROW(tempExpression = trueExpression.iff(piExpression), storm::exceptions::InvalidTypeException);
  187. ASSERT_NO_THROW(tempExpression = trueExpression.iff(falseExpression));
  188. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Bool);
  189. ASSERT_NO_THROW(tempExpression = boolVarExpression.iff(boolVarExpression));
  190. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Bool);
  191. ASSERT_THROW(tempExpression = trueExpression ^ piExpression, storm::exceptions::InvalidTypeException);
  192. ASSERT_NO_THROW(tempExpression = trueExpression ^ falseExpression);
  193. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Bool);
  194. ASSERT_NO_THROW(tempExpression = boolVarExpression ^ boolVarExpression);
  195. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Bool);
  196. ASSERT_THROW(tempExpression = trueExpression.floor(), storm::exceptions::InvalidTypeException);
  197. ASSERT_NO_THROW(tempExpression = threeExpression.floor());
  198. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Int);
  199. ASSERT_NO_THROW(tempExpression = doubleVarExpression.floor());
  200. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Int);
  201. ASSERT_THROW(tempExpression = trueExpression.ceil(), storm::exceptions::InvalidTypeException);
  202. ASSERT_NO_THROW(tempExpression = threeExpression.ceil());
  203. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Int);
  204. ASSERT_NO_THROW(tempExpression = doubleVarExpression.ceil());
  205. EXPECT_TRUE(tempExpression.getReturnType() == storm::expressions::ExpressionReturnType::Int);
  206. }
  207. TEST(Expression, SubstitutionTest) {
  208. storm::expressions::Expression trueExpression;
  209. storm::expressions::Expression falseExpression;
  210. storm::expressions::Expression threeExpression;
  211. storm::expressions::Expression piExpression;
  212. storm::expressions::Expression boolVarExpression;
  213. storm::expressions::Expression intVarExpression;
  214. storm::expressions::Expression doubleVarExpression;
  215. ASSERT_NO_THROW(trueExpression = storm::expressions::Expression::createTrue());
  216. ASSERT_NO_THROW(falseExpression = storm::expressions::Expression::createFalse());
  217. ASSERT_NO_THROW(threeExpression = storm::expressions::Expression::createIntegerLiteral(3));
  218. ASSERT_NO_THROW(piExpression = storm::expressions::Expression::createDoubleLiteral(3.14));
  219. ASSERT_NO_THROW(boolVarExpression = storm::expressions::Expression::createBooleanVariable("x"));
  220. ASSERT_NO_THROW(intVarExpression = storm::expressions::Expression::createIntegerVariable("y"));
  221. ASSERT_NO_THROW(doubleVarExpression = storm::expressions::Expression::createDoubleVariable("z"));
  222. storm::expressions::Expression tempExpression;
  223. ASSERT_NO_THROW(tempExpression = (intVarExpression < threeExpression || boolVarExpression) && boolVarExpression);
  224. std::map<std::string, storm::expressions::Expression> substution = { std::make_pair("y", doubleVarExpression), std::make_pair("x", storm::expressions::Expression::createTrue()), std::make_pair("a", storm::expressions::Expression::createTrue()) };
  225. storm::expressions::Expression substitutedExpression;
  226. ASSERT_NO_THROW(substitutedExpression = tempExpression.substitute(substution));
  227. EXPECT_TRUE(substitutedExpression.simplify().isTrue());
  228. }
  229. TEST(Expression, SimplificationTest) {
  230. storm::expressions::Expression trueExpression;
  231. storm::expressions::Expression falseExpression;
  232. storm::expressions::Expression threeExpression;
  233. storm::expressions::Expression intVarExpression;
  234. ASSERT_NO_THROW(trueExpression = storm::expressions::Expression::createTrue());
  235. ASSERT_NO_THROW(falseExpression = storm::expressions::Expression::createFalse());
  236. ASSERT_NO_THROW(threeExpression = storm::expressions::Expression::createIntegerLiteral(3));
  237. ASSERT_NO_THROW(intVarExpression = storm::expressions::Expression::createIntegerVariable("y"));
  238. storm::expressions::Expression tempExpression;
  239. storm::expressions::Expression simplifiedExpression;
  240. ASSERT_NO_THROW(tempExpression = trueExpression || intVarExpression > threeExpression);
  241. ASSERT_NO_THROW(simplifiedExpression = tempExpression.simplify());
  242. EXPECT_TRUE(simplifiedExpression.isTrue());
  243. ASSERT_NO_THROW(tempExpression = falseExpression && intVarExpression > threeExpression);
  244. ASSERT_NO_THROW(simplifiedExpression = tempExpression.simplify());
  245. EXPECT_TRUE(simplifiedExpression.isFalse());
  246. }
  247. TEST(Expression, SimpleEvaluationTest) {
  248. storm::expressions::Expression trueExpression;
  249. storm::expressions::Expression falseExpression;
  250. storm::expressions::Expression threeExpression;
  251. storm::expressions::Expression piExpression;
  252. storm::expressions::Expression boolVarExpression;
  253. storm::expressions::Expression intVarExpression;
  254. storm::expressions::Expression doubleVarExpression;
  255. ASSERT_NO_THROW(trueExpression = storm::expressions::Expression::createTrue());
  256. ASSERT_NO_THROW(falseExpression = storm::expressions::Expression::createFalse());
  257. ASSERT_NO_THROW(threeExpression = storm::expressions::Expression::createIntegerLiteral(3));
  258. ASSERT_NO_THROW(piExpression = storm::expressions::Expression::createDoubleLiteral(3.14));
  259. ASSERT_NO_THROW(boolVarExpression = storm::expressions::Expression::createBooleanVariable("x"));
  260. ASSERT_NO_THROW(intVarExpression = storm::expressions::Expression::createIntegerVariable("y"));
  261. ASSERT_NO_THROW(doubleVarExpression = storm::expressions::Expression::createDoubleVariable("z"));
  262. storm::expressions::Expression tempExpression;
  263. ASSERT_NO_THROW(tempExpression = (intVarExpression < threeExpression || boolVarExpression) && boolVarExpression);
  264. ASSERT_NO_THROW(storm::expressions::SimpleValuation valuation);
  265. storm::expressions::SimpleValuation valuation;
  266. ASSERT_NO_THROW(valuation.addBooleanIdentifier("x"));
  267. ASSERT_NO_THROW(valuation.addBooleanIdentifier("a"));
  268. ASSERT_NO_THROW(valuation.addIntegerIdentifier("y"));
  269. ASSERT_NO_THROW(valuation.addIntegerIdentifier("b"));
  270. ASSERT_NO_THROW(valuation.addDoubleIdentifier("z"));
  271. ASSERT_NO_THROW(valuation.addDoubleIdentifier("c"));
  272. ASSERT_THROW(tempExpression.evaluateAsDouble(&valuation), storm::exceptions::InvalidTypeException);
  273. ASSERT_THROW(tempExpression.evaluateAsInt(&valuation), storm::exceptions::InvalidTypeException);
  274. EXPECT_FALSE(tempExpression.evaluateAsBool(&valuation));
  275. ASSERT_NO_THROW(valuation.setBooleanValue("a", true));
  276. EXPECT_FALSE(tempExpression.evaluateAsBool(&valuation));
  277. ASSERT_NO_THROW(valuation.setIntegerValue("y", 3));
  278. EXPECT_FALSE(tempExpression.evaluateAsBool(&valuation));
  279. ASSERT_NO_THROW(tempExpression = ((intVarExpression < threeExpression).ite(trueExpression, falseExpression)));
  280. ASSERT_THROW(tempExpression.evaluateAsDouble(&valuation), storm::exceptions::InvalidTypeException);
  281. ASSERT_THROW(tempExpression.evaluateAsInt(&valuation), storm::exceptions::InvalidTypeException);
  282. EXPECT_FALSE(tempExpression.evaluateAsBool(&valuation));
  283. }