Exemplo n.º 1
0
def while3() -> None:
    """Termination leak."""
    x = input_high()
    while x != 0:
        x = x - 1
    #:: ExpectedOutput(call.precondition:assertion.false)
    sif_print(1)
Exemplo n.º 2
0
def fig1a() -> None:
    x = input_high()
    if x < 1234:
        x = 0
    y = x
    #:: ExpectedOutput(call.precondition:assertion.false)
    sif_print(y)
Exemplo n.º 3
0
def fig2b() -> None:
    h = input_high()
    l = input_low()
    x = f(h)
    y = f(l)
    #:: ExpectedOutput(call.precondition:assertion.false)
    sif_print(x)
Exemplo n.º 4
0
def fig2b_low() -> None:
    Requires(LowEvent())
    h = input_high()
    l = input_low()
    x = f(h)
    y = f(l)
    sif_print(y)
Exemplo n.º 5
0
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])
Exemplo n.º 6
0
def fig2a() -> None:
    x = input_high()
    if x == 1:
        l = 42
    else:
        l = 17
    l = 0
    #:: ExpectedOutput(call.precondition:assertion.false)
    sif_print(l)
Exemplo n.º 7
0
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)
Exemplo n.º 8
0
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)
Exemplo n.º 9
0
def test_contains_2() -> None:
    Requires(LowEvent())
    x = input_high()
    l = [1, 2, 3]
    b = x in l
    sif_print(l[0])