Testlib: Make QTEST_ASSERT usable in constexpr functions

Commit 8ea27bb1c669e21100a6a042b0378b3346bdf671 adapted the definition
of Q_ASSERT already.

Adopt the same logic for QTEST_ASSERT.

Change-Id: I5a5d0f62df79b18635d3b426a439c35b25d739c2
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit d4d600d411333bdfbcd116993ce30abd97b2a9aa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Kai Köhne 2023-07-11 17:09:39 +02:00 committed by Qt Cherry-pick Bot
parent b9c4fb7e61
commit 56c40449ae

View File

@ -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