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

Function testCompressedSetPacked

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

Source from the content-addressed store, hash-verified

111}
112
113func testCompressedSetPacked(t *testing.T) {
114 sequences := [10]Sequence{}
115 for i := range sequences {
116 sequences[i] = Sequence{Seed: New()}
117 }
118
119 ksuids := [1000]KSUID{}
120 for i := range ksuids {
121 ksuids[i], _ = sequences[i%len(sequences)].Next()
122 }
123
124 set := Compress(ksuids[:]...)
125
126 for i, it := 0, set.Iter(); it.Next(); {
127 if i >= len(ksuids) {
128 t.Error("too many KSUIDs were produced by the set iterator")
129 break
130 }
131 if ksuids[i] != it.KSUID {
132 t.Errorf("bad KSUID at index %d: expected %s but found %s", i, ksuids[i], it.KSUID)
133 }
134 i++
135 }
136
137 reportCompressionRatio(t, ksuids[:], set)
138}
139
140func testCompressedSetMixed(t *testing.T) {
141 now := time.Now()

Callers

nothing calls this directly

Calls 5

NewFunction · 0.85
CompressFunction · 0.85
reportCompressionRatioFunction · 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…