| 1377 | } |
| 1378 | |
| 1379 | func (m *TMap) validateIterator(itr *MapIterator[int, int]) error { |
| 1380 | other := make(map[int]int) |
| 1381 | for !itr.Done() { |
| 1382 | k, v, _ := itr.Next() |
| 1383 | other[k] = v |
| 1384 | } |
| 1385 | if len(other) != len(m.std) { |
| 1386 | return fmt.Errorf("map iterator size mismatch: %v!=%v", len(m.std), len(other)) |
| 1387 | } |
| 1388 | for k, v := range m.std { |
| 1389 | if v != other[k] { |
| 1390 | return fmt.Errorf("map iterator mismatch: key=%v, %v!=%v", k, v, other[k]) |
| 1391 | } |
| 1392 | } |
| 1393 | if k, v, ok := itr.Next(); ok { |
| 1394 | return fmt.Errorf("map iterator returned key/value after done: <%v/%v>", k, v) |
| 1395 | } |
| 1396 | return nil |
| 1397 | } |
| 1398 | |
| 1399 | func BenchmarkBuiltinMap_Set(b *testing.B) { |
| 1400 | b.ReportAllocs() |