Skip to content

Commit

Permalink
#2174: tests: fix some compilation errors with pedantic
Browse files Browse the repository at this point in the history
  • Loading branch information
lifflander committed Aug 9, 2023
1 parent 4eea336 commit f82e0cb
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion tests/unit/active/test_active_send_large.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ template <typename T>
void checkMsg(T msg) {
auto arr = reinterpret_cast<int64_t*>(&msg->payload[0]);
for (std::size_t i = 0; i < msg->bytes / sizeof(int64_t); i++) {
EXPECT_EQ(arr[i], i);
EXPECT_EQ(arr[i], static_cast<int64_t>(i));
}
}

Expand Down
6 changes: 3 additions & 3 deletions tests/unit/collection/test_checkpoint.extended.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ TEST_F(TestCheckpoint, test_checkpoint_1) {
});

// Ensure that all elements were properly destroyed
EXPECT_EQ(counter, 0);
EXPECT_EQ(counter, 0ull);
}
}

Expand Down Expand Up @@ -315,7 +315,7 @@ TEST_F(TestCheckpoint, test_checkpoint_in_place_2) {
});

// Ensure that all elements were properly destroyed
EXPECT_EQ(counter, 0);
EXPECT_EQ(counter, 0ull);
}

TEST_F(TestCheckpoint, test_checkpoint_in_place_3) {
Expand Down Expand Up @@ -425,7 +425,7 @@ TEST_F(TestCheckpoint, test_checkpoint_no_elements_on_root_rank) {
//verify that root node has no elements, by construction with map
if(this_node == 0) {
auto local_set = theCollection()->getLocalIndices(proxy);
EXPECT_EQ(local_set.size(), 0);
EXPECT_EQ(local_set.size(), 0ull);
}

vt_print(gen, "checkpointToFile\n");
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/collection/test_lb.extended.cc
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ TEST_F(TestLoadBalancerOther, test_make_graph_symmetric) {
auto const phase = thePhase()->getCurrentPhase();
auto const comm_data = theNodeLBData()->getNodeComm(phase);
ASSERT_NE(comm_data, nullptr);
ASSERT_EQ(comm_data->size(), 1);
ASSERT_EQ(comm_data->size(), 1ull);

// test
auto proxy = theLBManager()->makeLB<vt::vrt::collection::lb::TemperedWMin>();
Expand All @@ -190,11 +190,11 @@ TEST_F(TestLoadBalancerOther, test_make_graph_symmetric) {

// assert
if (num_nodes == 1) {
ASSERT_EQ(comm_data->size(), 1);
ASSERT_EQ(comm_data->size(), 1ull);
return;
}

ASSERT_EQ(comm_data->size(), 2);
ASSERT_EQ(comm_data->size(), 2ull);
auto const prev_node = (this_node + num_nodes - 1) % num_nodes;
bool this_to_next = false, prev_to_this = false;

Expand Down Expand Up @@ -423,7 +423,7 @@ TEST_P(TestNodeLBDataDumper, test_node_lb_data_dumping_with_interval) {
auto& json = *json_ptr;

EXPECT_TRUE(json.find("phases") != json.end());
EXPECT_EQ(json["phases"].size(), num_phases);
EXPECT_EQ(json["phases"].size(), static_cast<std::size_t>(num_phases));
});

if (vt::theContext()->getNode() == 0) {
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/collection/test_lb_data_holder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ TEST_F(TestOptionalPhasesMetadata, test_no_metadata) {
addPhasesDataToJson(json, num_phases, {});

LBDataHolder testObj(json);
EXPECT_EQ(testObj.count_, num_phases);
EXPECT_EQ(testObj.count_, static_cast<std::size_t>(num_phases));
std::set<PhaseType> expectedSkipped = {};
EXPECT_EQ(testObj.skipped_phases_, expectedSkipped);
std::set<PhaseType> expectedIdentical = {};
Expand Down Expand Up @@ -126,7 +126,7 @@ TEST_F(TestOptionalPhasesMetadata, test_no_lb_phases_metadata) {
addPhasesDataToJson(json, num_phases, {});

LBDataHolder testObj(json);
EXPECT_EQ(testObj.count_, num_phases);
EXPECT_EQ(testObj.count_, static_cast<std::size_t>(num_phases));
std::set<PhaseType> expectedSkipped = {};
EXPECT_EQ(testObj.skipped_phases_, expectedSkipped);
std::set<PhaseType> expectedIdentical = {};
Expand Down Expand Up @@ -162,7 +162,7 @@ TEST_F(TestOptionalPhasesMetadata, test_lb_phases_metadata_empty) {
addPhasesDataToJson(json, num_phases, {});

LBDataHolder testObj(json);
EXPECT_EQ(testObj.count_, num_phases);
EXPECT_EQ(testObj.count_, static_cast<std::size_t>(num_phases));
std::set<PhaseType> expectedSkipped = {};
EXPECT_EQ(testObj.skipped_phases_, expectedSkipped);
std::set<PhaseType> expectedIdentical = {};
Expand Down Expand Up @@ -198,7 +198,7 @@ TEST_F(TestOptionalPhasesMetadata, test_lb_phases_metadata_filled) {
addPhasesDataToJson(json, num_phases, {1,2,3,4,8,9});

LBDataHolder testObj(json);
EXPECT_EQ(testObj.count_, num_phases);
EXPECT_EQ(testObj.count_, static_cast<std::size_t>(num_phases));
std::set<PhaseType> expectedSkipped = {2, 3, 4};
EXPECT_EQ(testObj.skipped_phases_, expectedSkipped);
std::set<PhaseType> expectedIdentical = {1, 8, 9};
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/collection/test_model_select_subphases.nompi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ TEST_F(TestModelSelectSubphases, test_model_select_subphases_1) {
auto test_model =
std::make_shared<SelectSubphases>(std::make_shared<StubModel>(), subphases);

EXPECT_EQ(test_model->getNumSubphases(), subphases.size());
EXPECT_EQ(test_model->getNumSubphases(), static_cast<int>(subphases.size()));

test_model->setLoads(&proc_load, nullptr);
test_model->updateLoads(0);
Expand Down Expand Up @@ -171,7 +171,7 @@ TEST_F(TestModelSelectSubphases, test_model_select_subphases_2) {
auto test_model =
std::make_shared<SelectSubphases>(std::make_shared<StubModel>(), subphases);

EXPECT_EQ(test_model->getNumSubphases(), subphases.size());
EXPECT_EQ(test_model->getNumSubphases(), static_cast<int>(subphases.size()));

test_model->setLoads(&proc_load, nullptr);
test_model->updateLoads(0);
Expand Down
18 changes: 9 additions & 9 deletions tests/unit/lb/test_lb_data_comm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ TEST_F(TestLBDataComm, test_lb_data_comm_col_to_col_send) {
EXPECT_TRUE(key.from_.isMigratable());
EXPECT_EQ(key.from_.id, idxToElmID(prev_idx));
EXPECT_EQ(vol.bytes, sizeof(MyMsg) * num_sends);
EXPECT_EQ(vol.messages, num_sends);
EXPECT_EQ(vol.messages, static_cast<std::size_t>(num_sends));
found = true;
}
}
Expand Down Expand Up @@ -365,7 +365,7 @@ TEST_F(TestLBDataComm, test_lb_data_comm_col_to_objgroup_send) {
EXPECT_FALSE(key.to_.isMigratable());
EXPECT_EQ(key.to_.id, idb);
EXPECT_EQ(vol.bytes, sizeof(MyObjMsg) * num_sends);
EXPECT_EQ(vol.messages, num_sends);
EXPECT_EQ(vol.messages, static_cast<std::size_t>(num_sends));
found = true;
}
}
Expand Down Expand Up @@ -428,7 +428,7 @@ TEST_F(TestLBDataComm, test_lb_data_comm_objgroup_to_col_send) {
EXPECT_FALSE(key.from_.isMigratable());
EXPECT_EQ(key.from_.id, vt::elm::ElmIDBits::createObjGroup(op, prev).id);
EXPECT_EQ(vol.bytes, sizeof(MyMsg) * num_sends);
EXPECT_EQ(vol.messages, num_sends);
EXPECT_EQ(vol.messages, static_cast<std::size_t>(num_sends));
found = true;
}
}
Expand Down Expand Up @@ -482,7 +482,7 @@ TEST_F(TestLBDataComm, test_lb_data_comm_objgroup_to_objgroup_send) {
EXPECT_FALSE(key.from_.isMigratable());
EXPECT_EQ(key.to_.id, idb);
EXPECT_EQ(vol.bytes, sizeof(MyObjMsg) * num_sends);
EXPECT_EQ(vol.messages, num_sends);
EXPECT_EQ(vol.messages, static_cast<std::size_t>(num_sends));
found = true;
}
}
Expand Down Expand Up @@ -539,7 +539,7 @@ TEST_F(TestLBDataComm, test_lb_data_comm_handler_to_col_send) {
EXPECT_FALSE(key.from_.isMigratable());
EXPECT_EQ(key.from_.id, vt::elm::ElmIDBits::createBareHandler(prev).id);
EXPECT_EQ(vol.bytes, sizeof(MyMsg) * num_sends);
EXPECT_EQ(vol.messages, num_sends);
EXPECT_EQ(vol.messages, static_cast<std::size_t>(num_sends));
found = true;
}
}
Expand Down Expand Up @@ -600,7 +600,7 @@ TEST_F(TestLBDataComm, test_lb_data_comm_col_to_handler_send) {
EXPECT_FALSE(key.to_.isMigratable());
EXPECT_EQ(key.to_.id, vt::elm::ElmIDBits::createBareHandler(next).id);
EXPECT_EQ(vol.bytes, sizeof(MyObjMsg) * num_sends);
EXPECT_EQ(vol.messages, num_sends);
EXPECT_EQ(vol.messages, static_cast<std::size_t>(num_sends));
found = true;
}
}
Expand Down Expand Up @@ -647,7 +647,7 @@ TEST_F(TestLBDataComm, test_lb_data_comm_objgroup_to_handler_send) {
EXPECT_EQ(key.to_.id, vt::elm::ElmIDBits::createBareHandler(next).id);
EXPECT_FALSE(key.from_.isMigratable());
EXPECT_EQ(vol.bytes, sizeof(MyObjMsg) * num_sends);
EXPECT_EQ(vol.messages, num_sends);
EXPECT_EQ(vol.messages, static_cast<std::size_t>(num_sends));
found = true;
}
}
Expand Down Expand Up @@ -692,7 +692,7 @@ TEST_F(TestLBDataComm, test_lb_data_comm_handler_to_objgroup_send) {
EXPECT_EQ(key.from_.id, vt::elm::ElmIDBits::createBareHandler(this_node).id);
EXPECT_FALSE(key.from_.isMigratable());
EXPECT_EQ(vol.bytes, sizeof(MyObjMsg) * num_sends);
EXPECT_EQ(vol.messages, num_sends);
EXPECT_EQ(vol.messages, static_cast<std::size_t>(num_sends));
found = true;
}
}
Expand Down Expand Up @@ -732,7 +732,7 @@ TEST_F(TestLBDataComm, test_lb_data_comm_handler_to_handler_send) {
EXPECT_FALSE(key.to_.isMigratable());
EXPECT_FALSE(key.from_.isMigratable());
EXPECT_GE(vol.bytes, sizeof(MyObjMsg) * num_sends);
EXPECT_GE(vol.messages, num_sends);
EXPECT_EQ(vol.messages, static_cast<std::size_t>(num_sends));
found = true;
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/lb/test_lb_reader.nompi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ TEST_F(TestLBReader, test_lb_read_1) {
Config::openConfig(file_name);

EXPECT_EQ(Config::numEntries(), 3);
EXPECT_EQ(Config::getExactEntries().size(), 2);
EXPECT_EQ(Config::getModEntries().size(), 1);
EXPECT_EQ(Config::getExactEntries().size(), 2u);
EXPECT_EQ(Config::getModEntries().size(), 1u);

for (ConfigIdx i = 0; i < 21; i++) {
auto entry = Config::entry(i);
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/objgroup/test_objgroup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct TestObjGroup : TestParallelHarness {
void verifyVec(VectorPayload vec) {
auto final_size = vec.vec_.size();
auto n = vt::theContext()->getNumNodes();
EXPECT_EQ(final_size, n);
EXPECT_EQ(final_size, static_cast<std::size_t>(n));
total_verify_expected_++;
}
};
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/phase/test_phase_management.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ TEST_F(TestPhaseManagement, test_phase_manager_1) {
auto phase_mgr = phase::PhaseManager::construct();

// start with phase 0
EXPECT_EQ(phase_mgr->getCurrentPhase(), 0);
EXPECT_EQ(phase_mgr->getCurrentPhase(), 0ull);

int start_hooks = 0;
int end_hooks = 0;
Expand Down Expand Up @@ -97,13 +97,13 @@ TEST_F(TestPhaseManagement, test_phase_manager_1) {
EXPECT_EQ(start_hooks, 3);
EXPECT_EQ(end_hooks, 1);
EXPECT_EQ(end_post_hooks, 1);
EXPECT_EQ(phase_mgr->getCurrentPhase(), 1);
EXPECT_EQ(phase_mgr->getCurrentPhase(), 1ull);

phase_mgr->nextPhaseCollective();
EXPECT_EQ(start_hooks, 4);
EXPECT_EQ(end_hooks, 2);
EXPECT_EQ(end_post_hooks, 2);
EXPECT_EQ(phase_mgr->getCurrentPhase(), 2);
EXPECT_EQ(phase_mgr->getCurrentPhase(), 2ull);
}

}}} // end namespace vt::tests::unit
2 changes: 1 addition & 1 deletion tests/unit/termination/test_integral_set.cc
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ TEST_F(TestIntegralSet, test_interval_set_3) {
i.insert(0);

EXPECT_FALSE(i.empty());
EXPECT_EQ(i.size(), 1);
EXPECT_EQ(i.size(), 1ull);
}

}}} // end namespace vt::tests::unit
4 changes: 2 additions & 2 deletions tests/unit/utils/test_histogram_approx.nompi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ TEST_F(TestHistogramApprox, test_histogram_2) {
EXPECT_EQ(h.getMin(), 1);
EXPECT_EQ(h.getMax(), 92);
EXPECT_EQ(h.getCount(), len);
EXPECT_EQ(h.getCentroids().size(), 4);
EXPECT_EQ(h.getCentroids().size(), 4u);
}

TEST_F(TestHistogramApprox, test_histogram_sum_3) {
Expand Down Expand Up @@ -247,7 +247,7 @@ TEST_F(TestHistogramApprox, test_histogram_merge_7) {
auto centroids = h1.getCentroids();

// Must be 8 centroids if merge/max was applied correctly
EXPECT_EQ(centroids.size(), 8);
EXPECT_EQ(centroids.size(), 8ull);

// We should have all the original centroids, except the last one, which
// should be a single combined centroids of the last three values if optimal
Expand Down

0 comments on commit f82e0cb

Please sign in to comment.