From dc704a6b1381b490805fe633c22198910ee473c2 Mon Sep 17 00:00:00 2001 From: Marcell Vazquez-Chanlatte Date: Tue, 14 Nov 2017 20:43:22 -0800 Subject: [PATCH] increase test coverage in preperation for completing fastboolean eval --- stl/fastboolean_eval.py | 10 +++++----- stl/test_boolean_eval.py | 12 +++++++++++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/stl/fastboolean_eval.py b/stl/fastboolean_eval.py index 3ecb824..68f920e 100644 --- a/stl/fastboolean_eval.py +++ b/stl/fastboolean_eval.py @@ -28,11 +28,6 @@ def eval_term(term, x, t): def get_times(x, tau, lo=None, hi=None): - domain = fn.first(x.values()).domain - if lo is None or lo is -oo: - lo = domain.start() - if hi is None or hi is oo: - hi = domain.end() end = min(v.domain.end() for v in x.values()) hi = hi + tau if hi + tau <= end else end lo = lo + tau if lo + tau <= end else end @@ -104,6 +99,11 @@ def pointwise_satf_(phi): return lambda x, t: bitarray(x[str(phi.id)][tau] for tau in t) +@pointwise_satf.register(stl.Until) +def pointwise_satf_until(phi): + raise NotImplementedError + + @pointwise_satf.register(type(stl.TOP)) def pointwise_satf_top(_): return lambda _, t: bitarray([True] * len(t)) diff --git a/stl/test_boolean_eval.py b/stl/test_boolean_eval.py index 3261924..f98ce77 100644 --- a/stl/test_boolean_eval.py +++ b/stl/test_boolean_eval.py @@ -114,8 +114,18 @@ def test_fastboolean_equiv(phi): assert stl_eval4(x, 0) == stl_eval3(x, 0) +def test_fastboolean_smoketest(): + phi = stl.parse( + '(G[0, 4](x > 0)) & ((F[2, 1](AP1)) | (AP2)) & (G[0,0](AP2))') + stl_eval = stl.fastboolean_eval.pointwise_sat(phi) + assert not stl_eval(x, 0) + + with raises(NotImplementedError): + stl.fastboolean_eval.pointwise_sat(stl.ast.AST()) + + def test_implicit_validity_domain_rigid(): - phi = stl.parse('G[0, a?](x > b?)') + phi = stl.parse('(G[0, a?](x > b?)) & ((F(AP1)) | (AP2))') vals = {'a?': 3, 'b?': 20} stl_eval = stl.pointwise_sat(phi.set_params(vals)) oracle, order = stl.utils.implicit_validity_domain(phi, x)