comparison python/testc3.py @ 187:bf5ab358f43a

Renamed readme and added status badge
author Windel Bouwman
date Sat, 25 May 2013 14:41:19 +0200
parents 46d62dadd61b
children 6b2bec5653f1
comparison
equal deleted inserted replaced
186:46d62dadd61b 187:bf5ab358f43a
135 c = b > 1; 135 c = b > 1;
136 } 136 }
137 """ 137 """
138 self.diag.clear() 138 self.diag.clear()
139 ir = self.builder.build(snippet) 139 ir = self.builder.build(snippet)
140 assert len(self.diag.diags) == 3 140 self.assertEqual(len(self.diag.diags), 3)
141 self.assertEqual(self.diag.diags[0].loc.row, 8) 141 self.assertEqual(self.diag.diags[0].loc.row, 8)
142 self.assertEqual(self.diag.diags[1].loc.row, 9) 142 self.assertEqual(self.diag.diags[1].loc.row, 9)
143 self.assertEqual(self.diag.diags[2].loc.row, 10) 143 self.assertEqual(self.diag.diags[2].loc.row, 10)
144 self.assertFalse(ir) 144 self.assertFalse(ir)
145 def testEmpty(self): 145 def testEmpty(self):
173 i = i + 3; 173 i = i + 3;
174 a = a + i; 174 a = a + i;
175 } 175 }
176 } 176 }
177 """ 177 """
178 ir = self.builder.build(snippet) 178 ircode = self.builder.build(snippet)
179 if not ir: 179 if not ircode:
180 self.diag.printErrors(snippet) 180 self.diag.printErrors(snippet)
181 self.assertTrue(ir) 181 self.assertTrue(ircode)
182 def testIf(self): 182 def testIf(self):
183 snippet = """ 183 snippet = """
184 package tstIFF; 184 package tstIFF;
185 function void t(int b) 185 function void t(int b)
186 { 186 {
205 self.assertTrue(ir) 205 self.assertTrue(ir)
206 def test2(self): 206 def test2(self):
207 # testsrc2 is valid code: 207 # testsrc2 is valid code:
208 self.diag.clear() 208 self.diag.clear()
209 ir = self.builder.build(testsrc2) 209 ir = self.builder.build(testsrc2)
210 assert ir 210 self.assertTrue(ir)
211 #ir.dump()
212 211
213 if __name__ == '__main__': 212 if __name__ == '__main__':
214 do() 213 do()
215 unittest.main() 214 unittest.main()
216 215