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

     1  package ast
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestRecordDecl(t *testing.T) {
     8  	nodes := map[string]Node{
     9  		`0x7f913c0dbb50 <line:76:9, line:79:1> line:76:9 union definition`: &RecordDecl{
    10  			Addr:         0x7f913c0dbb50,
    11  			Pos:          NewPositionFromString("line:76:9, line:79:1"),
    12  			Prev:         "",
    13  			Position2:    "line:76:9",
    14  			Kind:         "union",
    15  			Name:         "",
    16  			IsDefinition: true,
    17  			ChildNodes:   []Node{},
    18  		},
    19  		`0x7f85360285c8 </usr/include/sys/_pthread/_pthread_types.h:57:1, line:61:1> line:57:8 struct ____pthread_handler_rec definition`: &RecordDecl{
    20  			Addr:         0x7f85360285c8,
    21  			Pos:          NewPositionFromString("/usr/include/sys/_pthread/_pthread_types.h:57:1, line:61:1"),
    22  			Prev:         "",
    23  			Position2:    "line:57:8",
    24  			Kind:         "struct",
    25  			Name:         "____pthread_handler_rec",
    26  			IsDefinition: true,
    27  			ChildNodes:   []Node{},
    28  		},
    29  		`0x7f85370248a0 <line:94:1, col:8> col:8 struct __sFILEX`: &RecordDecl{
    30  			Addr:         0x7f85370248a0,
    31  			Pos:          NewPositionFromString("line:94:1, col:8"),
    32  			Prev:         "",
    33  			Position2:    "col:8",
    34  			Kind:         "struct",
    35  			Name:         "__sFILEX",
    36  			IsDefinition: false,
    37  			ChildNodes:   []Node{},
    38  		},
    39  		`0x5564ed488a10 parent 0x5564ed3ffe00 <line:7232:3, line:7237:3> line:7232:10 struct sqlite3_index_constraint definition`: &RecordDecl{
    40  			Addr:         0x5564ed488a10,
    41  			Pos:          NewPositionFromString("line:7232:3, line:7237:3"),
    42  			Prev:         "",
    43  			Position2:    "line:7232:10",
    44  			Kind:         "struct",
    45  			Name:         "sqlite3_index_constraint",
    46  			IsDefinition: true,
    47  			ChildNodes:   []Node{},
    48  		},
    49  		`0x56454e55e4b8 prev 0x56454e55e360 <line:86428:1, line:86437:1> line:86428:8 struct Incrblob definition`: &RecordDecl{
    50  			Addr:         0x56454e55e4b8,
    51  			Pos:          NewPositionFromString("line:86428:1, line:86437:1"),
    52  			Prev:         "0x56454e55e360",
    53  			Position2:    "line:86428:8",
    54  			Kind:         "struct",
    55  			Name:         "Incrblob",
    56  			IsDefinition: true,
    57  			ChildNodes:   []Node{},
    58  		},
    59  		`0x3c854a0 </home/lepricon/go/src/github.com/Konstantin8105/c4go/build/git-source/VasielBook/Глава 6/6.2/main.c:12:1, line:15:1> line:12:8 struct MyComplex definition`: &RecordDecl{
    60  			Addr:         0x3c854a0,
    61  			Pos:          NewPositionFromString("/home/lepricon/go/src/github.com/Konstantin8105/c4go/build/git-source/VasielBook/Глава 6/6.2/main.c:12:1, line:15:1"),
    62  			Prev:         "",
    63  			Position2:    "line:12:8",
    64  			Kind:         "struct",
    65  			Name:         "MyComplex",
    66  			IsDefinition: true,
    67  			ChildNodes:   []Node{},
    68  		},
    69  	}
    70  
    71  	runNodeTests(t, nodes)
    72  }