Mercurial > lcfOS
diff test/testcg.py @ 292:534b94b40aa8
Fixup reorganize
author | Windel Bouwman |
---|---|
date | Wed, 27 Nov 2013 08:06:42 +0100 |
parents | 7b38782ed496 |
children | 6753763d3bec |
line wrap: on
line diff
--- a/test/testcg.py Sun Nov 24 11:24:15 2013 +0100 +++ b/test/testcg.py Wed Nov 27 08:06:42 2013 +0100 @@ -1,7 +1,8 @@ import unittest -import ppci, codegen, ir -import cortexm3 as arm -import codegenarm +import ppci +from codegen import CodeGenerator +import ir +from target import armtarget import outstream @@ -14,26 +15,27 @@ class testCodeGeneration(unittest.TestCase): def setUp(self): - self.cg = codegen.CodeGenerator(arm.armtarget) + self.cg = CodeGenerator(armtarget) def testFunction(self): + s = outstream.OutputStream() m, f, bb = genTestFunction() - bb.addInstruction(ir.Const(123)) + bb.addInstruction(ir.Exp(ir.Const(123))) bb.addInstruction(ir.Jump(f.epiloog)) m.check() - obj = self.cg.generate(m) + obj = self.cg.generate(m, s) self.assertTrue(obj) class testArmCodeGeneration(unittest.TestCase): def testStack(self): s = outstream.OutputStream() - cg = codegenarm.ArmCodeGenerator(s) + cg = CodeGenerator(armtarget) m, f, bb = genTestFunction() bb.addInstruction(ir.Move(ir.Mem(ir.Const(1)), ir.Const(22))) bb.addInstruction(ir.Jump(f.epiloog)) m.check() - cg.generate(m) + cg.generate(m, s) #s.dump()