summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2015-05-21 13:17:02 +0800
committerPeng Wu <alexepico@gmail.com>2015-05-21 13:17:02 +0800
commitc0442398c0bed7f1f4c67bfd338faf3e37904547 (patch)
tree7d5e43734507fcab521578b29091c5f9e4a99e77
parent2fd097b32236f156aa18e7ee077ef34dc36d2d52 (diff)
downloadlibpinyin-c0442398c0bed7f1f4c67bfd338faf3e37904547.tar.gz
libpinyin-c0442398c0bed7f1f4c67bfd338faf3e37904547.tar.xz
libpinyin-c0442398c0bed7f1f4c67bfd338faf3e37904547.zip
update test_table_info
-rw-r--r--tests/storage/test_table_info.cpp62
1 files changed, 38 insertions, 24 deletions
diff --git a/tests/storage/test_table_info.cpp b/tests/storage/test_table_info.cpp
index af727a6..172aaf2 100644
--- a/tests/storage/test_table_info.cpp
+++ b/tests/storage/test_table_info.cpp
@@ -24,6 +24,31 @@
#include "pinyin_internal.h"
+void dump_table_info(const pinyin_table_info_t * table_info) {
+ switch(table_info->m_file_type) {
+ case NOT_USED:
+ printf("not used.\n");
+ break;
+
+ case SYSTEM_FILE:
+ printf("system file:%s %s %s.\n", table_info->m_table_filename,
+ table_info->m_system_filename, table_info->m_user_filename);
+ break;
+
+ case DICTIONARY:
+ printf("dictionary:%s %s %s.\n", table_info->m_table_filename,
+ table_info->m_system_filename, table_info->m_user_filename);
+ break;
+
+ case USER_FILE:
+ printf("user file:%s.\n", table_info->m_user_filename);
+ break;
+
+ default:
+ assert(false);
+ }
+}
+
int main(int argc, char * argv[]) {
setlocale(LC_ALL, "");
@@ -43,30 +68,19 @@ int main(int argc, char * argv[]) {
system_table_info.get_default_tables() + i;
assert(i == table_info->m_dict_index);
- printf("table index:%d\n", table_info->m_dict_index);
-
- switch(table_info->m_file_type) {
- case NOT_USED:
- printf("not used.\n");
- break;
-
- case SYSTEM_FILE:
- printf("system file:%s %s %s.\n", table_info->m_table_filename,
- table_info->m_system_filename, table_info->m_user_filename);
- break;
-
- case DICTIONARY:
- printf("dictionary:%s %s %s.\n", table_info->m_table_filename,
- table_info->m_system_filename, table_info->m_user_filename);
- break;
-
- case USER_FILE:
- printf("user file:%s.\n", table_info->m_user_filename);
- break;
-
- default:
- assert(false);
- }
+ printf("default table index:%d\n", table_info->m_dict_index);
+
+ dump_table_info(table_info);
+ }
+
+ for (i = 0; i < PHRASE_INDEX_LIBRARY_COUNT; ++i) {
+ const pinyin_table_info_t * table_info =
+ system_table_info.get_addon_tables() + i;
+
+ assert(i == table_info->m_dict_index);
+ printf("addon table index:%d\n", table_info->m_dict_index);
+
+ dump_table_info(table_info);
}
UserTableInfo user_table_info;