summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2023-09-15 12:20:51 +0200
committerMarc Mutz <marc.mutz@qt.io>2023-12-09 21:00:16 +0100
commitca38ac77313cd4ad1436fae28ec43dc219ea341d (patch)
tree0a0f83309c75f65456ad5d90b6c6ad4e7f474630
parentab910e09c713161f568a867a09af5a52eb79c35f (diff)
tst_QUuid: use int128 literals and QCOMPARE supportv6.7.0-beta1
When the test was written, we didn't have support for either int128 literals or proper QCOMPARE failure printing (QTest::toString()), so the code awkwardly constructed literals from 64-bit ones using arithmetic and QCOMPAREed the high and low 64-bit halves separately. Now that we have added support for both, simplify the test code accordingly. Change-Id: Icdee7bb01f6e4bd3de74233b4fb992b0590ddafd Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-rw-r--r--tests/auto/corelib/plugin/quuid/tst_quuid.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp
index b637596536..5872993b2b 100644
--- a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp
+++ b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp
@@ -266,19 +266,16 @@ void tst_QUuid::id128()
void tst_QUuid::uint128()
{
#ifdef QT_SUPPORTS_INT128
- constexpr quint128 u = quint128(Q_UINT64_C(0xfc69b59ecc344436)) << 64
- | Q_UINT64_C(0xa43cee95d128b8c5); // This is LE
+ constexpr quint128 u = Q_UINT128_C(0xfc69b59e'cc344436'a43cee95'd128b8c5); // This is LE
constexpr quint128 be = qToBigEndian(u);
constexpr QUuid uuid = QUuid::fromUInt128(be);
static_assert(uuid.toUInt128() == be, "Round-trip through QUuid failed");
QCOMPARE(uuid, uuidA);
- QCOMPARE(quint64(uuid.toUInt128() >> 64), quint64(be >> 64));
- QCOMPARE(quint64(uuid.toUInt128()), quint64(be));
+ QCOMPARE(uuid.toUInt128(), be);
quint128 le = qFromBigEndian(be);
- QCOMPARE(quint64(uuid.toUInt128(QSysInfo::LittleEndian) >> 64), quint64(le >> 64));
- QCOMPARE(quint64(uuid.toUInt128(QSysInfo::LittleEndian)), quint64(le));
+ QCOMPARE(uuid.toUInt128(QSysInfo::LittleEndian), le);
QCOMPARE(QUuid::fromUInt128(le, QSysInfo::LittleEndian), uuidA);
QUuid::Id128Bytes bytes = { .data128 = { qToBigEndian(u) } };