| 238 | } |
| 239 | |
| 240 | func 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 | |
| 264 | func testCompressedSetNil(t *testing.T) { |
| 265 | set := CompressedSet(nil) |