github.com/Konstantin8105/c4go@v0.0.0-20240505174241-768bb1c65a51/ast/unary_operator_test.go (about) 1 package ast 2 3 import ( 4 "testing" 5 ) 6 7 func TestUnaryOperator(t *testing.T) { 8 nodes := map[string]Node{ 9 `0x7fe0260f50d8 <col:6, col:12> 'int' prefix '--'`: &UnaryOperator{ 10 Addr: 0x7fe0260f50d8, 11 Pos: NewPositionFromString("col:6, col:12"), 12 Type: "int", 13 Type2: "", 14 IsLvalue: false, 15 IsPrefix: true, 16 Operator: "--", 17 ChildNodes: []Node{}, 18 }, 19 `0x7fe0260fb468 <col:11, col:18> 'unsigned char' lvalue prefix '*'`: &UnaryOperator{ 20 Addr: 0x7fe0260fb468, 21 Pos: NewPositionFromString("col:11, col:18"), 22 Type: "unsigned char", 23 Type2: "", 24 IsLvalue: true, 25 IsPrefix: true, 26 Operator: "*", 27 ChildNodes: []Node{}, 28 }, 29 `0x7fe0260fb448 <col:12, col:18> 'unsigned char *' postfix '++'`: &UnaryOperator{ 30 Addr: 0x7fe0260fb448, 31 Pos: NewPositionFromString("col:12, col:18"), 32 Type: "unsigned char *", 33 Type2: "", 34 IsLvalue: false, 35 IsPrefix: false, 36 Operator: "++", 37 ChildNodes: []Node{}, 38 }, 39 `0x26fd2b8 <col:20, col:32> 'extCoord':'extCoord' lvalue prefix '*'`: &UnaryOperator{ 40 Addr: 0x26fd2b8, 41 Pos: NewPositionFromString("col:20, col:32"), 42 Type: "extCoord", 43 Type2: "extCoord", 44 IsLvalue: true, 45 IsPrefix: true, 46 Operator: "*", 47 ChildNodes: []Node{}, 48 }, 49 `0x55d0623ed400 <col:34, col:46> 'const UA_DataType *' prefix '&' cannot overflow`: &UnaryOperator{ 50 Addr: 0x55d0623ed400, 51 Pos: NewPositionFromString("col:34, col:46"), 52 Type: "const UA_DataType *", 53 Type2: "", 54 IsLvalue: false, 55 IsPrefix: true, 56 IsCannotOverflow: true, 57 Operator: "&", 58 ChildNodes: []Node{}, 59 }, 60 } 61 62 runNodeTests(t, nodes) 63 }