You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
527 B
27 lines
527 B
package tests
|
|
|
|
import (
|
|
"testing"
|
|
"github.com/stretchr/testify/assert"
|
|
"MY/dsa/hashmap"
|
|
)
|
|
|
|
func TestHashmap(t *testing.T) {
|
|
hmap := hashmap.New()
|
|
|
|
hmap.Add("zed", 100)
|
|
hmap.Add("joe", "That Thing")
|
|
hmap.Add("mary", 300.10)
|
|
|
|
val := hmap.Get("zed")
|
|
assert.Equal(t, val, 100, "bad zed")
|
|
|
|
val2 := hmap.Get("joe")
|
|
assert.Equal(t, val2, "That Thing", "bad joe")
|
|
|
|
val3 := hmap.Get("mary")
|
|
assert.Equal(t, val3, 300.10, "bad mary")
|
|
|
|
val4 := hmap.Get("nothere")
|
|
assert.Equal(t, val4, nil, "bad missing")
|
|
}
|
|
|