AllTestsMain.cpp 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. #include "oatpp/web/ClientRetryTest.hpp"
  2. #include "oatpp/web/FullTest.hpp"
  3. #include "oatpp/web/FullAsyncTest.hpp"
  4. #include "oatpp/web/FullAsyncClientTest.hpp"
  5. #include "oatpp/web/PipelineTest.hpp"
  6. #include "oatpp/web/PipelineAsyncTest.hpp"
  7. #include "oatpp/web/protocol/http/encoding/ChunkedTest.hpp"
  8. #include "oatpp/web/server/api/ApiControllerTest.hpp"
  9. #include "oatpp/web/server/handler/AuthorizationHandlerTest.hpp"
  10. #include "oatpp/web/server/HttpRouterTest.hpp"
  11. #include "oatpp/web/server/ServerStopTest.hpp"
  12. #include "oatpp/web/mime/multipart/StatefulParserTest.hpp"
  13. #include "oatpp/network/virtual_/PipeTest.hpp"
  14. #include "oatpp/network/virtual_/InterfaceTest.hpp"
  15. #include "oatpp/network/UrlTest.hpp"
  16. #include "oatpp/network/ConnectionPoolTest.hpp"
  17. #include "oatpp/network/monitor/ConnectionMonitorTest.hpp"
  18. #include "oatpp/parser/json/mapping/DeserializerTest.hpp"
  19. #include "oatpp/parser/json/mapping/DTOMapperPerfTest.hpp"
  20. #include "oatpp/parser/json/mapping/DTOMapperTest.hpp"
  21. #include "oatpp/parser/json/mapping/EnumTest.hpp"
  22. #include "oatpp/parser/json/mapping/UnorderedSetTest.hpp"
  23. #include "oatpp/encoding/UnicodeTest.hpp"
  24. #include "oatpp/encoding/Base64Test.hpp"
  25. #include "oatpp/core/parser/CaretTest.hpp"
  26. #include "oatpp/core/provider/PoolTest.hpp"
  27. #include "oatpp/core/provider/PoolTemplateTest.hpp"
  28. #include "oatpp/core/async/LockTest.hpp"
  29. #include "oatpp/core/data/mapping/type/UnorderedMapTest.hpp"
  30. #include "oatpp/core/data/mapping/type/PairListTest.hpp"
  31. #include "oatpp/core/data/mapping/type/VectorTest.hpp"
  32. #include "oatpp/core/data/mapping/type/UnorderedSetTest.hpp"
  33. #include "oatpp/core/data/mapping/type/ListTest.hpp"
  34. #include "oatpp/core/data/mapping/type/ObjectTest.hpp"
  35. #include "oatpp/core/data/mapping/type/StringTest.hpp"
  36. #include "oatpp/core/data/mapping/type/PrimitiveTest.hpp"
  37. #include "oatpp/core/data/mapping/type/ObjectWrapperTest.hpp"
  38. #include "oatpp/core/data/mapping/type/TypeTest.hpp"
  39. #include "oatpp/core/data/mapping/type/AnyTest.hpp"
  40. #include "oatpp/core/data/mapping/type/EnumTest.hpp"
  41. #include "oatpp/core/data/mapping/type/InterpretationTest.hpp"
  42. #include "oatpp/core/data/mapping/TypeResolverTest.hpp"
  43. #include "oatpp/core/data/resource/InMemoryDataTest.hpp"
  44. #include "oatpp/core/data/stream/BufferStreamTest.hpp"
  45. #include "oatpp/core/data/share/LazyStringMapTest.hpp"
  46. #include "oatpp/core/data/share/StringTemplateTest.hpp"
  47. #include "oatpp/core/data/share/MemoryLabelTest.hpp"
  48. #include "oatpp/core/data/buffer/ProcessorTest.hpp"
  49. #include "oatpp/core/base/CommandLineArgumentsTest.hpp"
  50. #include "oatpp/core/base/LoggerTest.hpp"
  51. #include "oatpp/core/async/Coroutine.hpp"
  52. #include "oatpp/core/Types.hpp"
  53. #include "oatpp/core/base/Environment.hpp"
  54. #include <iostream>
  55. #include <mutex>
  56. namespace {
  57. void runTests() {
  58. oatpp::base::Environment::printCompilationConfig();
  59. OATPP_LOGD("Tests", "coroutine size=%d", sizeof(oatpp::async::AbstractCoroutine));
  60. OATPP_LOGD("Tests", "action size=%d", sizeof(oatpp::async::Action));
  61. OATPP_LOGD("Tests", "class count=%d", oatpp::data::mapping::type::ClassId::getClassCount());
  62. auto names = oatpp::data::mapping::type::ClassId::getRegisteredClassNames();
  63. v_int32 i = 0;
  64. for(auto& name : names) {
  65. OATPP_LOGD("CLASS", "%d --> '%s'", i, name);
  66. i ++;
  67. }
  68. OATPP_RUN_TEST(oatpp::test::base::CommandLineArgumentsTest);
  69. OATPP_RUN_TEST(oatpp::test::base::LoggerTest);
  70. OATPP_RUN_TEST(oatpp::test::core::data::share::MemoryLabelTest);
  71. OATPP_RUN_TEST(oatpp::test::core::data::share::LazyStringMapTest);
  72. OATPP_RUN_TEST(oatpp::test::core::data::share::StringTemplateTest);
  73. OATPP_RUN_TEST(oatpp::test::core::data::buffer::ProcessorTest);
  74. OATPP_RUN_TEST(oatpp::test::core::data::stream::BufferStreamTest);
  75. OATPP_RUN_TEST(oatpp::test::core::data::mapping::type::ObjectWrapperTest);
  76. OATPP_RUN_TEST(oatpp::test::core::data::mapping::type::TypeTest);
  77. OATPP_RUN_TEST(oatpp::test::core::data::mapping::type::StringTest);
  78. OATPP_RUN_TEST(oatpp::test::core::data::mapping::type::PrimitiveTest);
  79. OATPP_RUN_TEST(oatpp::test::core::data::mapping::type::ListTest);
  80. OATPP_RUN_TEST(oatpp::test::core::data::mapping::type::VectorTest);
  81. OATPP_RUN_TEST(oatpp::test::core::data::mapping::type::UnorderedSetTest);
  82. OATPP_RUN_TEST(oatpp::test::core::data::mapping::type::PairListTest);
  83. OATPP_RUN_TEST(oatpp::test::core::data::mapping::type::UnorderedMapTest);
  84. OATPP_RUN_TEST(oatpp::test::core::data::mapping::type::AnyTest);
  85. OATPP_RUN_TEST(oatpp::test::core::data::mapping::type::EnumTest);
  86. OATPP_RUN_TEST(oatpp::test::core::data::mapping::type::ObjectTest);
  87. OATPP_RUN_TEST(oatpp::test::core::data::mapping::type::InterpretationTest);
  88. OATPP_RUN_TEST(oatpp::test::core::data::mapping::TypeResolverTest);
  89. OATPP_RUN_TEST(oatpp::test::core::data::resource::InMemoryDataTest);
  90. OATPP_RUN_TEST(oatpp::test::async::LockTest);
  91. OATPP_RUN_TEST(oatpp::test::parser::CaretTest);
  92. OATPP_RUN_TEST(oatpp::test::core::provider::PoolTest);
  93. OATPP_RUN_TEST(oatpp::test::core::provider::PoolTemplateTest);
  94. OATPP_RUN_TEST(oatpp::test::parser::json::mapping::EnumTest);
  95. OATPP_RUN_TEST(oatpp::test::parser::json::mapping::UnorderedSetTest);
  96. OATPP_RUN_TEST(oatpp::test::parser::json::mapping::DeserializerTest);
  97. OATPP_RUN_TEST(oatpp::test::parser::json::mapping::DTOMapperPerfTest);
  98. OATPP_RUN_TEST(oatpp::test::parser::json::mapping::DTOMapperTest);
  99. OATPP_RUN_TEST(oatpp::test::encoding::Base64Test);
  100. OATPP_RUN_TEST(oatpp::test::encoding::UnicodeTest);
  101. OATPP_RUN_TEST(oatpp::test::network::UrlTest);
  102. OATPP_RUN_TEST(oatpp::test::network::ConnectionPoolTest);
  103. OATPP_RUN_TEST(oatpp::test::network::monitor::ConnectionMonitorTest);
  104. OATPP_RUN_TEST(oatpp::test::network::virtual_::PipeTest);
  105. OATPP_RUN_TEST(oatpp::test::network::virtual_::InterfaceTest);
  106. OATPP_RUN_TEST(oatpp::test::web::protocol::http::encoding::ChunkedTest);
  107. OATPP_RUN_TEST(oatpp::test::web::mime::multipart::StatefulParserTest);
  108. OATPP_RUN_TEST(oatpp::test::web::server::HttpRouterTest);
  109. OATPP_RUN_TEST(oatpp::test::web::server::api::ApiControllerTest);
  110. OATPP_RUN_TEST(oatpp::test::web::server::handler::AuthorizationHandlerTest);
  111. {
  112. oatpp::test::web::server::ServerStopTest test_virtual(0);
  113. test_virtual.run();
  114. oatpp::test::web::server::ServerStopTest test_port(8000);
  115. test_port.run();
  116. }
  117. {
  118. oatpp::test::web::PipelineTest test_virtual(0, 3000);
  119. test_virtual.run();
  120. oatpp::test::web::PipelineTest test_port(8000, 3000);
  121. test_port.run();
  122. }
  123. {
  124. oatpp::test::web::PipelineAsyncTest test_virtual(0, 3000);
  125. test_virtual.run();
  126. oatpp::test::web::PipelineAsyncTest test_port(8000, 3000);
  127. test_port.run();
  128. }
  129. {
  130. oatpp::test::web::FullTest test_virtual(0, 1000);
  131. test_virtual.run();
  132. oatpp::test::web::FullTest test_port(8000, 5);
  133. test_port.run();
  134. }
  135. {
  136. oatpp::test::web::FullAsyncTest test_virtual(0, 1000);
  137. test_virtual.run();
  138. oatpp::test::web::FullAsyncTest test_port(8000, 5);
  139. test_port.run();
  140. }
  141. {
  142. oatpp::test::web::FullAsyncClientTest test_virtual(0, 1000);
  143. test_virtual.run(20);
  144. oatpp::test::web::FullAsyncClientTest test_port(8000, 5);
  145. test_port.run(1);
  146. }
  147. {
  148. oatpp::test::web::ClientRetryTest test_virtual(0);
  149. test_virtual.run();
  150. oatpp::test::web::ClientRetryTest test_port(8000);
  151. test_port.run();
  152. }
  153. }
  154. }
  155. int main() {
  156. oatpp::base::Environment::init();
  157. runTests();
  158. /* Print how much objects were created during app running, and what have left-probably leaked */
  159. /* Disable object counting for release builds using '-D OATPP_DISABLE_ENV_OBJECT_COUNTERS' flag for better performance */
  160. std::cout << "\nEnvironment:\n";
  161. std::cout << "objectsCount = " << oatpp::base::Environment::getObjectsCount() << "\n";
  162. std::cout << "objectsCreated = " << oatpp::base::Environment::getObjectsCreated() << "\n\n";
  163. OATPP_ASSERT(oatpp::base::Environment::getObjectsCount() == 0);
  164. oatpp::base::Environment::destroy();
  165. return 0;
  166. }