comparison test/testc3.py @ 355:c2ddc8a36f5e

Enabled optimization
author Windel Bouwman
date Fri, 14 Mar 2014 10:30:13 +0100
parents 5477e499b039
children 2ec730e45ea1
comparison
equal deleted inserted replaced
354:5477e499b039 355:c2ddc8a36f5e
1 import unittest 1 import unittest
2 import logging
2 import io 3 import io
3 from ppci.c3 import Builder, Lexer 4 from ppci.c3 import Builder, Lexer
4 from ppci.target import SimpleTarget 5 from ppci.target import SimpleTarget
5 import ppci 6 import ppci
6 7
42 class testBuilder(unittest.TestCase): 43 class testBuilder(unittest.TestCase):
43 def setUp(self): 44 def setUp(self):
44 self.diag = ppci.DiagnosticsManager() 45 self.diag = ppci.DiagnosticsManager()
45 self.builder = Builder(self.diag, SimpleTarget()) 46 self.builder = Builder(self.diag, SimpleTarget())
46 self.diag.clear() 47 self.diag.clear()
48 # Add a null logging handler to disable warning log messages:
49 nh = logging.NullHandler()
50 logging.getLogger().addHandler(nh)
47 51
48 def makeFileList(self, snippet): 52 def makeFileList(self, snippet):
49 """ Try to make a list with opened files """ 53 """ Try to make a list with opened files """
50 if type(snippet) is list: 54 if type(snippet) is list:
51 l2 = [] 55 l2 = []
380 c = x[2]; 384 c = x[2];
381 } 385 }
382 """ 386 """
383 self.expectErrors(snippet, [7]) 387 self.expectErrors(snippet, [7])
384 388
389 @unittest.skip('TODO')
390 def testArrayFail3(self):
391 snippet = """
392 module testarray;
393 function void t()
394 {
395 int c[20];
396 }
397 """
398 self.expectErrors(snippet, [7])
399
385 def testStructCall(self): 400 def testStructCall(self):
386 snippet = """ 401 snippet = """
387 module teststruct1; 402 module teststruct1;
388 function void t() 403 function void t()
389 { 404 {