diff options
Diffstat (limited to 'Swift/Controllers/UnitTest/ChatMessageSummarizerTest.cpp')
-rw-r--r-- | Swift/Controllers/UnitTest/ChatMessageSummarizerTest.cpp | 206 |
1 files changed, 103 insertions, 103 deletions
diff --git a/Swift/Controllers/UnitTest/ChatMessageSummarizerTest.cpp b/Swift/Controllers/UnitTest/ChatMessageSummarizerTest.cpp index 2711034..59c57b9 100644 --- a/Swift/Controllers/UnitTest/ChatMessageSummarizerTest.cpp +++ b/Swift/Controllers/UnitTest/ChatMessageSummarizerTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -7,115 +7,115 @@ #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> -#include "Swift/Controllers/ChatMessageSummarizer.h" +#include <Swift/Controllers/ChatMessageSummarizer.h> using namespace Swift; using namespace std; class ChatMessageSummarizerTest : public CppUnit::TestFixture { - CPPUNIT_TEST_SUITE(ChatMessageSummarizerTest); - CPPUNIT_TEST(testEmpty); - CPPUNIT_TEST(testCurrentNone); - CPPUNIT_TEST(testCurrentCount); - CPPUNIT_TEST(testCurrentCountOthersNone); - CPPUNIT_TEST(testCurrentCountOtherCount); - CPPUNIT_TEST(testCurrentNoneOtherCount); - CPPUNIT_TEST(testCurrentCountOthersCount); - CPPUNIT_TEST(testCurrentNoneOthersCount); - CPPUNIT_TEST(testCurrentCountSomeOthersCount); - CPPUNIT_TEST_SUITE_END(); + CPPUNIT_TEST_SUITE(ChatMessageSummarizerTest); + CPPUNIT_TEST(testEmpty); + CPPUNIT_TEST(testCurrentNone); + CPPUNIT_TEST(testCurrentCount); + CPPUNIT_TEST(testCurrentCountOthersNone); + CPPUNIT_TEST(testCurrentCountOtherCount); + CPPUNIT_TEST(testCurrentNoneOtherCount); + CPPUNIT_TEST(testCurrentCountOthersCount); + CPPUNIT_TEST(testCurrentNoneOthersCount); + CPPUNIT_TEST(testCurrentCountSomeOthersCount); + CPPUNIT_TEST_SUITE_END(); public: - ChatMessageSummarizerTest() {} - - void setUp() { - - } - - void testEmpty() { - string current(""); - vector<UnreadPair> unreads; - ChatMessageSummarizer summary; - CPPUNIT_ASSERT_EQUAL(current, summary.getSummary(current, unreads)); - } - - void testCurrentNone() { - string current("Bob"); - vector<UnreadPair> unreads; - unreads.push_back(UnreadPair("Bob", 0)); - ChatMessageSummarizer summary; - CPPUNIT_ASSERT_EQUAL(current, summary.getSummary(current, unreads)); - } - - void testCurrentCount() { - string current("Bob"); - vector<UnreadPair> unreads; - unreads.push_back(UnreadPair("Bob", 3)); - ChatMessageSummarizer summary; - CPPUNIT_ASSERT_EQUAL(string("Bob (3)"), summary.getSummary(current, unreads)); - } - - void testCurrentCountOthersNone() { - string current("Bob"); - vector<UnreadPair> unreads; - unreads.push_back(UnreadPair("Bert", 0)); - unreads.push_back(UnreadPair("Bob", 3)); - unreads.push_back(UnreadPair("Betty", 0)); - ChatMessageSummarizer summary; - CPPUNIT_ASSERT_EQUAL(string("Bob (3)"), summary.getSummary(current, unreads)); - } - - void testCurrentCountOtherCount() { - string current("Bob"); - vector<UnreadPair> unreads; - unreads.push_back(UnreadPair("Bert", 0)); - unreads.push_back(UnreadPair("Bob", 3)); - unreads.push_back(UnreadPair("Betty", 7)); - ChatMessageSummarizer summary; - CPPUNIT_ASSERT_EQUAL(string("Bob (3); Betty (7)"), summary.getSummary(current, unreads)); - } - - void testCurrentNoneOtherCount() { - string current("Bob"); - vector<UnreadPair> unreads; - unreads.push_back(UnreadPair("Bert", 0)); - unreads.push_back(UnreadPair("Bob", 0)); - unreads.push_back(UnreadPair("Betty", 7)); - ChatMessageSummarizer summary; - CPPUNIT_ASSERT_EQUAL(string("Bob; Betty (7)"), summary.getSummary(current, unreads)); - } - - void testCurrentNoneOthersCount() { - string current("Bob"); - vector<UnreadPair> unreads; - unreads.push_back(UnreadPair("Bert", 2)); - unreads.push_back(UnreadPair("Bob", 0)); - unreads.push_back(UnreadPair("Betty", 7)); - ChatMessageSummarizer summary; - CPPUNIT_ASSERT_EQUAL(string("Bob and 2 others (9)"), summary.getSummary(current, unreads)); - } - - void testCurrentCountOthersCount() { - string current("Bob"); - vector<UnreadPair> unreads; - unreads.push_back(UnreadPair("Bert", 2)); - unreads.push_back(UnreadPair("Bob", 11)); - unreads.push_back(UnreadPair("Betty", 7)); - ChatMessageSummarizer summary; - CPPUNIT_ASSERT_EQUAL(string("Bob (11) and 2 others (9)"), summary.getSummary(current, unreads)); - } - - void testCurrentCountSomeOthersCount() { - string current("Bob"); - vector<UnreadPair> unreads; - unreads.push_back(UnreadPair("Bert", 2)); - unreads.push_back(UnreadPair("Beverly", 0)); - unreads.push_back(UnreadPair("Bob", 11)); - unreads.push_back(UnreadPair("Beatrice", 0)); - unreads.push_back(UnreadPair("Betty", 7)); - ChatMessageSummarizer summary; - CPPUNIT_ASSERT_EQUAL(string("Bob (11) and 2 others (9)"), summary.getSummary(current, unreads)); - } + ChatMessageSummarizerTest() {} + + void setUp() { + + } + + void testEmpty() { + string current(""); + vector<UnreadPair> unreads; + ChatMessageSummarizer summary; + CPPUNIT_ASSERT_EQUAL(current, summary.getSummary(current, unreads)); + } + + void testCurrentNone() { + string current("Bob"); + vector<UnreadPair> unreads; + unreads.push_back(UnreadPair("Bob", 0)); + ChatMessageSummarizer summary; + CPPUNIT_ASSERT_EQUAL(current, summary.getSummary(current, unreads)); + } + + void testCurrentCount() { + string current("Bob"); + vector<UnreadPair> unreads; + unreads.push_back(UnreadPair("Bob", 3)); + ChatMessageSummarizer summary; + CPPUNIT_ASSERT_EQUAL(string("Bob (3)"), summary.getSummary(current, unreads)); + } + + void testCurrentCountOthersNone() { + string current("Bob"); + vector<UnreadPair> unreads; + unreads.push_back(UnreadPair("Bert", 0)); + unreads.push_back(UnreadPair("Bob", 3)); + unreads.push_back(UnreadPair("Betty", 0)); + ChatMessageSummarizer summary; + CPPUNIT_ASSERT_EQUAL(string("Bob (3)"), summary.getSummary(current, unreads)); + } + + void testCurrentCountOtherCount() { + string current("Bob"); + vector<UnreadPair> unreads; + unreads.push_back(UnreadPair("Bert", 0)); + unreads.push_back(UnreadPair("Bob", 3)); + unreads.push_back(UnreadPair("Betty", 7)); + ChatMessageSummarizer summary; + CPPUNIT_ASSERT_EQUAL(string("Bob (3); Betty (7)"), summary.getSummary(current, unreads)); + } + + void testCurrentNoneOtherCount() { + string current("Bob"); + vector<UnreadPair> unreads; + unreads.push_back(UnreadPair("Bert", 0)); + unreads.push_back(UnreadPair("Bob", 0)); + unreads.push_back(UnreadPair("Betty", 7)); + ChatMessageSummarizer summary; + CPPUNIT_ASSERT_EQUAL(string("Bob; Betty (7)"), summary.getSummary(current, unreads)); + } + + void testCurrentNoneOthersCount() { + string current("Bob"); + vector<UnreadPair> unreads; + unreads.push_back(UnreadPair("Bert", 2)); + unreads.push_back(UnreadPair("Bob", 0)); + unreads.push_back(UnreadPair("Betty", 7)); + ChatMessageSummarizer summary; + CPPUNIT_ASSERT_EQUAL(string("Bob and 2 others (9)"), summary.getSummary(current, unreads)); + } + + void testCurrentCountOthersCount() { + string current("Bob"); + vector<UnreadPair> unreads; + unreads.push_back(UnreadPair("Bert", 2)); + unreads.push_back(UnreadPair("Bob", 11)); + unreads.push_back(UnreadPair("Betty", 7)); + ChatMessageSummarizer summary; + CPPUNIT_ASSERT_EQUAL(string("Bob (11) and 2 others (9)"), summary.getSummary(current, unreads)); + } + + void testCurrentCountSomeOthersCount() { + string current("Bob"); + vector<UnreadPair> unreads; + unreads.push_back(UnreadPair("Bert", 2)); + unreads.push_back(UnreadPair("Beverly", 0)); + unreads.push_back(UnreadPair("Bob", 11)); + unreads.push_back(UnreadPair("Beatrice", 0)); + unreads.push_back(UnreadPair("Betty", 7)); + ChatMessageSummarizer summary; + CPPUNIT_ASSERT_EQUAL(string("Bob (11) and 2 others (9)"), summary.getSummary(current, unreads)); + } }; |