示例#1
0
def test_compute_add():
    instruction = "add 2\napply 0"
    calculator = Calculator(instruction)
    assert calculator.Compute() == 2
示例#2
0
def test_compute_1():
    instruction = "multiply 3\nadd 2\napply 10"
    calculator = Calculator(instruction)
    assert calculator.Compute() == 32
示例#3
0
def test_compute_apply():
    instruction = "apply 1"
    calculator = Calculator(instruction)
    assert calculator.Compute() == 1
示例#4
0
def test_compute_divide():
    instruction = "divide 2\napply 4"
    calculator = Calculator(instruction)
    assert calculator.Compute() == 2
示例#5
0
def test_compute_multiply():
    instruction = "multiply 2\napply 1"
    calculator = Calculator(instruction)
    assert calculator.Compute() == 2
示例#6
0
def test_compute_subtract():
    instruction = "subtract 2\napply 4"
    calculator = Calculator(instruction)
    assert calculator.Compute() == 2