2019-04-09 11:52:21 -04:00
|
|
|
package ast
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestImplicitCastExpr(t *testing.T) {
|
2019-06-04 00:14:04 -04:00
|
|
|
nodes := map[string]testNode{
|
2019-06-11 12:38:22 -04:00
|
|
|
`0x7f9f5b0a1288 <col:8> 'FILE *' <LValueToRValue>`: testNode{&ImplicitCastExpr{
|
2019-04-09 11:52:21 -04:00
|
|
|
Addr: 0x7f9f5b0a1288,
|
|
|
|
Pos: NewPositionFromString("col:8"),
|
|
|
|
Type: "FILE *",
|
|
|
|
Kind: "LValueToRValue",
|
|
|
|
ChildNodes: []Node{},
|
|
|
|
},
|
2019-06-11 12:38:22 -04:00
|
|
|
0x7f9f5b0a1288,
|
|
|
|
NewPositionFromString("col:8"),
|
|
|
|
[]Node{},
|
2019-06-04 00:14:04 -04:00
|
|
|
},
|
2019-06-11 12:38:22 -04:00
|
|
|
`0x7f9f5b0a7828 <col:11> 'int (*)(int, FILE *)' <FunctionToPointerDecay>`: testNode{&ImplicitCastExpr{
|
2019-04-09 11:52:21 -04:00
|
|
|
Addr: 0x7f9f5b0a7828,
|
|
|
|
Pos: NewPositionFromString("col:11"),
|
|
|
|
Type: "int (*)(int, FILE *)",
|
|
|
|
Kind: "FunctionToPointerDecay",
|
|
|
|
ChildNodes: []Node{},
|
|
|
|
},
|
2019-06-11 12:38:22 -04:00
|
|
|
0x7f9f5b0a7828,
|
|
|
|
NewPositionFromString("col:11"),
|
|
|
|
[]Node{},
|
2019-06-04 00:14:04 -04:00
|
|
|
},
|
2019-06-11 12:38:22 -04:00
|
|
|
`0x21267c8 <col:8> 'enum week1':'enum week2' <IntegralCast>`: testNode{&ImplicitCastExpr{
|
2019-04-09 11:52:21 -04:00
|
|
|
Addr: 0x21267c8,
|
|
|
|
Pos: NewPositionFromString("col:8"),
|
|
|
|
Type: "enum week1",
|
|
|
|
Type2: "enum week2",
|
|
|
|
Kind: "IntegralCast",
|
|
|
|
ChildNodes: []Node{},
|
|
|
|
},
|
2019-06-11 12:38:22 -04:00
|
|
|
0x21267c8,
|
|
|
|
NewPositionFromString("col:8"),
|
|
|
|
[]Node{},
|
2019-06-04 00:14:04 -04:00
|
|
|
},
|
2019-06-11 12:38:22 -04:00
|
|
|
`0x26fd2d8 <col:20, col:32> 'extCoord':'extCoord' <LValueToRValue>`: testNode{&ImplicitCastExpr{
|
2019-04-09 11:52:21 -04:00
|
|
|
Addr: 0x26fd2d8,
|
|
|
|
Pos: NewPositionFromString("col:20, col:32"),
|
|
|
|
Type: "extCoord",
|
|
|
|
Type2: "extCoord",
|
|
|
|
Kind: "LValueToRValue",
|
|
|
|
ChildNodes: []Node{},
|
|
|
|
},
|
2019-06-11 12:38:22 -04:00
|
|
|
0x26fd2d8,
|
|
|
|
NewPositionFromString("col:20, col:32"),
|
|
|
|
[]Node{},
|
2019-06-04 00:14:04 -04:00
|
|
|
},
|
2019-04-09 11:52:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
runNodeTests(t, nodes)
|
|
|
|
}
|