Ejemplo n.º 1
0
def test_call_non_terminating_5() -> None:
    Requires(MustTerminate(2))
    a = [1, 2, 3]
    for elem in a:
        Invariant(MustTerminate(len(a) - len(Previous(elem))))
    #:: ExpectedOutput(leak_check.failed:caller.has_unsatisfied_obligations)
    non_terminating()
Ejemplo n.º 2
0
def test_terminate_promise_4(a: List[int], b: List[int]) -> None:
    Requires(MustTerminate(2))
    Requires(Acc(list_pred(a)))
    Requires(Acc(list_pred(b)))
    for i in a:
        Invariant(MustTerminate(len(a) - len(Previous(i))))
        Invariant(Acc(list_pred(b)))
        #:: ExpectedOutput(leak_check.failed:loop_context.has_unsatisfied_obligations)
        for j in b:
            pass
Ejemplo n.º 3
0
def test_terminate_keep_promise_1() -> None:
    a = [1, 2, 3]
    for i in a:
        Invariant(MustTerminate(len(a) - len(Previous(i))))
        #:: ExpectedOutput(call.precondition:insufficient.permission)
        a.append(4)
Ejemplo n.º 4
0
def test_measures_4(a: List[int]) -> None:
    Requires(Acc(list_pred(a)))
    Requires(len(a) > 1)
    for i in a:
        #:: ExpectedOutput(invariant.not.preserved:obligation_measure.non_positive)
        Invariant(MustTerminate(len(a) - len(Previous(i)) - 1))
Ejemplo n.º 5
0
def test_measures_3(a: List[int]) -> None:
    Requires(Acc(list_pred(a)))
    for i in a:
        Invariant(MustTerminate(len(a) - len(Previous(i))))
Ejemplo n.º 6
0
def test_exhale_1(a: List[int]) -> None:
    Requires(Acc(list_pred(a)))
    for i in a:
        Invariant(MustTerminate(len(a) - len(Previous(i))))
        Invariant(MustTerminate(1 + len(a) - len(Previous(i))))
Ejemplo n.º 7
0
def test_generation_1(a: List[int]) -> None:
    Requires(Acc(list_pred(a)))
    for i in a:
        Invariant(MustTerminate(len(a) - len(Previous(i))))
    non_terminating()