mirror of
https://github.com/cowardmrx/maps.git
synced 2026-09-05 22:04:31 +08:00
🎉 maps
This commit is contained in:
64
maps_test.go
Normal file
64
maps_test.go
Normal file
@@ -0,0 +1,64 @@
|
||||
package maps
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSetMaps(t *testing.T) {
|
||||
maps := NewMaps()
|
||||
a := maps.Set("key1", "123123")
|
||||
fmt.Println(a)
|
||||
}
|
||||
|
||||
func TestExistMaps(t *testing.T) {
|
||||
maps := NewMaps()
|
||||
|
||||
a := maps.Set("key2", "this is value 2")
|
||||
|
||||
fmt.Println(a.Exist("key3"))
|
||||
}
|
||||
|
||||
func TestGetMaps(t *testing.T) {
|
||||
maps := NewMaps()
|
||||
|
||||
a := maps.Set("key1", "value1").Set("key2", "value 2").Set("key3", "value 3")
|
||||
|
||||
fmt.Println(a.Get("key4"))
|
||||
}
|
||||
|
||||
func TestDeleteMaps(t *testing.T) {
|
||||
maps := NewMaps()
|
||||
|
||||
a := maps.Set("key1", "value1").Set("key2", "value 2").Set("key3", "value 3")
|
||||
|
||||
fmt.Println(a.Delete("key1", "key2", "key3", "key4"))
|
||||
}
|
||||
|
||||
func TestKeysValues(t *testing.T) {
|
||||
maps := NewMaps()
|
||||
|
||||
a := maps.Set("key1", "value1").Set("key2", "value 2").Set("key3", "value 3")
|
||||
|
||||
fmt.Println(a.Keys())
|
||||
fmt.Println(a.Values())
|
||||
}
|
||||
|
||||
func TestOriginMap(t *testing.T) {
|
||||
maps := NewMaps()
|
||||
|
||||
a := maps.Set("key1", "value1").Set("key2", "value 2").Set("key3", "value 3")
|
||||
|
||||
fmt.Println(a.OriginMap())
|
||||
}
|
||||
|
||||
func TestSortKey(t *testing.T) {
|
||||
maps := NewMaps()
|
||||
|
||||
a := maps.Set("key3", "value1").Set("key4", "value 2").Set("key1", "value 3")
|
||||
|
||||
a.SortKey(sort.Strings)
|
||||
|
||||
fmt.Println(a)
|
||||
}
|
||||
Reference in New Issue
Block a user