From 3735aaf89605d0ef0f8b7372e9a9594137a21c15 Mon Sep 17 00:00:00 2001 From: heck Date: Thu, 8 Jul 2021 02:46:59 +0200 Subject: [PATCH] Test: PityTest - test_processdirs updated --- test/pitytest11/test/test_processdirs.cc | 154 ++++++++++------------- 1 file changed, 69 insertions(+), 85 deletions(-) diff --git a/test/pitytest11/test/test_processdirs.cc b/test/pitytest11/test/test_processdirs.cc index ee91a96..be5d531 100644 --- a/test/pitytest11/test/test_processdirs.cc +++ b/test/pitytest11/test/test_processdirs.cc @@ -5,7 +5,12 @@ using namespace std; 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()))); // cout << "[" << to_string(getpid()) << "/" << myself.getFQName() << "] - " << endl; @@ -16,98 +21,77 @@ void printHomeDir(PityUnit<>& myself) int main(int argc, char* argv[]) { PityUnit<>::debug_log_enabled = false; - PityUnit<> root = PityUnit<>{ "test_processdirs" }; + TestUnit suite = TestUnit{ "test_processdirs" }; // 1 - PityUnit<> test1 = PityUnit<>{ root, "node 1", [](PityUnit<>& mynode, void* ctx) { - PITYASSERT( - mynode.processDir() == "./pitytest_data/test_processdirs/", - ""); - return 0; - } }; - - PityUnit<> test1_1 = PityUnit<>{ test1, "node 1.1", [](PityUnit<>& mynode, void* ctx) { - PITYASSERT( - mynode.processDir() == "./pitytest_data/test_processdirs/", - ""); - return 0; - } }; + suite + .addCopy(TestUnit( + "node 1", + [](TestUnit& pity, TestContext* ctx) { + PITYASSERT(pity.processDir() == "./pitytest_data/test_processdirs/", "node 1"); + return 0; + })) + .addCopy(TestUnit("node 1.1", [](TestUnit& pity, TestContext* ctx) { + PITYASSERT(pity.processDir() == "./pitytest_data/test_processdirs/", "node 1.1"); + return 0; + })); // 2 - PityUnit<> test2 = PityUnit<>{ root, "node 2", [](PityUnit<>& mynode, void* ctx) { - PITYASSERT( - mynode.processDir() == "./pitytest_data/test_processdirs/", - ""); - return 0; - } }; - PityUnit<> test2_1 = PityUnit<>{ - test2, - "node 2.1", - [](PityUnit<>& mynode, void* ctx) { - PITYASSERT(mynode.processDir() == "./pitytest_data/test_processdirs/node_2_1/", ""); + suite + .addCopy(TestUnit( + "node 2", + [](TestUnit& pity, TestContext* ctx) { + PITYASSERT(pity.processDir() == "./pitytest_data/test_processdirs/", "node 2"); + return 0; + })) + .addCopy(TestUnit( + "node 2.1", + [](TestUnit& pity, TestContext* ctx) { + 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; - }, - 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 - PityUnit<> test3 = PityUnit<>{ - root, - "node 3", - [](PityUnit<>& mynode, void* ctx) { - PITYASSERT(mynode.processDir() == "./pitytest_data/test_processdirs/node_3/", ""); + suite + .addCopy(TestUnit( + "node 3", + [](TestUnit& pity, TestContext* ctx) { + PITYASSERT(pity.processDir() == "./pitytest_data/test_processdirs/node_3/", ""); + return 0; + }, + nullptr, + PityUnit<>::ExecutionMode::PROCESS_PARALLEL)) + .addCopy(TestUnit( + "node 3.1", + [](TestUnit& pity, TestContext* ctx) { + PITYASSERT(pity.processDir() == "./pitytest_data/test_processdirs/node_3/", ""); + return 0; + })) + .addCopy(TestUnit( + "node 3.1.1", + [](TestUnit& pity, TestContext* ctx) { + PITYASSERT(pity.processDir() == "./pitytest_data/test_processdirs/node_3/", ""); + return 0; + })) + .addCopy(TestUnit( + "node 3.1.1", + [](TestUnit& pity, TestContext* ctx) { + PITYASSERT(pity.processDir() == "./pitytest_data/test_processdirs/node_3_1_1/", ""); + return 0; + }, + nullptr, + PityUnit<>::ExecutionMode::PROCESS_PARALLEL)) + .addCopy(TestUnit("node 3.1.1.1", [](TestUnit& pity, TestContext* ctx) { + PITYASSERT(pity.processDir() == "./pitytest_data/test_processdirs/node_3_1_1/", ""); return 0; - }, - nullptr, - PityUnit<>::ExecutionMode::PROCESS_PARALLEL - }; + })); - PityUnit<> test3_1 = PityUnit<>{ test3, "node 3.1", [](PityUnit<>& mynode, void* ctx) { - PITYASSERT( - mynode.processDir() == - "./pitytest_data/test_processdirs/node_3/", - ""); - return 0; - } }; - - PityUnit<> test3_1_1 = PityUnit<>{ test3_1, "node 3.1.1", [](PityUnit<>& mynode, void* ctx) { - PITYASSERT( - mynode.processDir() == - "./pitytest_data/test_processdirs/node_3/", - ""); - return 0; - } }; - - PityUnit<> test3_1_1_1 = PityUnit<>{ - test3_1_1, - "node 3.1.1", - [](PityUnit<>& mynode, void* ctx) { - 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; - } - }; - - root.run(); + suite.run(); } \ No newline at end of file