diff test/testc3.py @ 354:5477e499b039

Added some sort of string functionality
author Windel Bouwman
date Thu, 13 Mar 2014 18:59:06 +0100
parents b8ad45b3a573
children c2ddc8a36f5e
line wrap: on
line diff
--- a/test/testc3.py	Sun Mar 09 18:49:10 2014 +0100
+++ b/test/testc3.py	Thu Mar 13 18:59:06 2014 +0100
@@ -343,6 +343,45 @@
         """
         self.expectErrors(snippet, [5])
 
+    def testArray(self):
+        snippet = """
+         module testarray;
+         function void t()
+         {
+            var int[100] x;
+            var int a, b;
+            a = 2;
+            b = x[a*2+9 - a] * x[22+12];
+            x[1] = x[2];
+         }
+        """
+        self.expectOK(snippet)
+
+    def testArrayFail(self):
+        snippet = """
+         module testarray;
+         function void t()
+         {
+            var bool c;
+            c = false;
+            var int[100] x;
+            x[1] = x[c];
+         }
+        """
+        self.expectErrors(snippet, [8])
+
+    def testArrayFail2(self):
+        snippet = """
+         module testarray;
+         function void t()
+         {
+            var int c;
+            var int x;
+            c = x[2];
+         }
+        """
+        self.expectErrors(snippet, [7])
+
     def testStructCall(self):
         snippet = """
          module teststruct1;