Mercurial > lcfOS
diff test/testzcc.py @ 287:1c7c1e619be8
File movage
author | Windel Bouwman |
---|---|
date | Thu, 21 Nov 2013 11:57:27 +0100 |
parents | d9df72971cbf |
children | a747a45dcd78 |
line wrap: on
line diff
--- a/test/testzcc.py Fri Nov 15 13:52:32 2013 +0100 +++ b/test/testzcc.py Thu Nov 21 11:57:27 2013 +0100 @@ -3,27 +3,45 @@ import zcc import outstream import ppci +import io +import os class ZccTestCase(unittest.TestCase): """ Tests the compiler driver """ - def do(self, fn): - """ Compile blink.c3 """ - args = zcc.parser.parse_args([fn, '--package_dir', './c3examples/']) + def do(self, filenames): + basedir = 'c3examples' + filenames = [os.path.join(basedir, fn) for fn in filenames] + args = zcc.parser.parse_args(filenames + []) self.assertEqual(0, zcc.main(args)) - def testExamples(self): + def t2estExamples(self): """ Test all examples in the c3/examples directory """ example_filenames = glob.glob('./c3examples/*.c3') for filename in example_filenames: self.do(filename) + def testBurn(self): + self.do(['stm32f4xx.c3', 'burn.c3']) + + def testBurn2(self): + self.do(['stm32f4xx.c3','burn2.c3']) + + def testComments(self): + self.do(['comments.c3']) + + def testCast(self): + self.do(['cast.c3']) + def testSectionAddress(self): - src = "module tst; function void t2() {var int t3; t3 = 2;}" + src = """module tst; + function void t2() {var int t3; t3 = 2;} + """ + f = io.StringIO(src) diag = ppci.DiagnosticsManager() outs = outstream.TextOutputStream() - self.assertTrue(zcc.zcc(src, outs, diag)) + self.assertTrue(zcc.zcc([f], outs, diag)) code = outs.getSection('code') self.assertEqual(0x08000000, code.address) data = outs.getSection('data')