diff 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
line wrap: on
line diff
--- a/python/testc3.py	Sat Mar 23 18:34:41 2013 +0100
+++ b/python/testc3.py	Fri Mar 29 17:33:17 2013 +0100
@@ -56,6 +56,29 @@
 
 """
 
+testsrc2 = """
+package test2;
+
+function void tst()
+{
+   var int a, b;
+   a = 2 * 33 - 12;
+   b = a * 2 + 13;
+   a = b + a;
+   if (a > b and b == 3)
+   {
+      var int x = a;
+      x = b * 2 - a;
+      a = x*x;
+   }
+   else
+   {
+      a = b + a;
+   }
+}
+
+"""
+
 def c3compile(src, diag):
    # Structures:
    builder = c3.Builder(diag)
@@ -176,6 +199,13 @@
       }
       """
       self.builder.build(snippet)
+   def test2(self):
+      # testsrc2 is valid code:
+      self.diag.clear()
+      ir = self.builder.build(testsrc2)
+      print(self.diag.diags)
+      assert ir
+      ir.dump()
 
 if __name__ == '__main__':
    do()