diff options
Diffstat (limited to 'Swiften/Compress/UnitTest')
-rw-r--r-- | Swiften/Compress/UnitTest/ZLibCompressorTest.cpp | 11 | ||||
-rw-r--r-- | Swiften/Compress/UnitTest/ZLibDecompressorTest.cpp | 17 |
2 files changed, 15 insertions, 13 deletions
diff --git a/Swiften/Compress/UnitTest/ZLibCompressorTest.cpp b/Swiften/Compress/UnitTest/ZLibCompressorTest.cpp index 8b3a48b..9320ae1 100644 --- a/Swiften/Compress/UnitTest/ZLibCompressorTest.cpp +++ b/Swiften/Compress/UnitTest/ZLibCompressorTest.cpp @@ -9,6 +9,7 @@ #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> +#include <QA/Checker/IO.h> #include <Swiften/Compress/ZLibCompressor.h> using namespace Swift; @@ -26,17 +27,17 @@ class ZLibCompressorTest : public CppUnit::TestFixture void testProcess() { ZLibCompressor testling; - ByteArray result = testling.process("foo"); + ByteArray result = testling.process(createByteArray("foo")); - CPPUNIT_ASSERT_EQUAL(ByteArray("\x78\xda\x4a\xcb\xcf\x07\x00\x00\x00\xff\xff", 11), result); + CPPUNIT_ASSERT_EQUAL(createByteArray("\x78\xda\x4a\xcb\xcf\x07\x00\x00\x00\xff\xff", 11), result); } void testProcess_Twice() { ZLibCompressor testling; - testling.process("foo"); - ByteArray result = testling.process("bar"); + testling.process(createByteArray("foo")); + ByteArray result = testling.process(createByteArray("bar")); - CPPUNIT_ASSERT_EQUAL(ByteArray("\x4a\x4a\x2c\x02\x00\x00\x00\xff\xff",9), result); + CPPUNIT_ASSERT_EQUAL(createByteArray("\x4a\x4a\x2c\x02\x00\x00\x00\xff\xff",9), result); } }; diff --git a/Swiften/Compress/UnitTest/ZLibDecompressorTest.cpp b/Swiften/Compress/UnitTest/ZLibDecompressorTest.cpp index 7a26d50..00aae6e 100644 --- a/Swiften/Compress/UnitTest/ZLibDecompressorTest.cpp +++ b/Swiften/Compress/UnitTest/ZLibDecompressorTest.cpp @@ -9,6 +9,7 @@ #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> +#include <QA/Checker/IO.h> #include <Swiften/Compress/ZLibDecompressor.h> #include <Swiften/Compress/ZLibCompressor.h> #include <Swiften/Compress/ZLibException.h> @@ -31,22 +32,22 @@ class ZLibDecompressorTest : public CppUnit::TestFixture void testProcess() { ZLibDecompressor testling; - ByteArray result = testling.process(ByteArray("\x78\xda\x4a\xcb\xcf\x07\x00\x00\x00\xff\xff", 11)); + ByteArray result = testling.process(createByteArray("\x78\xda\x4a\xcb\xcf\x07\x00\x00\x00\xff\xff", 11)); - CPPUNIT_ASSERT_EQUAL(ByteArray("foo"), result); + CPPUNIT_ASSERT_EQUAL(createByteArray("foo"), result); } void testProcess_Twice() { ZLibDecompressor testling; - testling.process(ByteArray("\x78\xda\x4a\xcb\xcf\x07\x00\x00\x00\xff\xff", 11)); - ByteArray result = testling.process(ByteArray("\x4a\x4a\x2c\x02\x00\x00\x00\xff\xff", 9)); + testling.process(createByteArray("\x78\xda\x4a\xcb\xcf\x07\x00\x00\x00\xff\xff", 11)); + ByteArray result = testling.process(createByteArray("\x4a\x4a\x2c\x02\x00\x00\x00\xff\xff", 9)); - CPPUNIT_ASSERT_EQUAL(ByteArray("bar"), result); + CPPUNIT_ASSERT_EQUAL(createByteArray("bar"), result); } void testProcess_Invalid() { ZLibDecompressor testling; - CPPUNIT_ASSERT_THROW(testling.process(ByteArray("invalid")), ZLibException); + CPPUNIT_ASSERT_THROW(testling.process(createByteArray("invalid")), ZLibException); } void testProcess_Huge() { @@ -55,7 +56,7 @@ class ZLibDecompressorTest : public CppUnit::TestFixture for (unsigned int i = 0; i < 2048; ++i) { data.push_back(static_cast<char>(i)); } - ByteArray original(&data[0], data.size()); + ByteArray original(createByteArray(&data[0], data.size())); ByteArray compressed = ZLibCompressor().process(original); ByteArray decompressed = ZLibDecompressor().process(compressed); @@ -68,7 +69,7 @@ class ZLibDecompressorTest : public CppUnit::TestFixture for (unsigned int i = 0; i < 1024; ++i) { data.push_back(static_cast<char>(i)); } - ByteArray original(&data[0], data.size()); + ByteArray original(createByteArray(&data[0], data.size())); ByteArray compressed = ZLibCompressor().process(original); ByteArray decompressed = ZLibDecompressor().process(compressed); |