Skip to content

Commit

Permalink
#2096: tests: fix duplicate elm indices
Browse files Browse the repository at this point in the history
  • Loading branch information
nlslatt authored and cz4rs committed Mar 30, 2023
1 parent 1aad763 commit e4180dc
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions tests/unit/collection/test_list_insert.cc
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,13 @@ TEST_F(TestListInsert, test_bounded_list_insert_here_3) {
num_work = 0;

auto const num_nodes = theContext()->getNumNodes();

auto const this_node = theContext()->getNode();
auto const range = Index1D(num_nodes * num_elms_per_node);

std::vector<std::tuple<vt::Index1D, std::unique_ptr<ListInsertTest>>> elms;

for (int i = 0; i < range.x(); i++) {
if (i % num_nodes == 0) {
if (i % num_nodes == this_node) {
Index1D ix{i};
elms.emplace_back(
std::make_tuple(ix, std::make_unique<ListInsertTest>())
Expand Down Expand Up @@ -282,11 +282,12 @@ TEST_F(TestListInsert, test_bounded_list_insert_here_no_default_constructor) {
num_work = 0;

auto const num_nodes = theContext()->getNumNodes();
auto const this_node = theContext()->getNode();
auto const range = Index1D(num_nodes * num_elms_per_node);

std::vector<std::tuple<vt::Index1D, std::unique_ptr<NonDefaultConstructibleStruct>>> elms;
for (int i = 0; i < range.x(); i++) {
if (i % num_nodes == 0) {
if (i % num_nodes == this_node) {
Index1D ix{i};
elms.emplace_back(
std::make_tuple(ix, std::make_unique<NonDefaultConstructibleStruct>(0))
Expand Down Expand Up @@ -314,13 +315,13 @@ TEST_F(TestListInsert, test_unbounded_list_insert_here_4) {
num_work = 0;

auto const num_nodes = theContext()->getNumNodes();

auto const this_node = theContext()->getNode();
auto const range = Index1D(num_nodes * num_elms_per_node);

std::vector<std::tuple<vt::Index1D, std::unique_ptr<ListInsertTest>>> elms;

for (int i = 0; i < range.x(); i++) {
if (i % num_nodes == 0) {
if (i % num_nodes == this_node) {
Index1D ix{i};
elms.emplace_back(
std::make_tuple(ix, std::make_unique<ListInsertTest>())
Expand Down Expand Up @@ -348,11 +349,12 @@ TEST_F(TestListInsert, test_unbounded_list_insert_here_no_default_constructor) {
num_work = 0;

auto const num_nodes = theContext()->getNumNodes();
auto const this_node = theContext()->getNode();
auto const range = Index1D(num_nodes * num_elms_per_node);

std::vector<std::tuple<vt::Index1D, std::unique_ptr<NonDefaultConstructibleStruct>>> elms;
for (int i = 0; i < range.x(); i++) {
if (i % num_nodes == 0) {
if (i % num_nodes == this_node) {
Index1D ix{i};
elms.emplace_back(
std::make_tuple(ix, std::make_unique<NonDefaultConstructibleStruct>(0))
Expand Down Expand Up @@ -404,6 +406,7 @@ TEST_F(TestListInsert, test_bounded_mix_list_insert_no_default_constructor) {
num_work = 0;

auto const num_nodes = theContext()->getNumNodes();
auto const this_node = theContext()->getNode();
auto const range = Index1D(num_nodes * num_elms_per_node);

std::vector<Index1D> list_insert;
Expand All @@ -413,7 +416,7 @@ TEST_F(TestListInsert, test_bounded_mix_list_insert_no_default_constructor) {

std::vector<std::tuple<vt::Index1D, std::unique_ptr<NonDefaultConstructibleStruct>>> elms;
for (int i = range.x() / 2; i < range.x(); i++) {
if (i % num_nodes == 0) {
if (i % num_nodes == this_node) {
Index1D ix{i};
elms.emplace_back(
std::make_tuple(ix, std::make_unique<NonDefaultConstructibleStruct>(0))
Expand Down

0 comments on commit e4180dc

Please sign in to comment.