| 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. |
| 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 |
|
| 15 |
#include "unittest.h" |
| 16 |
#include "rapidjson/rapidjson.h" |
| 17 |
|
| 18 |
#ifdef __clang__ |
| 19 |
#pragma GCC diagnostic push |
| 20 |
#if __has_warning("-Wdeprecated") |
| 21 |
#pragma GCC diagnostic ignored "-Wdeprecated" |
| 22 |
#endif |
| 23 |
#endif |
| 24 |
|
| 25 |
AssertException::~AssertException() throw() {} |
| 26 |
|
| 27 |
#ifdef __clang__ |
| 28 |
#pragma GCC diagnostic pop |
| 29 |
#endif |
| 30 |
|
| 31 |
int main(int argc, char **argv) { |
| 32 |
::testing::InitGoogleTest(&argc, argv); |
| 33 |
|
| 34 |
std::cout << "RapidJSON v" << RAPIDJSON_VERSION_STRING << std::endl; |
| 35 |
|
| 36 |
#ifdef _MSC_VER |
| 37 |
_CrtMemState memoryState = { 0 }; |
| 38 |
(void)memoryState; |
| 39 |
_CrtMemCheckpoint(&memoryState); |
| 40 |
//_CrtSetBreakAlloc(X); |
| 41 |
//void *testWhetherMemoryLeakDetectionWorks = malloc(1); |
| 42 |
#endif |
| 43 |
|
| 44 |
int ret = RUN_ALL_TESTS(); |
| 45 |
|
| 46 |
#ifdef _MSC_VER |
| 47 |
// Current gtest constantly leak 2 blocks at exit |
| 48 |
_CrtMemDumpAllObjectsSince(&memoryState); |
| 49 |
#endif |
| 50 |
return ret; |
| 51 |
} |