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

     1  package test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/isyscore/isc-gobase/isc"
     7  )
     8  
     9  func TestOperator(t *testing.T) {
    10  	list := isc.NewListWithItems(1, 2, 3, 4, 5, 6, 7)
    11  	l2 := isc.ListPlus(list, []int{7, 8, 9, 10})
    12  	t.Logf("%v\n", l2)
    13  
    14  	l3 := isc.ListMinus(list, []int{1, 3, 7, 8, 9})
    15  	t.Logf("%v\n", l3)
    16  
    17  	m1 := isc.NewMap[int, string]()
    18  	m1[1] = "a"
    19  	m1[2] = "b"
    20  	m1[3] = "c"
    21  
    22  	mt := isc.NewMap[int, string]()
    23  	mt[1] = "a"
    24  	mt[2] = "b"
    25  	mt[4] = "d"
    26  	mt[5] = "e"
    27  
    28  	m2 := isc.MapPlus(m1, mt)
    29  	t.Logf("%v\n", m2)
    30  	m3 := isc.MapMinus(m1, mt)
    31  	t.Logf("%v\n", m3)
    32  
    33  }