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.
39 lines
1.6 KiB
39 lines
1.6 KiB
import stormpy
|
|
import stormpy.logic
|
|
from helpers.helper import get_example_path
|
|
|
|
import math
|
|
from configurations import dft
|
|
|
|
|
|
@dft
|
|
class TestAnalysis:
|
|
|
|
def test_analyze_mttf(self):
|
|
dft = stormpy.dft.load_dft_json_file(get_example_path("dft", "and.json"))
|
|
formulas = stormpy.parse_properties("T=? [ F \"failed\" ]")
|
|
assert dft.nr_elements() == 3
|
|
results = stormpy.dft.analyze_dft(dft, [formulas[0].raw_formula])
|
|
assert math.isclose(results[0], 3)
|
|
|
|
def test_relevant_events_property(self):
|
|
dft = stormpy.dft.load_dft_json_file(get_example_path("dft", "and.json"))
|
|
properties = stormpy.parse_properties("P=? [ F<=1 \"A_failed\" ]")
|
|
formulas = [p.raw_formula for p in properties]
|
|
relevant_ids = stormpy.dft.compute_relevant_events(dft, formulas)
|
|
assert len(relevant_ids) == 1
|
|
index = next(iter(relevant_ids))
|
|
assert dft.get_element(index).name == "A"
|
|
results = stormpy.dft.analyze_dft(dft, formulas, relevant_events = relevant_ids)
|
|
assert math.isclose(results[0], 0.1548181217)
|
|
|
|
def test_relevant_events_additional(self):
|
|
dft = stormpy.dft.load_dft_json_file(get_example_path("dft", "and.json"))
|
|
properties = stormpy.parse_properties("P=? [ F<=1 \"failed\" ]")
|
|
formulas = [p.raw_formula for p in properties]
|
|
relevant_ids = stormpy.dft.compute_relevant_events(dft, formulas, ["B", "C"])
|
|
assert len(relevant_ids) == 2
|
|
assert 0 in relevant_ids
|
|
assert 1 in relevant_ids
|
|
results = stormpy.dft.analyze_dft(dft, formulas, relevant_events = relevant_ids)
|
|
assert math.isclose(results[0], 0.1548181217)
|