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.

57 lines
1.8 KiB

  1. import stormpy
  2. import stormpy.logic
  3. from stormpy.storage import BitVector
  4. from stormpy.utility import ShortestPathsGenerator
  5. from helpers.helper import get_example_path
  6. import pytest
  7. @pytest.fixture
  8. def test_model(scope="module", program_path=get_example_path("dtmc", "die.pm"), raw_formula="P=? [ F \"one\" ]"):
  9. program = stormpy.parse_prism_program(program_path)
  10. formulas = stormpy.parse_formulas_for_prism_program(raw_formula, program)
  11. test_model = stormpy.build_model(program, formulas[0])
  12. return test_model
  13. @pytest.fixture
  14. def test_state(test_model):
  15. some_state = 7
  16. assert test_model.nr_states > some_state, "test model too small"
  17. return some_state
  18. @pytest.fixture
  19. def test_state_list(test_model):
  20. some_state_list = [4, 5, 7]
  21. assert test_model.nr_states > max(some_state_list), "test model too small"
  22. return some_state_list
  23. @pytest.fixture
  24. def test_state_bitvector(test_model, test_state_list):
  25. return BitVector(length=test_model.nr_states, set_entries=test_state_list)
  26. @pytest.fixture
  27. def test_label(test_model):
  28. some_label = "one"
  29. assert some_label in test_model.labels, "test model does not contain label '" + some_label + "'"
  30. return some_label
  31. class TestShortestPaths:
  32. def test_spg_ctor_bitvector_target(self, test_model, test_state_bitvector):
  33. _ = ShortestPathsGenerator(test_model, test_state_bitvector)
  34. def test_spg_ctor_single_state_target(self, test_model, test_state):
  35. _ = ShortestPathsGenerator(test_model, test_state)
  36. def test_spg_ctor_state_list_target(self, test_model, test_state_list):
  37. _ = ShortestPathsGenerator(test_model, test_state_list)
  38. def test_spg_ctor_label_target(self, test_model, test_label):
  39. _ = ShortestPathsGenerator(test_model, test_label)
  40. # TODO: add tests that check actual functionality