summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTarun Gupta <tarun1995gupta@gmail.com>2017-03-22 09:18:20 (GMT)
committerTobias Markmann <tm@ayena.de>2017-03-23 21:07:53 (GMT)
commitcc873b3f00db4cd0a778bc2ec04f8748d70a92f9 (patch)
tree818b12d322fae76631668d8b64de082c6e20163e /Swiften/Serializer/PayloadSerializers/UnitTest
parent9bc6492fa3da165e0e3b9bb09b8f913d02275d11 (diff)
downloadswift-cc873b3f00db4cd0a778bc2ec04f8748d70a92f9.zip
swift-cc873b3f00db4cd0a778bc2ec04f8748d70a92f9.tar.bz2
Add Client State Indication Element, its Parser and Serializer
License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Adds tests for Client State Parser and Serializer, which passes. Tests performed on Ubuntu 16.04 LTS. Change-Id: I60c63f63e1c0fdd55600ef42faa95989ca5ab75b
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers/UnitTest')
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/ClientStateSerializerTest.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/ClientStateSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/ClientStateSerializerTest.cpp
new file mode 100644
index 0000000..1622354
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/ClientStateSerializerTest.cpp
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#include <gtest/gtest.h>
+
+#include <Swiften/Serializer/PayloadSerializers/ClientStateSerializer.h>
+
+using namespace Swift;
+
+TEST(ClientStateSerializerTest, testSerialize_ActiveState) {
+ ClientStateSerializer testling;
+ std::shared_ptr<ClientState> priority(new ClientState(ClientState::ClientStateType::Active));
+
+ ASSERT_EQ(std::string("<active xmlns=\"urn:xmpp:csi:0\"/>"), testling.serialize(priority));
+}
+
+TEST(ClientStateSerializerTest, testSerialize_InacativeState) {
+ ClientStateSerializer testling;
+ std::shared_ptr<ClientState> priority(new ClientState(ClientState::ClientStateType::Inactive));
+
+ ASSERT_EQ(std::string("<inactive xmlns=\"urn:xmpp:csi:0\"/>"), testling.serialize(priority));
+}