github.com/Asutorufa/yuhaiin@v0.3.6-0.20240502055049-7984da7023a0/pkg/utils/syncmap/syncmap_test.go (about) 1 package syncmap 2 3 import ( 4 "testing" 5 6 "github.com/Asutorufa/yuhaiin/pkg/utils/assert" 7 ) 8 9 func TestSyncMap(t *testing.T) { 10 var syncMap SyncMap[int, int] 11 syncMap.Store(1, 1) 12 syncMap.Store(2, 2) 13 v, _ := syncMap.Load(1) 14 assert.Equal(t, v, 1) 15 v, _ = syncMap.Load(2) 16 assert.Equal(t, v, 2) 17 }