Commit 1f584646 authored by romulo's avatar romulo
Browse files

Updating tests: TODO opacity tests are failing

parent a5b1a308
......@@ -49,9 +49,9 @@ def test_observer():
for out in obs.vs["out"][0]:
names = obs.vs["name"][out[0]]
if out[1] == d.Event("a"):
assert names == frozenset(("3", "4", "5"))
assert sorted(names) == ['3', '4', '5']
if out[1] == d.Event("b"):
assert names == frozenset(("2", "5"))
assert sorted(names) == ['2','5']
def test_observer_empty():
......
......@@ -2,8 +2,8 @@ import pathlib
import DESops as d
from tests.util import load_model
import os
import warnings
def test_SCA():
G = load_model("models/SDA_tests/stochCostAttack/test_p_g.fsm")
H = load_model("models/SDA_tests/stochCostAttack/test_p_h.fsm")
......@@ -15,28 +15,37 @@ def test_SCA():
X_crit.add("4")
A = d.SDA.construct_MDP(G, H, Ea, X_crit)
prism_path = pathlib.Path("prism-4.6-linux64/bin/")
vertex_val, max_prob, att = d.SDA.MDP_max_reachability(A, X_crit, prism_path)
isDirectory = os.path.isdir(prism_path)
if isDirectory:
vertex_val, max_prob, att = d.SDA.MDP_max_reachability(A, X_crit, prism_path)
assert max_prob == 0.5
assert max_prob == 0.5
assert vertex_val[0] == 0.5
assert all(v == 1 for k, v in vertex_val.items() if k != 0)
assert vertex_val[0] == 0.5
assert all(v == 1 for k, v in vertex_val.items() if k != 0)
assert ("1", "A", "eps") in att.vs["name"]
assert ("2", "B", d.Event("rN")) in att.vs["name"]
assert ("3", "A", d.Event("rE")) in att.vs["name"]
assert ("3", "A", "eps") in att.vs["name"]
assert ("4", "B", d.Event("rN")) in att.vs["name"]
else:
warnings.warn("Invalid Prism PATH")
assert ("1", "A", "eps") in att.vs["name"]
assert ("2", "B", d.Event("rN")) in att.vs["name"]
assert ("3", "A", d.Event("rE")) in att.vs["name"]
assert ("3", "A", "eps") in att.vs["name"]
assert ("4", "B", d.Event("rN")) in att.vs["name"]
def test_SCA_empty():
G = d.PFA()
A = d.SDA.construct_MDP(G, G, set(), set())
assert A.vcount() == 0
prism_path = pathlib.Path("prism-4.6-linux64/bin/")
vertex_val, max_prob, att = d.SDA.MDP_max_reachability(A, set(), prism_path)
assert len(vertex_val) == 0
assert max_prob is None
assert att.vcount() == 0
isDirectory = os.path.isdir(prism_path)
if isDirectory:
assert A.vcount() == 0
vertex_val, max_prob, att = d.SDA.MDP_max_reachability(A, set(), prism_path)
assert len(vertex_val) == 0
assert max_prob is None
assert att.vcount() == 0
else:
warnings.warn("Invalid Prism PATH")
......@@ -2,4 +2,4 @@ from DESops import __version__
def test_version():
assert __version__ == "20.6.1a4"
assert __version__ == "20.9.2"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment