| 212 | } |
| 213 | |
| 214 | func testCompressedSetSingle(t *testing.T) { |
| 215 | id := New() |
| 216 | |
| 217 | set := Compress( |
| 218 | id, id, id, id, id, id, id, id, id, id, |
| 219 | id, id, id, id, id, id, id, id, id, id, |
| 220 | id, id, id, id, id, id, id, id, id, id, |
| 221 | id, id, id, id, id, id, id, id, id, id, |
| 222 | ) |
| 223 | |
| 224 | n := 0 |
| 225 | |
| 226 | for it := set.Iter(); it.Next(); { |
| 227 | if n != 0 { |
| 228 | t.Errorf("too many ids found in the compressed set: %s", it.KSUID) |
| 229 | } else if id != it.KSUID { |
| 230 | t.Errorf("invalid id found in the compressed set: %s != %s", it.KSUID, id) |
| 231 | } |
| 232 | n++ |
| 233 | } |
| 234 | |
| 235 | if n == 0 { |
| 236 | t.Error("no ids were produced by the compressed set") |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | func testCompressedSetSequence(t *testing.T) { |
| 241 | seq := Sequence{Seed: New()} |