github.com/sohaha/zlsgo@v1.7.13-0.20240501141223-10dd1a906f76/zarray/map_test.go (about)

     1  //go:build go1.18
     2  // +build go1.18
     3  
     4  package zarray
     5  
     6  import (
     7  	"testing"
     8  
     9  	"github.com/sohaha/zlsgo"
    10  )
    11  
    12  func TestKeys(t *testing.T) {
    13  	tt := zlsgo.NewTest(t)
    14  	tt.Equal(3, len(Keys(map[int]int{1: 1, 2: 2, 3: 3})))
    15  	tt.Equal(3, len(Keys(map[int]interface{}{1: 1, 2: "2", 3: 3})))
    16  }
    17  
    18  func TestValues(t *testing.T) {
    19  	tt := zlsgo.NewTest(t)
    20  	tt.Equal(3, len(Values(map[int]int{1: 1, 2: 2, 3: 3})))
    21  	tt.Equal(3, len(Values(map[int]interface{}{1: 1, 2: "2", 3: 3})))
    22  }