diff --git a/unit_test/gtest_mem_main.cpp b/unit_test/gtest_mem_main.cpp index 77649e8b..9de94ac6 100644 --- a/unit_test/gtest_mem_main.cpp +++ b/unit_test/gtest_mem_main.cpp @@ -1,24 +1,27 @@ -/** +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +/* * This file implements a main() function for Google Test that runs all tests * and detects memory leaks. */ #include "mem_leak_detector.h" -#include #include +#include MemoryLeakDetector* leakDetector; -GTEST_API_ int main(int argc, char **argv) +GTEST_API_ int main(int argc, char** argv) { - std::cout << "Running main() from gtest_mem_main.cpp" << std::endl; + std::puts("Running main() from gtest_mem_main.cpp"); - testing::InitGoogleTest(&argc, argv); - leakDetector = new MemoryLeakDetector(); + testing::InitGoogleTest(&argc, argv); + leakDetector = new MemoryLeakDetector(); #if _MSC_VER - testing::UnitTest::GetInstance()->listeners().Append(leakDetector); + testing::UnitTest::GetInstance()->listeners().Append(leakDetector); #endif - return RUN_ALL_TESTS(); + return RUN_ALL_TESTS(); } \ No newline at end of file diff --git a/unit_test/mem_leak_detector.h b/unit_test/mem_leak_detector.h index 3643ec04..0997afe8 100644 --- a/unit_test/mem_leak_detector.h +++ b/unit_test/mem_leak_detector.h @@ -24,7 +24,7 @@ class MemoryLeakDetector : public testing::EmptyTestEventListener } void OnTestEnd(const testing::TestInfo& test_info) override - { + { if(test_info.result()->Passed() && enabled) { _CrtMemState stateNow, stateDiff; diff --git a/unit_test/test_classes.h b/unit_test/test_classes.h index 0c093d6e..a708e032 100644 --- a/unit_test/test_classes.h +++ b/unit_test/test_classes.h @@ -21,7 +21,7 @@ class MemoryLeakDetector; -extern MemoryLeakDetector* leakDetector; +extern MemoryLeakDetector * leakDetector; #if (defined _MSC_VER and __cpp_lib_ranges >= 201911) or __cpp_lib_ranges > 202000