Mercurial > lcfOS
diff test/testzcc.py @ 284:05184b95fa16
Moved tests to seperate folder
author | Windel Bouwman |
---|---|
date | Fri, 15 Nov 2013 13:43:22 +0100 |
parents | python/testzcc.py@56d37ed4b4d2 |
children | d9df72971cbf |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/testzcc.py Fri Nov 15 13:43:22 2013 +0100 @@ -0,0 +1,34 @@ +import unittest +import glob +import zcc +import outstream +import ppci + +class ZccTestCase(unittest.TestCase): + """ Tests the compiler driver """ + + def do(self, fn): + """ Compile blink.c3 """ + args = zcc.parser.parse_args([fn, '--package_dir', './c3examples']) + zcc.main(args) + + def testExamples(self): + """ Test all examples in the c3/examples directory """ + example_filenames = glob.glob('./c3examples/*.c3') + for filename in example_filenames: + self.do(filename) + + def testSectionAddress(self): + src = "module tst; function void t2() {var int t3; t3 = 2;}" + diag = ppci.DiagnosticsManager() + outs = outstream.TextOutputStream() + self.assertTrue(zcc.zcc(src, outs, diag)) + code = outs.getSection('code') + self.assertEqual(0x08000000, code.address) + data = outs.getSection('data') + self.assertEqual(0x20000000, data.address) + + +if __name__ == '__main__': + unittest.main() +