C++11 library providing functionality common to all adapters.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
3.2 KiB

  1. #include "../src/PityTest.hh"
  2. #include <iostream>
  3. #include <algorithm>
  4. using namespace std;
  5. using namespace pEp::PityTest11;
  6. using TestContext = void;
  7. using TestUnit = PityUnit<>;
  8. //TODO: Add HOME testing
  9. void printHomeDir(TestUnit& myself)
  10. {
  11. // TESTLOG(string(myself.getFQName() + " - PID: " + to_string(getpid())));
  12. // cout << "[" << to_string(getpid()) << "/" << myself.getFQName() << "] - " << endl;
  13. setenv("HOME", myself.processDir().c_str(), 1);
  14. myself.log("HOME=" + string(getenv("HOME")));
  15. }
  16. int main(int argc, char* argv[])
  17. {
  18. PityUnit<>::debug_log_enabled = false;
  19. // Suite
  20. TestUnit suite = TestUnit{ "test_processdirs" };
  21. // 1
  22. suite
  23. .addNew<TestUnit>(
  24. "node 1",
  25. [](TestUnit& pity, TestContext* ctx) {
  26. PITYASSERT(pity.processDir() == "./pitytest_data/test_processdirs/", "node 1");
  27. return 0;
  28. })
  29. .addNew<TestUnit>("node 1.1", [](TestUnit& pity, TestContext* ctx) {
  30. PITYASSERT(pity.processDir() == "./pitytest_data/test_processdirs/", "node 1.1");
  31. return 0;
  32. });
  33. // 2
  34. suite
  35. .addNew<TestUnit>(
  36. "node 2",
  37. [](TestUnit& pity, TestContext* ctx) {
  38. PITYASSERT(pity.processDir() == "./pitytest_data/test_processdirs/", "node 2");
  39. return 0;
  40. })
  41. .addNew<TestUnit>(
  42. "node 2.1",
  43. [](TestUnit& pity, TestContext* ctx) {
  44. PITYASSERT(pity.processDir() == "./pitytest_data/test_processdirs/node_2_1/", "");
  45. return 0;
  46. },
  47. nullptr,
  48. PityUnit<>::ExecutionMode::PROCESS_PARALLEL)
  49. .addNew<TestUnit>("node 2.1.1", [](TestUnit& pity, TestContext* ctx) {
  50. PITYASSERT(pity.processDir() == "./pitytest_data/test_processdirs/node_2_1/", "");
  51. return 0;
  52. });
  53. // 3
  54. suite
  55. .addNew<TestUnit>(
  56. "node 3",
  57. [](TestUnit& pity, TestContext* ctx) {
  58. PITYASSERT(pity.processDir() == "./pitytest_data/test_processdirs/node_3/", "");
  59. return 0;
  60. },
  61. nullptr,
  62. PityUnit<>::ExecutionMode::PROCESS_PARALLEL)
  63. .addNew<TestUnit>(
  64. "node 3.1",
  65. [](TestUnit& pity, TestContext* ctx) {
  66. PITYASSERT(pity.processDir() == "./pitytest_data/test_processdirs/node_3/", "");
  67. return 0;
  68. })
  69. .addNew<TestUnit>(
  70. "node 3.1.1",
  71. [](TestUnit& pity, TestContext* ctx) {
  72. PITYASSERT(pity.processDir() == "./pitytest_data/test_processdirs/node_3/", "");
  73. return 0;
  74. })
  75. .addNew<TestUnit>(
  76. "node 3.1.1",
  77. [](TestUnit& pity, TestContext* ctx) {
  78. PITYASSERT(pity.processDir() == "./pitytest_data/test_processdirs/node_3_1_1/", "");
  79. return 0;
  80. },
  81. nullptr,
  82. PityUnit<>::ExecutionMode::PROCESS_PARALLEL)
  83. .addNew<TestUnit>("node 3.1.1.1", [](TestUnit& pity, TestContext* ctx) {
  84. PITYASSERT(pity.processDir() == "./pitytest_data/test_processdirs/node_3_1_1/", "");
  85. return 0;
  86. });
  87. suite.run();
  88. }