CAP/TP02/ariteval/test_ariteval.py
Emma Nardino ff5f2319ec Add TPO2
2024-09-23 11:04:28 +02:00

29 lines
672 B
Python
Executable File

#! /usr/bin/env python3
import pytest
import glob
import sys
from test_expect_pragma import TestExpectPragmas
ALL_FILES = glob.glob('./tests/hello*.txt')
# only test programs of these shapes!
# ALL_FILES = glob.glob('./tests/test*.txt')
# + glob.glob('./tests/bad*.txt')
EVAL = 'arit.py'
class TestEVAL(TestExpectPragmas):
def evaluate(self, file):
return self.run_command(['python3', EVAL, file])
@pytest.mark.parametrize('filename', ALL_FILES)
def test_expect(self, filename):
expect = self.get_expect(filename)
eval = self.evaluate(filename)
assert expect == eval
if __name__ == '__main__':
pytest.main(sys.argv)