Skip to content

Commit

Permalink
#1934: Remove comparison of signed and unsigned integers in retention…
Browse files Browse the repository at this point in the history
… tests.
  • Loading branch information
thearusable committed Sep 23, 2024
1 parent 91ca1eb commit 87f126c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
16 changes: 8 additions & 8 deletions tests/unit/collection/test_lb_data_retention.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ struct TestCol : vt::Collection<TestCol,vt::Index1D> {
EXPECT_EQ(comm_phase_count, buffers_size);
EXPECT_EQ(sp_comm_phase_count, buffers_size);
} else if (phase == 0) {
EXPECT_EQ(load_phase_count, 1);
EXPECT_EQ(sp_load_phase_count, 1);
EXPECT_EQ(comm_phase_count, 0);
EXPECT_EQ(sp_comm_phase_count, 0);
EXPECT_EQ(load_phase_count, std::size_t{1});
EXPECT_EQ(sp_load_phase_count, std::size_t{1});
EXPECT_EQ(comm_phase_count, std::size_t{0});
EXPECT_EQ(sp_comm_phase_count, std::size_t{0});
} else {
// updatePhase will have caused entries to be added for the
// next phase already
Expand All @@ -125,10 +125,10 @@ struct TestCol : vt::Collection<TestCol,vt::Index1D> {
EXPECT_EQ(sp_comm_phase_count, phase + 1);
}
#else
EXPECT_EQ(load_phase_count, 0);
EXPECT_EQ(sp_load_phase_count, 0);
EXPECT_EQ(comm_phase_count, 0);
EXPECT_EQ(sp_comm_phase_count, 0);
EXPECT_EQ(load_phase_count, std::size_t{0});
EXPECT_EQ(sp_load_phase_count, std::size_t{0});
EXPECT_EQ(comm_phase_count, std::size_t{0});
EXPECT_EQ(sp_comm_phase_count, std::size_t{0});
#endif
}
};
Expand Down
36 changes: 18 additions & 18 deletions tests/unit/utils/test_circular_phases_buffer.nompi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace vt { namespace tests { namespace unit {
using TestCircularPhasesBuffer = TestHarness;

struct Dummy {
int x;
PhaseType x;
};

using CircularBufferType = util::container::CircularPhasesBuffer<Dummy>;
Expand Down Expand Up @@ -103,8 +103,8 @@ TEST_F(TestCircularPhasesBuffer, test_circular_phases_buffer_empty) {
EXPECT_TRUE(buffer.contains(0));
EXPECT_EQ(std::size_t{1}, buffer.size());
EXPECT_FALSE(buffer.empty());
EXPECT_EQ(0, buffer.frontPhase());
EXPECT_EQ(0, buffer.frontData().x);
EXPECT_EQ(PhaseType{0}, buffer.frontPhase());
EXPECT_EQ(PhaseType{0}, buffer.frontData().x);
EXPECT_NE(nullptr, buffer.find(0));

buffer[1] = {1};
Expand All @@ -115,8 +115,8 @@ TEST_F(TestCircularPhasesBuffer, test_circular_phases_buffer_empty) {
EXPECT_TRUE(buffer.contains(1));
EXPECT_EQ(std::size_t{4}, buffer.size());
EXPECT_FALSE(buffer.empty());
EXPECT_EQ(4, buffer.frontPhase());
EXPECT_EQ(8, buffer.frontData().x);
EXPECT_EQ(PhaseType{4}, buffer.frontPhase());
EXPECT_EQ(PhaseType{8}, buffer.frontData().x);
EXPECT_EQ(nullptr, buffer.find(0));
EXPECT_NE(nullptr, buffer.find(3));

Expand All @@ -134,7 +134,7 @@ TEST_F(TestCircularPhasesBuffer, test_circular_phases_buffer_single_element) {

EXPECT_EQ(false, buffer.contains(0));

for (int i = 0; i < 5; i++) {
for (PhaseType i = 0; i < 5; i++) {
buffer.store(i, {i});
EXPECT_EQ(i == 0, buffer.contains(0));
EXPECT_EQ(i == 1, buffer.contains(1));
Expand All @@ -154,7 +154,7 @@ TEST_F(TestCircularPhasesBuffer, test_circular_phases_buffer_single_element) {
TEST_F(TestCircularPhasesBuffer, test_circular_phases_buffer_multi_elements) {
CircularBufferType buffer{5};

for (int i = 0; i < 15; i++) {
for (PhaseType i = 0; i < 15; i++) {
buffer.store(i, {i});

EXPECT_EQ(i, buffer.frontPhase());
Expand All @@ -179,7 +179,7 @@ TEST_F(TestCircularPhasesBuffer, test_circular_phases_buffer_store) {
validateMissingPhases(buffer, {0, 1, 3, 4, 5, 6, 7, 8, 9});

// store series of elements
for (int i = 3; i < 15; i++) {
for (PhaseType i = 3; i < 15; i++) {
buffer.store(i, {i});
}

Expand All @@ -191,7 +191,7 @@ TEST_F(TestCircularPhasesBuffer, test_circular_phases_buffer_store) {
TEST_F(TestCircularPhasesBuffer, test_circular_phases_buffer_resize) {
CircularBufferType buffer{10};

for (int i = 0; i <= 15; i++) {
for (PhaseType i = 0; i <= 15; i++) {
buffer[i] = {i};
}
validatePresentPhases(buffer, {6, 7, 8, 9, 10, 11, 12, 13, 14, 15});
Expand All @@ -200,7 +200,7 @@ TEST_F(TestCircularPhasesBuffer, test_circular_phases_buffer_resize) {
validatePresentPhases(buffer, {11, 12, 13, 14, 15});
validateMissingPhases(buffer, {6, 7, 8, 9, 10});

for (int i = 15; i <= 32; i++) {
for (PhaseType i = 15; i <= 32; i++) {
buffer[i] = {i};
}
validatePresentPhases(buffer, {28, 29, 30, 31, 32});
Expand All @@ -210,7 +210,7 @@ TEST_F(TestCircularPhasesBuffer, test_circular_phases_buffer_resize) {

validatePresentPhases(buffer, {28, 29, 30, 31, 32});

for (int i = 33; i <= 35; i++) {
for (PhaseType i = 33; i <= 35; i++) {
buffer[i] = {i};
}
validatePresentPhases(buffer, {28, 29, 30, 31, 32, 33, 34, 35});
Expand All @@ -228,16 +228,16 @@ TEST_F(TestCircularPhasesBuffer, test_circular_phases_buffer_restart_from) {
EXPECT_EQ(std::numeric_limits<PhaseType>::max(), buffer.frontPhase());

buffer[3] = {3};
EXPECT_EQ(3, buffer.frontPhase());
EXPECT_EQ(3, buffer.frontData().x);
EXPECT_EQ(PhaseType{3}, buffer.frontPhase());
EXPECT_EQ(PhaseType{3}, buffer.frontData().x);

buffer.restartFrom(10);
EXPECT_EQ(10, buffer.frontPhase());
EXPECT_EQ(3, buffer.frontData().x);
EXPECT_EQ(PhaseType{10}, buffer.frontPhase());
EXPECT_EQ(PhaseType{3}, buffer.frontData().x);

buffer.restartFrom(0);
EXPECT_EQ(0, buffer.frontPhase());
EXPECT_EQ(3, buffer.frontData().x);
EXPECT_EQ(PhaseType{0}, buffer.frontPhase());
EXPECT_EQ(PhaseType{3}, buffer.frontData().x);
}

TEST_F(TestCircularPhasesBuffer, test_circular_phases_buffer_forward_iter) {
Expand Down Expand Up @@ -273,7 +273,7 @@ TEST_F(TestCircularPhasesBuffer, test_circular_phases_buffer_forward_iter) {
EXPECT_EQ(visited.size(), buffer.size());
}

for (int i = 0; i <= 15; i++) {
for (PhaseType i = 0; i <= 15; i++) {
buffer[i] = {i};
}

Expand Down

0 comments on commit 87f126c

Please sign in to comment.