github.com/isyscore/isc-gobase@v1.5.3-0.20231218061332-cbc7451899e9/isc/test/set_test.go (about)

     1  package test
     2  
     3  import (
     4  	"github.com/isyscore/isc-gobase/isc"
     5  	"testing"
     6  )
     7  
     8  func TestSet(t *testing.T) {
     9  	l := isc.NewListWithItems(1, 2, 3, 4, 1, 2, 3, 4, 5, 6)
    10  	t.Logf("%v", l)
    11  	ls := isc.ListToSet(l)
    12  	t.Logf("%v", ls)
    13  
    14  	s := isc.NewSetWithItems(1, 2, 3, 4, 1, 2, 3, 4, 5, 6)
    15  	t.Logf("%v", s)
    16  
    17  	_ = s.Add(7)
    18  	s.AddAll(8, 9)
    19  	t.Logf("%v", s)
    20  	_ = s.Delete(5)
    21  	t.Logf("%v", s)
    22  	s.Clear()
    23  	t.Logf("%v", s)
    24  }