Exemplo n.º 1
0
def test_two_power_four(token_stack, two, four):
    token_stack.push(two)
    token_stack.push(four)
    power = Power()
    result = power.compute()
    assert result == Number([6, 1])
Exemplo n.º 2
0
def test_one_power_minus_one(token_stack, one, minus_one):
    with pytest.raises(NegativePowerError):
        token_stack.push(one)
        token_stack.push(minus_one)
        power = Power()
        power.compute()
Exemplo n.º 3
0
def test_one_power_two(token_stack, one, two):
    token_stack.push(one)
    token_stack.push(two)
    power = Power()
    result = power.compute()
    assert result == Number([1])
Exemplo n.º 4
0
def test_minus_one_power_five(token_stack, minus_one, five):
    token_stack.push(minus_one)
    token_stack.push(five)
    power = Power()
    result = power.compute()
    assert result == Number([1], Sign.negative)
Exemplo n.º 5
0
def test_minus_one_power_four(token_stack, minus_one, four):
    token_stack.push(minus_one)
    token_stack.push(four)
    power = Power()
    result = power.compute()
    assert result == Number([1])
Exemplo n.º 6
0
def test_four_power_zero(token_stack, zero, four):
    token_stack.push(four)
    token_stack.push(zero)
    power = Power()
    result = power.compute()
    assert result == Number([1])
Exemplo n.º 7
0
def test_ninety_nine_power_five(token_stack, ninety_nine, five):
    token_stack.push(ninety_nine)
    token_stack.push(five)
    power = Power()
    result = power.compute()
    assert result == Number([9, 9, 4, 0, 0, 9, 9, 0, 5, 9])
Exemplo n.º 8
0
def test_eight_power_four(token_stack, eight, four):
    token_stack.push(eight)
    token_stack.push(four)
    power = Power()
    result = power.compute()
    assert result == Number([6, 9, 0, 4])