diff python/testir.py @ 253:74c6a20302d5

Added better logging
author Windel Bouwman
date Wed, 31 Jul 2013 17:57:03 +0200
parents c4370696ccc7
children 225f444019b1
line wrap: on
line diff
--- a/python/testir.py	Tue Jul 30 17:57:46 2013 +0200
+++ b/python/testir.py	Wed Jul 31 17:57:03 2013 +0200
@@ -2,6 +2,24 @@
 import sys
 import c3, ppci, ir, x86, transform
 
+class IrCodeTestCase(unittest.TestCase):
+    def setUp(self):
+        self.b = ir.Builder()
+        self.m = ir.Module('test')
+        self.b.setModule(self.m)
+
+    def testBuilder(self):
+        f = self.b.newFunction('add')
+        self.b.setFunction(f)
+        bb = self.b.newBB()
+        self.b.setBB(bb)
+        v1 = self.b.newTmp('t')
+        self.b.addIns(ir.Return(v1))
+        self.m.check()
+        # Run interpreter:
+        r = self.m.getFunction('add').call(1, 2)
+        #self.assertEqual(3, r)
+
 class ConstantFolderTestCase(unittest.TestCase):
     def setUp(self):
         self.b = ir.Builder()