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<int64_t>(0x8234567812345678ULL)).
utils_test now passes 37/37.
This commit is contained in:
berrux-dev committed 2026-11-17 17:12:26 +01:00
1 parent d4ff991330
commit 6d517d353a
1 file changed
+4 -1
@@ -1042,7 +1042,10 @@ void LtsUtilsTest::byteAccess()
LtsUtils::get8Byte(ba, pos, i); LtsUtils::get8Byte(ba, pos, i);
QCOMPARE(i, 0x1234567812345678); QCOMPARE(i, 0x1234567812345678);
LtsUtils::get8Byte(ba, pos, i); 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<int64_t>(0x8234567812345678ULL));
uint64_t u = 0; uint64_t u = 0;
pos = 0; pos = 0;