unittest.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Tencent is pleased to support the open source community by making RapidJSON available.
  2. //
  3. // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
  4. //
  5. // Licensed under the MIT License (the "License"); you may not use this file except
  6. // in compliance with the License. You may obtain a copy of the License at
  7. //
  8. // http://opensource.org/licenses/MIT
  9. //
  10. // Unless required by applicable law or agreed to in writing, software distributed
  11. // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  12. // CONDITIONS OF ANY KIND, either express or implied. See the License for the
  13. // specific language governing permissions and limitations under the License.
  14. #include "unittest.h"
  15. #include "rapidjson/rapidjson.h"
  16. #ifdef __clang__
  17. #pragma GCC diagnostic push
  18. #if __has_warning("-Wdeprecated")
  19. #pragma GCC diagnostic ignored "-Wdeprecated"
  20. #endif
  21. #endif
  22. AssertException::~AssertException() throw() {}
  23. #ifdef __clang__
  24. #pragma GCC diagnostic pop
  25. #endif
  26. int main(int argc, char **argv) {
  27. ::testing::InitGoogleTest(&argc, argv);
  28. std::cout << "RapidJSON v" << RAPIDJSON_VERSION_STRING << std::endl;
  29. #ifdef _MSC_VER
  30. _CrtMemState memoryState = { 0 };
  31. (void)memoryState;
  32. _CrtMemCheckpoint(&memoryState);
  33. //_CrtSetBreakAlloc(X);
  34. //void *testWhetherMemoryLeakDetectionWorks = malloc(1);
  35. #endif
  36. int ret = RUN_ALL_TESTS();
  37. #ifdef _MSC_VER
  38. // Current gtest constantly leak 2 blocks at exit
  39. _CrtMemDumpAllObjectsSince(&memoryState);
  40. #endif
  41. return ret;
  42. }