nswrap/ast/floating_literal_test.go

35 lines
743 B
Go
Raw Normal View History

2019-04-09 11:52:21 -04:00
package ast
import (
"testing"
)
func TestFloatingLiteral(t *testing.T) {
2019-06-04 00:14:04 -04:00
nodes := map[string]testNode{
`0x7febe106f5e8 <col:24> 'double' 1.230000e+00`: testNode{&FloatingLiteral{
2019-04-09 11:52:21 -04:00
Addr: 0x7febe106f5e8,
Pos: NewPositionFromString("col:24"),
Type: "double",
Value: 1.23,
ChildNodes: []Node{},
},
0x7febe106f5e8,
NewPositionFromString("col:24"),
[]Node{},
2019-06-04 00:14:04 -04:00
},
`0x21c65b8 <col:41> 'double' 2.718282e+00`: testNode{&FloatingLiteral{
2019-04-09 11:52:21 -04:00
Addr: 0x21c65b8,
Pos: NewPositionFromString("col:41"),
Type: "double",
Value: 2.718282e+00,
ChildNodes: []Node{},
},
0x21c65b8,
NewPositionFromString("col:41"),
[]Node{},
2019-06-04 00:14:04 -04:00
},
2019-04-09 11:52:21 -04:00
}
runNodeTests(t, nodes)
}