diff --git a/stl/ast.py b/stl/ast.py index 2c08252..eec5a62 100644 --- a/stl/ast.py +++ b/stl/ast.py @@ -1,11 +1,12 @@ # -*- coding: utf-8 -*- - from collections import deque, namedtuple from functools import lru_cache import funcy as fn from lenses import lens, bind +import stl + def flatten_binary(phi, op, dropT, shortT): def f(x): @@ -47,6 +48,9 @@ class AST(object): return phi + def __call__(self, trace, time): + return stl.pointwise_sat(self)(trace, time) + @property def children(self): return tuple() diff --git a/stl/test_boolean_eval.py b/stl/test_boolean_eval.py index f98ce77..47429e8 100644 --- a/stl/test_boolean_eval.py +++ b/stl/test_boolean_eval.py @@ -1,6 +1,6 @@ import hypothesis.strategies as st import traces -from hypothesis import given, settings, Verbosity, Phase +from hypothesis import given from pytest import raises import stl @@ -81,11 +81,6 @@ def test_eval_smoke_tests(phi): @given(SignalTemporalLogicStrategy) -@settings( - max_shrinks=0, - verbosity=Verbosity.verbose, - perform_health_check=False, - phases=[Phase.generate]) def test_temporal_identities(phi): stl_eval = stl.boolean_eval.pointwise_sat(phi) stl_eval2 = stl.boolean_eval.pointwise_sat(~phi) @@ -124,6 +119,12 @@ def test_fastboolean_smoketest(): stl.fastboolean_eval.pointwise_sat(stl.ast.AST()) +def test_callable_interface(): + phi = stl.parse( + '(G[0, 4](x > 0)) & ((F[2, 1](AP1)) | (AP2)) & (G[0,0](AP2))') + assert not phi(x, 0) + + def test_implicit_validity_domain_rigid(): phi = stl.parse('(G[0, a?](x > b?)) & ((F(AP1)) | (AP2))') vals = {'a?': 3, 'b?': 20}