'Tests that redeclarations of existing types are parsed correctly.
This is non-standard, but allowed by many compilers.'

def test_duplicate_typedef(self):

    d1 = '\n                                                typedef    int    numbertype;\n                                                typedef    int    numbertype;\n                                '
    self.assertEqual(self.get_decl(d1, 0), ['Typedef', 'numbertype', ['TypeDecl', ['IdentifierType', ['int']]]])
    self.assertEqual(self.get_decl(d1, 1), ['Typedef', 'numbertype', ['TypeDecl', ['IdentifierType', ['int']]]])
    d2 = '\n                                                typedef    int    (*funcptr)(int    x);\n                                                typedef    int    (*funcptr)(int    x);\n                                '
    self.assertEqual(self.get_decl(d2, 0), ['Typedef', 'funcptr', ['PtrDecl', ['FuncDecl', [['Decl', 'x', ['TypeDecl', ['IdentifierType', ['int']]]]], ['TypeDecl', ['IdentifierType', ['int']]]]]])
    self.assertEqual(self.get_decl(d2, 1), ['Typedef', 'funcptr', ['PtrDecl', ['FuncDecl', [['Decl', 'x', ['TypeDecl', ['IdentifierType', ['int']]]]], ['TypeDecl', ['IdentifierType', ['int']]]]]])
    d3 = '\n                                                typedef    int    numberarray[5];\n                                                typedef    int    numberarray[5];\n                                '
    self.assertEqual(self.get_decl(d3, 0), ['Typedef', 'numberarray', ['ArrayDecl', '5', [], ['TypeDecl', ['IdentifierType', ['int']]]]])
    self.assertEqual(self.get_decl(d3, 1), ['Typedef', 'numberarray', ['ArrayDecl', '5', [], ['TypeDecl', ['IdentifierType', ['int']]]]])
