AllTestsMain.cpp 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #include "oatpp/web/FullTest.hpp"
  2. #include "oatpp/web/FullAsyncTest.hpp"
  3. #include "oatpp/web/server/api/ApiControllerTest.hpp"
  4. #include "oatpp/network/virtual_/PipeTest.hpp"
  5. #include "oatpp/network/virtual_/InterfaceTest.hpp"
  6. #include "oatpp/network/UrlTest.hpp"
  7. #include "oatpp/core/data/stream/ChunkedBufferTest.hpp"
  8. #include "oatpp/core/data/share/MemoryLabelTest.hpp"
  9. #include "oatpp/parser/json/mapping/DeserializerTest.hpp"
  10. #include "oatpp/parser/json/mapping/DTOMapperPerfTest.hpp"
  11. #include "oatpp/parser/json/mapping/DTOMapperTest.hpp"
  12. #include "oatpp/encoding/UnicodeTest.hpp"
  13. #include "oatpp/encoding/Base64Test.hpp"
  14. #include "oatpp/core/parser/CaretTest.hpp"
  15. #include "oatpp/core/data/mapping/type/TypeTest.hpp"
  16. #include "oatpp/core/base/collection/LinkedListTest.hpp"
  17. #include "oatpp/core/base/memory/MemoryPoolTest.hpp"
  18. #include "oatpp/core/base/memory/PerfTest.hpp"
  19. #include "oatpp/core/base/CommandLineArgumentsTest.hpp"
  20. #include "oatpp/core/base/RegRuleTest.hpp"
  21. #include "oatpp/core/concurrency/SpinLock.hpp"
  22. #include "oatpp/core/base/Environment.hpp"
  23. #include <iostream>
  24. #ifdef OATPP_ENABLE_ALL_TESTS_MAIN
  25. namespace {
  26. class Logger : public oatpp::base::Logger {
  27. private:
  28. oatpp::concurrency::SpinLock::Atom m_atom;
  29. public:
  30. Logger()
  31. : m_atom(false)
  32. {}
  33. void log(v_int32 priority, const std::string& tag, const std::string& message) override {
  34. oatpp::concurrency::SpinLock lock(m_atom);
  35. std::cout << tag << ":" << message << "\n";
  36. }
  37. };
  38. void runTests() {
  39. oatpp::base::Environment::printCompilationConfig();
  40. OATPP_RUN_TEST(oatpp::test::base::RegRuleTest);
  41. OATPP_RUN_TEST(oatpp::test::base::CommandLineArgumentsTest);
  42. OATPP_RUN_TEST(oatpp::test::memory::MemoryPoolTest);
  43. OATPP_RUN_TEST(oatpp::test::memory::PerfTest);
  44. OATPP_RUN_TEST(oatpp::test::collection::LinkedListTest);
  45. OATPP_RUN_TEST(oatpp::test::core::data::share::MemoryLabelTest);
  46. OATPP_RUN_TEST(oatpp::test::core::data::stream::ChunkedBufferTest);
  47. OATPP_RUN_TEST(oatpp::test::core::data::mapping::type::TypeTest);
  48. OATPP_RUN_TEST(oatpp::test::parser::CaretTest);
  49. OATPP_RUN_TEST(oatpp::test::parser::json::mapping::DeserializerTest);
  50. OATPP_RUN_TEST(oatpp::test::parser::json::mapping::DTOMapperPerfTest);
  51. OATPP_RUN_TEST(oatpp::test::parser::json::mapping::DTOMapperTest);
  52. OATPP_RUN_TEST(oatpp::test::encoding::Base64Test);
  53. OATPP_RUN_TEST(oatpp::test::encoding::UnicodeTest);
  54. OATPP_RUN_TEST(oatpp::test::network::UrlTest);
  55. OATPP_RUN_TEST(oatpp::test::network::virtual_::PipeTest);
  56. OATPP_RUN_TEST(oatpp::test::network::virtual_::InterfaceTest);
  57. OATPP_RUN_TEST(oatpp::test::web::server::api::ApiControllerTest);
  58. OATPP_RUN_TEST(oatpp::test::web::FullTest);
  59. OATPP_RUN_TEST(oatpp::test::web::FullAsyncTest);
  60. }
  61. }
  62. int main() {
  63. oatpp::base::Environment::init();
  64. oatpp::base::Environment::setLogger(new Logger());
  65. runTests();
  66. oatpp::base::Environment::setLogger(nullptr);
  67. oatpp::base::Environment::destroy();
  68. /* Print how much objects were created during app running, and what have left-probably leaked */
  69. /* Disable object counting for release builds using '-D OATPP_DISABLE_ENV_OBJECT_COUNTERS' flag for better performance */
  70. std::cout << "\nEnvironment:\n";
  71. std::cout << "objectsCount = " << oatpp::base::Environment::getObjectsCount() << "\n";
  72. std::cout << "objectsCreated = " << oatpp::base::Environment::getObjectsCreated() << "\n\n";
  73. OATPP_ASSERT(oatpp::base::Environment::getObjectsCount() == 0);
  74. oatpp::base::Environment::destroy();
  75. return 0;
  76. }
  77. #endif