diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2011-11-29 17:14:54 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-01 04:22:01 +0100 |
commit | d7fb773727b89d9db5acfcb3b4651d0fb6b3b820 (patch) | |
tree | 8009731a5e0f356b0e200c2867dae9bd20a00d7b /tests/auto/corelib/tools | |
parent | 7f64c3ddc8a2fee82e2ddaa8fa86170ada8b8e79 (diff) |
Minor improvement to QByteArray autotest
Rename the qUncompress test to make clear that the test only deals with
uncompressing corrupted data and add a message making it clear that this
test will produce some warning messages.
Don't skip creating the test data, as that prevents the test output
reporting exactly what is skipped.
The expected output is the same for every row (an empty QByteArray), so
don't bother storing that in the data table.
Change-Id: I59f1cc91a941bcaadacb2a613dd5eca2564961c1
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/corelib/tools')
-rw-r--r-- | tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp | 51 |
1 files changed, 23 insertions, 28 deletions
diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp index fdd9cb8aef..5f9751c606 100644 --- a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp +++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp @@ -63,8 +63,8 @@ private slots: void qCompress_data(); #ifndef QT_NO_COMPRESS void qCompress(); - void qUncompress_data(); - void qUncompress(); + void qUncompressCorruptedData_data(); + void qUncompressCorruptedData(); void qCompressionZeroTermination(); #endif void constByteArray(); @@ -185,45 +185,40 @@ void tst_QByteArray::qCompress() QTEST( ::qUncompress( compressed ), "ba" ); } -// Corrupt data causes this test to lock up on HP-UX / PA-RISC with gcc, -// SOLARIS, QNX and Windows. -void tst_QByteArray::qUncompress_data() +void tst_QByteArray::qUncompressCorruptedData_data() { -#if !(defined(Q_OS_HPUX) && !defined(__ia64) && defined(Q_CC_GNU)) && !defined(Q_OS_SOLARIS) && !defined(Q_OS_QNX) && !defined(Q_OS_WIN) QTest::addColumn<QByteArray>("in"); - QTest::addColumn<QByteArray>("out"); - - QTest::newRow("0x00000000") << QByteArray("\x00\x00\x00\x00", 4) << QByteArray(); - QTest::newRow("0x000000ff") << QByteArray("\x00\x00\x00\xff", 4) << QByteArray(); - QTest::newRow("0x3f000000") << QByteArray("\x3f\x00\x00\x00", 4) << QByteArray(); - QTest::newRow("0x3fffffff") << QByteArray("\x3f\xff\xff\xff", 4) << QByteArray(); - QTest::newRow("0x7fffff00") << QByteArray("\x7f\xff\xff\x00", 4) << QByteArray(); - QTest::newRow("0x7fffffff") << QByteArray("\x7f\xff\xff\xff", 4) << QByteArray(); - QTest::newRow("0x80000000") << QByteArray("\x80\x00\x00\x00", 4) << QByteArray(); - QTest::newRow("0x800000ff") << QByteArray("\x80\x00\x00\xff", 4) << QByteArray(); - QTest::newRow("0xcf000000") << QByteArray("\xcf\x00\x00\x00", 4) << QByteArray(); - QTest::newRow("0xcfffffff") << QByteArray("\xcf\xff\xff\xff", 4) << QByteArray(); - QTest::newRow("0xffffff00") << QByteArray("\xff\xff\xff\x00", 4) << QByteArray(); - QTest::newRow("0xffffffff") << QByteArray("\xff\xff\xff\xff", 4) << QByteArray(); -#else - QSKIP("Test does not make sense on this platform"); -#endif + + QTest::newRow("0x00000000") << QByteArray("\x00\x00\x00\x00", 4); + QTest::newRow("0x000000ff") << QByteArray("\x00\x00\x00\xff", 4); + QTest::newRow("0x3f000000") << QByteArray("\x3f\x00\x00\x00", 4); + QTest::newRow("0x3fffffff") << QByteArray("\x3f\xff\xff\xff", 4); + QTest::newRow("0x7fffff00") << QByteArray("\x7f\xff\xff\x00", 4); + QTest::newRow("0x7fffffff") << QByteArray("\x7f\xff\xff\xff", 4); + QTest::newRow("0x80000000") << QByteArray("\x80\x00\x00\x00", 4); + QTest::newRow("0x800000ff") << QByteArray("\x80\x00\x00\xff", 4); + QTest::newRow("0xcf000000") << QByteArray("\xcf\x00\x00\x00", 4); + QTest::newRow("0xcfffffff") << QByteArray("\xcf\xff\xff\xff", 4); + QTest::newRow("0xffffff00") << QByteArray("\xff\xff\xff\x00", 4); + QTest::newRow("0xffffffff") << QByteArray("\xff\xff\xff\xff", 4); } -void tst_QByteArray::qUncompress() +// Corrupt data causes this test to lock up on HP-UX / PA-RISC with gcc, +// SOLARIS, QNX and Windows. +// This test is expected to produce some warning messages in the test output. +void tst_QByteArray::qUncompressCorruptedData() { #if !(defined(Q_OS_HPUX) && !defined(__ia64) && defined(Q_CC_GNU)) && !defined(Q_OS_SOLARIS) && !defined(Q_OS_QNX) && !defined(Q_OS_WIN) QFETCH(QByteArray, in); - QFETCH(QByteArray, out); QByteArray res; res = ::qUncompress(in); - QCOMPARE(res, out); + QCOMPARE(res, QByteArray()); res = ::qUncompress(in + "blah"); - QCOMPARE(res, out); + QCOMPARE(res, QByteArray()); #else - QSKIP("Test does not make sense on this platform"); + QSKIP("This test freezes on this platform"); #endif } |