Commit 1544f94b authored by niklas.baumgarten's avatar niklas.baumgarten
Browse files

worked on test

parent c39b95a1
......@@ -16,6 +16,11 @@ TEST(TestParallel, TestBroadcastInt) {
if (!PPM->master()) EXPECT_EQ(PPM->BroadcastInt(), 1);
}
TEST(TestParallel, TestBroadcastInt2) {
if (PPM->master()) PPM->Broadcast(1);
if (!PPM->master()) EXPECT_EQ(1, PPM->Broadcast<int>());
}
struct BroadcastStruct {
int integer;
......@@ -69,13 +74,6 @@ TEST(TestParallel, TestComplexSum) {
EXPECT_EQ(PPM->Sum(a), b);
}
TEST(TestParallel, TestNonExistingSum) {
// FLAGS_gtest_death_test_style = "threadsafe";
// std::string a = "I'm not summable";
// EXPECT_EXIT(PPM->Sum(a), ExitedWithCode(1),
// "Sum not implemented for " + std::string(Type(std::string{})));
}
TEST(TestParallel, TestIntegerMin) {
int a;
if (PPM->master()) a = 1;
......@@ -136,15 +134,21 @@ TEST(TestParallel, TestUnsignedIntMax) {
EXPECT_EQ(PPM->Max(a), 1);
}
TEST(TestParallel, TestSplit) {
PPM->NewCommunicators(-1, 4);
auto worldComm = PPM->GetComm(-1);
auto comm = PPM->GetComm(0);
std::cout << "World rank/size: " << worldComm->p << "/" << worldComm->P << "\t"
<< "Comm rank/size: " << comm->p << "/" << comm->P << "\t" << endl;
TEST(TestParallel, TestSplitProc) {
int partitions = 2;
PPM->SplitCommunicator(-1, partitions);
if (PPM->master(-1)) EXPECT_EQ(PPM->proc(-1), 0);
if (!PPM->master(-1)) EXPECT_NE(PPM->proc(-1), 0);
// EXPECT_EQ(comm->Master(), worldComm->Master());
if (PPM->master(0)) EXPECT_EQ(PPM->proc(0), 0);
if (!PPM->master(0)) EXPECT_NE(PPM->proc(0), 0);
int testSize;
MPI_Comm_size(MPI_COMM_WORLD, &testSize);
EXPECT_EQ(PPM->size(-1), testSize);
EXPECT_EQ(PPM->size(0) * partitions, testSize);
EXPECT_EQ(PPM->size(1) * partitions, testSize);
}
int main(int argc, char **argv) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment