summaryrefslogtreecommitdiff
path: root/editeng/qa/lookuptree
diff options
context:
space:
mode:
authorTomaž Vajngerl <quikee@gmail.com>2014-02-02 15:02:36 +0100
committerTomaž Vajngerl <quikee@gmail.com>2014-02-06 09:26:46 +0100
commit569e5f023ea3dc86988365ac23ceef70b94b177d (patch)
tree658b894fb5361b09c25dbe5a9ab901b68814ba01 /editeng/qa/lookuptree
parent1790ff71bd0772a37ad6ab7885cdbe2752dfdadf (diff)
Add getAllElements (strings) for Trie.
Change-Id: I9603cc51545f72fdb0854f2d76e2326706329000
Diffstat (limited to 'editeng/qa/lookuptree')
-rw-r--r--editeng/qa/lookuptree/lookuptree_test.cxx34
1 files changed, 31 insertions, 3 deletions
diff --git a/editeng/qa/lookuptree/lookuptree_test.cxx b/editeng/qa/lookuptree/lookuptree_test.cxx
index ab2f814f4b12..0bea3a5bdf00 100644
--- a/editeng/qa/lookuptree/lookuptree_test.cxx
+++ b/editeng/qa/lookuptree/lookuptree_test.cxx
@@ -34,10 +34,12 @@ class LookupTreeTest : public CppUnit::TestFixture
public:
void testLookupTree();
void testTrie();
+ void testTrieGetAllEntries();
CPPUNIT_TEST_SUITE(LookupTreeTest);
CPPUNIT_TEST(testLookupTree);
CPPUNIT_TEST(testTrie);
+ CPPUNIT_TEST(testTrieGetAllEntries);
CPPUNIT_TEST_SUITE_END();
};
@@ -227,11 +229,11 @@ void LookupTreeTest::testTrie()
editeng::Trie trie;
std::vector<OUString> suggestions;
- trie.findSuggestions( OUString(""), suggestions);
+ trie.findSuggestions( OUString(), suggestions);
CPPUNIT_ASSERT_EQUAL( (size_t) 0, suggestions.size() );
- trie.insert( OUString("") );
- trie.findSuggestions( OUString(""), suggestions);
+ trie.insert( OUString() );
+ trie.findSuggestions( OUString(), suggestions);
CPPUNIT_ASSERT_EQUAL( (size_t) 0, suggestions.size() );
trie.findSuggestions( OUString("a"), suggestions);
@@ -302,7 +304,33 @@ void LookupTreeTest::testTrie()
trie.findSuggestions( OUString(""), suggestions);
CPPUNIT_ASSERT_EQUAL( (size_t) 6, suggestions.size() );
suggestions.clear();
+}
+
+void LookupTreeTest::testTrieGetAllEntries()
+{
+ editeng::Trie trie;
+
+ std::vector<OUString> entries;
+
+ trie.getAllEntries(entries);
+ CPPUNIT_ASSERT_EQUAL( (size_t) 0, entries.size() );
+
+ trie.insert("A");
+ trie.getAllEntries(entries);
+ CPPUNIT_ASSERT_EQUAL( (size_t) 1, entries.size() );
+ entries.clear();
+
+ trie.insert("B");
+ trie.insert("C");
+ trie.getAllEntries(entries);
+ CPPUNIT_ASSERT_EQUAL( (size_t) 3, entries.size() );
+ entries.clear();
+ trie.insert("AA");
+ trie.insert("AAA");
+ trie.getAllEntries(entries);
+ CPPUNIT_ASSERT_EQUAL( (size_t) 5, entries.size() );
+ entries.clear();
}
} // namespace end