From 9f4fcd098e4c0c3febe2812cc99e0bf75ac27680 Mon Sep 17 00:00:00 2001 From: Ashod Nakashian Date: Mon, 22 Mar 2021 11:32:07 -0400 Subject: [PATCH] wsd: test: make test assertion failures more obvious Change-Id: Id076c9b270837840d8aa2bc88fa42e0861ad6df7 Signed-off-by: Ashod Nakashian --- test/lokassert.hpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/lokassert.hpp b/test/lokassert.hpp index 785d764ee..efcfa710f 100644 --- a/test/lokassert.hpp +++ b/test/lokassert.hpp @@ -35,7 +35,7 @@ inline std::ostream& operator<<(std::ostream& os, const std::vector& v) { \ if (!(condition)) \ { \ - TST_LOG_NAME("unittest", "Assertion failure: " << (#condition)); \ + TST_LOG_NAME("unittest", "ERROR: Assertion failure: " << (#condition)); \ LOK_ASSERT_IMPL(condition); \ CPPUNIT_ASSERT(condition); \ } \ @@ -46,7 +46,7 @@ inline std::ostream& operator<<(std::ostream& os, const std::vector& v) { \ if (!((expected) == (actual))) \ { \ - TST_LOG_NAME("unittest", "Assertion failure: Expected [" \ + TST_LOG_NAME("unittest", "ERROR: Assertion failure: Expected [" \ << (expected) << "] but got [" << (actual) << ']'); \ LOK_ASSERT_IMPL((expected) == (actual)); \ CPPUNIT_ASSERT_EQUAL((expected), (actual)); \ @@ -62,9 +62,9 @@ inline std::ostream& operator<<(std::ostream& os, const std::vector& v) std::ostringstream oss##__LINE__; \ oss##__LINE__ << message; \ const auto msg##__LINE__ = oss##__LINE__.str(); \ - TST_LOG_NAME("unittest", "Assertion failure: " << msg##__LINE__ << ". Expected [" \ - << (expected) << "] but got [" \ - << (actual) << "]: "); \ + TST_LOG_NAME("unittest", "ERROR: Assertion failure: " \ + << msg##__LINE__ << ". Expected [" << (expected) \ + << "] but got [" << (actual) << "]: "); \ CPPUNIT_ASSERT_EQUAL_MESSAGE(msg##__LINE__, (expected), (actual)); \ } \ } while (false) @@ -74,8 +74,8 @@ inline std::ostream& operator<<(std::ostream& os, const std::vector& v) { \ if (!(condition)) \ { \ - TST_LOG_NAME("unittest", \ - "Assertion failure: " << (message) << ". Condition: " << (#condition)); \ + TST_LOG_NAME("unittest", "ERROR: Assertion failure: " << (message) << ". Condition: " \ + << (#condition)); \ LOK_ASSERT_IMPL(condition); \ CPPUNIT_ASSERT_MESSAGE((message), (condition)); \ } \ @@ -84,7 +84,7 @@ inline std::ostream& operator<<(std::ostream& os, const std::vector& v) #define LOK_ASSERT_FAIL(message) \ do \ { \ - TST_LOG_NAME("unittest", "Forced failure: " << (message)); \ + TST_LOG_NAME("unittest", "ERROR: Forced failure: " << (message)); \ LOK_ASSERT_IMPL(!"Forced failure"); \ CPPUNIT_FAIL((message)); \ } while (false)