summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2017-02-04 15:16:26 +0800
committerPeng Wu <alexepico@gmail.com>2017-02-04 15:16:26 +0800
commit1e698604f33ece6cbd3ee436aa6b9607003f3150 (patch)
tree3c9399f687f990f5b4317155b1f27b85d4890759 /tests
parent58e14c36cdabbd941a2aa9e6d21c76238d08d178 (diff)
downloadlibpinyin-1e698604f33ece6cbd3ee436aa6b9607003f3150.zip
libpinyin-1e698604f33ece6cbd3ee436aa6b9607003f3150.tar.gz
libpinyin-1e698604f33ece6cbd3ee436aa6b9607003f3150.tar.xz
rename MatchResults to MatchResult
Diffstat (limited to 'tests')
-rw-r--r--tests/lookup/test_phrase_lookup.cpp12
-rw-r--r--tests/lookup/test_pinyin_lookup.cpp12
2 files changed, 12 insertions, 12 deletions
diff --git a/tests/lookup/test_phrase_lookup.cpp b/tests/lookup/test_phrase_lookup.cpp
index 3a475b9..408b0eb 100644
--- a/tests/lookup/test_phrase_lookup.cpp
+++ b/tests/lookup/test_phrase_lookup.cpp
@@ -32,23 +32,23 @@
bool try_phrase_lookup(PhraseLookup * phrase_lookup,
ucs4_t * ucs4_str, glong ucs4_len){
char * result_string = NULL;
- MatchResults results = g_array_new(FALSE, FALSE, sizeof(phrase_token_t));
- phrase_lookup->get_best_match(ucs4_len, ucs4_str, results);
+ MatchResult result = g_array_new(FALSE, FALSE, sizeof(phrase_token_t));
+ phrase_lookup->get_best_match(ucs4_len, ucs4_str, result);
#if 0
- for ( size_t i = 0; i < results->len; ++i) {
- phrase_token_t * token = &g_array_index(results, phrase_token_t, i);
+ for (size_t i = 0; i < result->len; ++i) {
+ phrase_token_t * token = &g_array_index(result, phrase_token_t, i);
if ( *token == null_token )
continue;
printf("%d:%d\t", i, *token);
}
printf("\n");
#endif
- phrase_lookup->convert_to_utf8(results, result_string);
+ phrase_lookup->convert_to_utf8(result, result_string);
if (result_string)
printf("%s\n", result_string);
else
fprintf(stderr, "Error: Un-segmentable sentence encountered!\n");
- g_array_free(results, TRUE);
+ g_array_free(result, TRUE);
g_free(result_string);
return true;
}
diff --git a/tests/lookup/test_pinyin_lookup.cpp b/tests/lookup/test_pinyin_lookup.cpp
index b0af455..8a1647d 100644
--- a/tests/lookup/test_pinyin_lookup.cpp
+++ b/tests/lookup/test_pinyin_lookup.cpp
@@ -70,7 +70,7 @@ int main( int argc, char * argv[]){
CandidateConstraints constraints = g_array_new
(TRUE, FALSE, sizeof(lookup_constraint_t));
- MatchResults results = g_array_new(FALSE, FALSE, sizeof(phrase_token_t));
+ MatchResult result = g_array_new(FALSE, FALSE, sizeof(phrase_token_t));
char* linebuf = NULL; size_t size = 0; ssize_t read;
while( (read = getline(&linebuf, &size, stdin)) != -1 ){
@@ -113,11 +113,11 @@ int main( int argc, char * argv[]){
guint32 start_time = record_time();
for (size_t i = 0; i < bench_times; ++i)
- pinyin_lookup.get_best_match(prefixes, &matrix, constraints, results);
+ pinyin_lookup.get_best_match(prefixes, &matrix, constraints, result);
print_time(start_time, bench_times);
- for (size_t i = 0; i < results->len; ++i){
- phrase_token_t * token = &g_array_index(results, phrase_token_t, i);
+ for (size_t i = 0; i < result->len; ++i){
+ phrase_token_t * token = &g_array_index(result, phrase_token_t, i);
if ( null_token == *token)
continue;
printf("pos:%ld,token:%d\t", i, *token);
@@ -125,7 +125,7 @@ int main( int argc, char * argv[]){
printf("\n");
char * sentence = NULL;
- pinyin_lookup.convert_to_utf8(results, sentence);
+ pinyin_lookup.convert_to_utf8(result, sentence);
printf("%s\n", sentence);
g_array_free(keys, TRUE);
@@ -135,7 +135,7 @@ int main( int argc, char * argv[]){
g_array_free(prefixes, TRUE);
g_array_free(constraints, TRUE);
- g_array_free(results, TRUE);
+ g_array_free(result, TRUE);
free(linebuf);
return 0;