MCPcopy
hub / github.com/grpc/grpc-go / TestAddressMap_Length

Method TestAddressMap_Length

resolver/map_test.go:54–72  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

52)
53
54func (s) TestAddressMap_Length(t *testing.T) {
55 addrMap := NewAddressMapV2[any]()
56 if got := addrMap.Len(); got != 0 {
57 t.Fatalf("addrMap.Len() = %v; want 0", got)
58 }
59 for i := 0; i < 10; i++ {
60 addrMap.Set(addr1, nil)
61 if got, want := addrMap.Len(), 1; got != want {
62 t.Fatalf("addrMap.Len() = %v; want %v", got, want)
63 }
64 addrMap.Set(addr7, nil) // aliases addr1
65 }
66 for i := 0; i < 10; i++ {
67 addrMap.Set(addr2, nil)
68 if got, want := addrMap.Len(), 2; got != want {
69 t.Fatalf("addrMap.Len() = %v; want %v", got, want)
70 }
71 }
72}
73
74func (s) TestAddressMap_Get(t *testing.T) {
75 addrMap := NewAddressMapV2[int]()

Callers

nothing calls this directly

Calls 3

LenMethod · 0.65
FatalfMethod · 0.65
SetMethod · 0.65

Tested by

no test coverage detected