/* * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include #include #include #include #include using namespace Swift; class StanzaAckParserTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(StanzaAckParserTest); CPPUNIT_TEST(testParse); CPPUNIT_TEST(testParse_Invalid); CPPUNIT_TEST(testParse_Empty); CPPUNIT_TEST_SUITE_END(); public: void testParse() { StanzaAckParser testling; ElementParserTester parser(&testling); CPPUNIT_ASSERT(parser.parse("")); CPPUNIT_ASSERT(testling.getElementGeneric()->isValid()); CPPUNIT_ASSERT_EQUAL(12U, testling.getElementGeneric()->getHandledStanzasCount()); } void testParse_Invalid() { StanzaAckParser testling; ElementParserTester parser(&testling); CPPUNIT_ASSERT(parser.parse("")); CPPUNIT_ASSERT(!testling.getElementGeneric()->isValid()); } void testParse_Empty() { StanzaAckParser testling; ElementParserTester parser(&testling); CPPUNIT_ASSERT(parser.parse("")); CPPUNIT_ASSERT(!testling.getElementGeneric()->isValid()); } }; CPPUNIT_TEST_SUITE_REGISTRATION(StanzaAckParserTest);