[COLLECTIONS-577] Add additional test cases for fixed problems with prefixMap. Thanks to Chris Duncan

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1705637 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Thomas Neidhart 2015-09-28 09:42:00 +00:00
parent f8bd75d37c
commit 3b691712fd
1 changed files with 20 additions and 0 deletions

View File

@ -345,6 +345,26 @@ public class PatriciaTrieTest<V> extends AbstractSortedMapTest<String, V> {
assertEquals(2, aTree.prefixMap("").values().size());
}
public void testPrefixMapSizes2() {
final char u8000 = Character.toChars(32768)[0]; // U+8000 (1000000000000000)
final char char_b = 'b'; // 1100010
final PatriciaTrie<String> trie = new PatriciaTrie<String>();
final String prefixString = "" + char_b;
final String longerString = prefixString + u8000;
assertEquals(1, prefixString.length());
assertEquals(2, longerString.length());
assertTrue(longerString.startsWith(prefixString));
trie.put(prefixString, "prefixString");
trie.put(longerString, "longerString");
assertEquals(2, trie.prefixMap(prefixString).size());
assertTrue(trie.prefixMap(prefixString).containsKey(longerString));
}
//-----------------------------------------------------------------------
@Override