| 132 | } |
| 133 | |
| 134 | func (s) TestAddressMap_Keys(t *testing.T) { |
| 135 | addrMap := NewAddressMapV2[int]() |
| 136 | addrMap.Set(addr1, 1) |
| 137 | addrMap.Set(addr2, 2) |
| 138 | addrMap.Set(addr3, 3) |
| 139 | addrMap.Set(addr4, 4) |
| 140 | addrMap.Set(addr5, 5) |
| 141 | addrMap.Set(addr6, 6) |
| 142 | addrMap.Set(addr7, 7) // aliases addr1 |
| 143 | |
| 144 | want := []Address{addr1, addr2, addr3, addr4, addr5, addr6} |
| 145 | got := addrMap.Keys() |
| 146 | if d := cmp.Diff(want, got, cmp.Transformer("sort", func(in []Address) []Address { |
| 147 | out := append([]Address(nil), in...) |
| 148 | sort.Slice(out, func(i, j int) bool { return fmt.Sprint(out[i]) < fmt.Sprint(out[j]) }) |
| 149 | return out |
| 150 | })); d != "" { |
| 151 | t.Fatalf("addrMap.Keys returned unexpected elements (-want, +got):\n%v", d) |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | func (s) TestAddressMap_Values(t *testing.T) { |
| 156 | addrMap := NewAddressMapV2[int]() |