summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2012-02-21 14:09:32 +0800
committerPeng Wu <alexepico@gmail.com>2012-02-21 14:09:32 +0800
commit62dffb4c3615c275d514ee9428d1688770c6173b (patch)
tree13bc21f7052d15c1fefae58f7d9cc62f6a3d810f
parent5deda46d8f6c8e922cc31e7958d3558589bb7260 (diff)
downloadlibpinyin-62dffb4c3615c275d514ee9428d1688770c6173b.zip
libpinyin-62dffb4c3615c275d514ee9428d1688770c6173b.tar.gz
libpinyin-62dffb4c3615c275d514ee9428d1688770c6173b.tar.xz
update tests directory
-rw-r--r--tests/lookup/test_phrase_lookup.cpp6
-rw-r--r--tests/storage/test_chewing_table.cpp4
-rw-r--r--tests/storage/test_phrase_index.cpp8
-rw-r--r--tests/storage/test_phrase_table.cpp2
4 files changed, 10 insertions, 10 deletions
diff --git a/tests/lookup/test_phrase_lookup.cpp b/tests/lookup/test_phrase_lookup.cpp
index cf08dff..a4676f5 100644
--- a/tests/lookup/test_phrase_lookup.cpp
+++ b/tests/lookup/test_phrase_lookup.cpp
@@ -29,10 +29,10 @@ void print_help(){
}
bool try_phrase_lookup(PhraseLookup * phrase_lookup,
- utf16_t * utf16, glong utf16_len){
+ 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(utf16_len, utf16, results);
+ phrase_lookup->get_best_match(ucs4_len, ucs4_str, results);
#if 0
for ( size_t i = 0; i < results->len; ++i) {
phrase_token_t * token = &g_array_index(results, phrase_token_t, i);
@@ -108,7 +108,7 @@ int main(int argc, char * argv[]){
//check non-ucs2 characters
const glong num_of_chars = g_utf8_strlen(linebuf, -1);
glong len = 0;
- utf16_t * sentence = g_utf8_to_utf16(linebuf, -1, NULL, &len, NULL);
+ ucs4_t * sentence = g_utf8_to_ucs4(linebuf, -1, NULL, &len, NULL);
if ( len != num_of_chars ) {
fprintf(stderr, "non-ucs2 characters are not accepted.\n");
g_free(sentence);
diff --git a/tests/storage/test_chewing_table.cpp b/tests/storage/test_chewing_table.cpp
index 02e855e..ac09a10 100644
--- a/tests/storage/test_chewing_table.cpp
+++ b/tests/storage/test_chewing_table.cpp
@@ -115,9 +115,9 @@ int main(int argc, char * argv[]) {
phrase_index.get_phrase_item( token, item);
/* get phrase string */
- gunichar2 buffer[MAX_PHRASE_LENGTH + 1];
+ ucs4_t buffer[MAX_PHRASE_LENGTH + 1];
item.get_phrase_string(buffer);
- char * string = g_utf16_to_utf8
+ char * string = g_ucs4_to_utf8
( buffer, item.get_phrase_length(),
NULL, NULL, NULL);
printf("%s\t", string);
diff --git a/tests/storage/test_phrase_index.cpp b/tests/storage/test_phrase_index.cpp
index b883c9e..22f5efc 100644
--- a/tests/storage/test_phrase_index.cpp
+++ b/tests/storage/test_phrase_index.cpp
@@ -7,7 +7,7 @@ size_t bench_times = 100000;
int main(int argc, char * argv[]){
PhraseItem phrase_item;
- utf16_t string1 = 2;
+ ucs4_t string1 = 2;
ChewingKey key1 = ChewingKey(CHEWING_CH, CHEWING_ZERO_MIDDLE, CHEWING_ENG);
ChewingKey key2 = ChewingKey(CHEWING_SH, CHEWING_ZERO_MIDDLE, CHEWING_ANG);
@@ -33,7 +33,7 @@ int main(int argc, char * argv[]){
assert(phrase_item.get_unigram_frequency() == 0);
- utf16_t string2;
+ ucs4_t string2;
phrase_item.get_phrase_string(&string2);
assert(string1 == string2);
@@ -106,9 +106,9 @@ int main(int argc, char * argv[]){
assert( item2.get_phrase_length() == 14);
assert( item2.get_n_pronunciation() == 1);
- gunichar2 buf[1024];
+ ucs4_t buf[1024];
item2.get_phrase_string(buf);
- char * string = g_utf16_to_utf8( buf, 14, NULL, NULL, NULL);
+ char * string = g_ucs4_to_utf8( buf, 14, NULL, NULL, NULL);
printf("%s\n", string);
g_free(string);
diff --git a/tests/storage/test_phrase_table.cpp b/tests/storage/test_phrase_table.cpp
index a4e3a30..2907948 100644
--- a/tests/storage/test_phrase_table.cpp
+++ b/tests/storage/test_phrase_table.cpp
@@ -37,7 +37,7 @@ int main(int argc, char * argv[]){
break;
glong phrase_len = g_utf8_strlen(linebuf, -1);
- utf16_t * new_phrase = g_utf8_to_utf16(linebuf, -1, NULL, NULL, NULL);
+ ucs4_t * new_phrase = g_utf8_to_ucs4(linebuf, -1, NULL, NULL, NULL);
phrase_token_t token;
guint32 start = record_time();