summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2016-07-04 16:13:18 +0800
committerPeng Wu <alexepico@gmail.com>2016-07-04 16:13:18 +0800
commit92b3978e1b98fefbf19a32be7a2a165faa47b4f5 (patch)
tree22c55521feba96c28be252e700459d9af7c9a8f2 /tests
parent8bb2978cfe90b179f60bd242434eb397d9fa380a (diff)
downloadlibpinyin-92b3978e1b98fefbf19a32be7a2a165faa47b4f5.zip
libpinyin-92b3978e1b98fefbf19a32be7a2a165faa47b4f5.tar.gz
libpinyin-92b3978e1b98fefbf19a32be7a2a165faa47b4f5.tar.xz
update test cases
Diffstat (limited to 'tests')
-rw-r--r--tests/test_chewing.cpp10
-rw-r--r--tests/test_pinyin.cpp13
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);