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.

48 lines
2.3 KiB

  1. #include "gtest/gtest.h"
  2. #include "storm-config.h"
  3. #include "src/parser/PrismParser.h"
  4. #include "src/utility/solver.h"
  5. #include "src/storage/jani/Model.h"
  6. #ifdef STORM_HAVE_MSAT
  7. TEST(PrismProgramTest, FlattenModules) {
  8. storm::prism::Program result;
  9. ASSERT_NO_THROW(result = storm::parser::PrismParser::parse(STORM_CPP_TESTS_BASE_PATH "/functional/parser/prism/leader3.nm"));
  10. std::unique_ptr<storm::utility::solver::SmtSolverFactory> smtSolverFactory(new storm::utility::solver::MathsatSmtSolverFactory());
  11. ASSERT_NO_THROW(result = result.flattenModules(smtSolverFactory));
  12. EXPECT_EQ(1, result.getNumberOfModules());
  13. EXPECT_EQ(74, result.getModule(0).getNumberOfCommands());
  14. ASSERT_NO_THROW(result = storm::parser::PrismParser::parse(STORM_CPP_TESTS_BASE_PATH "/functional/parser/prism/wlan0_collide.nm"));
  15. ASSERT_NO_THROW(result = result.flattenModules(smtSolverFactory));
  16. EXPECT_EQ(1, result.getNumberOfModules());
  17. EXPECT_EQ(180, result.getModule(0).getNumberOfCommands());
  18. }
  19. #endif
  20. TEST(PrismProgramTest, ConvertToJani) {
  21. storm::prism::Program prismProgram;
  22. storm::jani::Model janiModel;
  23. ASSERT_NO_THROW(prismProgram = storm::parser::PrismParser::parse(STORM_CPP_TESTS_BASE_PATH "/functional/parser/prism/leader3.nm"));
  24. ASSERT_NO_THROW(janiModel = prismProgram.toJani());
  25. ASSERT_NO_THROW(prismProgram = storm::parser::PrismParser::parse(STORM_CPP_TESTS_BASE_PATH "/functional/parser/prism/wlan0_collide.nm"));
  26. ASSERT_NO_THROW(janiModel = prismProgram.toJani());
  27. ASSERT_NO_THROW(prismProgram = storm::parser::PrismParser::parse(STORM_CPP_TESTS_BASE_PATH "/functional/builder/brp-16-2.pm"));
  28. ASSERT_NO_THROW(janiModel = prismProgram.toJani());
  29. ASSERT_NO_THROW(prismProgram = storm::parser::PrismParser::parse(STORM_CPP_TESTS_BASE_PATH "/functional/builder/crowds-5-5.pm"));
  30. ASSERT_NO_THROW(janiModel = prismProgram.toJani());
  31. ASSERT_NO_THROW(prismProgram = storm::parser::PrismParser::parse(STORM_CPP_TESTS_BASE_PATH "/functional/builder/leader-3-5.pm"));
  32. ASSERT_NO_THROW(janiModel = prismProgram.toJani());
  33. ASSERT_NO_THROW(prismProgram = storm::parser::PrismParser::parse(STORM_CPP_TESTS_BASE_PATH "/functional/builder/nand-5-2.pm"));
  34. ASSERT_NO_THROW(janiModel = prismProgram.toJani());
  35. }