summaryrefslogtreecommitdiffstats
path: root/tests/storage
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2013-04-10 13:55:57 +0800
committerPeng Wu <alexepico@gmail.com>2013-04-10 13:55:57 +0800
commit8888185c907779dc9aa20b0b2e7bd19af6d11d2c (patch)
tree1534851a7448f9621dfa98a03c84eb47e7a31f15 /tests/storage
parent2c7f91dd2546ccba87714391c1281ee8973de4ac (diff)
downloadlibpinyin-8888185c907779dc9aa20b0b2e7bd19af6d11d2c.tar.gz
libpinyin-8888185c907779dc9aa20b0b2e7bd19af6d11d2c.tar.xz
libpinyin-8888185c907779dc9aa20b0b2e7bd19af6d11d2c.zip
update tests/storage
Diffstat (limited to 'tests/storage')
-rw-r--r--tests/storage/test_chewing_table.cpp13
-rw-r--r--tests/storage/test_phrase_index.cpp14
-rw-r--r--tests/storage/test_phrase_table.cpp13
3 files changed, 37 insertions, 3 deletions
diff --git a/tests/storage/test_chewing_table.cpp b/tests/storage/test_chewing_table.cpp
index bb25780..f3d0f5d 100644
--- a/tests/storage/test_chewing_table.cpp
+++ b/tests/storage/test_chewing_table.cpp
@@ -27,11 +27,22 @@
size_t bench_times = 1000;
int main(int argc, char * argv[]) {
+ SystemTableInfo system_table_info;
+
+ bool retval = system_table_info.load("../../data/table.conf");
+ if (!retval) {
+ fprintf(stderr, "load table.conf failed.\n");
+ exit(ENOENT);
+ }
+
pinyin_option_t options = USE_TONE | PINYIN_INCOMPLETE;
ChewingLargeTable largetable(options);
FacadePhraseIndex phrase_index;
- if (!load_phrase_table(&largetable, NULL, &phrase_index))
+ const pinyin_table_info_t * phrase_files =
+ system_table_info.get_table_info();
+
+ if (!load_phrase_table(phrase_files, &largetable, NULL, &phrase_index))
exit(ENOENT);
MemoryChunk * new_chunk = new MemoryChunk;
diff --git a/tests/storage/test_phrase_index.cpp b/tests/storage/test_phrase_index.cpp
index 96f9ca0..79a3ca4 100644
--- a/tests/storage/test_phrase_index.cpp
+++ b/tests/storage/test_phrase_index.cpp
@@ -71,8 +71,20 @@ int main(int argc, char * argv[]){
assert(poss == 0.5);
}
+ SystemTableInfo system_table_info;
+
+ bool retval = system_table_info.load("../../data/table.conf");
+ if (!retval) {
+ fprintf(stderr, "load table.conf failed.\n");
+ exit(ENOENT);
+ }
+
FacadePhraseIndex phrase_index;
- if (!load_phrase_table(NULL, NULL, &phrase_index))
+
+ const pinyin_table_info_t * phrase_files =
+ system_table_info.get_table_info();
+
+ if (!load_phrase_table(phrase_files, NULL, NULL, &phrase_index))
exit(ENOENT);
phrase_index.compact();
diff --git a/tests/storage/test_phrase_table.cpp b/tests/storage/test_phrase_table.cpp
index 9a84d6d..a9c8ed5 100644
--- a/tests/storage/test_phrase_table.cpp
+++ b/tests/storage/test_phrase_table.cpp
@@ -6,10 +6,21 @@
size_t bench_times = 1000;
int main(int argc, char * argv[]){
+ SystemTableInfo system_table_info;
+
+ bool retval = system_table_info.load("../../data/table.conf");
+ if (!retval) {
+ fprintf(stderr, "load table.conf failed.\n");
+ exit(ENOENT);
+ }
+
PhraseLargeTable2 largetable;
FacadePhraseIndex phrase_index;
- if (!load_phrase_table(NULL, &largetable, &phrase_index))
+ const pinyin_table_info_t * phrase_files =
+ system_table_info.get_table_info();
+
+ if (!load_phrase_table(phrase_files, NULL, &largetable, &phrase_index))
exit(ENOENT);
MemoryChunk * chunk = new MemoryChunk;