Skip to content

Commit fb58993

Browse files
committed
Apply clang-format and cmake-format
1 parent b582d7f commit fb58993

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

cmake/modules/TestTarget.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ if (NOT META_NO_CPP_UNIT)
1717
# allow disabling CppUnit-based tests completely
1818
option(ENABLE_CPP_UNIT "whether CppUnit-based tests should be enabled" ON)
1919
option(ENABLE_CPPUNIT2GTEST "whether to allow CppUnit2Gtest to be used instead of cppunit" ON)
20-
20+
2121
# if user has Ray's adapter layer use it instead
2222
find_package(CppUnit2Gtest QUIET)
23-
if(ENABLE_CPPUNIT2GTEST AND CppUnit2Gtest_FOUND)
23+
if (ENABLE_CPPUNIT2GTEST AND CppUnit2Gtest_FOUND)
2424
find_package(GTest REQUIRED)
2525
set(DETECTED_CPP_UNIT_LIB CppUnit2Gtest::CppUnit2Gtest)
2626
message(STATUS "Using CppUnit2Gtest instead of cppunit")

tests/outputcheck.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,17 @@ inline OutputCheck::OutputCheck(std::function<void(const std::string &)> &&custo
7272
*/
7373
inline OutputCheck::~OutputCheck() noexcept(false)
7474
{
75-
# ifdef CppUnit2Gtest
76-
# define ExpectEqual(a, b) EXPECT_EQ(a,b); if (!(a == b) ) throw std::logic_error("bad assert")
77-
# define Fail(msg) ADD_FAILURE() << msg; throw std::logic_error("bad assert")
78-
# else
79-
# define ExpectEqual(a, b) CPPUNIT_ASSERT_EQUAL(a,b)
80-
# define Fail(msg) CPPUNIT_FAIL(msg)
75+
#ifdef CppUnit2Gtest
76+
#define ExpectEqual(a, b) \
77+
EXPECT_EQ(a, b); \
78+
if (!(a == b)) \
79+
throw std::logic_error("bad assert")
80+
#define Fail(msg) \
81+
ADD_FAILURE() << msg; \
82+
throw std::logic_error("bad assert")
83+
#else
84+
#define ExpectEqual(a, b) CPPUNIT_ASSERT_EQUAL(a, b)
85+
#define Fail(msg) CPPUNIT_FAIL(msg)
8186
#endif
8287
m_os.rdbuf(m_regularOutputBuffer);
8388
const std::string actualOutput(m_buffer.str());

tests/testutils.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -325,11 +325,10 @@ template <typename T, Traits::DisableIf<std::is_integral<T>> * = nullptr> const
325325
* \brief Asserts whether the specified \a string matches the specified \a regex.
326326
* \remarks Requires cppunit.
327327
*/
328-
#define TESTUTILS_ASSERT_LIKE_FLAGS(message, expectedRegex, regexFlags, actualString) \
329-
CPPUNIT_ASSERT_MESSAGE( \
330-
CppUtilities::argsToString('\"', actualString, "\"\n not like\n\"", expectedRegex, '\"', "\n\nExpression: " #actualString, message), \
331-
(std::regex_match(actualString, std::regex(expectedRegex, regexFlags)) ) \
332-
)
328+
#define TESTUTILS_ASSERT_LIKE_FLAGS(message, expectedRegex, regexFlags, actualString) \
329+
CPPUNIT_ASSERT_MESSAGE( \
330+
CppUtilities::argsToString('\"', actualString, "\"\n not like\n\"", expectedRegex, '\"', "\n\nExpression: " #actualString, message), \
331+
(std::regex_match(actualString, std::regex(expectedRegex, regexFlags))))
333332
/*!
334333
* \brief Asserts whether the specified \a string matches the specified \a regex.
335334
* \remarks Requires cppunit.

0 commit comments

Comments
 (0)