Skip to content

Commit fd56b5f

Browse files
committed
Add unit test to test iteration over empty sharing map
1 parent 6be330e commit fd56b5f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

unit/util/sharing_map.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,9 @@ TEST_CASE("Sharing map views and iteration", "[core][util]")
378378
SECTION("Iterate")
379379
{
380380
sharing_map_standardt sm;
381+
382+
sm.iterate([](const irep_idt &key, const std::string &value) {});
383+
381384
fill(sm);
382385

383386
typedef std::pair<std::string, std::string> pt;
@@ -394,6 +397,23 @@ TEST_CASE("Sharing map views and iteration", "[core][util]")
394397
REQUIRE((pairs[2] == pt("k", "2")));
395398
}
396399

400+
SECTION("Delta view (one empty)")
401+
{
402+
sharing_map_standardt sm1;
403+
fill(sm1);
404+
405+
sharing_map_standardt sm2;
406+
407+
sharing_map_standardt::delta_viewt delta_view;
408+
409+
sm1.get_delta_view(sm2, delta_view, false);
410+
REQUIRE(delta_view.size() == 3);
411+
412+
delta_view.clear();
413+
sm2.get_delta_view(sm1, delta_view, false);
414+
REQUIRE(delta_view.empty());
415+
}
416+
397417
SECTION("Delta view (no sharing, same keys)")
398418
{
399419
sharing_map_standardt sm1;

0 commit comments

Comments
 (0)