diff options
Diffstat (limited to 'Swiften/Parser/UnitTest/MessageParserTest.cpp')
m--------- | Swiften | 0 | ||||
-rw-r--r-- | Swiften/Parser/UnitTest/MessageParserTest.cpp | 80 |
2 files changed, 0 insertions, 80 deletions
diff --git a/Swiften b/Swiften new file mode 160000 +Subproject 8213ba16d0043d2461f4b031c881d61dda5a38c diff --git a/Swiften/Parser/UnitTest/MessageParserTest.cpp b/Swiften/Parser/UnitTest/MessageParserTest.cpp deleted file mode 100644 index 61a8d20..0000000 --- a/Swiften/Parser/UnitTest/MessageParserTest.cpp +++ /dev/null @@ -1,80 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Parser/MessageParser.h" -#include "Swiften/Parser/PayloadParserFactoryCollection.h" -#include "Swiften/Parser/UnitTest/StanzaParserTester.h" - -using namespace Swift; - -class MessageParserTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(MessageParserTest); - CPPUNIT_TEST(testParse_Normal); - CPPUNIT_TEST(testParse_Chat); - CPPUNIT_TEST(testParse_Error); - CPPUNIT_TEST(testParse_Groupchat); - CPPUNIT_TEST(testParse_Headline); - CPPUNIT_TEST_SUITE_END(); - - public: - MessageParserTest() {} - - void setUp() { - factoryCollection_ = new PayloadParserFactoryCollection(); - } - - void tearDown() { - delete factoryCollection_; - } - - void testParse_Chat() { - MessageParser testling(factoryCollection_); - StanzaParserTester parser(&testling); - - CPPUNIT_ASSERT(parser.parse("<message type=\"chat\"/>")); - - CPPUNIT_ASSERT_EQUAL(Message::Chat, testling.getStanzaGeneric()->getType()); - } - - void testParse_Groupchat() { - MessageParser testling(factoryCollection_); - StanzaParserTester parser(&testling); - - CPPUNIT_ASSERT(parser.parse("<message type=\"groupchat\"/>")); - - CPPUNIT_ASSERT_EQUAL(Message::Groupchat, testling.getStanzaGeneric()->getType()); - } - - void testParse_Error() { - MessageParser testling(factoryCollection_); - StanzaParserTester parser(&testling); - - CPPUNIT_ASSERT(parser.parse("<message type=\"error\"/>")); - - CPPUNIT_ASSERT_EQUAL(Message::Error, testling.getStanzaGeneric()->getType()); - } - - void testParse_Headline() { - MessageParser testling(factoryCollection_); - StanzaParserTester parser(&testling); - - CPPUNIT_ASSERT(parser.parse("<message type=\"headline\"/>")); - - CPPUNIT_ASSERT_EQUAL(Message::Headline, testling.getStanzaGeneric()->getType()); - } - - void testParse_Normal() { - MessageParser testling(factoryCollection_); - StanzaParserTester parser(&testling); - - CPPUNIT_ASSERT(parser.parse("<message/>")); - - CPPUNIT_ASSERT_EQUAL(Message::Normal, testling.getStanzaGeneric()->getType()); - } - - private: - PayloadParserFactoryCollection* factoryCollection_; -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(MessageParserTest); |