#include "../src/PityTest.hh" #include #include using namespace std; using namespace pEp::PityTest11; 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; setenv("HOME", myself.getProcessDir().c_str(), 1); myself.log("HOME=" + string(getenv("HOME"))); } int main(int argc, char* argv[]) { PityUnit<>::debug_log_enabled = false; // Suite TestUnit suite = TestUnit{ "test_processdirs" }; std::string base = TestUnit::getGlobalRootDir() + "test_processdirs/"; // 1 suite .addNew( "node 1", [=](TestUnit& pity, TestContext* ctx) { PITYASSERT( pity.getProcessDir() == TestUnit::getGlobalRootDir() + "test_processdirs/", pity.getProcessDir()); return 0; }) ->addNew("node 1.1", [=](TestUnit& pity, TestContext* ctx) { PITYASSERT( pity.getProcessDir() == TestUnit::getGlobalRootDir() + "test_processdirs/", pity.getProcessDir()); return 0; }); // 2 suite .addNew( "node 2", [=](TestUnit& pity, TestContext* ctx) { PITYASSERT( pity.getProcessDir() == TestUnit::getGlobalRootDir() + "test_processdirs/", pity.getProcessDir()); return 0; }) ->addNew( "node 2.1", [=](TestUnit& pity, TestContext* ctx) { PITYASSERT( pity.getProcessDir() == TestUnit::getGlobalRootDir() + "test_processdirs_node_2_node_2_1/", pity.getProcessDir()); return 0; }, nullptr, PityUnit<>::ExecutionMode::PROCESS_PARALLEL) ->addNew("node 2.1.1", [=](TestUnit& pity, TestContext* ctx) { PITYASSERT( pity.getProcessDir() == TestUnit::getGlobalRootDir() + "test_processdirs_node_2_node_2_1/", pity.getProcessDir()); return 0; }); //3 suite .addNew( "node 3", [=](TestUnit& pity, TestContext* ctx) { PITYASSERT( pity.getProcessDir() == TestUnit::getGlobalRootDir() + "test_processdirs_node_3/", pity.getProcessDir()); return 0; }, nullptr, PityUnit<>::ExecutionMode::PROCESS_PARALLEL) ->addNew( "node 3.1", [](TestUnit& pity, TestContext* ctx) { PITYASSERT( pity.getProcessDir() == TestUnit::getGlobalRootDir() + "test_processdirs_node_3/", pity.getProcessDir()); return 0; }) ->addNew( "node 3.1.1", [](TestUnit& pity, TestContext* ctx) { PITYASSERT( pity.getProcessDir() == TestUnit::getGlobalRootDir() + "test_processdirs_node_3/", pity.getProcessDir()); return 0; }) ->addNew( "node 3.1.1.1", [](TestUnit& pity, TestContext* ctx) { PITYASSERT( pity.getProcessDir() == TestUnit::getGlobalRootDir() + "test_processdirs_node_3_node_3_1_node_3_1_1_node_3_1_1_1/", pity.getProcessDir()); return 0; }, nullptr, PityUnit<>::ExecutionMode::PROCESS_PARALLEL) ->addNew("node 3.1.1.1.1", [](TestUnit& pity, TestContext* ctx) { PITYASSERT( pity.getProcessDir() == TestUnit::getGlobalRootDir() + "test_processdirs_node_3_node_3_1_node_3_1_1_node_3_1_1_1/", pity.getProcessDir()); return 0; }); suite.run(); }