func TestDistinct(t *testing.T) { var pb PriorityBitmap pb.Set(0, 0) pb.Set(1, 1) assert.EqualValues(t, []interface{}{0, 1}, itertools.IterableAsSlice(&pb)) pb.Set(0, -1) assert.EqualValues(t, []interface{}{0, 1}, itertools.IterableAsSlice(&pb)) pb.Set(1, -2) assert.EqualValues(t, []interface{}{1, 0}, itertools.IterableAsSlice(&pb)) }
func TestIntBounds(t *testing.T) { var pb PriorityBitmap pb.Set(math.MaxInt32, math.MinInt32) pb.Set(math.MinInt32, math.MaxInt32) assert.EqualValues(t, []interface{}{math.MaxInt32, math.MinInt32}, itertools.IterableAsSlice(&pb)) }
func bitmapSlice(bm *Bitmap) (ret []int) { sl := itertools.IterableAsSlice(bm) missinggo.CastSlice(&ret, sl) return }