test_valids.py 1.2 KB

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