comparison 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
comparison
equal deleted inserted replaced
353:b8ad45b3a573 354:5477e499b039
341 a.z = 2; 341 a.z = 2;
342 } 342 }
343 """ 343 """
344 self.expectErrors(snippet, [5]) 344 self.expectErrors(snippet, [5])
345 345
346 def testArray(self):
347 snippet = """
348 module testarray;
349 function void t()
350 {
351 var int[100] x;
352 var int a, b;
353 a = 2;
354 b = x[a*2+9 - a] * x[22+12];
355 x[1] = x[2];
356 }
357 """
358 self.expectOK(snippet)
359
360 def testArrayFail(self):
361 snippet = """
362 module testarray;
363 function void t()
364 {
365 var bool c;
366 c = false;
367 var int[100] x;
368 x[1] = x[c];
369 }
370 """
371 self.expectErrors(snippet, [8])
372
373 def testArrayFail2(self):
374 snippet = """
375 module testarray;
376 function void t()
377 {
378 var int c;
379 var int x;
380 c = x[2];
381 }
382 """
383 self.expectErrors(snippet, [7])
384
346 def testStructCall(self): 385 def testStructCall(self):
347 snippet = """ 386 snippet = """
348 module teststruct1; 387 module teststruct1;
349 function void t() 388 function void t()
350 { 389 {