increase test coverage in preperation for completing fastboolean eval

This commit is contained in:
Marcell Vazquez-Chanlatte 2017-11-14 20:43:22 -08:00
parent d8bdab4e6a
commit dc704a6b13
2 changed files with 16 additions and 6 deletions

View file

@ -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))

View file

@ -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)