21 lines
389 B
Go
21 lines
389 B
Go
package pmap
|
|
|
|
import "testing"
|
|
|
|
func TestPmap(t *testing.T) {
|
|
p := New()
|
|
const numElems = 5
|
|
for i := range make([]int, numElems) {
|
|
p = p.Set(i, i)
|
|
}
|
|
if p.Len() != numElems {
|
|
t.Fatalf("Len() = %v, want %v", p.Len(), numElems)
|
|
}
|
|
for i := range make([]int, numElems) {
|
|
v, ok := p.Get(i)
|
|
if v != i || !ok {
|
|
t.Errorf("Get(%d) = %v %v, want %v %v", i, v, ok, i, true)
|
|
}
|
|
}
|
|
}
|