From 6d517d353acea856af25a2167a230c4d9ba2bea0 Mon Sep 17 00:00:00 2001 From: berrux_dev Date: Tue, 17 Nov 2026 17:12:26 +0100 Subject: [PATCH] Fix signed/unsigned QCOMPARE in utils_test byteAccess get8Byte round-trips the bits correctly (the uint64_t path for the same value passed), but QCOMPARE of the signed int64_t result against the unsigned literal 0x8234567812345678 fails in QtTest even though the bit patterns are identical (top bit set). Compare against the explicitly signed form instead: QCOMPARE(i, static_cast(0x8234567812345678ULL)). utils_test now passes 37/37. --- .../Common/LtsUtils/LtsUtilsCore/UnitTests/utils_test.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qt6-after/qt6-migrated-legatus/Lts/Common/LtsUtils/LtsUtilsCore/UnitTests/utils_test.cpp b/qt6-after/qt6-migrated-legatus/Lts/Common/LtsUtils/LtsUtilsCore/UnitTests/utils_test.cpp index 9c3fb38ef..6566e6ffd 100644 --- a/qt6-after/qt6-migrated-legatus/Lts/Common/LtsUtils/LtsUtilsCore/UnitTests/utils_test.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Common/LtsUtils/LtsUtilsCore/UnitTests/utils_test.cpp @@ -1042,7 +1042,10 @@ void LtsUtilsTest::byteAccess() LtsUtils::get8Byte(ba, pos, i); QCOMPARE(i, 0x1234567812345678); LtsUtils::get8Byte(ba, pos, i); - QCOMPARE(i, 0x8234567812345678); + // Top bit set: as a signed int64_t this value is negative. Compare against + // the explicitly-signed form (QCOMPARE of a signed int64_t against the + // unsigned literal fails even though the bits are identical). + QCOMPARE(i, static_cast(0x8234567812345678ULL)); uint64_t u = 0; pos = 0;