Skip to content

Commit

Permalink
FIX KYLIN-4810, Add some tips and test case
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengshengjun authored and hit-lacus committed Nov 24, 2020
1 parent f04d1d8 commit 3e12b6d
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,26 @@ public void partOverflowTest() {
}
}

@Test
public void utf8PartOverflowTest() {
//construct values more than 255 bytes
StringBuilder sb = new StringBuilder();
for (int i=0; i<255; i++){
sb.append('a');
}
// append utf-8 words, each word is more than 1 byte
sb.append("你好");
TrieDictionaryBuilder<String> b = new TrieDictionaryBuilder<String>(new StringBytesConverter());
b.addValue(sb.toString());
TrieDictionary<String> dict = b.build(0);
int totalValues = 0;
for (int i = dict.getMinId(); i <= dict.getMaxId(); i++) {
totalValues ++;
}
assertEquals(1, totalValues);
assertEquals(sb.toString(), dict.getValueFromId(0));
}

@Test
public void emptyValueTest() {
ArrayList<String> str = new ArrayList<String>();
Expand Down

0 comments on commit 3e12b6d

Please sign in to comment.