From 92b3978e1b98fefbf19a32be7a2a165faa47b4f5 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Mon, 4 Jul 2016 16:13:18 +0800 Subject: update test cases --- tests/test_chewing.cpp | 10 +++++++--- tests/test_pinyin.cpp | 13 +++++++++---- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/tests/test_chewing.cpp b/tests/test_chewing.cpp index 5a5701f..3243e1f 100644 --- a/tests/test_chewing.cpp +++ b/tests/test_chewing.cpp @@ -39,11 +39,10 @@ int main(int argc, char * argv[]){ linebuf[strlen(linebuf) - 1] = '\0'; } - if ( strcmp ( linebuf, "quit" ) == 0) + if ( strcmp ( linebuf, "quit" ) == 0) break; - pinyin_parse_more_chewings - (instance, linebuf); + size_t len = pinyin_parse_more_chewings(instance, linebuf); pinyin_guess_sentence(instance); char * sentence = NULL; @@ -52,6 +51,11 @@ 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); + pinyin_train(instance); pinyin_reset(instance); pinyin_save(context); diff --git a/tests/test_pinyin.cpp b/tests/test_pinyin.cpp index 18ead74..1ce1f28 100644 --- a/tests/test_pinyin.cpp +++ b/tests/test_pinyin.cpp @@ -64,13 +64,18 @@ int main(int argc, char * argv[]){ if ( strcmp ( linebuf, "quit" ) == 0) break; - pinyin_parse_more_full_pinyins(instance, linebuf); + size_t len = pinyin_parse_more_full_pinyins(instance, linebuf); pinyin_guess_sentence_with_prefix(instance, prefixbuf); pinyin_guess_candidates(instance, 0); - guint len = 0; - pinyin_get_n_candidate(instance, &len); - for (size_t i = 0; i < len; ++i) { + 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); + + guint num = 0; + pinyin_get_n_candidate(instance, &num); + for (size_t i = 0; i < num; ++i) { lookup_candidate_t * candidate = NULL; pinyin_get_candidate(instance, i, &candidate); -- cgit