diff --git a/stl/test_utils.py b/stl/test_utils.py index 05a8960..38c2665 100644 --- a/stl/test_utils.py +++ b/stl/test_utils.py @@ -59,6 +59,14 @@ class TestSTLUtils(unittest.TestCase): post_l2 = len(list(stl.walk(stl.utils.f_neg_or_canonical_form(phi)))) self.assertEqual(post_l, post_l2) + def test_andf(self): + phi = stl.parse("x") + self.assertEqual(phi, stl.andf(phi)) + + def test_orf(self): + phi = stl.parse("x") + self.assertEqual(phi, stl.orf(phi)) + # def test_to_from_mtl(self): # raise NotImplementedError diff --git a/stl/utils.py b/stl/utils.py index 5bcb6d5..6f169c9 100644 --- a/stl/utils.py +++ b/stl/utils.py @@ -131,10 +131,10 @@ def until(phi1, phi2, *, lo, hi): return stl.ast.Until(Interval(lo, hi), phi1, phi2) def andf(*args): - return reduce(op.and_, args, stl.TOP) + return reduce(op.and_, args) if args else stl.TOP def orf(*args): - return reduce(op.or_, args, stl.TOP) + return reduce(op.or_, args) if args else stl.TOP def implies(x, y): return ~x | y