github.com/Konstantin8105/c4go@v0.0.0-20240505174241-768bb1c65a51/ast/field_decl_test.go (about)

     1  package ast
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestFieldDecl(t *testing.T) {
     8  	nodes := map[string]Node{
     9  		`0x7fef510c4848 <line:141:2, col:6> col:6 _ur 'int'`: &FieldDecl{
    10  			Addr:         0x7fef510c4848,
    11  			Pos:          NewPositionFromString("line:141:2, col:6"),
    12  			Position2:    "col:6",
    13  			Name:         "_ur",
    14  			Type:         "int",
    15  			Type2:        "",
    16  			IsImplicit:   false,
    17  			IsReferenced: false,
    18  			ChildNodes:   []Node{},
    19  		},
    20  		`0x7fef510c46f8 <line:139:2, col:16> col:16 _ub 'struct __sbuf':'struct __sbuf'`: &FieldDecl{
    21  			Addr:         0x7fef510c46f8,
    22  			Pos:          NewPositionFromString("line:139:2, col:16"),
    23  			Position2:    "col:16",
    24  			Name:         "_ub",
    25  			Type:         "struct __sbuf",
    26  			Type2:        "struct __sbuf",
    27  			IsImplicit:   false,
    28  			IsReferenced: false,
    29  			ChildNodes:   []Node{},
    30  		},
    31  		`0x7fef510c3fe0 <line:134:2, col:19> col:19 _read 'int (* _Nullable)(void *, char *, int)':'int (*)(void *, char *, int)'`: &FieldDecl{
    32  			Addr:         0x7fef510c3fe0,
    33  			Pos:          NewPositionFromString("line:134:2, col:19"),
    34  			Position2:    "col:19",
    35  			Name:         "_read",
    36  			Type:         "int (* _Nullable)(void *, char *, int)",
    37  			Type2:        "int (*)(void *, char *, int)",
    38  			IsImplicit:   false,
    39  			IsReferenced: false,
    40  			ChildNodes:   []Node{},
    41  		},
    42  		`0x7fef51073a60 <line:105:2, col:40> col:40 __cleanup_stack 'struct ____pthread_handler_rec *'`: &FieldDecl{
    43  			Addr:         0x7fef51073a60,
    44  			Pos:          NewPositionFromString("line:105:2, col:40"),
    45  			Position2:    "col:40",
    46  			Name:         "__cleanup_stack",
    47  			Type:         "struct ____pthread_handler_rec *",
    48  			Type2:        "",
    49  			IsImplicit:   false,
    50  			IsReferenced: false,
    51  			ChildNodes:   []Node{},
    52  		},
    53  		`0x7fef510738e8 <line:100:2, col:43> col:7 __opaque 'char [16]'`: &FieldDecl{
    54  			Addr:         0x7fef510738e8,
    55  			Pos:          NewPositionFromString("line:100:2, col:43"),
    56  			Position2:    "col:7",
    57  			Name:         "__opaque",
    58  			Type:         "char [16]",
    59  			Type2:        "",
    60  			IsImplicit:   false,
    61  			IsReferenced: false,
    62  			ChildNodes:   []Node{},
    63  		},
    64  		`0x7fe9f5072268 <line:129:2, col:6> col:6 referenced _lbfsize 'int'`: &FieldDecl{
    65  			Addr:         0x7fe9f5072268,
    66  			Pos:          NewPositionFromString("line:129:2, col:6"),
    67  			Position2:    "col:6",
    68  			Name:         "_lbfsize",
    69  			Type:         "int",
    70  			Type2:        "",
    71  			IsImplicit:   false,
    72  			IsReferenced: true,
    73  			ChildNodes:   []Node{},
    74  		},
    75  		`0x7f9bc9083d00 <line:91:5, line:97:8> line:91:5 'unsigned short'`: &FieldDecl{
    76  			Addr:         0x7f9bc9083d00,
    77  			Pos:          NewPositionFromString("line:91:5, line:97:8"),
    78  			Position2:    "line:91:5",
    79  			Name:         "",
    80  			Type:         "unsigned short",
    81  			Type2:        "",
    82  			IsImplicit:   false,
    83  			IsReferenced: false,
    84  			ChildNodes:   []Node{},
    85  		},
    86  		`0x30363a0 <col:18, col:29> __val 'int [2]'`: &FieldDecl{
    87  			Addr:         0x30363a0,
    88  			Pos:          NewPositionFromString("col:18, col:29"),
    89  			Position2:    "",
    90  			Name:         "__val",
    91  			Type:         "int [2]",
    92  			Type2:        "",
    93  			IsImplicit:   false,
    94  			IsReferenced: false,
    95  			ChildNodes:   []Node{},
    96  		},
    97  		`0x17aeac0 <line:3:9> col:9 implicit referenced 'struct vec3d_t::(anonymous at main.c:3:9)'`: &FieldDecl{
    98  			Addr:         0x17aeac0,
    99  			Pos:          NewPositionFromString("line:3:9"),
   100  			Position2:    "col:9",
   101  			Name:         "",
   102  			Type:         "struct vec3d_t::(anonymous at main.c:3:9)",
   103  			Type2:        "",
   104  			IsImplicit:   true,
   105  			IsReferenced: true,
   106  			ChildNodes:   []Node{},
   107  		},
   108  		`0x56498bf52160 <line:269:5, col:21> col:21 type 'enum __pid_type':'enum __pid_type'`: &FieldDecl{
   109  			Addr:         0x56498bf52160,
   110  			Pos:          NewPositionFromString("line:269:5, col:21"),
   111  			Position2:    "col:21",
   112  			Name:         "type",
   113  			Type:         "enum __pid_type",
   114  			Type2:        "enum __pid_type",
   115  			IsImplicit:   false,
   116  			IsReferenced: false,
   117  			ChildNodes:   []Node{},
   118  		},
   119  	}
   120  
   121  	runNodeTests(t, nodes)
   122  }