mirror of
https://github.com/duke-git/lancet.git
synced 2025-10-05 07:26:51 +08:00
test: add unit test for HashMap
This commit is contained in:
20
datastructure/hashmap/hashmap_test.go
Normal file
20
datastructure/hashmap/hashmap_test.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package datastructure
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/duke-git/lancet/v2/internal"
|
||||
)
|
||||
|
||||
func TestHashMap_PutAndGet(t *testing.T) {
|
||||
assert := internal.NewAssert(t, "TestHashMap_Get")
|
||||
|
||||
hm := NewHashMap()
|
||||
|
||||
hm.Put("abc", 3)
|
||||
assert.Equal(3, hm.Get("abc"))
|
||||
assert.IsNil(hm.Get("abcd"))
|
||||
|
||||
hm.Put("abc", 4)
|
||||
assert.Equal(4, hm.Get("abc"))
|
||||
}
|
Reference in New Issue
Block a user