summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2013-11-05 22:14:35 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-06 00:35:43 +0100
commit569dec8e78030689740b2ff99c071862aa9abaaa (patch)
treea21755da85ebf3926911af813def7b1e62df61a5 /tests/auto/corelib/global/qglobal/tst_qglobal.cpp
parente7fd798af001e2c4e323f5ae90e4e994f12ccf33 (diff)
QIntegerForSize: add test
Make sure that the size of QIntegerForSize<N>::{Signed,Unsigned} is actually N. Change-Id: I221304f7c420e80758ef7b115bafb7cf1f8c8829 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'tests/auto/corelib/global/qglobal/tst_qglobal.cpp')
-rw-r--r--tests/auto/corelib/global/qglobal/tst_qglobal.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
index 4a50a45ea6..0d08e912f8 100644
--- a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
+++ b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
@@ -59,6 +59,7 @@ private slots:
void qCoreAppStartupFunctionRestart();
void isEnum();
void qAlignOf();
+ void integerForSize();
};
void tst_QGlobal::qIsNull()
@@ -566,5 +567,19 @@ void tst_QGlobal::qAlignOf()
#undef TEST_AlignOf_RValueRef
#undef TEST_AlignOf_impl
+void tst_QGlobal::integerForSize()
+{
+ // compile-only test:
+ Q_STATIC_ASSERT(sizeof(QIntegerForSize<1>::Signed) == 1);
+ Q_STATIC_ASSERT(sizeof(QIntegerForSize<2>::Signed) == 2);
+ Q_STATIC_ASSERT(sizeof(QIntegerForSize<4>::Signed) == 4);
+ Q_STATIC_ASSERT(sizeof(QIntegerForSize<8>::Signed) == 8);
+
+ Q_STATIC_ASSERT(sizeof(QIntegerForSize<1>::Unsigned) == 1);
+ Q_STATIC_ASSERT(sizeof(QIntegerForSize<2>::Unsigned) == 2);
+ Q_STATIC_ASSERT(sizeof(QIntegerForSize<4>::Unsigned) == 4);
+ Q_STATIC_ASSERT(sizeof(QIntegerForSize<8>::Unsigned) == 8);
+}
+
QTEST_APPLESS_MAIN(tst_QGlobal)
#include "tst_qglobal.moc"