Mercurial > lcfOS
view python/testzcc.py @ 251:6ed3d3a82a63
Added another c3 example. First import attempt
author | Windel Bouwman |
---|---|
date | Mon, 29 Jul 2013 20:23:13 +0200 |
parents | f5fba5b554d7 |
children | 56d37ed4b4d2 |
line wrap: on
line source
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(['-d', 'stm32f4/blink.c3']) args = zcc.parser.parse_args([fn]) zcc.main(args) def testExamples(self): """ Test all examples in the c3/examples directory """ example_filenames = glob.glob('./stm32f4/*.c3') for filename in example_filenames: self.do(filename) def testSectionAddress(self): src = "package 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()