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

Function testCompressedSetSequence

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

Source from the content-addressed store, hash-verified

238}
239
240func testCompressedSetSequence(t *testing.T) {
241 seq := Sequence{Seed: New()}
242
243 ids := make([]KSUID, 5)
244
245 for i := 0; i < 5; i++ {
246 ids[i], _ = seq.Next()
247 }
248
249 iter := Compress(ids...).Iter()
250
251 index := 0
252 for iter.Next() {
253 if iter.KSUID != ids[index] {
254 t.Errorf("mismatched id at index %d: %s != %s", index, iter.KSUID, ids[index])
255 }
256 index++
257 }
258
259 if index != 5 {
260 t.Errorf("Expected 5 ids, got %d", index)
261 }
262}
263
264func testCompressedSetNil(t *testing.T) {
265 set := CompressedSet(nil)

Callers

nothing calls this directly

Calls 5

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