Example #1
0
def test_say_multivar(model):
    assert interpreter.main("tests/altr_files/say_multivar.altr") == [
        1,
        2,
        "hello",
        "1 2 hello \n",
    ]
def test_setvar():
    assert interpreter.main("tests/altr_files/integration.altr") == [
        1,
        False,
        "Alter",
        "Hello!",
        1,
        "1 False Alter \n",
    ]
Example #3
0
def test_hello():
    assert interpreter.main("tests/altr_files/if_statement.altr") == [
        5,
        44,
        0,
        -9,
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
    ]
Example #4
0
def test_math():
    assert interpreter.main("tests/altr_files/varmath.altr") == [
        5,
        0.546797,
        "foo",
        True,
        6,
        18,
        1.0,
        5.756797,
        1.43919925,
        "foofoofoofoofoo",
        1.43919925,
        1.43919925,
        0,
        "foofoofoofoofoobar",
        "foofoofoofoofoobarbaz",
        1,
        56.43919925,
    ]
Example #5
0
def test_input_string(monkeypatch):
    monkeypatch.setattr("builtins.input", lambda _: "Alter")
    assert interpreter.main("tests/altr_files/input.altr") == ["Alter"]
Example #6
0
import sys
import os

sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from interpreter import interpreter

try:
    sys.argv[1]
except:
    sys.argv.insert(1, "main.altr")

interpreter.main(sys.argv[1])
Example #7
0
def test_setvar():
    assert interpreter.main("tests/altr_files/setvar.altr") == [1]
Example #8
0
def test_multi_letter_var():
    assert interpreter.main("tests/altr_files/multi_letter_var.altr") == [
        "Hello"
    ]
Example #9
0
def test_multivar():
    assert interpreter.main("tests/altr_files/multi_var.altr") == [1, 3]
Example #10
0
def test_hello(model):
    assert interpreter.main("tests/altr_files/hello.altr") == ["Hello World"]
Example #11
0
def test_say_groups(model):
    assert interpreter.main("tests/altr_files/say_groups.altr") == [
        4,
        "Alter",
        "hello, Alter, goodbye 4",
    ]
Example #12
0
def test_say_var(model):
    assert interpreter.main("tests/altr_files/say_var.altr") == [
        "hello", "hello"
    ]