summaryrefslogtreecommitdiffstats
path: root/tests/storage/test_chewing_table.cpp
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2012-06-14 11:13:51 +0800
committerPeng Wu <alexepico@gmail.com>2012-06-14 11:13:51 +0800
commit4c42f29cb8863cc5d6810a8a2a25c478e16292f7 (patch)
treee4bcd14f79ca5b147e6908f074f443784ce9e1f1 /tests/storage/test_chewing_table.cpp
parent188af7797fc9fbb4d9ffe775ae2a05369698cdef (diff)
downloadlibpinyin-4c42f29cb8863cc5d6810a8a2a25c478e16292f7.tar.gz
libpinyin-4c42f29cb8863cc5d6810a8a2a25c478e16292f7.tar.xz
libpinyin-4c42f29cb8863cc5d6810a8a2a25c478e16292f7.zip
refine tests
Diffstat (limited to 'tests/storage/test_chewing_table.cpp')
-rw-r--r--tests/storage/test_chewing_table.cpp23
1 files changed, 3 insertions, 20 deletions
diff --git a/tests/storage/test_chewing_table.cpp b/tests/storage/test_chewing_table.cpp
index 028cda9..a826f46 100644
--- a/tests/storage/test_chewing_table.cpp
+++ b/tests/storage/test_chewing_table.cpp
@@ -22,7 +22,7 @@
#include "timer.h"
#include <string.h>
#include "pinyin_internal.h"
-
+#include "tests_helper.h"
size_t bench_times = 1000;
@@ -31,25 +31,8 @@ int main(int argc, char * argv[]) {
ChewingLargeTable largetable(options);
FacadePhraseIndex phrase_index;
- 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 (NULL == tablefile) {
- fprintf(stderr, "open %s failed!\n", tablename);
- exit(ENOENT);
- }
-
- largetable.load_text(tablefile);
- fseek(tablefile, 0L, SEEK_SET);
- phrase_index.load_text(i, tablefile);
- fclose(tablefile);
- g_free(filename);
- }
+ if (!load_phrase_table(&largetable, NULL, &phrase_index))
+ exit(ENOENT);
MemoryChunk * new_chunk = new MemoryChunk;
largetable.store(new_chunk);