Commit 9b3d1b48 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 0826205c
......@@ -210,7 +210,7 @@ func (S *RangeSet) DelRange(r Range) {
Range{S.rangev[ilo].lo, r.lo-1}},
S.rangev[ilo+1:]...)...)
ilo++
debugfRSet("\tshrink left\t-> %s\n", S)
debugfRSet("\tshrink [%d] left\t-> %s\n", ilo, S)
}
if r.hi_ < S.rangev[jhi-1].hi_ { // shrink right
S.rangev = append(
......@@ -218,7 +218,7 @@ func (S *RangeSet) DelRange(r Range) {
Range{r.hi_+1, S.rangev[jhi-1].hi_}},
S.rangev[jhi:]...)...)
jhi--
debugfRSet("\tshrink right\t-> %s\n", S)
debugfRSet("\tshrink [%d] right\t-> %s\n", jhi-1, S)
}
if (jhi - ilo) > 0 {
......
......@@ -106,6 +106,14 @@ func TestRangeSet(t *testing.T) {
S(3,5), // B
S(1,7), // U
S(1,3, 5,7)), // D
// delete covering several ranges
// [-1,0) [1,3) [5,7) [9,11) [15,20) [100,200) \ [2,17)
E(
S(-1,0, 1,3, 5,7, 9,11, 15,20, 100,200), // A
S(2,17), // B
S(-1,0, 1,20, 100,200), // U
S(-1,0, 1,2, 17,20, 100,200)), // D
}
for _, tt := range testv {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment