From 8b8ff64be273d9e74ac64d7efd1d5f6b2c70d362 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Mon, 17 May 2021 12:50:49 +0200 Subject: PRIx macros: add some actual testing Not just a compile-time one (that the macros compile and don't raise warnings). Change-Id: I5642bf242a6c26a33730708f3c1710237fc107a2 Reviewed-by: Thiago Macieira --- tests/auto/corelib/global/qglobal/tst_qglobal.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'tests/auto/corelib/global/qglobal') diff --git a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp index d2a449bb58..5547f832ff 100644 --- a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp +++ b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp @@ -674,27 +674,27 @@ void tst_QGlobal::PRImacros() // none of these calls must generate a -Wformat warning { quintptr p = 123u; - (void)QString::asprintf("The value %" PRIuQUINTPTR " is nice", p); - (void)QString::asprintf("The value %" PRIoQUINTPTR " is nice", p); - (void)QString::asprintf("The value %" PRIxQUINTPTR " is nice", p); - (void)QString::asprintf("The value %" PRIXQUINTPTR " is nice", p); + QCOMPARE(QString::asprintf("The value %" PRIuQUINTPTR " is nice", p), "The value 123 is nice"); + QCOMPARE(QString::asprintf("The value %" PRIoQUINTPTR " is nice", p), "The value 173 is nice"); + QCOMPARE(QString::asprintf("The value %" PRIxQUINTPTR " is nice", p), "The value 7b is nice"); + QCOMPARE(QString::asprintf("The value %" PRIXQUINTPTR " is nice", p), "The value 7B is nice"); } { qintptr p = 123; - (void)QString::asprintf("The value %" PRIdQINTPTR " is nice", p); - (void)QString::asprintf("The value %" PRIiQINTPTR " is nice", p); + QCOMPARE(QString::asprintf("The value %" PRIdQINTPTR " is nice", p), "The value 123 is nice"); + QCOMPARE(QString::asprintf("The value %" PRIiQINTPTR " is nice", p), "The value 123 is nice"); } { qptrdiff d = 123; - (void)QString::asprintf("The value %" PRIdQPTRDIFF " is nice", d); - (void)QString::asprintf("The value %" PRIiQPTRDIFF " is nice", d); + QCOMPARE(QString::asprintf("The value %" PRIdQPTRDIFF " is nice", d), "The value 123 is nice"); + QCOMPARE(QString::asprintf("The value %" PRIiQPTRDIFF " is nice", d), "The value 123 is nice"); } { qsizetype s = 123; - (void)QString::asprintf("The value %" PRIdQSIZETYPE " is nice", s); - (void)QString::asprintf("The value %" PRIiQSIZETYPE " is nice", s); + QCOMPARE(QString::asprintf("The value %" PRIdQSIZETYPE " is nice", s), "The value 123 is nice"); + QCOMPARE(QString::asprintf("The value %" PRIiQSIZETYPE " is nice", s), "The value 123 is nice"); } } -- cgit v1.2.3