diff options
author | Marc Mutz <marc.mutz@qt.io> | 2023-09-12 23:38:34 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2023-09-13 09:18:40 +0200 |
commit | 32f66f7008ce8fff1a8cdc5219978d1a61d4684c (patch) | |
tree | 11af50f8b57fae7c869dbb53d99d51c345680957 /tests/auto/corelib/global/qglobal | |
parent | 39d3af0c29147ff319e89c0be602d99af0af0996 (diff) |
Add some tests for q(u)int128
Check that QIntegerForSize<16> and std::numeric_limits<quint128> work
and that q(u)int128 are available in C mode, too.
Pick-to: 6.6
Change-Id: I44af8282399c78f6e74a8268af53bad64407ca34
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/global/qglobal')
-rw-r--r-- | tests/auto/corelib/global/qglobal/qglobal.c | 7 | ||||
-rw-r--r-- | tests/auto/corelib/global/qglobal/tst_qglobal.cpp | 6 |
2 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/corelib/global/qglobal/qglobal.c b/tests/auto/corelib/global/qglobal/qglobal.c index 46745ef368..c8dbbc318f 100644 --- a/tests/auto/corelib/global/qglobal/qglobal.c +++ b/tests/auto/corelib/global/qglobal/qglobal.c @@ -4,6 +4,7 @@ #include <QtCore/qglobal.h> #include <QtCore/qtversion.h> #include <QtCore/qyieldcpu.h> +#include <QtCore/qtypes.h> #ifdef Q_COMPILER_THREAD_LOCAL # include <threads.h> @@ -50,6 +51,12 @@ void tst_GlobalTypes() qintptr qip; quintptr qup; Q_UNUSED(qs); Q_UNUSED(qp); Q_UNUSED(qip); Q_UNUSED(qup); + +#ifdef QT_SUPPORTS_INT128 + qint128 s128; + quint128 u128; + Q_UNUSED(s128); Q_UNUSED(u128); +#endif /* QT_SUPPORTS_INT128 */ } /* Qt version */ diff --git a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp index 48b5714086..cf37b1ecb8 100644 --- a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp +++ b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp @@ -424,11 +424,17 @@ void tst_QGlobal::integerForSize() static_assert(sizeof(QIntegerForSize<2>::Signed) == 2); static_assert(sizeof(QIntegerForSize<4>::Signed) == 4); static_assert(sizeof(QIntegerForSize<8>::Signed) == 8); +#ifdef QT_SUPPORTS_INT128 + static_assert(sizeof(QIntegerForSize<16>::Signed) == 16); +#endif static_assert(sizeof(QIntegerForSize<1>::Unsigned) == 1); static_assert(sizeof(QIntegerForSize<2>::Unsigned) == 2); static_assert(sizeof(QIntegerForSize<4>::Unsigned) == 4); static_assert(sizeof(QIntegerForSize<8>::Unsigned) == 8); +#ifdef QT_SUPPORTS_INT128 + static_assert(sizeof(QIntegerForSize<16>::Unsigned) == 16); +#endif } typedef QPair<const char *, const char *> stringpair; |