diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2021-05-17 12:50:49 +0200 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2021-05-18 02:09:06 +0200 |
commit | 8b8ff64be273d9e74ac64d7efd1d5f6b2c70d362 (patch) | |
tree | 9c53e7a725a34f5be444e84083b21a4105c96fe7 /tests | |
parent | 8f7873272ac9e5c5f1a83a5204afb512843cf8d8 (diff) |
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 <thiago.macieira@intel.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/global/qglobal/tst_qglobal.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
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"); } } |