def test_eventually_nested_3() -> None: formula = LTLEventually( LTLAnd( LTLVariable("a"), LTLEventually( LTLVariable("b"), ), ), ) def get_lookup_table_a_false() -> Dict[str, Union[bool, Callable[[], bool]]]: return {"a": False} def get_lookup_table_a_true() -> Dict[str, Union[bool, Callable[[], bool]]]: return {"a": True} def get_lookup_table_b_true() -> Dict[str, Union[bool, Callable[[], bool]]]: return {"b": True} f: Union[LTLFormula, bool] = formula f = ltl_interpret(cast(LTLFormula, f), get_lookup_table_a_false) f = ltl_interpret(cast(LTLFormula, f), get_lookup_table_a_false) f = ltl_interpret(cast(LTLFormula, f), get_lookup_table_a_true) f = ltl_interpret(cast(LTLFormula, f), get_lookup_table_a_true) f = ltl_interpret(cast(LTLFormula, f), get_lookup_table_b_true) assert f
def test_until_2() -> None: formula = LTLUntil( LTLVariable("a"), LTLVariable("b"), ) def get_lookup_table() -> Dict[str, Union[bool, Callable[[], bool]]]: return {"a": False, "b": True} f: Union[LTLFormula, bool] = formula f = ltl_interpret(cast(LTLFormula, f), get_lookup_table) assert f
def test_get_variable_names() -> None: expected = ["a", "b"] formula: LTLFormula = LTLEventually( LTLAnd( LTLVariable("a"), LTLEventually( LTLVariable("b"), ), ), ) actual = get_variable_names(formula) assert actual == expected
def test_var(b: bool) -> None: formula = LTLVariable("a") def get_lookup_table() -> Dict[str, Union[bool, Callable[[], bool]]]: lookup_table: Dict[str, Union[bool, Callable[[], bool]]] = {"a": b} return lookup_table f = ltl_interpret(formula, get_lookup_table) assert f is b
def test_eventually(lst: List[bool]) -> None: expected = any(lst) f: Union[LTLFormula, bool] = LTLEventually(LTLVariable("a")) for b in lst: if type(f) is bool: break def get_lookup_table() -> Dict[str, Union[bool, Callable[[], bool]]]: lookup_table: Dict[str, Union[bool, Callable[[], bool]]] = {"a": b} return lookup_table f = ltl_interpret(cast(LTLFormula, f), get_lookup_table) if type(f) is LTLEventually: f = False assert f is expected
def test_next(b: bool) -> None: f = ltl_interpret(LTLNext(LTLVariable(b)), fail_get_lookup_table) assert f == LTLVariable(b)
def test_if(b0: bool, b1: bool) -> None: f = ltl_interpret( LTLIf(LTLVariable(b0), LTLVariable(b1)), fail_get_lookup_table, ) assert f is (not b0 or b1)
def test_and(b0: bool, b1: bool) -> None: f = ltl_interpret( LTLAnd(LTLVariable(b0), LTLVariable(b1)), fail_get_lookup_table, ) assert f is (b0 and b1)
def test_bool(b: bool) -> None: f = ltl_interpret(LTLVariable(b), fail_get_lookup_table) assert f is b
def test_always_with_is_final_2() -> None: formula = LTLAlways(LTLAlways(LTLVariable("a"))) f = ltl_interpret(formula, lambda: {"a": True}, is_final=True) assert f is True
def test_eventually_nested_with_is_final() -> None: formula = LTLEventually(LTLEventually(LTLVariable("a"))) f = ltl_interpret(formula, lambda: {"a": False}, is_final=True) assert f is False