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.0 KiB

8 years ago
  1. import stormpy
  2. import stormpy.logic
  3. from helpers.helper import get_example_path
  4. class TestParse:
  5. def test_parse_prism_program(self):
  6. program = stormpy.parse_prism_program(get_example_path("dtmc", "die.pm"))
  7. assert program.nr_modules == 1
  8. assert program.model_type == stormpy.PrismModelType.DTMC
  9. assert not program.has_undefined_constants
  10. def test_parse_parametric_prism_program(self):
  11. program = stormpy.parse_prism_program(get_example_path("pdtmc", "brp16_2.pm"))
  12. assert program.nr_modules == 5
  13. assert program.model_type == stormpy.PrismModelType.DTMC
  14. assert program.has_undefined_constants
  15. def test_parse_formula(self):
  16. formula = "P=? [F \"one\"]"
  17. properties = stormpy.parse_properties(formula)
  18. assert len(properties) == 1
  19. assert str(properties[0].raw_formula) == formula
  20. def test_parse_explicit_dtmc(self):
  21. model = stormpy.build_sparse_model_from_explicit(get_example_path("dtmc", "die.tra"), get_example_path("dtmc", "die.lab"))
  22. assert model.nr_states == 13
  23. assert model.nr_transitions == 20
  24. assert model.model_type == stormpy.ModelType.DTMC
  25. assert not model.supports_parameters
  26. assert type(model) is stormpy.SparseDtmc
  27. def test_parse_explicit_mdp(self):
  28. model = stormpy.build_sparse_model_from_explicit(get_example_path("mdp", "two_dice.tra"), get_example_path("mdp", "two_dice.lab"))
  29. assert model.nr_states == 169
  30. assert model.nr_transitions == 436
  31. assert model.model_type == stormpy.ModelType.MDP
  32. assert not model.supports_parameters
  33. assert type(model) is stormpy.SparseMdp
  34. def test_parse_drn_dtmc(self):
  35. model = stormpy.build_model_from_drn(get_example_path("ctmc", "dft.drn"))
  36. assert model.nr_states == 16
  37. assert model.nr_transitions == 33
  38. assert model.model_type == stormpy.ModelType.CTMC
  39. assert not model.supports_parameters
  40. assert type(model) is stormpy.SparseCtmc