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

     1  package ast
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestTypedefDecl(t *testing.T) {
     8  	nodes := map[string]Node{
     9  		`0x7fdef0862430 <line:120:1, col:16> col:16`: &TypedefDecl{
    10  			Addr:         0x7fdef0862430,
    11  			Pos:          NewPositionFromString("line:120:1, col:16"),
    12  			Position2:    "col:16",
    13  			Name:         "",
    14  			Type:         "",
    15  			Type2:        "",
    16  			IsImplicit:   false,
    17  			IsReferenced: false,
    18  			ChildNodes:   []Node{},
    19  		},
    20  		`0x7ffb9f824278 <<invalid sloc>> <invalid sloc> implicit __uint128_t 'unsigned __int128'`: &TypedefDecl{
    21  			Addr:         0x7ffb9f824278,
    22  			Pos:          NewPositionFromString("<invalid sloc>"),
    23  			Position2:    "<invalid sloc>",
    24  			Name:         "__uint128_t",
    25  			Type:         "unsigned __int128",
    26  			Type2:        "",
    27  			IsImplicit:   true,
    28  			IsReferenced: false,
    29  			ChildNodes:   []Node{},
    30  		},
    31  		`0x7ffb9f824898 <<invalid sloc>> <invalid sloc> implicit referenced __builtin_va_list 'struct __va_list_tag [1]'`: &TypedefDecl{
    32  			Addr:         0x7ffb9f824898,
    33  			Pos:          NewPositionFromString("<invalid sloc>"),
    34  			Position2:    "<invalid sloc>",
    35  			Name:         "__builtin_va_list",
    36  			Type:         "struct __va_list_tag [1]",
    37  			Type2:        "",
    38  			IsImplicit:   true,
    39  			IsReferenced: true,
    40  			ChildNodes:   []Node{},
    41  		},
    42  		`0x7ffb9f8248f8 </usr/include/i386/_types.h:37:1, col:24> col:24 __int8_t 'signed char'`: &TypedefDecl{
    43  			Addr:         0x7ffb9f8248f8,
    44  			Pos:          NewPositionFromString("/usr/include/i386/_types.h:37:1, col:24"),
    45  			Position2:    "col:24",
    46  			Name:         "__int8_t",
    47  			Type:         "signed char",
    48  			Type2:        "",
    49  			IsImplicit:   false,
    50  			IsReferenced: false,
    51  			ChildNodes:   []Node{},
    52  		},
    53  		`0x7ffb9f8dbf50 <line:98:1, col:27> col:27 referenced ____va_list '__builtin_va_list':'struct __va_list_tag [1]'`: &TypedefDecl{
    54  			Addr:         0x7ffb9f8dbf50,
    55  			Pos:          NewPositionFromString("line:98:1, col:27"),
    56  			Position2:    "col:27",
    57  			Name:         "____va_list",
    58  			Type:         "__builtin_va_list",
    59  			Type2:        "struct __va_list_tag [1]",
    60  			IsImplicit:   false,
    61  			IsReferenced: true,
    62  			ChildNodes:   []Node{},
    63  		},
    64  		`0x34461f0 <line:338:1, col:77> __io_read_fn '__ssize_t (void *, char *, size_t)'`: &TypedefDecl{
    65  			Addr:         0x34461f0,
    66  			Pos:          NewPositionFromString("line:338:1, col:77"),
    67  			Position2:    "",
    68  			Name:         "__io_read_fn",
    69  			Type:         "__ssize_t (void *, char *, size_t)",
    70  			Type2:        "",
    71  			IsImplicit:   false,
    72  			IsReferenced: false,
    73  			ChildNodes:   []Node{},
    74  		},
    75  		`0x55b9da8784b0 <line:341:1, line:342:16> line:341:19 __io_write_fn '__ssize_t (void *, const char *, size_t)'`: &TypedefDecl{
    76  			Addr:         0x55b9da8784b0,
    77  			Pos:          NewPositionFromString("line:341:1, line:342:16"),
    78  			Position2:    "line:341:19",
    79  			Name:         "__io_write_fn",
    80  			Type:         "__ssize_t (void *, const char *, size_t)",
    81  			Type2:        "",
    82  			IsImplicit:   false,
    83  			IsReferenced: false,
    84  			ChildNodes:   []Node{},
    85  		},
    86  		`0x3f0b9b0 <line:12:1, line:15:3> col:3 referenced extCoord 'struct extCoord':'extCoord'`: &TypedefDecl{
    87  			Addr:         0x3f0b9b0,
    88  			Pos:          NewPositionFromString("line:12:1, line:15:3"),
    89  			Position2:    "col:3",
    90  			Name:         "extCoord",
    91  			Type:         "struct extCoord",
    92  			Type2:        "extCoord",
    93  			IsImplicit:   false,
    94  			IsReferenced: true,
    95  			ChildNodes:   []Node{},
    96  		},
    97  	}
    98  
    99  	runNodeTests(t, nodes)
   100  }