예제 #1
0
 def test_automata (self):
     full = deque(open(TEST_FILE).readlines())
     while full:
         a = full.popleft()
         b = full.popleft()
         res = self.get_type(cpy.lex(a))
         self.assertEquals( b.split(), res)
예제 #2
0
 def test_identifier(self):
     res = cpy.lex ("void c_function (void);")
     self.assertEquals([ t.type for t in res ] , ['VOID',
                                 'IDENTIFIER',
                                 '(',
                                 'VOID',
                                 ')',
                                 ';'])
예제 #3
0
 def test_lex (self):
     self.assertNotEquals (0, len(cpy.lex ("void c_function (void);") ) )