MCPcopy Create free account
hub / github.com/cantabular/faststringmap / randomSmallStrings

Function randomSmallStrings

uint32_store_test.go:86–95  ·  view source on GitHub ↗
(nStrs int, maxLen uint8)

Source from the content-addressed store, hash-verified

84func (m mapSlice) Get(s string) uint32 { return m.m[s] }
85
86func randomSmallStrings(nStrs int, maxLen uint8) map[string]uint32 {
87 m := map[string]uint32{"": 0}
88 for len(m) < nStrs {
89 s := randomSmallString(maxLen)
90 if _, ok := m[s]; !ok {
91 m[s] = uint32(len(m))
92 }
93 }
94 return m
95}
96
97func randomSmallString(maxLen uint8) string {
98 var sb strings.Builder

Callers 1

TestFastStringToUint32Function · 0.85

Calls 1

randomSmallStringFunction · 0.85

Tested by

no test coverage detected