'Tests the "coordinates" of parsed elements - file
name and line numbers, with modification insterted by
#line directives.'

def test_coords(self):

    self.assert_coord(self.parse('int    a;').ext[0], 1)
    t1 = '\n                                int    a;\n                                int    b;\n\n\n                                int    c;\n                                '
    f1 = self.parse(t1, filename='test.c')
    self.assert_coord(f1.ext[0], 2, 'test.c')
    self.assert_coord(f1.ext[1], 3, 'test.c')
    self.assert_coord(f1.ext[2], 6, 'test.c')
    t1_1 = '\n                                int    main()    {\n                                                k    =    p;\n                                                printf("%d",    b);\n                                                return    0;\n                                }'
    f1_1 = self.parse(t1_1, filename='test.c')
    self.assert_coord(f1_1.ext[0].body.block_items[0], 3, 'test.c')
    self.assert_coord(f1_1.ext[0].body.block_items[1], 4, 'test.c')
    t1_2 = '\n                                int    main    ()    {\n                                                int    p    =    (int)    k;\n                                }'
    f1_2 = self.parse(t1_2, filename='test.c')
    self.assert_coord(f1_2.ext[0].body.block_items[0].init, 3, 'test.c')
    t2 = '\n                                #line    99\n                                int    c;\n                                '
    self.assert_coord(self.parse(t2).ext[0], 99)
    t3 = '\n                                int    dsf;\n                                char    p;\n                                #line    3000    "in.h"\n                                char    d;\n                                '
    f3 = self.parse(t3, filename='test.c')
    self.assert_coord(f3.ext[0], 2, 'test.c')
    self.assert_coord(f3.ext[1], 3, 'test.c')
    self.assert_coord(f3.ext[2], 3000, 'in.h')
    t4 = '\n                                #line    20    "restore.h"\n                                int    maydler(char);\n\n                                #line    30    "includes/daween.ph"\n                                long    j,    k;\n\n                                #line    50000\n                                char*    ro;\n                                '
    f4 = self.parse(t4, filename='myb.c')
    self.assert_coord(f4.ext[0], 20, 'restore.h')
    self.assert_coord(f4.ext[1], 30, 'includes/daween.ph')
    self.assert_coord(f4.ext[2], 30, 'includes/daween.ph')
    self.assert_coord(f4.ext[3], 50000, 'includes/daween.ph')
    t5 = '\n                                int\n                                #line    99\n                                c;\n                                '
    self.assert_coord(self.parse(t5).ext[0], 99)
    t6 = '\n                                int    foo(int    j,\n                                                                ...)    {\n                                }'
    f6 = self.parse(t6, filename='z.c')
    self.assert_coord(self.parse(t6).ext[0].decl.type.args.params[1], 3)
