diff test/testir.py @ 394:988f3fb861e4

c3 code generator rewrite
author Windel Bouwman
date Thu, 22 May 2014 08:14:12 +0200
parents 86b02c98a717
children 5d03c10fe19d
line wrap: on
line diff
--- a/test/testir.py	Sat May 17 21:17:40 2014 +0200
+++ b/test/testir.py	Thu May 22 08:14:12 2014 +0200
@@ -1,5 +1,4 @@
 import unittest
-import os
 import sys
 import io
 import ppci
@@ -10,7 +9,7 @@
 
 class IrCodeTestCase(unittest.TestCase):
     def testAdd(self):
-        v = ir.Add(ir.Const(1), ir.Const(2))
+        v = ir.Add(ir.Const(1), ir.Const(2), "add", ir.i32)
 
 
 class IrBuilderTestCase(unittest.TestCase):
@@ -20,7 +19,7 @@
         self.b.setModule(self.m)
 
     def testBuilder(self):
-        f = self.b.newFunction('add')
+        f = self.b.new_function('add')
         self.b.setFunction(f)
         bb = self.b.newBlock()
         self.b.emit(ir.Jump(bb))
@@ -65,23 +64,23 @@
         self.b.setModule(self.m)
 
     def testBuilder(self):
-        f = self.b.newFunction('test')
+        f = self.b.new_function('test')
         self.b.setFunction(f)
         bb = self.b.newBlock()
         self.b.emit(ir.Jump(bb))
         self.b.setBlock(bb)
         v1 = ir.Const(5)
         v2 = ir.Const(7)
-        v3 = ir.Add(v1, v2)
+        v3 = ir.Add(v1, v2, "add", ir.i32)
         self.b.emit(ir.Jump(f.epiloog))
         self.cf.run(self.m)
 
     def testAdd0(self):
-        f = self.b.newFunction('test')
+        f = self.b.new_function('test')
         self.b.setFunction(f)
         self.b.setBlock(self.b.newBlock())
-        v1 = ir.Const(0)
-        v3 = ir.Add(v1, ir.Const(0))
+        v1 = ir.Const(12)
+        v3 = ir.Add(v1, ir.Const(0), "add", ir.i32)
 
 
 class TestWriter(unittest.TestCase):