diff options
Diffstat (limited to 'tests/auto/corelib/global')
-rw-r--r-- | tests/auto/corelib/global/qflags/tst_qflags.cpp | 2 | ||||
-rw-r--r-- | tests/auto/corelib/global/qglobal/tst_qglobal.cpp | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/tests/auto/corelib/global/qflags/tst_qflags.cpp b/tests/auto/corelib/global/qflags/tst_qflags.cpp index e50a6b63fe..73a69a1309 100644 --- a/tests/auto/corelib/global/qflags/tst_qflags.cpp +++ b/tests/auto/corelib/global/qflags/tst_qflags.cpp @@ -99,7 +99,7 @@ void tst_QFlags::testFlagMultiBits() const } } -template <int N, typename T> bool verifyConstExpr(T n) { return n == N; } +template <unsigned int N, typename T> bool verifyConstExpr(T n) { return n == N; } void tst_QFlags::constExpr() { 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" |