Mercurial > lcfOS
comparison python/testir.py @ 253:74c6a20302d5
Added better logging
author | Windel Bouwman |
---|---|
date | Wed, 31 Jul 2013 17:57:03 +0200 |
parents | c4370696ccc7 |
children | 225f444019b1 |
comparison
equal
deleted
inserted
replaced
252:c4370696ccc7 | 253:74c6a20302d5 |
---|---|
1 import unittest, os | 1 import unittest, os |
2 import sys | 2 import sys |
3 import c3, ppci, ir, x86, transform | 3 import c3, ppci, ir, x86, transform |
4 | |
5 class IrCodeTestCase(unittest.TestCase): | |
6 def setUp(self): | |
7 self.b = ir.Builder() | |
8 self.m = ir.Module('test') | |
9 self.b.setModule(self.m) | |
10 | |
11 def testBuilder(self): | |
12 f = self.b.newFunction('add') | |
13 self.b.setFunction(f) | |
14 bb = self.b.newBB() | |
15 self.b.setBB(bb) | |
16 v1 = self.b.newTmp('t') | |
17 self.b.addIns(ir.Return(v1)) | |
18 self.m.check() | |
19 # Run interpreter: | |
20 r = self.m.getFunction('add').call(1, 2) | |
21 #self.assertEqual(3, r) | |
4 | 22 |
5 class ConstantFolderTestCase(unittest.TestCase): | 23 class ConstantFolderTestCase(unittest.TestCase): |
6 def setUp(self): | 24 def setUp(self): |
7 self.b = ir.Builder() | 25 self.b = ir.Builder() |
8 self.cf = transform.ConstantFolder() | 26 self.cf = transform.ConstantFolder() |