blob: 0d501015949a1b06c3d0ee6964bb35a441f5f4c4 (
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
|
/*
* Copyright (c) 2015 Tarun Gupta.
* Licensed under the simplified BSD license.
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <Swiften/Serializer/PayloadSerializers/IBBSerializer.h>
#include <Swiften/Elements/IBB.h>
#include <Swiften/Base/ByteArray.h>
using namespace Swift;
class IBBSerializerTest : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(IBBSerializerTest);
CPPUNIT_TEST(testSerialize_data);
CPPUNIT_TEST_SUITE_END();
public:
IBBSerializerTest() {}
void testSerialize_data() {
IBBSerializer testling;
boost::shared_ptr<IBB> ibb = boost::make_shared<IBB>();
ibb->setAction(IBB::Data);
ibb->setData(createByteArray("abcdefgihjklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890\x0a"));
ibb->setSequenceNumber(4);
CPPUNIT_ASSERT_EQUAL(std::string("<data seq=\"4\" sid=\"\" xmlns=\"http://jabber.org/protocol/ibb\">"
"YWJjZGVmZ2loamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWjEyMzQ1"
"Njc4OTAK"
"</data>"), testling.serialize(ibb));
}
};
CPPUNIT_TEST_SUITE_REGISTRATION(IBBSerializerTest);
|