Update intervals tests for better code coverage

This commit is contained in:
baldurk
2021-02-18 12:11:02 +00:00
parent 2409132989
commit bafdb16b4b
+3 -5
View File
@@ -61,8 +61,7 @@ Intervals<uint64_t> make_intervals(const rdcarray<Interval> &intervals)
{
auto j = res.end();
j--;
if(i->start > j->start())
j->split(i->start);
RDCASSERTMSG("make_intervals parameters must fully specify intervals", i->start == j->start());
if(i->end < j->finish())
{
j->split(i->end);
@@ -284,15 +283,14 @@ TEST_CASE("Test Intervals type", "[intervals]")
SECTION("update an empty interval at 0")
{
Intervals<uint64_t> test = make_intervals({{0, 0, 5}, {5, 1, 10}, {10, 0, UINT64_MAX}});
test.update(0, 0, 1, [](uint64_t x, uint64_t y) -> uint64_t { return x + y; });
test.update(0, 0, 1, [](uint64_t x, uint64_t y) -> uint64_t { return 99; });
check_intervals(test, {{0, 0, 5}, {5, 1, 10}, {10, 0, UINT64_MAX}});
};
SECTION("update an empty interval at UINT64_MAX")
{
Intervals<uint64_t> test = make_intervals({{0, 0, 5}, {5, 1, 10}, {10, 0, UINT64_MAX}});
test.update(UINT64_MAX, UINT64_MAX, 1,
[](uint64_t x, uint64_t y) -> uint64_t { return x + y; });
test.update(UINT64_MAX, UINT64_MAX, 1, [](uint64_t x, uint64_t y) -> uint64_t { return 99; });
check_intervals(test, {{0, 0, 5}, {5, 1, 10}, {10, 0, UINT64_MAX}});
};
};