summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-03-28 13:40:14 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-03-28 13:40:43 (GMT)
commitb61486fefe602e0d18fa5279021006f87b965307 (patch)
tree437585cbef1179e1ec31f79789591d5610200c29 /Swiften/Base/UnitTest
parentdae28dd45e43fc6e6ef2ec4c6c65d5d736ed86f8 (diff)
downloadswift-b61486fefe602e0d18fa5279021006f87b965307.zip
swift-b61486fefe602e0d18fa5279021006f87b965307.tar.bz2
Moved Swiften to a separate module.
Diffstat (limited to 'Swiften/Base/UnitTest')
m---------Swiften0
-rw-r--r--Swiften/Base/UnitTest/ByteArrayTest.cpp21
-rw-r--r--Swiften/Base/UnitTest/IDGeneratorTest.cpp34
-rw-r--r--Swiften/Base/UnitTest/StringTest.cpp179
4 files changed, 0 insertions, 234 deletions
diff --git a/Swiften b/Swiften
new file mode 160000
+Subproject 8213ba16d0043d2461f4b031c881d61dda5a38c
diff --git a/Swiften/Base/UnitTest/ByteArrayTest.cpp b/Swiften/Base/UnitTest/ByteArrayTest.cpp
deleted file mode 100644
index bf893bd..0000000
--- a/Swiften/Base/UnitTest/ByteArrayTest.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-
-#include "Swiften/Base/ByteArray.h"
-
-using namespace Swift;
-
-class ByteArrayTest : public CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE(ByteArrayTest);
- CPPUNIT_TEST(testGetData_NoData);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- void testGetData_NoData() {
- ByteArray testling;
-
- CPPUNIT_ASSERT_EQUAL(static_cast<const char*>(NULL), static_cast<const char*>(testling.getData()));
- }
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(ByteArrayTest);
diff --git a/Swiften/Base/UnitTest/IDGeneratorTest.cpp b/Swiften/Base/UnitTest/IDGeneratorTest.cpp
deleted file mode 100644
index bd96d91..0000000
--- a/Swiften/Base/UnitTest/IDGeneratorTest.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-#include <set>
-
-#include "Swiften/Base/IDGenerator.h"
-
-using namespace Swift;
-
-class IDGeneratorTest : public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE(IDGeneratorTest);
- CPPUNIT_TEST(testGenerate);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- IDGeneratorTest() {}
-
- void setUp() {
- generatedIDs_.clear();
- }
-
- void testGenerate() {
- IDGenerator testling;
- for (unsigned int i = 0; i < 26*4; ++i) {
- String id = testling.generateID();
- CPPUNIT_ASSERT(generatedIDs_.insert(id).second);
- }
- }
-
- private:
- std::set<String> generatedIDs_;
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(IDGeneratorTest);
diff --git a/Swiften/Base/UnitTest/StringTest.cpp b/Swiften/Base/UnitTest/StringTest.cpp
deleted file mode 100644
index 87e1a99..0000000
--- a/Swiften/Base/UnitTest/StringTest.cpp
+++ /dev/null
@@ -1,179 +0,0 @@
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-
-#include "Swiften/Base/String.h"
-
-using namespace Swift;
-
-class StringTest : public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE(StringTest);
- CPPUNIT_TEST(testGetLength);
- CPPUNIT_TEST(testGetLength_EncodedLength2);
- CPPUNIT_TEST(testGetLength_EncodedLength3);
- CPPUNIT_TEST(testGetLength_EncodedLength4);
- CPPUNIT_TEST(testGetUnicodeCodePoints);
- CPPUNIT_TEST(testGetSplittedAtFirst);
- CPPUNIT_TEST(testGetSplittedAtFirst_CharacterAtEnd);
- CPPUNIT_TEST(testGetSplittedAtFirst_NoSuchCharacter);
- CPPUNIT_TEST(testRemoveAll);
- CPPUNIT_TEST(testRemoveAll_LastChar);
- CPPUNIT_TEST(testRemoveAll_ConsecutiveChars);
- CPPUNIT_TEST(testReplaceAll);
- CPPUNIT_TEST(testReplaceAll_LastChar);
- CPPUNIT_TEST(testReplaceAll_ConsecutiveChars);
- CPPUNIT_TEST(testReplaceAll_MatchingReplace);
- CPPUNIT_TEST(testGetLowerCase);
- CPPUNIT_TEST(testSplit);
- CPPUNIT_TEST(testContains);
- CPPUNIT_TEST(testContainsFalse);
- CPPUNIT_TEST(testContainsExact);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- StringTest() {}
-
- void testGetLength() {
- String testling("xyz$xyz");
-
- CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(7), testling.getLength());
- }
-
- void testGetLength_EncodedLength2() {
- String testling("xyz\xC2\xA2xyz");
-
- CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(7), testling.getLength());
- }
-
- void testGetLength_EncodedLength3() {
- String testling("xyz\xE2\x82\xACxyz");
-
- CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(7), testling.getLength());
- }
-
- void testGetLength_EncodedLength4() {
- String testling("xyz\xf4\x8a\xaf\x8dxyz");
-
- CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(7), testling.getLength());
- }
-
- void testGetUnicodeCodePoints() {
- String testling("$\xc2\xa2\xe2\x82\xac\xf4\x8a\xaf\x8d");
- std::vector<unsigned int> points = testling.getUnicodeCodePoints();
-
- CPPUNIT_ASSERT_EQUAL(0x24U, points[0]);
- CPPUNIT_ASSERT_EQUAL(0xA2U, points[1]);
- CPPUNIT_ASSERT_EQUAL(0x20ACU, points[2]);
- CPPUNIT_ASSERT_EQUAL(0x10ABCDU, points[3]);
- }
-
- void testGetSplittedAtFirst() {
- String testling("ab@cd@ef");
-
- std::pair<String,String> result = testling.getSplittedAtFirst('@');
- CPPUNIT_ASSERT_EQUAL(String("ab"), result.first);
- CPPUNIT_ASSERT_EQUAL(String("cd@ef"), result.second);
- }
-
- void testGetSplittedAtFirst_CharacterAtEnd() {
- String testling("ab@");
-
- std::pair<String,String> result = testling.getSplittedAtFirst('@');
- CPPUNIT_ASSERT_EQUAL(String("ab"), result.first);
- CPPUNIT_ASSERT(result.second.isEmpty());
- }
-
- void testGetSplittedAtFirst_NoSuchCharacter() {
- String testling("ab");
-
- std::pair<String,String> result = testling.getSplittedAtFirst('@');
- CPPUNIT_ASSERT_EQUAL(String("ab"), result.first);
- CPPUNIT_ASSERT(result.second.isEmpty());
- }
-
- void testRemoveAll() {
- String testling("ab c de");
-
- testling.removeAll(' ');
-
- CPPUNIT_ASSERT_EQUAL(String("abcde"), testling);
- }
-
- void testRemoveAll_LastChar() {
- String testling("abcde ");
-
- testling.removeAll(' ');
-
- CPPUNIT_ASSERT_EQUAL(String("abcde"), testling);
- }
-
- void testRemoveAll_ConsecutiveChars() {
- String testling("ab cde");
-
- testling.removeAll(' ');
-
- CPPUNIT_ASSERT_EQUAL(String("abcde"), testling);
- }
-
- void testReplaceAll() {
- String testling("abcbd");
-
- testling.replaceAll('b', "xyz");
-
- CPPUNIT_ASSERT_EQUAL(String("axyzcxyzd"), testling);
- }
-
- void testReplaceAll_LastChar() {
- String testling("abc");
-
- testling.replaceAll('c', "xyz");
-
- CPPUNIT_ASSERT_EQUAL(String("abxyz"), testling);
- }
-
- void testReplaceAll_ConsecutiveChars() {
- String testling("abbc");
-
- testling.replaceAll('b',"xyz");
-
- CPPUNIT_ASSERT_EQUAL(String("axyzxyzc"), testling);
- }
-
- void testReplaceAll_MatchingReplace() {
- String testling("abc");
-
- testling.replaceAll('b',"bbb");
-
- CPPUNIT_ASSERT_EQUAL(String("abbbc"), testling);
- }
-
- void testGetLowerCase() {
- String testling("aBcD e");
-
- CPPUNIT_ASSERT_EQUAL(String("abcd e"), testling.getLowerCase());
- }
-
- void testSplit() {
- std::vector<String> result = String("abc def ghi").split(' ');
-
- CPPUNIT_ASSERT_EQUAL(3, static_cast<int>(result.size()));
- CPPUNIT_ASSERT_EQUAL(String("abc"), result[0]);
- CPPUNIT_ASSERT_EQUAL(String("def"), result[1]);
- CPPUNIT_ASSERT_EQUAL(String("ghi"), result[2]);
- }
-
- void testContains() {
- CPPUNIT_ASSERT(String("abcde").contains(String("bcd")));
- }
-
- void testContainsFalse() {
- CPPUNIT_ASSERT(!String("abcde").contains(String("abcdef")));
- }
-
- void testContainsExact() {
- CPPUNIT_ASSERT(String("abcde").contains(String("abcde")));
- }
-
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(StringTest);