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", ]
def test_hello(): assert interpreter.main("tests/altr_files/if_statement.altr") == [ 5, 44, 0, -9, "1", "1", "1", "1", "1", "1", "1", "1", ]
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, ]
def test_input_string(monkeypatch): monkeypatch.setattr("builtins.input", lambda _: "Alter") assert interpreter.main("tests/altr_files/input.altr") == ["Alter"]
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])
def test_setvar(): assert interpreter.main("tests/altr_files/setvar.altr") == [1]
def test_multi_letter_var(): assert interpreter.main("tests/altr_files/multi_letter_var.altr") == [ "Hello" ]
def test_multivar(): assert interpreter.main("tests/altr_files/multi_var.altr") == [1, 3]
def test_hello(model): assert interpreter.main("tests/altr_files/hello.altr") == ["Hello World"]
def test_say_groups(model): assert interpreter.main("tests/altr_files/say_groups.altr") == [ 4, "Alter", "hello, Alter, goodbye 4", ]
def test_say_var(model): assert interpreter.main("tests/altr_files/say_var.altr") == [ "hello", "hello" ]