nswrap/ast/alloc_size_attr_test.go

48 lines
1.2 KiB
Go
Raw Normal View History

2019-04-09 11:52:21 -04:00
package ast
import (
"testing"
)
func TestAllocSizeAttr(t *testing.T) {
2019-06-04 00:14:04 -04:00
nodes := map[string]testNode{
`0x7f8e390a5d38 <col:100, col:114> 1 2`: testNode{&AllocSizeAttr{
2019-04-09 11:52:21 -04:00
Addr: 0x7f8e390a5d38,
Pos: NewPositionFromString("col:100, col:114"),
2019-06-04 00:14:04 -04:00
A: "1",
B: "2",
2019-04-09 11:52:21 -04:00
ChildNodes: []Node{},
},
0x7f8e390a5d38,
NewPositionFromString("col:100, col:114"),
[]Node{},
2019-06-04 00:14:04 -04:00
},
`0x7fbd1a167f48 </usr/include/stdlib.h:342:37> Inherited 1 0`: testNode{&AllocSizeAttr{
2019-06-04 00:14:04 -04:00
Addr: 0x7fbd1a167f48,
Pos: NewPositionFromString("/usr/include/stdlib.h:342:37"),
Inherited: true,
A: "1",
B: "0",
ChildNodes: []Node{},
},
0x7fbd1a167f48,
NewPositionFromString("/usr/include/stdlib.h:342:37"),
[]Node{},
2019-06-04 00:14:04 -04:00
},
`0x7fbd1a167f48 </usr/include/stdlib.h:342:37> Inherited 1`: testNode{&AllocSizeAttr{
2019-04-09 11:52:21 -04:00
Addr: 0x7fbd1a167f48,
Pos: NewPositionFromString("/usr/include/stdlib.h:342:37"),
Inherited: true,
2019-06-04 00:14:04 -04:00
A: "1",
B: "",
2019-04-09 11:52:21 -04:00
ChildNodes: []Node{},
},
0x7fbd1a167f48,
NewPositionFromString("/usr/include/stdlib.h:342:37"),
[]Node{},
2019-06-04 00:14:04 -04:00
},
2019-04-09 11:52:21 -04:00
}
runNodeTests(t, nodes)
}