diff options
Diffstat (limited to 'tests/auto/corelib/global')
15 files changed, 55 insertions, 21 deletions
diff --git a/tests/auto/corelib/global/q_func_info/q_func_info.pro b/tests/auto/corelib/global/q_func_info/q_func_info.pro index aad0edf4ed..7663a880eb 100644 --- a/tests/auto/corelib/global/q_func_info/q_func_info.pro +++ b/tests/auto/corelib/global/q_func_info/q_func_info.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_q_func_info QT = core testlib SOURCES = tst_q_func_info.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/global/qflags/qflags.pro b/tests/auto/corelib/global/qflags/qflags.pro index 7602008e22..29dfb0684c 100644 --- a/tests/auto/corelib/global/qflags/qflags.pro +++ b/tests/auto/corelib/global/qflags/qflags.pro @@ -1,7 +1,6 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qflags QT = core testlib SOURCES = tst_qflags.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 contains(QT_CONFIG, c++11): CONFIG += c++11 contains(QT_CONFIG, c++14): CONFIG += c++14 diff --git a/tests/auto/corelib/global/qgetputenv/qgetputenv.pro b/tests/auto/corelib/global/qgetputenv/qgetputenv.pro index 34fb1a702b..c6d1100335 100644 --- a/tests/auto/corelib/global/qgetputenv/qgetputenv.pro +++ b/tests/auto/corelib/global/qgetputenv/qgetputenv.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qgetputenv QT = core testlib SOURCES = tst_qgetputenv.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp b/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp index 71a3419963..adf8172a68 100644 --- a/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp +++ b/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp @@ -80,7 +80,7 @@ void tst_QGetPutEnv::getSetCheck() QCOMPARE(qEnvironmentVariableIntValue(varName, &ok), 0); QVERIFY(!ok); result = qgetenv(varName); - QVERIFY(result == "supervalue"); + QCOMPARE(result, QByteArrayLiteral("supervalue")); qputenv(varName,QByteArray()); diff --git a/tests/auto/corelib/global/qglobal/qglobal.pro b/tests/auto/corelib/global/qglobal/qglobal.pro index d1c02f80e9..b8ed7761f5 100644 --- a/tests/auto/corelib/global/qglobal/qglobal.pro +++ b/tests/auto/corelib/global/qglobal/qglobal.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qglobal QT = core testlib SOURCES = tst_qglobal.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/global/qglobalstatic/qglobalstatic.pro b/tests/auto/corelib/global/qglobalstatic/qglobalstatic.pro index 7b374505ce..056d940da7 100644 --- a/tests/auto/corelib/global/qglobalstatic/qglobalstatic.pro +++ b/tests/auto/corelib/global/qglobalstatic/qglobalstatic.pro @@ -10,4 +10,3 @@ CONFIG += exceptions SOURCES += tst_qglobalstatic.cpp DEFINES += SRCDIR=\\\"$$PWD/\\\" -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/global/qhooks/qhooks.pro b/tests/auto/corelib/global/qhooks/qhooks.pro index f886e7d49a..a5c0d63cb9 100644 --- a/tests/auto/corelib/global/qhooks/qhooks.pro +++ b/tests/auto/corelib/global/qhooks/qhooks.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qhooks QT = core-private testlib SOURCES = tst_qhooks.cpp diff --git a/tests/auto/corelib/global/qhooks/tst_qhooks.cpp b/tests/auto/corelib/global/qhooks/tst_qhooks.cpp index b5930790e4..a38a396a5d 100644 --- a/tests/auto/corelib/global/qhooks/tst_qhooks.cpp +++ b/tests/auto/corelib/global/qhooks/tst_qhooks.cpp @@ -46,7 +46,7 @@ private slots: void tst_QHooks::testVersion() { - QVERIFY(qtHookData[QHooks::HookDataVersion] >= 1); + QVERIFY(qtHookData[QHooks::HookDataVersion] >= 3); QCOMPARE(qtHookData[QHooks::HookDataSize], (quintptr)QHooks::LastHookIndex); QCOMPARE(qtHookData[QHooks::QtVersion], (quintptr)QT_VERSION); } diff --git a/tests/auto/corelib/global/qlogging/app/app.pro b/tests/auto/corelib/global/qlogging/app/app.pro index 4789efc478..8ada04acdc 100644 --- a/tests/auto/corelib/global/qlogging/app/app.pro +++ b/tests/auto/corelib/global/qlogging/app/app.pro @@ -9,7 +9,6 @@ CONFIG -= app_bundle CONFIG += console SOURCES += main.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 DEFINES += QT_MESSAGELOGCONTEXT gcc:!mingw:!haiku: QMAKE_LFLAGS += -rdynamic diff --git a/tests/auto/corelib/global/qlogging/test/test.pro b/tests/auto/corelib/global/qlogging/test/test.pro index fdebf45281..df002c5728 100644 --- a/tests/auto/corelib/global/qlogging/test/test.pro +++ b/tests/auto/corelib/global/qlogging/test/test.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase CONFIG -= app_bundle debug_and_release_target contains(QT_CONFIG, c++11): CONFIG += c++11 contains(QT_CONFIG, c++14): CONFIG += c++14 diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp index a65a72313f..e2370665d8 100644 --- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp +++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp @@ -821,7 +821,7 @@ void tst_qmessagehandler::qMessagePattern() // test QT_MESSAGE_PATTERN // QStringList environment = m_baseEnvironment; - environment.prepend("QT_MESSAGE_PATTERN=\"" + pattern + "\""); + environment.prepend("QT_MESSAGE_PATTERN=\"" + pattern + QLatin1Char('"')); process.setEnvironment(environment); process.start(appExe); diff --git a/tests/auto/corelib/global/qnumeric/qnumeric.pro b/tests/auto/corelib/global/qnumeric/qnumeric.pro index 0772ce6aab..188bb5b463 100644 --- a/tests/auto/corelib/global/qnumeric/qnumeric.pro +++ b/tests/auto/corelib/global/qnumeric/qnumeric.pro @@ -1,7 +1,6 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qnumeric QT = core-private testlib SOURCES = tst_qnumeric.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 intel_icc: QMAKE_CXXFLAGS += -fp-model strict intel_icl: QMAKE_CXXFLAGS += /fp:strict diff --git a/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp b/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp index 6be8ff81cf..1847056de5 100644 --- a/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp +++ b/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp @@ -55,6 +55,7 @@ private slots: void addOverflow(); void mulOverflow_data(); void mulOverflow(); + void signedOverflow(); }; void tst_QNumeric::fuzzyCompare_data() @@ -105,6 +106,18 @@ void tst_QNumeric::qNan() QVERIFY(qIsNaN(nan)); QVERIFY(qIsNaN(nan + 1)); QVERIFY(qIsNaN(-nan)); + + Q_STATIC_ASSERT(sizeof(double) == 8); +#ifdef Q_LITTLE_ENDIAN + const uchar bytes[] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f }; +#else + const uchar bytes[] = { 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }; +#endif + memcpy(&nan, bytes, 8); + QVERIFY(!qIsFinite(nan)); + QVERIFY(!qIsInf(nan)); + QVERIFY(qIsNaN(nan)); + double inf = qInf(); QVERIFY(inf > 0); QVERIFY(-inf < 0); @@ -366,5 +379,35 @@ void tst_QNumeric::mulOverflow() MulOverflowDispatch<quint64>()(); } +void tst_QNumeric::signedOverflow() +{ + const int minInt = std::numeric_limits<int>::min(); + const int maxInt = std::numeric_limits<int>::max(); + int r; + + QCOMPARE(add_overflow(minInt + 1, int(-1), &r), false); + QCOMPARE(add_overflow(minInt, int(-1), &r), true); + QCOMPARE(add_overflow(minInt, minInt, &r), true); + QCOMPARE(add_overflow(maxInt - 1, int(1), &r), false); + QCOMPARE(add_overflow(maxInt, int(1), &r), true); + QCOMPARE(add_overflow(maxInt, maxInt, &r), true); + + QCOMPARE(sub_overflow(minInt + 1, int(1), &r), false); + QCOMPARE(sub_overflow(minInt, int(1), &r), true); + QCOMPARE(sub_overflow(minInt, maxInt, &r), true); + QCOMPARE(sub_overflow(maxInt - 1, int(-1), &r), false); + QCOMPARE(sub_overflow(maxInt, int(-1), &r), true); + QCOMPARE(sub_overflow(maxInt, minInt, &r), true); + + QCOMPARE(mul_overflow(minInt, int(1), &r), false); + QCOMPARE(mul_overflow(minInt, int(-1), &r), true); + QCOMPARE(mul_overflow(minInt, int(2), &r), true); + QCOMPARE(mul_overflow(minInt, minInt, &r), true); + QCOMPARE(mul_overflow(maxInt, int(1), &r), false); + QCOMPARE(mul_overflow(maxInt, int(-1), &r), false); + QCOMPARE(mul_overflow(maxInt, int(2), &r), true); + QCOMPARE(mul_overflow(maxInt, maxInt, &r), true); +} + QTEST_APPLESS_MAIN(tst_QNumeric) #include "tst_qnumeric.moc" diff --git a/tests/auto/corelib/global/qrand/qrand.pro b/tests/auto/corelib/global/qrand/qrand.pro index 7761b6721a..ee1430aea5 100644 --- a/tests/auto/corelib/global/qrand/qrand.pro +++ b/tests/auto/corelib/global/qrand/qrand.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qrand QT = core testlib SOURCES = tst_qrand.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/global/qtendian/qtendian.pro b/tests/auto/corelib/global/qtendian/qtendian.pro index 363b86988d..2b0af4fa4c 100644 --- a/tests/auto/corelib/global/qtendian/qtendian.pro +++ b/tests/auto/corelib/global/qtendian/qtendian.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qtendian QT = core testlib SOURCES = tst_qtendian.cpp @@ -6,4 +6,3 @@ wince* { # QTBUG-37194 , internal compiler errors with MSVC2008 for Windows CE QMAKE_CFLAGS_RELEASE -= -O2 QMAKE_CXXFLAGS_RELEASE -= -O2 } -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 |