MCPcopy
hub / github.com/segmentio/ksuid / testCompressedSetConcat

Function testCompressedSetConcat

set_test.go:272–289  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

270}
271
272func testCompressedSetConcat(t *testing.T) {
273 ksuids := [100]KSUID{}
274
275 for i := range ksuids {
276 ksuids[i] = New()
277 }
278
279 set := CompressedSet(nil)
280 set = AppendCompressed(set, ksuids[:42]...)
281 set = AppendCompressed(set, ksuids[42:64]...)
282 set = AppendCompressed(set, ksuids[64:]...)
283
284 for i, it := 0, set.Iter(); it.Next(); i++ {
285 if ksuids[i] != it.KSUID {
286 t.Errorf("invalid ID at index %d: %s != %s", i, ksuids[i], it.KSUID)
287 }
288 }
289}
290
291func reportCompressionRatio(t *testing.T, ksuids []KSUID, set CompressedSet) {
292 len1 := byteLength * len(ksuids)

Callers

nothing calls this directly

Calls 5

NewFunction · 0.85
CompressedSetTypeAlias · 0.85
AppendCompressedFunction · 0.85
IterMethod · 0.80
NextMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…