comparison python/testcg.py @ 209:07bfea4c1ed7

Added codegen test
author Windel Bouwman
date Sat, 29 Jun 2013 10:08:46 +0200
parents
children 494828a7adf1
comparison
equal deleted inserted replaced
208:4cb47d80fd1f 209:07bfea4c1ed7
1 import unittest
2 import ppci, codegen, ir
3 import arm_cm3
4
5 class testCodeGeneration(unittest.TestCase):
6 def setUp(self):
7 self.cg = codegen.CodeGenerator(arm_cm3.armtarget)
8
9 def testFunction(self):
10 m = ir.Module('tst')
11 f = ir.Function('tst')
12 m.addFunction(f)
13 bb = ir.BasicBlock('entry')
14 f.addBasicBlock(bb)
15 v = ir.Value('tst')
16 bb.addInstruction(ir.ImmLoad(v, 123))
17 m.check()
18 obj = self.cg.generate(m)
19 self.assertTrue(obj)
20
21 if __name__ == '__main__':
22 unittest.main()