These functions currently require that the new closed interval has a length of
at least 2. They also currently permit empty half-open intervals. This patch
defines nonEmpty in each traits structure and uses it to correct the
implementations of setStart and setStop.
Details
Details
Diff Detail
Diff Detail
- Build Status
Buildable 881 Build 881: arc lint + arc unit
Event Timeline
Comment Actions
Could you add unit tests to unittest/ADT/IntervalMapTest? I want to make sure that:
- We're allowed to create 1-element intervals using setStart/setStop.
- If we create a 0-element interval using setStart/setStop, it just gets deleted.
Comment Actions
The revised assertion will fail in that case. Is deleting the interval actually the desired behavior?
Comment Actions
Looking at it more, it shouldn't be possible to do what I described (creating a 0-element interval using setStart/setStop). I'm walking the request for that test back :).
Comment Actions
LGTM. Could you wait a day or two before committing? I haven't worked on IntervalMap before, so it'd be nice to others a chance to chime in.
unittests/ADT/IntervalMapTest.cpp | ||
---|---|---|
19 | nit: You don't need the extra space, 'IntervalMapHalfOpenInfo<unsigned>>' would be fine. |
Comment Actions
Eliminated unnecessary space in template instantiation.
Revised test for half-open intervals to cover using setStop to create an interval with a length of 1.
nit: You don't need the extra space, 'IntervalMapHalfOpenInfo<unsigned>>' would be fine.