diff --git a/test/pEpTest/test/test_pEpLog_basic.cc b/test/pEpTest/test/test_pEpLog_basic.cc deleted file mode 100644 index aba4f4f..0000000 --- a/test/pEpTest/test/test_pEpLog_basic.cc +++ /dev/null @@ -1,43 +0,0 @@ -#include "pEpTestUnit.hh" -#include "../../framework/utils.hh" -#include -#include - -using namespace std; -using namespace pEp; -using namespace pEp::Test; - - -void print_and_sleep(pEpTestUnit myself, int sleepmilis, int rep_count) -{ - TESTLOGH1("HYA FROM:" + myself.getFQName()); - int i = 0; - while (i < rep_count) { - TESTLOG(string(myself.getFQName() + " - PID: " + to_string(getpid()) + " - " + to_string(i))); - sleep_millis(sleepmilis); - i++; - } -} - -int main(int argc, char* argv[]) -{ - pEpTestModel model{}; - { - pEpTestUnit::setDefaultExecutionMode(pEpTestUnit::ExecutionMode::PROCESS_PARALLEL); - auto root = pEpTestUnit::createRootNode(model, "rootNode", [](pEpTestUnit mynode) { - print_and_sleep(mynode, 100, 10); - }); - - auto test1 = pEpTestUnit::createChildNode(root, "test1", [](pEpTestUnit mynode) -> void { - print_and_sleep(mynode, 50, 23); - }, pEp::Test::pEpTestUnit::ExecutionMode::PROCESS_SERIAL); - - auto test2 = pEpTestUnit::createChildNode(root, "test2", [](pEpTestUnit mynode) -> void { - print_and_sleep(mynode, 150, 13); - }); - - auto test1_1 = pEpTestUnit::createChildNode(test1, "test1.1", nullptr); - - root.run(); - } -} \ No newline at end of file diff --git a/test/pEpTest/test/test_pEpTest_basic.cc b/test/pEpTest/test/test_pEpTest_basic.cc new file mode 100644 index 0000000..3214488 --- /dev/null +++ b/test/pEpTest/test/test_pEpTest_basic.cc @@ -0,0 +1,53 @@ +#include "../src/pEpTestUnit.hh" +#include "../../framework/utils.hh" +#include +#include + +using namespace std; +using namespace pEp; +using namespace pEp::Test; + + +void print_and_sleep(pEpTestUnit& myself, int sleepmilis, int rep_count) +{ +// TESTLOGH1("HYA FROM:" + myself.getFQName()); + int i = 0; + while (i < rep_count) { + TESTLOG(string(myself.getFQName() + " - PID: " + to_string(getpid()) + " - " + to_string(i))); + sleep_millis(sleepmilis); + i++; + } +} + +int main(int argc, char* argv[]) +{ + string dummy; + pEpTestModel model{ "pEpTestModel" }; + { + // pEpTestUnit::setDefaultExecutionMode(pEp::Test::pEpTestUnit::ExecutionMode::PROCESS_SERIAL); + pEpTestUnit root = pEpTestUnit::createRootNode( + model, + "DistributedTest", + [](pEpTestUnit mynode) { print_and_sleep(mynode, 200, 5); }, + pEp::Test::pEpTestUnit::ExecutionMode::PROCESS_PARALLEL); + + pEpTestUnit test1 = pEpTestUnit::createChildNode(root, "node1", [](pEpTestUnit mynode) { + print_and_sleep(mynode, 200, 10); + }); + + pEpTestUnit test2 = pEpTestUnit::createChildNode(root, "node2", [](pEpTestUnit mynode) { + print_and_sleep(mynode, 200, 10); + }); + + pEpTestUnit test1_1 = pEpTestUnit::createChildNode(test1, "test1.1", [](pEpTestUnit mynode) { + print_and_sleep(mynode, 200, 10); + }); + + pEpTestUnit test2_1 = pEpTestUnit::createChildNode(test2, "test2.1", [](pEpTestUnit mynode) { + print_and_sleep(mynode, 200, 10); + }); + + // cout << root.to_string() << endl; + root.run(); + } +} \ No newline at end of file