summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2010-09-14 16:10:33 +0800
committerPeng Wu <alexepico@gmail.com>2010-09-14 16:10:33 +0800
commit32b04bf652dca5d8e4d9980a9066d6ada19c868c (patch)
tree4f4ec95b18b96764706510c1fdfa111e93411ab6
parent9a5f7fb359c1a6ea6a6fde624473bfd4777b68a4 (diff)
downloadlibpinyin-32b04bf652dca5d8e4d9980a9066d6ada19c868c.tar.gz
libpinyin-32b04bf652dca5d8e4d9980a9066d6ada19c868c.tar.xz
libpinyin-32b04bf652dca5d8e4d9980a9066d6ada19c868c.zip
add test case for compat method
-rw-r--r--tests/storage/test_phrase_index.cpp4
-rw-r--r--utils/storage/gen_binary_files.cpp2
2 files changed, 6 insertions, 0 deletions
diff --git a/tests/storage/test_phrase_index.cpp b/tests/storage/test_phrase_index.cpp
index 0ebcc36..72b6d03 100644
--- a/tests/storage/test_phrase_index.cpp
+++ b/tests/storage/test_phrase_index.cpp
@@ -110,6 +110,8 @@ int main(int argc, char * argv[]){
phrase_index_load.load_text(2, infile);
fclose(infile);
+ phrase_index.compat();
+
MemoryChunk* store1 = new MemoryChunk;
phrase_index_load.store(1, store1);
phrase_index_load.load(1, store1);
@@ -118,6 +120,8 @@ int main(int argc, char * argv[]){
phrase_index_load.store(2, store2);
phrase_index_load.load(2, store2);
+ phrase_index.compat();
+
phrase_index_load.get_phrase_item(16870555, item2);
assert( item2.get_phrase_length() == 14);
assert( item2.get_n_pronunciation() == 1);
diff --git a/utils/storage/gen_binary_files.cpp b/utils/storage/gen_binary_files.cpp
index 5e7f619..0873283 100644
--- a/utils/storage/gen_binary_files.cpp
+++ b/utils/storage/gen_binary_files.cpp
@@ -89,6 +89,8 @@ int main(int argc, char * argv[]){
phrase_index.load_text(2, infile);
fclose(infile);
+ phrase_index.compat();
+
new_chunk = new MemoryChunk;
phrase_index.store(1, new_chunk);
new_chunk->save("../../data/gb_char.bin");