diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-03-28 13:40:14 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-03-28 13:40:43 (GMT) |
commit | b61486fefe602e0d18fa5279021006f87b965307 (patch) | |
tree | 437585cbef1179e1ec31f79789591d5610200c29 /Swiften/Serializer/PayloadSerializers/UnitTest | |
parent | dae28dd45e43fc6e6ef2ec4c6c65d5d736ed86f8 (diff) | |
download | swift-contrib-b61486fefe602e0d18fa5279021006f87b965307.zip swift-contrib-b61486fefe602e0d18fa5279021006f87b965307.tar.bz2 |
Moved Swiften to a separate module.
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers/UnitTest')
17 files changed, 0 insertions, 597 deletions
diff --git a/Swiften b/Swiften new file mode 160000 +Subproject 8213ba16d0043d2461f4b031c881d61dda5a38c diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/CapsInfoSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/CapsInfoSerializerTest.cpp deleted file mode 100644 index 650a7ee..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/CapsInfoSerializerTest.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h" - -using namespace Swift; - -class CapsInfoSerializerTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(CapsInfoSerializerTest); - CPPUNIT_TEST(testSerialize); - CPPUNIT_TEST_SUITE_END(); - - public: - CapsInfoSerializerTest() {} - - void testSerialize() { - CapsInfoSerializer testling; - boost::shared_ptr<CapsInfo> priority(new CapsInfo("http://swift.im", "myversion", "sha-1")); - - CPPUNIT_ASSERT_EQUAL(String("<c hash=\"sha-1\" node=\"http://swift.im\" ver=\"myversion\" xmlns=\"http://jabber.org/protocol/caps\"/>"), testling.serialize(priority)); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(CapsInfoSerializerTest); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/DiscoInfoSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/DiscoInfoSerializerTest.cpp deleted file mode 100644 index d3e247f..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/DiscoInfoSerializerTest.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h" - -using namespace Swift; - -class DiscoInfoSerializerTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(DiscoInfoSerializerTest); - CPPUNIT_TEST(testSerialize); - CPPUNIT_TEST_SUITE_END(); - - public: - DiscoInfoSerializerTest() {} - - void testSerialize() { - DiscoInfoSerializer testling; - boost::shared_ptr<DiscoInfo> discoInfo(new DiscoInfo()); - discoInfo->addIdentity(DiscoInfo::Identity("Swift", "client", "pc")); - discoInfo->addIdentity(DiscoInfo::Identity("Vlug", "client", "pc", "nl")); - discoInfo->addFeature("http://jabber.org/protocol/caps"); - discoInfo->addFeature("http://jabber.org/protocol/disco#info"); - discoInfo->setNode("http://swift.im#bla"); - - String expectedResult = - "<query node=\"http://swift.im#bla\" xmlns=\"http://jabber.org/protocol/disco#info\">" - "<identity category=\"client\" name=\"Swift\" type=\"pc\"/>" - "<identity category=\"client\" name=\"Vlug\" type=\"pc\" xml:lang=\"nl\"/>" - "<feature var=\"http://jabber.org/protocol/caps\"/>" - "<feature var=\"http://jabber.org/protocol/disco#info\"/>" - "</query>"; - - CPPUNIT_ASSERT_EQUAL(expectedResult, testling.serialize(discoInfo)); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(DiscoInfoSerializerTest); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/ErrorSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/ErrorSerializerTest.cpp deleted file mode 100644 index ecd904a..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/ErrorSerializerTest.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Serializer/PayloadSerializers/ErrorSerializer.h" - -using namespace Swift; - -class ErrorSerializerTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(ErrorSerializerTest); - CPPUNIT_TEST(testSerialize); - CPPUNIT_TEST_SUITE_END(); - - public: - ErrorSerializerTest() {} - - void testSerialize() { - ErrorSerializer testling; - boost::shared_ptr<ErrorPayload> error(new ErrorPayload(ErrorPayload::BadRequest, ErrorPayload::Cancel, "My Error")); - - CPPUNIT_ASSERT_EQUAL(String("<error type=\"cancel\"><bad-request xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"/><text xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\">My Error</text></error>"), testling.serialize(error)); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(ErrorSerializerTest); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.cpp deleted file mode 100644 index 23ff4a0..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h" - -#include <cppunit/extensions/HelperMacros.h> - -#include "Swiften/Serializer/PayloadSerializer.h" - -namespace Swift { - -String PayloadsSerializer::serialize(boost::shared_ptr<Payload> payload) { - PayloadSerializer* serializer = serializers.getPayloadSerializer(payload); - if (serializer) { - return serializer->serialize(payload); - } - else { - CPPUNIT_ASSERT(false); - return ""; - } -} - - -} diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h b/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h deleted file mode 100644 index 9fca334..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include <boost/shared_ptr.hpp> - -#include "Swiften/Elements/Payload.h" -#include "Swiften/Base/String.h" -#include "Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h" - -namespace Swift { - class PayloadsSerializer { - public: - String serialize(boost::shared_ptr<Payload> payload); - - private: - FullPayloadSerializerCollection serializers; - }; -} diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/PrioritySerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/PrioritySerializerTest.cpp deleted file mode 100644 index 5f6432b..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/PrioritySerializerTest.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Serializer/PayloadSerializers/PrioritySerializer.h" - -using namespace Swift; - -class PrioritySerializerTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(PrioritySerializerTest); - CPPUNIT_TEST(testSerialize); - CPPUNIT_TEST_SUITE_END(); - - public: - PrioritySerializerTest() {} - - void testSerialize() { - PrioritySerializer testling; - boost::shared_ptr<Priority> priority(new Priority(-113)); - - CPPUNIT_ASSERT_EQUAL(String("<priority>-113</priority>"), testling.serialize(priority)); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(PrioritySerializerTest); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/PrivateStorageSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/PrivateStorageSerializerTest.cpp deleted file mode 100644 index 7f0d5c9..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/PrivateStorageSerializerTest.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h" -#include "Swiften/Elements/PrivateStorage.h" -#include "Swiften/Elements/Storage.h" - -using namespace Swift; - -class PrivateStorageSerializerTest : public CppUnit::TestFixture { - CPPUNIT_TEST_SUITE(PrivateStorageSerializerTest); - CPPUNIT_TEST(testSerialize); - CPPUNIT_TEST_SUITE_END(); - - public: - PrivateStorageSerializerTest() {} - - void testSerialize() { - PayloadsSerializer serializer; - - boost::shared_ptr<PrivateStorage> privateStorage(new PrivateStorage()); - boost::shared_ptr<Storage> storage(new Storage()); - Storage::Conference conference; - conference.name = "Swift"; - conference.jid = JID("swift@rooms.swift.im"); - conference.nick = "Alice"; - storage->addConference(conference); - privateStorage->setPayload(storage); - - CPPUNIT_ASSERT_EQUAL(String( - "<query xmlns=\"jabber:iq:private\">" - "<storage xmlns=\"storage:bookmarks\">" - "<conference " - "autojoin=\"0\" " - "jid=\"swift@rooms.swift.im\" " - "name=\"Swift\">" - "<nick>Alice</nick>" - "</conference>" - "</storage>" - "</query>"), serializer.serialize(privateStorage)); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(PrivateStorageSerializerTest); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/ResourceBindSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/ResourceBindSerializerTest.cpp deleted file mode 100644 index ff09966..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/ResourceBindSerializerTest.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h" - -using namespace Swift; - -class ResourceBindSerializerTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(ResourceBindSerializerTest); - CPPUNIT_TEST(testSerialize_JID); - CPPUNIT_TEST(testSerialize_Resource); - CPPUNIT_TEST(testSerialize_Empty); - CPPUNIT_TEST_SUITE_END(); - - public: - ResourceBindSerializerTest() {} - - void testSerialize_JID() { - ResourceBindSerializer testling; - boost::shared_ptr<ResourceBind> resourceBind(new ResourceBind()); - resourceBind->setJID(JID("somenode@example.com/someresource")); - - CPPUNIT_ASSERT_EQUAL(String( - "<bind xmlns=\"urn:ietf:params:xml:ns:xmpp-bind\">" - "<jid>somenode@example.com/someresource</jid>" - "</bind>"), testling.serialize(resourceBind)); - } - - void testSerialize_Resource() { - ResourceBindSerializer testling; - boost::shared_ptr<ResourceBind> resourceBind(new ResourceBind()); - resourceBind->setResource("someresource"); - - CPPUNIT_ASSERT_EQUAL(String( - "<bind xmlns=\"urn:ietf:params:xml:ns:xmpp-bind\">" - "<resource>someresource</resource>" - "</bind>"), testling.serialize(resourceBind)); - } - - void testSerialize_Empty() { - ResourceBindSerializer testling; - boost::shared_ptr<ResourceBind> resourceBind(new ResourceBind()); - - CPPUNIT_ASSERT_EQUAL(String("<bind xmlns=\"urn:ietf:params:xml:ns:xmpp-bind\"/>"), testling.serialize(resourceBind)); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(ResourceBindSerializerTest); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/RosterSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/RosterSerializerTest.cpp deleted file mode 100644 index 81fdc09..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/RosterSerializerTest.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Serializer/PayloadSerializers/RosterSerializer.h" - -using namespace Swift; - -class RosterSerializerTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(RosterSerializerTest); - CPPUNIT_TEST(testSerialize); - CPPUNIT_TEST_SUITE_END(); - - public: - RosterSerializerTest() {} - - void testSerialize() { - RosterSerializer testling; - boost::shared_ptr<RosterPayload> roster(new RosterPayload()); - - RosterItemPayload item1; - item1.setJID(JID("foo@bar.com")); - item1.setName("Foo @ Bar"); - item1.setSubscription(RosterItemPayload::From); - item1.addGroup("Group 1"); - item1.addGroup("Group 2"); - item1.setSubscriptionRequested(); - roster->addItem(item1); - - RosterItemPayload item2; - item2.setJID(JID("baz@blo.com")); - item2.setName("Baz"); - roster->addItem(item2); - - String expectedResult = - "<query xmlns=\"jabber:iq:roster\">" - "<item ask=\"subscribe\" jid=\"foo@bar.com\" name=\"Foo @ Bar\" subscription=\"from\">" - "<group>Group 1</group>" - "<group>Group 2</group>" - "</item>" - "<item jid=\"baz@blo.com\" name=\"Baz\" subscription=\"none\"/>" - "</query>"; - - CPPUNIT_ASSERT_EQUAL(expectedResult, testling.serialize(roster)); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(RosterSerializerTest); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelSerializerTest.cpp deleted file mode 100644 index e75695f..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelSerializerTest.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h" - -using namespace Swift; - -class SecurityLabelSerializerTest : public CppUnit::TestFixture { - CPPUNIT_TEST_SUITE(SecurityLabelSerializerTest); - CPPUNIT_TEST(testSerialize); - CPPUNIT_TEST(testSerialize_EmptyLabel); - CPPUNIT_TEST_SUITE_END(); - - public: - void testSerialize() { - SecurityLabelSerializer testling; - boost::shared_ptr<SecurityLabel> securityLabel(new SecurityLabel()); - securityLabel->setDisplayMarking("SECRET"); - securityLabel->setForegroundColor("black"); - securityLabel->setBackgroundColor("red"); - securityLabel->setLabel("<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQYCAQQGASk=</esssecuritylabel>"); - securityLabel->addEquivalentLabel("<icismlabel xmlns=\"http://example.gov/IC-ISM/0\" classification=\"S\" ownerProducer=\"USA\" disseminationControls=\"FOUO\"/>"); - securityLabel->addEquivalentLabel("<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MRUCAgD9DA9BcXVhIChvYnNvbGV0ZSk=</esssecuritylabel>"); - - CPPUNIT_ASSERT_EQUAL(String( - "<securitylabel xmlns=\"urn:xmpp:sec-label:0\">" - "<displaymarking bgcolor=\"red\" fgcolor=\"black\">SECRET</displaymarking>" - "<label>" - "<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQYCAQQGASk=</esssecuritylabel>" - "</label>" - "<equivalentlabel>" - "<icismlabel xmlns=\"http://example.gov/IC-ISM/0\" classification=\"S\" ownerProducer=\"USA\" disseminationControls=\"FOUO\"/>" - "</equivalentlabel>" - "<equivalentlabel>" - "<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MRUCAgD9DA9BcXVhIChvYnNvbGV0ZSk=</esssecuritylabel>" - "</equivalentlabel>" - "</securitylabel>"), testling.serialize(securityLabel)); - } - - void testSerialize_EmptyLabel() { - SecurityLabelSerializer testling; - boost::shared_ptr<SecurityLabel> securityLabel(new SecurityLabel()); - securityLabel->setDisplayMarking("SECRET"); - securityLabel->setLabel(""); - - CPPUNIT_ASSERT_EQUAL(String( - "<securitylabel xmlns=\"urn:xmpp:sec-label:0\">" - "<displaymarking>SECRET</displaymarking>" - "<label></label>" - "</securitylabel>"), testling.serialize(securityLabel)); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(SecurityLabelSerializerTest); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelsCatalogSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelsCatalogSerializerTest.cpp deleted file mode 100644 index 3055aca..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelsCatalogSerializerTest.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h" - -using namespace Swift; - -class SecurityLabelsCatalogSerializerTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(SecurityLabelsCatalogSerializerTest); - CPPUNIT_TEST(testSerialize); - CPPUNIT_TEST_SUITE_END(); - - public: - SecurityLabelsCatalogSerializerTest() {} - - void testSerialize() { - SecurityLabelsCatalogSerializer testling; - boost::shared_ptr<SecurityLabelsCatalog> catalog(new SecurityLabelsCatalog()); - catalog->setTo(JID("example.com")); - catalog->setName("Default"); - catalog->setDescription("an example set of labels"); - - SecurityLabel securityLabel1; - securityLabel1.setDisplayMarking("SECRET"); - securityLabel1.setForegroundColor("black"); - securityLabel1.setBackgroundColor("red"); - securityLabel1.setLabel("<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQYCAQQGASk=</esssecuritylabel>"); - catalog->addLabel(securityLabel1); - - SecurityLabel securityLabel2; - securityLabel2.setDisplayMarking("CONFIDENTIAL"); - securityLabel2.setForegroundColor("black"); - securityLabel2.setBackgroundColor("navy"); - securityLabel2.setLabel("<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQMGASk=</esssecuritylabel>"); - catalog->addLabel(securityLabel2); - - CPPUNIT_ASSERT_EQUAL(String( - "<catalog desc=\"an example set of labels\" name=\"Default\" to=\"example.com\" xmlns=\"urn:xmpp:sec-label:catalog:0\">" - "<securitylabel xmlns=\"urn:xmpp:sec-label:0\">" - "<displaymarking bgcolor=\"red\" fgcolor=\"black\">SECRET</displaymarking>" - "<label><esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQYCAQQGASk=</esssecuritylabel></label>" - "</securitylabel>" - "<securitylabel xmlns=\"urn:xmpp:sec-label:0\">" - "<displaymarking bgcolor=\"navy\" fgcolor=\"black\">CONFIDENTIAL</displaymarking>" - "<label><esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQMGASk=</esssecuritylabel></label>" - "</securitylabel>" - "</catalog>"), testling.serialize(catalog)); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(SecurityLabelsCatalogSerializerTest); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/SoftwareVersionSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/SoftwareVersionSerializerTest.cpp deleted file mode 100644 index fd5dba5..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/SoftwareVersionSerializerTest.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h" - -using namespace Swift; - -class SoftwareVersionSerializerTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(SoftwareVersionSerializerTest); - CPPUNIT_TEST(testSerialize); - CPPUNIT_TEST_SUITE_END(); - - public: - SoftwareVersionSerializerTest() {} - - void testSerialize() { - SoftwareVersionSerializer testling; - boost::shared_ptr<SoftwareVersion> softwareVersion(new SoftwareVersion("Swift", "0.1", "Mac OS X")); - - CPPUNIT_ASSERT_EQUAL(String("<query xmlns=\"jabber:iq:version\"><name>Swift</name><version>0.1</version><os>Mac OS X</os></query>"), testling.serialize(softwareVersion)); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(SoftwareVersionSerializerTest); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/StatusSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/StatusSerializerTest.cpp deleted file mode 100644 index 6dedacd..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/StatusSerializerTest.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Serializer/PayloadSerializers/StatusSerializer.h" - -using namespace Swift; - -class StatusSerializerTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(StatusSerializerTest); - CPPUNIT_TEST(testSerialize); - CPPUNIT_TEST_SUITE_END(); - - public: - StatusSerializerTest() {} - - void testSerialize() { - StatusSerializer testling; - boost::shared_ptr<Status> status(new Status("I am away")); - - CPPUNIT_ASSERT_EQUAL(String("<status>I am away</status>"), testling.serialize(status)); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(StatusSerializerTest); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/StatusShowSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/StatusShowSerializerTest.cpp deleted file mode 100644 index 42e1c7c..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/StatusShowSerializerTest.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Serializer/PayloadSerializers/StatusShowSerializer.h" - -using namespace Swift; - -class StatusShowSerializerTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(StatusShowSerializerTest); - CPPUNIT_TEST(testSerialize_Online); - CPPUNIT_TEST(testSerialize_Away); - CPPUNIT_TEST(testSerialize_FFC); - CPPUNIT_TEST(testSerialize_XA); - CPPUNIT_TEST(testSerialize_DND); - CPPUNIT_TEST_SUITE_END(); - - public: - StatusShowSerializerTest() {} - - void testSerialize_Online() { - StatusShowSerializer testling; - boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::Online)); - CPPUNIT_ASSERT_EQUAL(String(""), testling.serialize(statusShow)); - } - - void testSerialize_Away() { - StatusShowSerializer testling; - boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::Away)); - CPPUNIT_ASSERT_EQUAL(String("<show>away</show>"), testling.serialize(statusShow)); - } - - void testSerialize_FFC() { - StatusShowSerializer testling; - boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::FFC)); - CPPUNIT_ASSERT_EQUAL(String("<show>chat</show>"), testling.serialize(statusShow)); - } - - void testSerialize_XA() { - StatusShowSerializer testling; - boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::XA)); - CPPUNIT_ASSERT_EQUAL(String("<show>xa</show>"), testling.serialize(statusShow)); - } - - void testSerialize_DND() { - StatusShowSerializer testling; - boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::DND)); - CPPUNIT_ASSERT_EQUAL(String("<show>dnd</show>"), testling.serialize(statusShow)); - } - - void testSerialize_None() { - StatusShowSerializer testling; - boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::None)); - CPPUNIT_ASSERT_EQUAL(String(""), testling.serialize(statusShow)); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(StatusShowSerializerTest); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/StorageSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/StorageSerializerTest.cpp deleted file mode 100644 index daf43c5..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/StorageSerializerTest.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h" -#include "Swiften/Elements/Storage.h" - -using namespace Swift; - -class StorageSerializerTest : public CppUnit::TestFixture { - CPPUNIT_TEST_SUITE(StorageSerializerTest); - CPPUNIT_TEST(testSerialize); - CPPUNIT_TEST(testSerialize_NoNickOrPassword); - CPPUNIT_TEST_SUITE_END(); - - public: - StorageSerializerTest() {} - - void testSerialize() { - PayloadsSerializer serializer; - boost::shared_ptr<Storage> storage(new Storage()); - Storage::Conference conference; - conference.name = "Council of Oberon"; - conference.autoJoin = true; - conference.jid = JID("council@conference.underhill.org"); - conference.nick = "Puck"; - conference.password = "MyPass"; - storage->addConference(conference); - - CPPUNIT_ASSERT_EQUAL(String( - "<storage xmlns=\"storage:bookmarks\">" - "<conference " - "autojoin=\"1\" " - "jid=\"council@conference.underhill.org\" " - "name=\"Council of Oberon\">" - "<nick>Puck</nick>" - "<password>MyPass</password>" - "</conference>" - "</storage>"), serializer.serialize(storage)); - } - - void testSerialize_NoNickOrPassword() { - PayloadsSerializer serializer; - boost::shared_ptr<Storage> storage(new Storage()); - Storage::Conference conference; - conference.name = "Council of Oberon"; - conference.autoJoin = true; - conference.jid = JID("council@conference.underhill.org"); - storage->addConference(conference); - - CPPUNIT_ASSERT_EQUAL(String( - "<storage xmlns=\"storage:bookmarks\">" - "<conference " - "autojoin=\"1\" " - "jid=\"council@conference.underhill.org\" " - "name=\"Council of Oberon\"/>" - "</storage>"), serializer.serialize(storage)); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(StorageSerializerTest); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/VCardUpdateSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/VCardUpdateSerializerTest.cpp deleted file mode 100644 index 23988d7..0000000 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/VCardUpdateSerializerTest.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h" - -using namespace Swift; - -class VCardUpdateSerializerTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(VCardUpdateSerializerTest); - CPPUNIT_TEST(testSerialize); - CPPUNIT_TEST_SUITE_END(); - - public: - VCardUpdateSerializerTest() {} - - void testSerialize() { - VCardUpdateSerializer testling; - boost::shared_ptr<VCardUpdate> update(new VCardUpdate()); - update->setPhotoHash("sha1-hash-of-image"); - - String expectedResult = - "<x xmlns=\"vcard-temp:x:update\">" - "<photo>sha1-hash-of-image</photo>" - "</x>"; - - CPPUNIT_ASSERT_EQUAL(expectedResult, testling.serialize(update)); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(VCardUpdateSerializerTest); |