def while3() -> None: """Termination leak.""" x = input_high() while x != 0: x = x - 1 #:: ExpectedOutput(call.precondition:assertion.false) sif_print(1)
def fig1a() -> None: x = input_high() if x < 1234: x = 0 y = x #:: ExpectedOutput(call.precondition:assertion.false) sif_print(y)
def fig2b() -> None: h = input_high() l = input_low() x = f(h) y = f(l) #:: ExpectedOutput(call.precondition:assertion.false) sif_print(x)
def fig2b_low() -> None: Requires(LowEvent()) h = input_high() l = input_low() x = f(h) y = f(l) sif_print(y)
def test_high_data() -> None: Requires(LowEvent()) x = input_high() y = input_low() l = [1, y] l.append(x) sif_print(l[1]) #:: ExpectedOutput(call.precondition:assertion.false) sif_print(l[2])
def fig2a() -> None: x = input_high() if x == 1: l = 42 else: l = 17 l = 0 #:: ExpectedOutput(call.precondition:assertion.false) sif_print(l)
def test_contains() -> None: Requires(LowEvent()) x = input_high() y = input_low() l = [1, 2, 3] if y in l: sif_print(0) if x in l: #:: ExpectedOutput(call.precondition:assertion.false) sif_print(1)
def while5() -> None: """Nested while.""" h = input_high() l = input_low() i = 0 while l != 0: while h != 0: i = i + 1 h = h - 1 l = l - 1 #:: ExpectedOutput(call.precondition:assertion.false) sif_print(i)
def test_contains_2() -> None: Requires(LowEvent()) x = input_high() l = [1, 2, 3] b = x in l sif_print(l[0])