From fc7d0d162ef69703ab17cc00bd900ec4e8a9c023 Mon Sep 17 00:00:00 2001 From: Arsentiy Milchakov Date: Wed, 28 Jun 2017 19:26:46 +0300 Subject: review fixes --- base/base_tests/logging_test.cpp | 19 +++++++++---------- base/logging.hpp | 2 +- base/newtype.hpp | 2 +- 3 files changed, 11 insertions(+), 12 deletions(-) (limited to 'base') diff --git a/base/base_tests/logging_test.cpp b/base/base_tests/logging_test.cpp index 365db44668..b7b39c994b 100644 --- a/base/base_tests/logging_test.cpp +++ b/base/base_tests/logging_test.cpp @@ -19,11 +19,10 @@ namespace return 3; } - bool g_NegativeFunctionCalled; - bool NegativeFunction() + bool BoolFunction(bool result, bool & called) { - g_NegativeFunctionCalled = true; - return false; + called = true; + return result; } } @@ -53,11 +52,11 @@ UNIT_TEST(NullMessage) UNIT_TEST(Logging_ConditionalLog) { - g_SomeFunctionCalled = false; - CLOG(LINFO, SomeFunction(), ("This should not pass")); - TEST(g_SomeFunctionCalled, ()); + bool isCalled = false; + CLOG(LINFO, BoolFunction(true, isCalled), ("This should not be displayed")); + TEST(isCalled, ()); - g_NegativeFunctionCalled = false; - CLOG(LWARNING, NegativeFunction(), ("This should pass")); - TEST(g_NegativeFunctionCalled, ()); + isCalled = false; + CLOG(LWARNING, BoolFunction(false, isCalled), ("This should be displayed")); + TEST(isCalled, ()); } diff --git a/base/logging.hpp b/base/logging.hpp index 147958938a..2bbcbd75e8 100644 --- a/base/logging.hpp +++ b/base/logging.hpp @@ -92,6 +92,6 @@ using ::my::LCRITICAL; #define CLOG(level, X, msg) \ do \ { \ - if (!X) \ + if (!(X)) \ LOG(level, (SRC(), "CLOG(" #X ")", ::my::impl::Message msg)); \ } while (false) diff --git a/base/newtype.hpp b/base/newtype.hpp index a51e35b65f..50f0cab9fc 100644 --- a/base/newtype.hpp +++ b/base/newtype.hpp @@ -161,7 +161,7 @@ std::string SimpleDebugPrint(NewType const & nt) { \ return my::newtype_default_output::SimpleDebugPrint(nt); \ } \ - inline ostream & operator<<(ostream & ost, NAME const & nt) \ + inline std::ostream & operator<<(std::ostream & ost, NAME const & nt) \ { \ return ost << my::newtype_default_output::SimpleDebugPrint(nt); \ } -- cgit v1.2.3