summaryrefslogtreecommitdiff
path: root/tests/calc1.txt
blob: 127a4981bdcfb343fe557971ce7dcb0a01a7bce4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
*** Settings ***
Library     Process

*** Keywords ***
Run Calculator
    [Arguments]  ${expr}
    ${result} =  Run Process  ${CURDIR}/../calc1  ${expr}
    [Return]  ${result}

Calculate
    [Arguments]  ${expr}
    ${rc} =  Run Calculator  ${expr}
    Should Be Equal As Integers     ${rc.rc}    0
    ${result} =  Get Variable Value  ${rc.stdout}
    [Return]  ${result}

The result of ${calculation} should be ${expected}
    ${result} =  Calculate  ${calculation}
    Should Be Equal As Integers  ${expected}  ${result}

*** Test Cases ***
Simple calculations
    [Template]  The result of ${calculations} should be ${expected}
    1-1  0
    100-3  97
    50${SPACE*5}- 5  45

    1+1  2
    100+3  103
    34 +${SPACE*4}6  40

    10/2  5
    3*4  12

Multiple Runs Of Plus And Minus
    [Template]  The result of ${calculations} should be ${expected}
    1+1+1  3
    1-1-1  -1
    5+1-2  4