Mercurial > lcfOS
comparison python/testc3.py @ 170:4348da5ca307
Cleanup of ir dir
author | Windel Bouwman |
---|---|
date | Fri, 29 Mar 2013 17:33:17 +0100 |
parents | ee0d30533dae |
children | 25a0753da4cf |
comparison
equal
deleted
inserted
replaced
169:ee0d30533dae | 170:4348da5ca307 |
---|---|
51 return a + b; | 51 return a + b; |
52 } | 52 } |
53 | 53 |
54 var int hahaa = 23 * 2; | 54 var int hahaa = 23 * 2; |
55 | 55 |
56 | |
57 """ | |
58 | |
59 testsrc2 = """ | |
60 package test2; | |
61 | |
62 function void tst() | |
63 { | |
64 var int a, b; | |
65 a = 2 * 33 - 12; | |
66 b = a * 2 + 13; | |
67 a = b + a; | |
68 if (a > b and b == 3) | |
69 { | |
70 var int x = a; | |
71 x = b * 2 - a; | |
72 a = x*x; | |
73 } | |
74 else | |
75 { | |
76 a = b + a; | |
77 } | |
78 } | |
56 | 79 |
57 """ | 80 """ |
58 | 81 |
59 def c3compile(src, diag): | 82 def c3compile(src, diag): |
60 # Structures: | 83 # Structures: |
174 | 197 |
175 return b; | 198 return b; |
176 } | 199 } |
177 """ | 200 """ |
178 self.builder.build(snippet) | 201 self.builder.build(snippet) |
202 def test2(self): | |
203 # testsrc2 is valid code: | |
204 self.diag.clear() | |
205 ir = self.builder.build(testsrc2) | |
206 print(self.diag.diags) | |
207 assert ir | |
208 ir.dump() | |
179 | 209 |
180 if __name__ == '__main__': | 210 if __name__ == '__main__': |
181 do() | 211 do() |
182 unittest.main() | 212 unittest.main() |
183 | 213 |