comparison test/testzcc.py @ 300:158068af716c

yafm
author Windel Bouwman
date Tue, 03 Dec 2013 18:00:22 +0100
parents 534b94b40aa8
children 6753763d3bec
comparison
equal deleted inserted replaced
299:674789d9ff37 300:158068af716c
9 9
10 class ZccTestCase(unittest.TestCase): 10 class ZccTestCase(unittest.TestCase):
11 """ Tests the compiler driver """ 11 """ Tests the compiler driver """
12 12
13 def do(self, filenames, imps=[]): 13 def do(self, filenames, imps=[]):
14 basedir = 'c3examples' 14 basedir = os.path.join('..', 'examples', 'c3')
15 arg_list = [os.path.join(basedir, fn) for fn in filenames] 15 arg_list = [os.path.join(basedir, fn) for fn in filenames]
16 for fn in imps: 16 for fn in imps:
17 arg_list.append('-i') 17 arg_list.append('-i')
18 arg_list.append(os.path.join(basedir, fn)) 18 arg_list.append(os.path.join(basedir, fn))
19 arg_list.append('--target') 19 arg_list.append('--target')
20 arg_list.append('arm') 20 arg_list.append('arm')
21 args = zcc.parser.parse_args(arg_list) 21 args = zcc.parser.parse_args(arg_list)
22 self.assertEqual(0, zcc.main(args)) 22 self.assertEqual(0, zcc.main(args))
23 23
24 @unittest.skip('Not working yet')
25 def testBurn(self):
26 self.do(['burn.c3'], ['stm32f4xx.c3'])
27
28 def testBurn2(self): 24 def testBurn2(self):
29 self.do(['burn2.c3'], ['stm32f4xx.c3']) 25 self.do(['burn2.c3'], ['stm32f4xx.c3'])
30 26
31 def testComments(self): 27 def testComments(self):
32 self.do(['comments.c3']) 28 self.do(['comments.c3'])
33 29
34 def testCast(self): 30 def testCast(self):
35 self.do(['cast.c3']) 31 self.do(['cast.c3'])
32
33 def testFunctions(self):
34 self.do(['functions.c3'])
36 35
37 def testSectionAddress(self): 36 def testSectionAddress(self):
38 src = """module tst; 37 src = """module tst;
39 function void t2() {var int t3; t3 = 2;} 38 function void t2() {var int t3; t3 = 2;}
40 """ 39 """
49 self.assertEqual(0x20000000, data.address) 48 self.assertEqual(0x20000000, data.address)
50 49
51 50
52 if __name__ == '__main__': 51 if __name__ == '__main__':
53 unittest.main() 52 unittest.main()
54