Source

hpaco / cli / tests / arithmetic.test

Full commit
# Addition
./runtest
<<<
{}

{1 + 1}
>>>
2
>>>= 0

# Addition (chained)
./runtest
<<<
{}

{1 + 2 + 4}
>>>
7
>>>= 0

# Subtraction
./runtest
<<<
{}

{4 - 2}
>>>
2
>>>= 0

# Subtraction (chained)
./runtest
<<<
{}

{4 - 2 - 1}
>>>
1
>>>= 0

# Multiplication
./runtest
<<<
{}

{2 * 3}
>>>
6
>>>= 0

# Multiplication (chained)
./runtest
<<<
{}

{3 * 2 * 4}
>>>
24
>>>= 0


# Division
./runtest
<<<
{}

{3 / 4}
>>>
0.75
>>>= 0

# Division (chained)
./runtest
<<<
{}

{100 / 10 / 2}
>>>
5
>>>= 0

# List membership
./runtest
<<<
{}

{%if 'a' in ['a','b','c']%}yes{%else%}no{%endif%}
>>>
yes
>>>=0

./runtest
<<<
{}

{%if 'd' in ['a','b','c']%}yes{%else%}no{%endif%}
>>>
no
>>>=0

./runtest
<<<
{}

{%if ['a','b','c'] contains 'a' %}yes{%else%}no{%endif%}
>>>
yes
>>>=0

./runtest
<<<
{}

{%if ['a','b','c'] contains 'd' %}yes{%else%}no{%endif%}
>>>
no
>>>=0

# Concatenation
./runtest
<<<
{}

{"foo" ++ "bar"}
>>>
foobar
>>>= 0