1234567891011121314151617181920212223242526272829 |
- import unittest
- import util
- from postproc import postproc
- from hutn_compiler.compiler import main
- def compile_file(obj, filename):
- result = main(util.get_code_path(filename), "grammars/actionlanguage.g", "PS", [])
- expected = open(util.get_expected_path(filename)).read()
- result = postproc(result)
- expected = postproc(expected)
- if result != expected:
- #f = open(util.get_expected_path(filename), 'w')
- #f.write(result)
- #f.close()
- pass
- assert result == expected
- class TestReal(unittest.TestCase):
- def test_fibonacci(self):
- compile_file(self, "fibonacci.al")
- def test_fibonacci_smart(self):
- compile_file(self, "fibonacci_smart.al")
- def test_factorial(self):
- compile_file(self, "factorial.al")
|