Skip to content
Snippets Groups Projects
Commit 588b5c95 authored by Anna Wellmann's avatar Anna Wellmann
Browse files

Amend the tests

parent 538a38f7
No related branches found
No related tags found
1 merge request!168Partially revert "Refactor exchangeIndicesForCommAfterFtoC"
......@@ -283,15 +283,29 @@ TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCX, threeR
TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCX, sixRecvIndicesX)
{
// this test shows the limits of the current approach. The last index is always deleted
CommunicationRoutineDouble communicator;
std::vector<uint> expected = { 10, 20, 30, 40, 50, 60 };
std::vector<uint> receivedIndicesByComm(expected.size(), 0);
std::vector<uint> expected = { 10, 20, 30, 40, 50 };
std::vector<uint> receivedIndicesByComm = { 10, 20, 30, 40, 50, 60 };
communicator.setReceivedIndices(receivedIndicesByComm);
createTestSubject(communicator);
std::vector<uint> recvIndicesForCommAfterFtoCPositions = act();
EXPECT_THAT(recvIndicesForCommAfterFtoCPositions.size(), testing::Eq(5));
EXPECT_THAT(recvIndicesForCommAfterFtoCPositions, testing::Eq(expected));
}
TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCX, recvIndicesXContainZero)
{
CommunicationRoutineDouble communicator;
std::vector<uint> expected = { 0, 20, 30, 40 };
std::vector<uint> receivedIndicesByComm(6, 0);
std::copy(expected.begin(), expected.end(), receivedIndicesByComm.begin());
communicator.setReceivedIndices(receivedIndicesByComm);
createTestSubject(communicator);
std::vector<uint> recvIndicesForCommAfterFtoCPositions = act();
EXPECT_THAT(recvIndicesForCommAfterFtoCPositions.size(), testing::Eq(6));
EXPECT_THAT(recvIndicesForCommAfterFtoCPositions.size(), testing::Eq(4));
EXPECT_THAT(recvIndicesForCommAfterFtoCPositions, testing::Eq(expected));
}
......@@ -390,15 +404,29 @@ TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCY, threeR
TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCY, sixRecvIndicesY)
{
// this test shows the limits of the current approach. The last index is always deleted
CommunicationRoutineDouble communicator;
std::vector<uint> expected = { 10, 20, 30, 40, 50, 60 };
std::vector<uint> receivedIndicesByComm(expected.size(), 0);
std::vector<uint> expected = { 10, 20, 30, 40, 50 };
std::vector<uint> receivedIndicesByComm = { 10, 20, 30, 40, 50, 60 };
communicator.setReceivedIndices(receivedIndicesByComm);
createTestSubject(communicator);
std::vector<uint> recvIndicesForCommAfterFtoCPositions = act();
EXPECT_THAT(recvIndicesForCommAfterFtoCPositions.size(), testing::Eq(5));
EXPECT_THAT(recvIndicesForCommAfterFtoCPositions, testing::Eq(expected));
}
TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCY, recvIndicesYContainZero)
{
CommunicationRoutineDouble communicator;
std::vector<uint> expected = { 0, 20, 30, 40 };
std::vector<uint> receivedIndicesByComm(6, 0);
std::copy(expected.begin(), expected.end(), receivedIndicesByComm.begin());
communicator.setReceivedIndices(receivedIndicesByComm);
createTestSubject(communicator);
std::vector<uint> recvIndicesForCommAfterFtoCPositions = act();
EXPECT_THAT(recvIndicesForCommAfterFtoCPositions.size(), testing::Eq(6));
EXPECT_THAT(recvIndicesForCommAfterFtoCPositions.size(), testing::Eq(4));
EXPECT_THAT(recvIndicesForCommAfterFtoCPositions, testing::Eq(expected));
}
......@@ -495,16 +523,30 @@ TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCZ, threeR
EXPECT_THAT(recvIndicesForCommAfterFtoCPositions, testing::Eq(expected));
}
TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCZ, sixRecvIndicesZ)
TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCZ, sixRecvIndicesYZ)
{
// this test shows the limits of the current approach. The last index is always deleted
CommunicationRoutineDouble communicator;
std::vector<uint> expected = { 10, 20, 30, 40, 50, 60 };
std::vector<uint> receivedIndicesBZComm(expected.size(), 0);
std::copy(expected.begin(), expected.end(), receivedIndicesBZComm.begin());
communicator.setReceivedIndices(receivedIndicesBZComm);
std::vector<uint> expected = { 10, 20, 30, 40, 50 };
std::vector<uint> receivedIndicesByComm = { 10, 20, 30, 40, 50, 60 };
communicator.setReceivedIndices(receivedIndicesByComm);
createTestSubject(communicator);
std::vector<uint> recvIndicesForCommAfterFtoCPositions = act();
EXPECT_THAT(recvIndicesForCommAfterFtoCPositions.size(), testing::Eq(5));
EXPECT_THAT(recvIndicesForCommAfterFtoCPositions, testing::Eq(expected));
}
TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCZ, recvIndicesZContainZero)
{
CommunicationRoutineDouble communicator;
std::vector<uint> expected = { 0, 20, 30, 40 };
std::vector<uint> receivedIndicesByComm(6, 0);
std::copy(expected.begin(), expected.end(), receivedIndicesByComm.begin());
communicator.setReceivedIndices(receivedIndicesByComm);
createTestSubject(communicator);
std::vector<uint> recvIndicesForCommAfterFtoCPositions = act();
EXPECT_THAT(recvIndicesForCommAfterFtoCPositions.size(), testing::Eq(6));
EXPECT_THAT(recvIndicesForCommAfterFtoCPositions.size(), testing::Eq(4));
EXPECT_THAT(recvIndicesForCommAfterFtoCPositions, testing::Eq(expected));
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment