github.com/haraldrudell/parl@v0.4.176/sets/set-element_test.go (about)

     1  /*
     2  © 2022–present Harald Rudell <harald.rudell@gmail.com> (https://haraldrudell.github.io/haraldrudell/)
     3  ISC License
     4  */
     5  
     6  package sets
     7  
     8  import "testing"
     9  
    10  func TestSetElement(t *testing.T) {
    11  	var value, name = 1, "nname"
    12  
    13  	element := SetElement[int]{
    14  		ValueV: value,
    15  		Name:   name,
    16  	}
    17  
    18  	if element.Value() != value {
    19  		t.Errorf("Value %d exp %d", element.Value(), value)
    20  	}
    21  	if element.String() != name {
    22  		t.Errorf("String %q exp %q", element.String(), name)
    23  	}
    24  
    25  	if _, ok := any(&element).(Element[int]); !ok {
    26  		t.Error("is not Element")
    27  	}
    28  }