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.

58 lines
1.8 KiB

  1. import os
  2. import stormpy
  3. import stormpy.logic
  4. from helpers.helper import get_example_path
  5. from configurations import dft
  6. @dft
  7. class TestDft:
  8. def test_modularisation(self):
  9. dft = stormpy.dft.load_dft_galileo_file(get_example_path("dft", "hecs.dft"))
  10. assert dft.nr_elements() == 23
  11. assert dft.nr_be() == 13
  12. assert dft.nr_dynamic() == 2
  13. dfts = dft.modularisation()
  14. assert len(dfts) == 4
  15. for ft in dfts:
  16. assert ft.top_level_element.name in ["n116", "n137", "n120", "n21"]
  17. @dft
  18. class TestDftElement:
  19. def test_element(self):
  20. dft = stormpy.dft.load_dft_json_file(get_example_path("dft", "and.json"))
  21. tle = dft.top_level_element
  22. assert dft.nr_elements() == 3
  23. assert dft.nr_be() == 2
  24. assert dft.nr_dynamic() == 0
  25. assert tle.id == 2
  26. assert tle.name == "A"
  27. @dft
  28. class TestDftSymmetries:
  29. def test_symmetries_small(self):
  30. dft = stormpy.dft.load_dft_json_file(get_example_path("dft", "and.json"))
  31. symmetries = dft.symmetries()
  32. assert len(symmetries.groups) == 1
  33. for index, group in symmetries.groups.items():
  34. assert len(group) == 1
  35. for syms in group:
  36. assert len(syms) == 2
  37. for elem in syms:
  38. assert elem == 0 or elem == 1
  39. def test_symmetries(self):
  40. dft = stormpy.dft.load_dft_galileo_file(get_example_path("dft", "rc.dft"))
  41. symmetries = dft.symmetries()
  42. assert len(symmetries.groups) == 1
  43. for index, group in symmetries.groups.items():
  44. assert len(group) == 3
  45. i = 4
  46. for syms in group:
  47. assert len(syms) == 2
  48. for elem in syms:
  49. assert elem == i or elem == i+3
  50. i += 1