commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1705637 - /commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/trie/PatriciaTrieTest.java
Date Mon, 28 Sep 2015 09:42:00 GMT
Author: tn
Date: Mon Sep 28 09:42:00 2015
New Revision: 1705637

URL: http://svn.apache.org/viewvc?rev=1705637&view=rev
Log:
[COLLECTIONS-577] Add additional test cases for fixed problems with prefixMap. Thanks to Chris
Duncan

Modified:
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/trie/PatriciaTrieTest.java

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/trie/PatriciaTrieTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/trie/PatriciaTrieTest.java?rev=1705637&r1=1705636&r2=1705637&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/trie/PatriciaTrieTest.java
(original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/trie/PatriciaTrieTest.java
Mon Sep 28 09:42:00 2015
@@ -345,6 +345,26 @@ public class PatriciaTrieTest<V> extends
         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



Mime
View raw message