test_valids.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import unittest
  2. import util
  3. from hutn_compiler.compiler import main
  4. def parse_file(filename):
  5. main(util.get_code_path(filename), "grammars/actionlanguage.g", "N", [])
  6. return True
  7. class TestValids(unittest.TestCase):
  8. def test_empty(self):
  9. self.assertTrue(parse_file("empty.alc"))
  10. def test_assign(self):
  11. self.assertTrue(parse_file("assign.alc"))
  12. def test_variable_declare(self):
  13. self.assertTrue(parse_file("vardecl.alc"))
  14. def test_accumulate(self):
  15. self.assertTrue(parse_file("accumulate.alc"))
  16. def test_fibonacci(self):
  17. self.assertTrue(parse_file("fibonacci.alc"))
  18. def test_while(self):
  19. self.assertTrue(parse_file("while.alc"))
  20. def test_if(self):
  21. self.assertTrue(parse_file("if.alc"))
  22. def test_action(self):
  23. self.assertTrue(parse_file("action.alc"))
  24. def test_type(self):
  25. self.assertTrue(parse_file("types.alc"))
  26. def test_global(self):
  27. self.assertTrue(parse_file("global.alc"))
  28. def test_include(self):
  29. self.assertTrue(parse_file("include.alc"))