(t *testing.T)
| 82 | } |
| 83 | |
| 84 | func testCompressedSetSparse(t *testing.T) { |
| 85 | now := time.Now() |
| 86 | |
| 87 | times := [100]time.Time{} |
| 88 | for i := range times { |
| 89 | times[i] = now.Add(time.Duration(i) * 2 * time.Second) |
| 90 | } |
| 91 | |
| 92 | ksuids := [1000]KSUID{} |
| 93 | for i := range ksuids { |
| 94 | ksuids[i], _ = NewRandomWithTime(times[i%len(times)]) |
| 95 | } |
| 96 | |
| 97 | set := Compress(ksuids[:]...) |
| 98 | |
| 99 | for i, it := 0, set.Iter(); it.Next(); { |
| 100 | if i >= len(ksuids) { |
| 101 | t.Error("too many KSUIDs were produced by the set iterator") |
| 102 | break |
| 103 | } |
| 104 | if ksuids[i] != it.KSUID { |
| 105 | t.Errorf("bad KSUID at index %d: expected %s but found %s", i, ksuids[i], it.KSUID) |
| 106 | } |
| 107 | i++ |
| 108 | } |
| 109 | |
| 110 | reportCompressionRatio(t, ksuids[:], set) |
| 111 | } |
| 112 | |
| 113 | func testCompressedSetPacked(t *testing.T) { |
| 114 | sequences := [10]Sequence{} |
nothing calls this directly
no test coverage detected
searching dependent graphs…