github.com/Konstantin8105/c4go@v0.0.0-20240505174241-768bb1c65a51/ast/parm_var_decl_test.go (about) 1 package ast 2 3 import ( 4 "testing" 5 ) 6 7 func TestParmVarDecl(t *testing.T) { 8 nodes := map[string]Node{ 9 `0x7f973380f000 <col:14> col:17 'int'`: &ParmVarDecl{ 10 Addr: 0x7f973380f000, 11 Pos: NewPositionFromString("col:14"), 12 Position2: "col:17", 13 Type: "int", 14 Name: "", 15 Type2: "", 16 IsUsed: false, 17 IsReferenced: false, 18 ChildNodes: []Node{}, 19 }, 20 `0x7f973380f070 <col:19, col:30> col:31 'const char *'`: &ParmVarDecl{ 21 Addr: 0x7f973380f070, 22 Pos: NewPositionFromString("col:19, col:30"), 23 Position2: "col:31", 24 Type: "const char *", 25 Name: "", 26 Type2: "", 27 IsUsed: false, 28 IsReferenced: false, 29 ChildNodes: []Node{}, 30 }, 31 `0x7f9733816e50 <col:13, col:37> col:37 __filename 'const char *__restrict'`: &ParmVarDecl{ 32 Addr: 0x7f9733816e50, 33 Pos: NewPositionFromString("col:13, col:37"), 34 Position2: "col:37", 35 Type: "const char *__restrict", 36 Name: "__filename", 37 Type2: "", 38 IsUsed: false, 39 IsReferenced: false, 40 ChildNodes: []Node{}, 41 }, 42 `0x7f9733817418 <<invalid sloc>> <invalid sloc> 'FILE *'`: &ParmVarDecl{ 43 Addr: 0x7f9733817418, 44 Pos: NewPositionFromString("<invalid sloc>"), 45 Position2: "<invalid sloc>", 46 Type: "FILE *", 47 Name: "", 48 Type2: "", 49 IsUsed: false, 50 IsReferenced: false, 51 ChildNodes: []Node{}, 52 }, 53 `0x7f9733817c30 <col:40, col:47> col:47 __size 'size_t':'unsigned long'`: &ParmVarDecl{ 54 Addr: 0x7f9733817c30, 55 Pos: NewPositionFromString("col:40, col:47"), 56 Position2: "col:47", 57 Type: "size_t", 58 Name: "__size", 59 Type2: "unsigned long", 60 IsUsed: false, 61 IsReferenced: false, 62 ChildNodes: []Node{}, 63 }, 64 `0x7f973382fa10 <line:476:18, col:25> col:34 'int (* _Nullable)(void *, char *, int)':'int (*)(void *, char *, int)'`: &ParmVarDecl{ 65 Addr: 0x7f973382fa10, 66 Pos: NewPositionFromString("line:476:18, col:25"), 67 Position2: "col:34", 68 Type: "int (* _Nullable)(void *, char *, int)", 69 Name: "", 70 Type2: "int (*)(void *, char *, int)", 71 IsUsed: false, 72 IsReferenced: false, 73 ChildNodes: []Node{}, 74 }, 75 `0x7f97338355b8 <col:10, col:14> col:14 used argc 'int'`: &ParmVarDecl{ 76 Addr: 0x7f97338355b8, 77 Pos: NewPositionFromString("col:10, col:14"), 78 Position2: "col:14", 79 Type: "int", 80 Name: "argc", 81 Type2: "", 82 IsUsed: true, 83 IsReferenced: false, 84 ChildNodes: []Node{}, 85 }, 86 `0x1d82850 <col:11, col:22> col:16 referenced foo 'char *':'char *'`: &ParmVarDecl{ 87 Addr: 0x1d82850, 88 Pos: NewPositionFromString("col:11, col:22"), 89 Position2: "col:16", 90 Type: "char *", 91 Name: "foo", 92 Type2: "char *", 93 IsUsed: false, 94 IsReferenced: true, 95 ChildNodes: []Node{}, 96 }, 97 `0x7f95f30ed9d0 <col:23, col:51> col:51 used eptr 'const char *' register`: &ParmVarDecl{ 98 Addr: 0x7f95f30ed9d0, 99 Pos: NewPositionFromString("col:23, col:51"), 100 Position2: "col:51", 101 Type: "const char *", 102 Name: "eptr", 103 Type2: "", 104 IsUsed: true, 105 IsReferenced: false, 106 IsRegister: true, 107 ChildNodes: []Node{}, 108 }, 109 } 110 111 runNodeTests(t, nodes) 112 }