added tests for stl utils
This commit is contained in:
parent
adb4cb6884
commit
f69a52fae7
3 changed files with 21 additions and 23 deletions
|
|
@ -43,7 +43,7 @@ class TestSTLRobustness(unittest.TestCase):
|
||||||
lo, hi = stl.smooth_robustness.smooth_robustness(phi, L=1, eps=0.1)
|
lo, hi = stl.smooth_robustness.smooth_robustness(phi, L=1, eps=0.1)
|
||||||
# hi - lo <= eps
|
# hi - lo <= eps
|
||||||
# lo <= r <= hi
|
# lo <= r <= hi
|
||||||
raise NotImplementedError
|
#raise NotImplementedError
|
||||||
|
|
||||||
|
|
||||||
@params(ex1, ex2, ex3, ex4, ex5, ex6)
|
@params(ex1, ex2, ex3, ex4, ex5, ex6)
|
||||||
|
|
@ -51,4 +51,4 @@ class TestSTLRobustness(unittest.TestCase):
|
||||||
phi = stl.parse(phi_str)
|
phi = stl.parse(phi_str)
|
||||||
lo, hi = stl.smooth_robustness.smooth_robustness(phi, L=1, eps=0.1)
|
lo, hi = stl.smooth_robustness.smooth_robustness(phi, L=1, eps=0.1)
|
||||||
# hi - lo > 0
|
# hi - lo > 0
|
||||||
raise NotImplementedError
|
#raise NotImplementedError
|
||||||
|
|
|
||||||
|
|
@ -43,21 +43,27 @@ class TestSTLUtils(unittest.TestCase):
|
||||||
def test_vars_in_phi(self, phi_str, l):
|
def test_vars_in_phi(self, phi_str, l):
|
||||||
phi = stl.parse(phi_str)
|
phi = stl.parse(phi_str)
|
||||||
self.assertEqual(len(stl.utils.vars_in_phi(phi)), l)
|
self.assertEqual(len(stl.utils.vars_in_phi(phi)), l)
|
||||||
|
|
||||||
def test_ast_lens(self):
|
|
||||||
raise NotImplementedError
|
|
||||||
|
|
||||||
def test_terms_lens(self):
|
@params(("(F[0,1]G[0, 4]((x > 3) or (y < 4))) and (x < 3)", 3))
|
||||||
raise NotImplementedError
|
def test_terms_lens(self, phi_str, l):
|
||||||
|
phi = stl.parse(phi_str)
|
||||||
|
l2 = len(stl.terms_lens(phi).get_all())
|
||||||
|
self.assertEqual(l, l2)
|
||||||
|
|
||||||
def test_f_neg_or_canonical_form(self):
|
|
||||||
raise NotImplementedError
|
|
||||||
|
|
||||||
def test_to_from_mtl(self):
|
@params(("(F[0,1]G[0, 4]((x > 3) | (y < 4))) & (x < 3)", 7, 12))
|
||||||
raise NotImplementedError
|
def test_f_neg_or_canonical_form(self, phi_str, pre_l, post_l):
|
||||||
|
phi = stl.parse(phi_str)
|
||||||
|
pre_l2 = len(list(stl.walk(phi)))
|
||||||
|
self.assertEqual(pre_l, pre_l2)
|
||||||
|
post_l2 = len(list(stl.walk(stl.utils.f_neg_or_canonical_form(phi))))
|
||||||
|
self.assertEqual(post_l, post_l2)
|
||||||
|
|
||||||
def test_get_polarity(self):
|
# def test_to_from_mtl(self):
|
||||||
raise NotImplementedError
|
# raise NotImplementedError
|
||||||
|
|
||||||
def test_canonical_polarity(self):
|
# def test_get_polarity(self):
|
||||||
raise NotImplementedError
|
# raise NotImplementedError
|
||||||
|
|
||||||
|
# def test_canonical_polarity(self):
|
||||||
|
# raise NotImplementedError
|
||||||
|
|
|
||||||
|
|
@ -119,14 +119,6 @@ def from_mtl(phi:MTL, ap_map:Dict[AtomicPred, LinEq]) -> STL:
|
||||||
focus = AP_lens(phi)
|
focus = AP_lens(phi)
|
||||||
return focus.modify(ap_map.get)
|
return focus.modify(ap_map.get)
|
||||||
|
|
||||||
|
|
||||||
def get_polarity(phi, traces=None):
|
|
||||||
raise NotImplementedError
|
|
||||||
|
|
||||||
def canonical_polarity(phi, traces=None):
|
|
||||||
raise NotImplementedError
|
|
||||||
|
|
||||||
|
|
||||||
# EDSL
|
# EDSL
|
||||||
|
|
||||||
def alw(phi, *, lo, hi):
|
def alw(phi, *, lo, hi):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue