From 0a7718231e7b3cbb3f92550cc533eb2b4d7fe127 Mon Sep 17 00:00:00 2001 From: Arkadiusz Szczepkowicz Date: Mon, 7 Nov 2022 14:14:47 +0100 Subject: [PATCH] #2001: Add mixed list insert test --- tests/unit/collection/test_list_insert.cc | 40 +++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/unit/collection/test_list_insert.cc b/tests/unit/collection/test_list_insert.cc index 6ffed1d6ad..47d78cdef5 100644 --- a/tests/unit/collection/test_list_insert.cc +++ b/tests/unit/collection/test_list_insert.cc @@ -399,4 +399,44 @@ TEST_F(TestListInsert, test_bounded_bulk_insert_no_default_constructor) { EXPECT_EQ(num_work, num_elms_per_node * num_nodes); } +TEST_F(TestListInsert, test_bounded_mix_list_insert_no_default_constructor) { + num_inserted = 0; + num_work = 0; + + auto const num_nodes = theContext()->getNumNodes(); + auto const range = Index1D(num_nodes * num_elms_per_node); + + std::vector list_insert; + for (int i = 0; i < range.x() / 2; i++) { + list_insert.emplace_back(Index1D{i}); + } + + std::vector>> elms; + for (int i = range.x() / 2; i < range.x(); i++) { + if (i % num_nodes == 0) { + Index1D ix{i}; + elms.emplace_back( + std::make_tuple(ix, std::make_unique(0)) + ); + } + } + + auto proxy = vt::makeCollection("test_bounded_mix_list_insert_no_default_constructor") + .collective(true) + .bounds(range) + .listInsert(list_insert) + .listInsertHere(std::move(elms)) + .elementConstructor(NonDefaultConstructibleStruct::getConstructor()) + .template mapperObjGroupConstruct>() + .wait(); + + EXPECT_EQ(num_inserted, num_elms_per_node); + num_inserted = 0; + + runInEpochCollective([&]{ + proxy.broadcast(); + }); + EXPECT_EQ(num_work, num_elms_per_node * num_nodes); +} + }}}} // end namespace vt::tests::unit::list_insert