diff options
author | Arsentiy Milchakov <milcars@mapswithme.com> | 2017-06-28 19:26:46 +0300 |
---|---|---|
committer | Ilya Zverev <ilya@zverev.info> | 2017-06-28 19:41:05 +0300 |
commit | fc7d0d162ef69703ab17cc00bd900ec4e8a9c023 (patch) | |
tree | 0c4bf9fc74bc3741a69d921e229413ad63e0ddee /base | |
parent | c878b6a37dd87f57c9db8754a9e30e2ea713220c (diff) |
review fixes
Diffstat (limited to 'base')
-rw-r--r-- | base/base_tests/logging_test.cpp | 19 | ||||
-rw-r--r-- | base/logging.hpp | 2 | ||||
-rw-r--r-- | base/newtype.hpp | 2 |
3 files changed, 11 insertions, 12 deletions
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<Type, Tag> 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); \ } |