MCPcopy
hub / github.com/tinylib/msgp / TestString_AsSlice

Function TestString_AsSlice

msgp/setof/generated_test.go:70–93  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

68}
69
70func TestString_AsSlice(t *testing.T) {
71 set := make(String)
72 set["val0"] = struct{}{}
73 set["val1"] = struct{}{}
74 set["val2"] = struct{}{}
75 set["val3"] = struct{}{}
76 set["val4"] = struct{}{}
77
78 slice := set.AsSlice()
79 if len(slice) != len(set) {
80 t.Fatalf("length mismatch: expected %d, got %d", len(set), len(slice))
81 }
82
83 found := make(map[string]bool)
84 for _, v := range slice {
85 found[v] = true
86 }
87
88 for k := range set {
89 if !found[k] {
90 t.Fatalf("missing key in slice: %v", k)
91 }
92 }
93}
94
95func TestString_FromSlice(t *testing.T) {
96 slice := []string{"val0", "val1", "val2", "val3", "val4"}

Callers

nothing calls this directly

Calls 1

AsSliceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…