summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2016-07-05 15:53:58 +0800
committerPeng Wu <alexepico@gmail.com>2016-07-05 16:11:27 +0800
commite3025d3bfbca1f98c7bec84b2fb50235e1e9c4e1 (patch)
treedc75cb20b735867fea1860291612b55f1ae6c016 /tests
parent4c2ba2e080b4ffd0dc611ba2b899ff7671332a7e (diff)
downloadlibpinyin-e3025d3bfbca1f98c7bec84b2fb50235e1e9c4e1.zip
libpinyin-e3025d3bfbca1f98c7bec84b2fb50235e1e9c4e1.tar.gz
libpinyin-e3025d3bfbca1f98c7bec84b2fb50235e1e9c4e1.tar.xz
update test cases
Diffstat (limited to 'tests')
-rw-r--r--tests/test_chewing.cpp10
-rw-r--r--tests/test_pinyin.cpp15
2 files changed, 15 insertions, 10 deletions
diff --git a/tests/test_chewing.cpp b/tests/test_chewing.cpp
index 3243e1f..b757bc6 100644
--- a/tests/test_chewing.cpp
+++ b/tests/test_chewing.cpp
@@ -51,10 +51,12 @@ int main(int argc, char * argv[]){
printf("%s\n", sentence);
g_free(sentence);
- gchar * aux_text = NULL;
- pinyin_get_chewing_auxiliary_text(instance, len, &aux_text);
- printf("auxiliary text:%s\n", aux_text);
- g_free(aux_text);
+ for (size_t i = 0; i <= len; ++i) {
+ gchar * aux_text = NULL;
+ pinyin_get_chewing_auxiliary_text(instance, i, &aux_text);
+ printf("auxiliary text:%s\n", aux_text);
+ g_free(aux_text);
+ }
pinyin_train(instance);
pinyin_reset(instance);
diff --git a/tests/test_pinyin.cpp b/tests/test_pinyin.cpp
index 1ce1f28..38d31cb 100644
--- a/tests/test_pinyin.cpp
+++ b/tests/test_pinyin.cpp
@@ -29,7 +29,7 @@ int main(int argc, char * argv[]){
pinyin_context_t * context =
pinyin_init("../data", "../data");
- pinyin_option_t options =
+ pinyin_option_t options = PINYIN_INCOMPLETE |
PINYIN_CORRECT_ALL | USE_DIVIDED_TABLE | USE_RESPLIT_TABLE |
DYNAMIC_ADJUST;
pinyin_set_options(context, options);
@@ -68,14 +68,17 @@ int main(int argc, char * argv[]){
pinyin_guess_sentence_with_prefix(instance, prefixbuf);
pinyin_guess_candidates(instance, 0);
- gchar * aux_text = NULL;
- pinyin_get_full_pinyin_auxiliary_text(instance, len, &aux_text);
- printf("auxiliary text:%s\n", aux_text);
- g_free(aux_text);
+ size_t i = 0;
+ for (i = 0; i <= len; ++i) {
+ gchar * aux_text = NULL;
+ pinyin_get_full_pinyin_auxiliary_text(instance, i, &aux_text);
+ printf("auxiliary text:%s\n", aux_text);
+ g_free(aux_text);
+ }
guint num = 0;
pinyin_get_n_candidate(instance, &num);
- for (size_t i = 0; i < num; ++i) {
+ for (i = 0; i < num; ++i) {
lookup_candidate_t * candidate = NULL;
pinyin_get_candidate(instance, i, &candidate);