pmap/pmap_test.go

21 lines
391 B
Go
Raw Normal View History

2022-01-22 09:49:46 +00:00
package pmap
import "testing"
func TestPmap(t *testing.T) {
p := New()
2022-01-22 21:04:29 +00:00
const numElems = 100
2022-01-22 09:49:46 +00:00
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)
}
}
}