import unittest
import util

from hutn_compiler.compiler import do_compile

def parse_file(filename):
    return do_compile(util.get_code_path(filename), "grammars/actionlanguage.g", None)

class TestValids(unittest.TestCase):
    def test_empty(self):
        self.assertTrue(parse_file("empty.al"))

    def test_assign(self):
        self.assertTrue(parse_file("assign.al"))

    def test_variable_declare(self):
        self.assertTrue(parse_file("vardecl.al"))

    def test_accumulate(self):
        self.assertTrue(parse_file("accumulate.al"))

    def test_fibonacci(self):
        self.assertTrue(parse_file("fibonacci.al"))

    def test_while(self):
        self.assertTrue(parse_file("while.al"))

    def test_if(self):
        self.assertTrue(parse_file("if.al"))

    def test_action(self):
        self.assertTrue(parse_file("action.al"))

    def test_type(self):
        self.assertTrue(parse_file("types.al"))

    def test_global(self):
        self.assertTrue(parse_file("global.al"))

    def test_include(self):
        self.assertTrue(parse_file("include.al"))
