comparison python/testir.py @ 274:ea93e0a7a31e

Move docs
author Windel Bouwman
date Wed, 04 Sep 2013 17:35:06 +0200
parents e64bae57cda8
children 046017431c6a
comparison
equal deleted inserted replaced
273:6b3a874edd6e 274:ea93e0a7a31e
14 14
15 def testBuilder(self): 15 def testBuilder(self):
16 f = self.b.newFunction('add') 16 f = self.b.newFunction('add')
17 self.b.setFunction(f) 17 self.b.setFunction(f)
18 bb = self.b.newBlock() 18 bb = self.b.newBlock()
19 self.b.emit(ir.Jump(bb))
19 self.b.setBlock(bb) 20 self.b.setBlock(bb)
20 self.b.emit(ir.Exp(ir.Const(0))) 21 self.b.emit(ir.Exp(ir.Const(0)))
22 self.b.emit(ir.Jump(f.epiloog))
21 self.m.check() 23 self.m.check()
22 # Run interpreter: 24 # Run interpreter:
23 # r = self.m.getFunction('add').call(1, 2) 25 # r = self.m.getFunction('add').call(1, 2)
24 #self.assertEqual(3, r) 26 #self.assertEqual(3, r)
25 27
32 self.b.setModule(self.m) 34 self.b.setModule(self.m)
33 35
34 def testBuilder(self): 36 def testBuilder(self):
35 f = self.b.newFunction('test') 37 f = self.b.newFunction('test')
36 self.b.setFunction(f) 38 self.b.setFunction(f)
37 self.b.setBlock(self.b.newBlock()) 39 bb = self.b.newBlock()
40 self.b.emit(ir.Jump(bb))
41 self.b.setBlock(bb)
38 v1 = ir.Const(5) 42 v1 = ir.Const(5)
39 v2 = ir.Const(7) 43 v2 = ir.Const(7)
40 v3 = ir.Add(v1, v2) 44 v3 = ir.Add(v1, v2)
41 self.cf.run(self.m) 45 self.b.emit(ir.Jump(f.epiloog))
46 #self.cf.run(self.m)
42 47
43 def testAdd0(self): 48 def testAdd0(self):
44 f = self.b.newFunction('test') 49 f = self.b.newFunction('test')
45 self.b.setFunction(f) 50 self.b.setFunction(f)
46 self.b.setBlock(self.b.newBlock()) 51 self.b.setBlock(self.b.newBlock())