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

     1  package ast
     2  
     3  import (
     4  	"reflect"
     5  	"testing"
     6  
     7  	"github.com/Konstantin8105/c4go/util"
     8  )
     9  
    10  func TestArrayFiller(t *testing.T) {
    11  	expected := &ArrayFiller{
    12  		ChildNodes: []Node{},
    13  	}
    14  	actual, err := Parse(`array filler`)
    15  
    16  	if !reflect.DeepEqual(expected, actual) {
    17  		t.Errorf("%s", util.ShowDiff(formatMultiLine(expected),
    18  			formatMultiLine(actual)))
    19  	}
    20  	if err != nil {
    21  		t.Errorf("Error parsing")
    22  	}
    23  
    24  	if uint64(actual.Address()) != 0 {
    25  		t.Fatal("Address is not zero")
    26  	}
    27  	var v ArrayFiller
    28  	actual.AddChild(&v)
    29  	if len(actual.Children()) == 0 {
    30  		t.Fatal("Childrens is not correct")
    31  	}
    32  
    33  	_ = actual.Position()
    34  }