diff options
author | Peng Wu <alexepico@gmail.com> | 2012-06-14 11:13:51 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2012-06-14 11:13:51 +0800 |
commit | 4c42f29cb8863cc5d6810a8a2a25c478e16292f7 (patch) | |
tree | e4bcd14f79ca5b147e6908f074f443784ce9e1f1 /tests/storage/test_phrase_table.cpp | |
parent | 188af7797fc9fbb4d9ffe775ae2a05369698cdef (diff) | |
download | libpinyin-4c42f29cb8863cc5d6810a8a2a25c478e16292f7.tar.gz libpinyin-4c42f29cb8863cc5d6810a8a2a25c478e16292f7.tar.xz libpinyin-4c42f29cb8863cc5d6810a8a2a25c478e16292f7.zip |
refine tests
Diffstat (limited to 'tests/storage/test_phrase_table.cpp')
-rw-r--r-- | tests/storage/test_phrase_table.cpp | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/tests/storage/test_phrase_table.cpp b/tests/storage/test_phrase_table.cpp index a7043a8..58d634e 100644 --- a/tests/storage/test_phrase_table.cpp +++ b/tests/storage/test_phrase_table.cpp @@ -1,29 +1,15 @@ #include "timer.h" #include <string.h> #include "pinyin_internal.h" +#include "tests_helper.h" size_t bench_times = 1000; int main(int argc, char * argv[]){ PhraseLargeTable largetable; - for (size_t i = 0; i < PHRASE_INDEX_LIBRARY_COUNT; ++i) { - const char * tablename = pinyin_table_files[i]; - if (NULL == tablename) - continue; - - gchar * filename = g_build_filename("..", "..", "data", - tablename, NULL); - FILE * tablefile = fopen(filename, "r"); - if ( tablefile == NULL ) { - fprintf(stderr, "open %s failed!\n", tablename); - return 1; - } - - largetable.load_text(tablefile); - fclose(tablefile); - g_free(filename); - } + if (!load_phrase_table(NULL, &largetable, NULL)) + exit(ENOENT); MemoryChunk * chunk = new MemoryChunk; largetable.store(chunk); |