From 3b691712fd2dc7251907912124de0954f0652f6c Mon Sep 17 00:00:00 2001 From: Thomas Neidhart Date: Mon, 28 Sep 2015 09:42:00 +0000 Subject: [PATCH] [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 --- .../collections4/trie/PatriciaTrieTest.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/test/java/org/apache/commons/collections4/trie/PatriciaTrieTest.java b/src/test/java/org/apache/commons/collections4/trie/PatriciaTrieTest.java index def26b9bf..5a6ba81ba 100755 --- a/src/test/java/org/apache/commons/collections4/trie/PatriciaTrieTest.java +++ b/src/test/java/org/apache/commons/collections4/trie/PatriciaTrieTest.java @@ -345,6 +345,26 @@ public class PatriciaTrieTest extends AbstractSortedMapTest { 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 trie = new PatriciaTrie(); + 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