diff options
author | Kai Köhne <kai.koehne@qt.io> | 2023-07-11 17:09:39 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2023-07-17 08:33:40 +0000 |
commit | d4d600d411333bdfbcd116993ce30abd97b2a9aa (patch) | |
tree | e12db6cfb257cb5162d2da33c0cd1d697dbf4137 /src/testlib/qtestassert.h | |
parent | 0493504f34c6673e05be630d8096cf2a78a780b1 (diff) |
Testlib: Make QTEST_ASSERT usable in constexpr functions
Commit 8ea27bb1c669e21100a6a042b0378b3346bdf671 adapted the definition
of Q_ASSERT already.
Adopt the same logic for QTEST_ASSERT.
Pick-to: 6.5 6.6
Change-Id: I5a5d0f62df79b18635d3b426a439c35b25d739c2
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/testlib/qtestassert.h')
-rw-r--r-- | src/testlib/qtestassert.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/testlib/qtestassert.h b/src/testlib/qtestassert.h index f112d847ae..63ebbed71c 100644 --- a/src/testlib/qtestassert.h +++ b/src/testlib/qtestassert.h @@ -8,10 +8,9 @@ QT_BEGIN_NAMESPACE +#define QTEST_ASSERT(cond) ((cond) ? static_cast<void>(0) : qt_assert(#cond, __FILE__, __LINE__)) -#define QTEST_ASSERT(cond) do { if (!(cond)) qt_assert(#cond,__FILE__,__LINE__); } while (false) - -#define QTEST_ASSERT_X(cond, where, what) do { if (!(cond)) qt_assert_x(where, what,__FILE__,__LINE__); } while (false) +#define QTEST_ASSERT_X(cond, where, what) ((cond) ? static_cast<void>(0) : qt_assert_x(where, what, __FILE__, __LINE__)) QT_END_NAMESPACE |