summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-03-31 14:57:35 (GMT)
committerTobias Markmann <tm@ayena.de>2016-03-31 14:57:35 (GMT)
commitcfbdb43d2cadd40aa87338d41548e4bf89e146e6 (patch)
tree18d94153a302445196fc0c18586abf44a1ce4a38 /Swiften/StringCodecs/UnitTest
parent1d545a4a7fb877f021508094b88c1f17b30d8b4e (diff)
downloadswift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.zip
swift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.tar.bz2
Convert tabs to 4 spaces for all source files
Removed trailing spaces and whitespace on empty lines in the process. Changed CheckTabs.py tool to disallow hard tabs in source files. Test-Information: Manually checked 30 random files that the conversion worked as expected. Change-Id: I874f99d617bd3d2bb55f02d58f22f58f9b094480
Diffstat (limited to 'Swiften/StringCodecs/UnitTest')
-rw-r--r--Swiften/StringCodecs/UnitTest/Base64Test.cpp94
-rw-r--r--Swiften/StringCodecs/UnitTest/HexifyTest.cpp38
-rw-r--r--Swiften/StringCodecs/UnitTest/PBKDF2Test.cpp48
3 files changed, 90 insertions, 90 deletions
diff --git a/Swiften/StringCodecs/UnitTest/Base64Test.cpp b/Swiften/StringCodecs/UnitTest/Base64Test.cpp
index d626090..272514f 100644
--- a/Swiften/StringCodecs/UnitTest/Base64Test.cpp
+++ b/Swiften/StringCodecs/UnitTest/Base64Test.cpp
@@ -15,53 +15,53 @@
using namespace Swift;
class Base64Test : public CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE(Base64Test);
- CPPUNIT_TEST(testEncodeDecodeAllChars);
- CPPUNIT_TEST(testEncodeDecodeOneBytePadding);
- CPPUNIT_TEST(testEncodeDecodeTwoBytesPadding);
- CPPUNIT_TEST(testEncode_NoData);
- CPPUNIT_TEST(testDecode_NoData);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- void testEncodeDecodeAllChars() {
- ByteArray input;
- for (unsigned char i = 0; i < 255; ++i) {
- input.push_back(i);
- }
- std::string result(Base64::encode(input));
-
- CPPUNIT_ASSERT_EQUAL(std::string("AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+"), result);
- CPPUNIT_ASSERT_EQUAL(input, Base64::decode(result));
- }
-
- void testEncodeDecodeOneBytePadding() {
- ByteArray input = createByteArray("ABCDE", 5);
-
- std::string result = Base64::encode(input);
-
- CPPUNIT_ASSERT_EQUAL(std::string("QUJDREU="), result);
- CPPUNIT_ASSERT_EQUAL(input, Base64::decode(result));
- }
-
- void testEncodeDecodeTwoBytesPadding() {
- ByteArray input = createByteArray("ABCD", 4);
-
- std::string result = Base64::encode(input);
-
- CPPUNIT_ASSERT_EQUAL(std::string("QUJDRA=="), result);
- CPPUNIT_ASSERT_EQUAL(input, Base64::decode(result));
- }
-
- void testEncode_NoData() {
- std::string result(Base64::encode(ByteArray()));
- CPPUNIT_ASSERT_EQUAL(std::string(""), result);
- }
-
- void testDecode_NoData() {
- ByteArray result(Base64::decode(""));
- CPPUNIT_ASSERT_EQUAL(ByteArray(), result);
- }
+ CPPUNIT_TEST_SUITE(Base64Test);
+ CPPUNIT_TEST(testEncodeDecodeAllChars);
+ CPPUNIT_TEST(testEncodeDecodeOneBytePadding);
+ CPPUNIT_TEST(testEncodeDecodeTwoBytesPadding);
+ CPPUNIT_TEST(testEncode_NoData);
+ CPPUNIT_TEST(testDecode_NoData);
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+ void testEncodeDecodeAllChars() {
+ ByteArray input;
+ for (unsigned char i = 0; i < 255; ++i) {
+ input.push_back(i);
+ }
+ std::string result(Base64::encode(input));
+
+ CPPUNIT_ASSERT_EQUAL(std::string("AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+"), result);
+ CPPUNIT_ASSERT_EQUAL(input, Base64::decode(result));
+ }
+
+ void testEncodeDecodeOneBytePadding() {
+ ByteArray input = createByteArray("ABCDE", 5);
+
+ std::string result = Base64::encode(input);
+
+ CPPUNIT_ASSERT_EQUAL(std::string("QUJDREU="), result);
+ CPPUNIT_ASSERT_EQUAL(input, Base64::decode(result));
+ }
+
+ void testEncodeDecodeTwoBytesPadding() {
+ ByteArray input = createByteArray("ABCD", 4);
+
+ std::string result = Base64::encode(input);
+
+ CPPUNIT_ASSERT_EQUAL(std::string("QUJDRA=="), result);
+ CPPUNIT_ASSERT_EQUAL(input, Base64::decode(result));
+ }
+
+ void testEncode_NoData() {
+ std::string result(Base64::encode(ByteArray()));
+ CPPUNIT_ASSERT_EQUAL(std::string(""), result);
+ }
+
+ void testDecode_NoData() {
+ ByteArray result(Base64::decode(""));
+ CPPUNIT_ASSERT_EQUAL(ByteArray(), result);
+ }
};
CPPUNIT_TEST_SUITE_REGISTRATION(Base64Test);
diff --git a/Swiften/StringCodecs/UnitTest/HexifyTest.cpp b/Swiften/StringCodecs/UnitTest/HexifyTest.cpp
index 57f4fe8..7d349fa 100644
--- a/Swiften/StringCodecs/UnitTest/HexifyTest.cpp
+++ b/Swiften/StringCodecs/UnitTest/HexifyTest.cpp
@@ -15,25 +15,25 @@
using namespace Swift;
class HexifyTest : public CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE(HexifyTest);
- CPPUNIT_TEST(testHexify);
- CPPUNIT_TEST(testHexify_Byte);
- CPPUNIT_TEST(testUnhexify);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- void testHexify() {
- CPPUNIT_ASSERT_EQUAL(std::string("4206b23ca6b0a643d20d89b04ff58cf78b8096ed"), Hexify::hexify(createByteArray("\x42\x06\xb2\x3c\xa6\xb0\xa6\x43\xd2\x0d\x89\xb0\x4f\xf5\x8c\xf7\x8b\x80\x96\xed")));
- }
-
- void testHexify_Byte() {
- CPPUNIT_ASSERT_EQUAL(std::string("b2"), Hexify::hexify(0xb2));
- }
-
- void testUnhexify() {
- CPPUNIT_ASSERT_EQUAL(std::string("ffaf02"), Hexify::hexify(Hexify::unhexify("ffaf02")));
- CPPUNIT_ASSERT(createByteArray("\x01\x23\xf2", 3) == Hexify::unhexify("0123f2"));
- }
+ CPPUNIT_TEST_SUITE(HexifyTest);
+ CPPUNIT_TEST(testHexify);
+ CPPUNIT_TEST(testHexify_Byte);
+ CPPUNIT_TEST(testUnhexify);
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+ void testHexify() {
+ CPPUNIT_ASSERT_EQUAL(std::string("4206b23ca6b0a643d20d89b04ff58cf78b8096ed"), Hexify::hexify(createByteArray("\x42\x06\xb2\x3c\xa6\xb0\xa6\x43\xd2\x0d\x89\xb0\x4f\xf5\x8c\xf7\x8b\x80\x96\xed")));
+ }
+
+ void testHexify_Byte() {
+ CPPUNIT_ASSERT_EQUAL(std::string("b2"), Hexify::hexify(0xb2));
+ }
+
+ void testUnhexify() {
+ CPPUNIT_ASSERT_EQUAL(std::string("ffaf02"), Hexify::hexify(Hexify::unhexify("ffaf02")));
+ CPPUNIT_ASSERT(createByteArray("\x01\x23\xf2", 3) == Hexify::unhexify("0123f2"));
+ }
};
CPPUNIT_TEST_SUITE_REGISTRATION(HexifyTest);
diff --git a/Swiften/StringCodecs/UnitTest/PBKDF2Test.cpp b/Swiften/StringCodecs/UnitTest/PBKDF2Test.cpp
index b75f6fb..343c170 100644
--- a/Swiften/StringCodecs/UnitTest/PBKDF2Test.cpp
+++ b/Swiften/StringCodecs/UnitTest/PBKDF2Test.cpp
@@ -17,37 +17,37 @@
using namespace Swift;
class PBKDF2Test : public CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE(PBKDF2Test);
- CPPUNIT_TEST(testGetResult_I1);
- CPPUNIT_TEST(testGetResult_I2);
- CPPUNIT_TEST(testGetResult_I4096);
- CPPUNIT_TEST_SUITE_END();
+ CPPUNIT_TEST_SUITE(PBKDF2Test);
+ CPPUNIT_TEST(testGetResult_I1);
+ CPPUNIT_TEST(testGetResult_I2);
+ CPPUNIT_TEST(testGetResult_I4096);
+ CPPUNIT_TEST_SUITE_END();
- public:
- void setUp() {
- crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create());
- }
+ public:
+ void setUp() {
+ crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create());
+ }
- void testGetResult_I1() {
- ByteArray result(PBKDF2::encode(createSafeByteArray("password"), createByteArray("salt"), 1, crypto.get()));
+ void testGetResult_I1() {
+ ByteArray result(PBKDF2::encode(createSafeByteArray("password"), createByteArray("salt"), 1, crypto.get()));
- CPPUNIT_ASSERT_EQUAL(createByteArray("\x0c\x60\xc8\x0f\x96\x1f\x0e\x71\xf3\xa9\xb5\x24\xaf\x60\x12\x06\x2f\xe0\x37\xa6"), result);
- }
+ CPPUNIT_ASSERT_EQUAL(createByteArray("\x0c\x60\xc8\x0f\x96\x1f\x0e\x71\xf3\xa9\xb5\x24\xaf\x60\x12\x06\x2f\xe0\x37\xa6"), result);
+ }
- void testGetResult_I2() {
- ByteArray result(PBKDF2::encode(createSafeByteArray("password"), createByteArray("salt"), 2, crypto.get()));
+ void testGetResult_I2() {
+ ByteArray result(PBKDF2::encode(createSafeByteArray("password"), createByteArray("salt"), 2, crypto.get()));
- CPPUNIT_ASSERT_EQUAL(createByteArray("\xea\x6c\x1\x4d\xc7\x2d\x6f\x8c\xcd\x1e\xd9\x2a\xce\x1d\x41\xf0\xd8\xde\x89\x57"), result);
- }
+ CPPUNIT_ASSERT_EQUAL(createByteArray("\xea\x6c\x1\x4d\xc7\x2d\x6f\x8c\xcd\x1e\xd9\x2a\xce\x1d\x41\xf0\xd8\xde\x89\x57"), result);
+ }
- void testGetResult_I4096() {
- ByteArray result(PBKDF2::encode(createSafeByteArray("password"), createByteArray("salt"), 4096, crypto.get()));
+ void testGetResult_I4096() {
+ ByteArray result(PBKDF2::encode(createSafeByteArray("password"), createByteArray("salt"), 4096, crypto.get()));
- CPPUNIT_ASSERT_EQUAL(createByteArray("\x4b\x00\x79\x1\xb7\x65\x48\x9a\xbe\xad\x49\xd9\x26\xf7\x21\xd0\x65\xa4\x29\xc1", 20), result);
- }
-
- private:
- boost::shared_ptr<CryptoProvider> crypto;
+ CPPUNIT_ASSERT_EQUAL(createByteArray("\x4b\x00\x79\x1\xb7\x65\x48\x9a\xbe\xad\x49\xd9\x26\xf7\x21\xd0\x65\xa4\x29\xc1", 20), result);
+ }
+
+ private:
+ boost::shared_ptr<CryptoProvider> crypto;
};
CPPUNIT_TEST_SUITE_REGISTRATION(PBKDF2Test);