Mercurial > lcfOS
comparison 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 |
comparison
equal
deleted
inserted
replaced
283:c9781c73e7e2 | 284:05184b95fa16 |
---|---|
1 import unittest | |
2 import glob | |
3 import zcc | |
4 import outstream | |
5 import ppci | |
6 | |
7 class ZccTestCase(unittest.TestCase): | |
8 """ Tests the compiler driver """ | |
9 | |
10 def do(self, fn): | |
11 """ Compile blink.c3 """ | |
12 args = zcc.parser.parse_args([fn, '--package_dir', './c3examples']) | |
13 zcc.main(args) | |
14 | |
15 def testExamples(self): | |
16 """ Test all examples in the c3/examples directory """ | |
17 example_filenames = glob.glob('./c3examples/*.c3') | |
18 for filename in example_filenames: | |
19 self.do(filename) | |
20 | |
21 def testSectionAddress(self): | |
22 src = "module tst; function void t2() {var int t3; t3 = 2;}" | |
23 diag = ppci.DiagnosticsManager() | |
24 outs = outstream.TextOutputStream() | |
25 self.assertTrue(zcc.zcc(src, outs, diag)) | |
26 code = outs.getSection('code') | |
27 self.assertEqual(0x08000000, code.address) | |
28 data = outs.getSection('data') | |
29 self.assertEqual(0x20000000, data.address) | |
30 | |
31 | |
32 if __name__ == '__main__': | |
33 unittest.main() | |
34 |