github.com/Konstantin8105/c4go@v0.0.0-20240505174241-768bb1c65a51/ast/floating_literal_test.go (about)

     1  package ast
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/Konstantin8105/c4go/preprocessor"
     7  )
     8  
     9  func TestFloatingLiteral(t *testing.T) {
    10  	nodes := map[string]Node{
    11  		`0x7febe106f5e8 <col:24> 'double' 1.230000e+00`: &FloatingLiteral{
    12  			Addr:       0x7febe106f5e8,
    13  			Pos:        NewPositionFromString("col:24"),
    14  			Type:       "double",
    15  			Value:      1.23,
    16  			ChildNodes: []Node{},
    17  		},
    18  		`0x21c65b8 <col:41> 'double' 2.718282e+00`: &FloatingLiteral{
    19  			Addr:       0x21c65b8,
    20  			Pos:        NewPositionFromString("col:41"),
    21  			Type:       "double",
    22  			Value:      2.718282e+00,
    23  			ChildNodes: []Node{},
    24  		},
    25  	}
    26  
    27  	runNodeTests(t, nodes)
    28  }
    29  
    30  func TestFloatingLiteralRepairFL(t *testing.T) {
    31  	var fl FloatingLiteral
    32  	var file preprocessor.FilePP
    33  	errs := RepairFloatingLiteralsFromSource(&fl, file)
    34  	if len(errs) == 0 {
    35  		t.Errorf("Error is empty")
    36  	}
    37  }