Fix edge-case in identify 'end' upper-bound
All checks were successful
ci/woodpecker/push/check Pipeline was successful
All checks were successful
ci/woodpecker/push/check Pipeline was successful
Just my luck, this was found immediately in the CI, right when I uploaded the project thinking I was done. Thankfully the fix is easy and (in hindsight) quite obvious.
This commit is contained in:
parent
8ea4fd373b
commit
2317285d0f
|
@ -35,7 +35,7 @@ public:
|
|||
if (insert_begin)
|
||||
it = underlying_.insert(it, {begin, val});
|
||||
// Get the proper upper-bound for `end`
|
||||
it = (it == underlying_.end()) ? it : std::next(it);
|
||||
it = (it == underlying_.end() || end < it->first) ? it : std::next(it);
|
||||
if (!(at_upper_bound(it) == end_val))
|
||||
underlying_.insert(it, {end, end_val});
|
||||
}
|
||||
|
|
|
@ -242,6 +242,12 @@ TEST_F(IntervalMapTest, fuzzing_003) {
|
|||
assign(-110, -10, 4);
|
||||
}
|
||||
|
||||
TEST_F(IntervalMapTest, fuzzing_004) {
|
||||
assign(-20, 120, 1);
|
||||
assign(50, 110, 0);
|
||||
assign(-120, 100, 0);
|
||||
}
|
||||
|
||||
TEST_F(IntervalMapTest, randomized_test) {
|
||||
auto const seed = []() {
|
||||
std::random_device r;
|
||||
|
|
Loading…
Reference in a new issue