blob: 018d2cc3c4d837b71a02d40fa7860e63b08d2b6e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
/*
* Copyright (c) 2015 Tarun Gupta
* Licensed under the simplified BSD license.
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
/*
* Copyright (c) 2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <Swiften/Serializer/PayloadSerializers/ChatStateSerializer.h>
using namespace Swift;
class ChatStateSerializerTest : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(ChatStateSerializerTest);
CPPUNIT_TEST(testSerialize_ActiveState);
CPPUNIT_TEST(testSerialize_GoneState);
CPPUNIT_TEST(testSerialize_ComposingState);
CPPUNIT_TEST(testSerialize_PausedState);
CPPUNIT_TEST(testSerialize_InacativeState);
CPPUNIT_TEST_SUITE_END();
public:
ChatStateSerializerTest() {}
ChatStateSerializer testling;
void testSerialize_ActiveState() {
std::shared_ptr<ChatState> priority(new ChatState(ChatState::Active));
CPPUNIT_ASSERT_EQUAL(std::string("<active xmlns=\"http://jabber.org/protocol/chatstates\"/>"), testling.serialize(priority));
}
void testSerialize_GoneState() {
std::shared_ptr<ChatState> priority(new ChatState(ChatState::Gone));
CPPUNIT_ASSERT_EQUAL(std::string("<gone xmlns=\"http://jabber.org/protocol/chatstates\"/>"), testling.serialize(priority));
}
void testSerialize_ComposingState() {
std::shared_ptr<ChatState> priority(new ChatState(ChatState::Composing));
CPPUNIT_ASSERT_EQUAL(std::string("<composing xmlns=\"http://jabber.org/protocol/chatstates\"/>"), testling.serialize(priority));
}
void testSerialize_PausedState() {
std::shared_ptr<ChatState> priority(new ChatState(ChatState::Paused));
CPPUNIT_ASSERT_EQUAL(std::string("<paused xmlns=\"http://jabber.org/protocol/chatstates\"/>"), testling.serialize(priority));
}
void testSerialize_InacativeState() {
std::shared_ptr<ChatState> priority(new ChatState(ChatState::Inactive));
CPPUNIT_ASSERT_EQUAL(std::string("<inactive xmlns=\"http://jabber.org/protocol/chatstates\"/>"), testling.serialize(priority));
}
};
CPPUNIT_TEST_SUITE_REGISTRATION(ChatStateSerializerTest);
|