Browse Source

Test: PityTest - test_processdirs updated

LIB-11
heck 4 years ago
parent
commit
3735aaf896
  1. 154
      test/pitytest11/test/test_processdirs.cc

154
test/pitytest11/test/test_processdirs.cc

@ -5,7 +5,12 @@
using namespace std; using namespace std;
using namespace pEp::PityTest11; using namespace pEp::PityTest11;
void printHomeDir(PityUnit<>& myself)
using TestContext = void;
using TestUnit = PityUnit<>;
//TODO: Add HOME testing
void printHomeDir(TestUnit& myself)
{ {
// TESTLOG(string(myself.getFQName() + " - PID: " + to_string(getpid()))); // TESTLOG(string(myself.getFQName() + " - PID: " + to_string(getpid())));
// cout << "[" << to_string(getpid()) << "/" << myself.getFQName() << "] - " << endl; // cout << "[" << to_string(getpid()) << "/" << myself.getFQName() << "] - " << endl;
@ -16,98 +21,77 @@ void printHomeDir(PityUnit<>& myself)
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
PityUnit<>::debug_log_enabled = false; PityUnit<>::debug_log_enabled = false;
PityUnit<> root = PityUnit<>{ "test_processdirs" }; TestUnit suite = TestUnit{ "test_processdirs" };
// 1 // 1
PityUnit<> test1 = PityUnit<>{ root, "node 1", [](PityUnit<>& mynode, void* ctx) { suite
PITYASSERT( .addCopy(TestUnit(
mynode.processDir() == "./pitytest_data/test_processdirs/", "node 1",
""); [](TestUnit& pity, TestContext* ctx) {
return 0; PITYASSERT(pity.processDir() == "./pitytest_data/test_processdirs/", "node 1");
} }; return 0;
}))
PityUnit<> test1_1 = PityUnit<>{ test1, "node 1.1", [](PityUnit<>& mynode, void* ctx) { .addCopy(TestUnit("node 1.1", [](TestUnit& pity, TestContext* ctx) {
PITYASSERT( PITYASSERT(pity.processDir() == "./pitytest_data/test_processdirs/", "node 1.1");
mynode.processDir() == "./pitytest_data/test_processdirs/", return 0;
""); }));
return 0;
} };
// 2 // 2
PityUnit<> test2 = PityUnit<>{ root, "node 2", [](PityUnit<>& mynode, void* ctx) { suite
PITYASSERT( .addCopy(TestUnit(
mynode.processDir() == "./pitytest_data/test_processdirs/", "node 2",
""); [](TestUnit& pity, TestContext* ctx) {
return 0; PITYASSERT(pity.processDir() == "./pitytest_data/test_processdirs/", "node 2");
} }; return 0;
PityUnit<> test2_1 = PityUnit<>{ }))
test2, .addCopy(TestUnit(
"node 2.1", "node 2.1",
[](PityUnit<>& mynode, void* ctx) { [](TestUnit& pity, TestContext* ctx) {
PITYASSERT(mynode.processDir() == "./pitytest_data/test_processdirs/node_2_1/", ""); PITYASSERT(pity.processDir() == "./pitytest_data/test_processdirs/node_2_1/", "");
return 0;
},
nullptr,
PityUnit<>::ExecutionMode::PROCESS_PARALLEL))
.addCopy(TestUnit("node 2.1.1", [](TestUnit& pity, TestContext* ctx) {
PITYASSERT(pity.processDir() == "./pitytest_data/test_processdirs/node_2_1/", "");
return 0; return 0;
}, }));
nullptr,
pEp::PityTest11::PityUnit<>::ExecutionMode::PROCESS_PARALLEL
};
PityUnit<> test2_1_1 = PityUnit<>{ test2_1, "node 2.1.1", [](PityUnit<> mynode, void* ctx) {
PITYASSERT(
mynode.processDir() ==
"./pitytest_data/test_processdirs/node_2_1/",
"");
return 0;
} };
// 3 // 3
PityUnit<> test3 = PityUnit<>{ suite
root, .addCopy(TestUnit(
"node 3", "node 3",
[](PityUnit<>& mynode, void* ctx) { [](TestUnit& pity, TestContext* ctx) {
PITYASSERT(mynode.processDir() == "./pitytest_data/test_processdirs/node_3/", ""); PITYASSERT(pity.processDir() == "./pitytest_data/test_processdirs/node_3/", "");
return 0; return 0;
}, },
nullptr, nullptr,
PityUnit<>::ExecutionMode::PROCESS_PARALLEL PityUnit<>::ExecutionMode::PROCESS_PARALLEL))
}; .addCopy(TestUnit(
"node 3.1",
PityUnit<> test3_1 = PityUnit<>{ test3, "node 3.1", [](PityUnit<>& mynode, void* ctx) { [](TestUnit& pity, TestContext* ctx) {
PITYASSERT( PITYASSERT(pity.processDir() == "./pitytest_data/test_processdirs/node_3/", "");
mynode.processDir() == return 0;
"./pitytest_data/test_processdirs/node_3/", }))
""); .addCopy(TestUnit(
return 0; "node 3.1.1",
} }; [](TestUnit& pity, TestContext* ctx) {
PITYASSERT(pity.processDir() == "./pitytest_data/test_processdirs/node_3/", "");
PityUnit<> test3_1_1 = PityUnit<>{ test3_1, "node 3.1.1", [](PityUnit<>& mynode, void* ctx) { return 0;
PITYASSERT( }))
mynode.processDir() == .addCopy(TestUnit(
"./pitytest_data/test_processdirs/node_3/", "node 3.1.1",
""); [](TestUnit& pity, TestContext* ctx) {
return 0; PITYASSERT(pity.processDir() == "./pitytest_data/test_processdirs/node_3_1_1/", "");
} }; return 0;
},
PityUnit<> test3_1_1_1 = PityUnit<>{ nullptr,
test3_1_1, PityUnit<>::ExecutionMode::PROCESS_PARALLEL))
"node 3.1.1", .addCopy(TestUnit("node 3.1.1.1", [](TestUnit& pity, TestContext* ctx) {
[](PityUnit<>& mynode, void* ctx) { PITYASSERT(pity.processDir() == "./pitytest_data/test_processdirs/node_3_1_1/", "");
PITYASSERT(mynode.processDir() == "./pitytest_data/test_processdirs/node_3_1_1/", "");
return 0;
},
nullptr,
PityUnit<>::ExecutionMode::PROCESS_PARALLEL
};
PityUnit<> test3_1_1_1_1 = PityUnit<>{
test3_1_1_1,
"node 3.1.1.1",
[](PityUnit<>& mynode, void* ctx) {
PITYASSERT(mynode.processDir() == "./pitytest_data/test_processdirs/node_3_1_1/", "");
return 0; return 0;
} }));
};
root.run(); suite.run();
} }
Loading…
Cancel
Save