diff options
author | Peng Wu <alexepico@gmail.com> | 2010-10-15 14:32:12 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2010-10-15 14:32:12 +0800 |
commit | 0a0630746d37cb0088eea1e7d1420e76d5dd0d7f (patch) | |
tree | 6b24273f176c6a0cd91ca450c0a4672aa0e257d6 /tests | |
parent | c41635080ec47ed414e1180212b30866a673eb44 (diff) | |
download | libpinyin-0a0630746d37cb0088eea1e7d1420e76d5dd0d7f.tar.gz libpinyin-0a0630746d37cb0088eea1e7d1420e76d5dd0d7f.tar.xz libpinyin-0a0630746d37cb0088eea1e7d1420e76d5dd0d7f.zip |
fixes compile warnings
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lookup/test_simple_lookup.cpp | 2 | ||||
-rw-r--r-- | tests/storage/test_ngram.cpp | 18 | ||||
-rw-r--r-- | tests/storage/test_parser.cpp | 2 | ||||
-rw-r--r-- | tests/storage/test_phrase_index.cpp | 2 | ||||
-rw-r--r-- | tests/storage/test_phrase_table.cpp | 2 | ||||
-rw-r--r-- | tests/storage/test_pinyin_index.cpp | 12 |
6 files changed, 19 insertions, 19 deletions
diff --git a/tests/lookup/test_simple_lookup.cpp b/tests/lookup/test_simple_lookup.cpp index 7039f45..ccbacf8 100644 --- a/tests/lookup/test_simple_lookup.cpp +++ b/tests/lookup/test_simple_lookup.cpp @@ -87,7 +87,7 @@ int main( int argc, char * argv[]){ phrase_token_t * token = &g_array_index(results, phrase_token_t, i); if ( NULL == *token) continue; - printf("pos:%d,token:%d\t", i, *token); + printf("pos:%ld,token:%d\t", i, *token); } printf("\n"); char * sentence = NULL; diff --git a/tests/storage/test_ngram.cpp b/tests/storage/test_ngram.cpp index 2110afc..0b8f199 100644 --- a/tests/storage/test_ngram.cpp +++ b/tests/storage/test_ngram.cpp @@ -12,7 +12,7 @@ int main(int argc, char * argv[]){ phrase_token_t tokens[6] = { 2, 6, 4, 3, 1, 3}; guint32 freqs[6] = { 1, 2, 4, 8, 16, 32}; - for(int i = 0; i < 6 ;++i){ + for(size_t i = 0; i < 6 ;++i){ single_gram.set_freq(tokens[i], freqs[i]); } @@ -25,7 +25,7 @@ int main(int argc, char * argv[]){ BigramPhraseArray array = g_array_new(FALSE, FALSE, sizeof(BigramPhraseItem)); range.m_range_begin = 0; range.m_range_end = 8; single_gram.search(&range,array); - for ( int i = 0; i < array->len; ++i){ + for ( size_t i = 0; i < array->len; ++i){ BigramPhraseItem * item = &g_array_index(array, BigramPhraseItem, i); printf("item:%d:%f\n", item->m_token, item->m_freq); } @@ -50,7 +50,7 @@ int main(int argc, char * argv[]){ g_array_set_size(array, 0); range.m_range_begin = 0; range.m_range_end = 8; user->search(&range,array); - for ( int i = 0; i < array->len; ++i){ + for ( size_t i = 0; i < array->len; ++i){ BigramPhraseItem * item = &g_array_index(array, BigramPhraseItem, i); printf("item:%d:%f\n", item->m_token, item->m_freq); } @@ -62,7 +62,7 @@ int main(int argc, char * argv[]){ g_array_set_size(array, 0); range.m_range_begin = 0; range.m_range_end = 8; user->search(&range,array); - for ( int i = 0; i < array->len; ++i){ + for ( size_t i = 0; i < array->len; ++i){ BigramPhraseItem * item = &g_array_index(array, BigramPhraseItem, i); printf("item:%d:%f\n", item->m_token, item->m_freq); } @@ -75,7 +75,7 @@ int main(int argc, char * argv[]){ g_array_set_size(array, 0); range.m_range_begin = 0; range.m_range_end = 8; system->search(&range,array); - for ( int i = 0; i < array->len; ++i){ + for ( size_t i = 0; i < array->len; ++i){ BigramPhraseItem * item = &g_array_index(array, BigramPhraseItem, i); printf("item:%d:%f\n", item->m_token, item->m_freq); } @@ -87,7 +87,7 @@ int main(int argc, char * argv[]){ g_array_set_size(array, 0); range.m_range_begin = 0; range.m_range_end = 8; system->search(&range,array); - for ( int i = 0; i < array->len; ++i){ + for ( size_t i = 0; i < array->len; ++i){ BigramPhraseItem * item = &g_array_index(array, BigramPhraseItem, i); printf("item:%d:%f\n", item->m_token, item->m_freq); } @@ -98,7 +98,7 @@ int main(int argc, char * argv[]){ g_array_set_size(array, 0); range.m_range_begin = 0; range.m_range_end = 8; single_gram.search(&range,array); - for ( int i = 0; i < array->len; ++i){ + for ( size_t i = 0; i < array->len; ++i){ BigramPhraseItem * item = &g_array_index(array, BigramPhraseItem, i); printf("item:%d:%f\n", item->m_token, item->m_freq); } @@ -112,12 +112,12 @@ int main(int argc, char * argv[]){ bigram.get_all_items(system_items, user_items); printf("----------------------system----------------------------\n"); - for ( int i = 0; i < system_items->len; ++i){ + for ( size_t i = 0; i < system_items->len; ++i){ phrase_token_t * token = &g_array_index(system_items, phrase_token_t, i); printf("item:%d\n", *token); } printf("-----------------------user-----------------------------\n"); - for ( int i = 0; i < user_items->len; ++i){ + for ( size_t i = 0; i < user_items->len; ++i){ phrase_token_t * token = &g_array_index(user_items, phrase_token_t, i); printf("item:%d\n", *token); } diff --git a/tests/storage/test_parser.cpp b/tests/storage/test_parser.cpp index 7467e8a..fe870a3 100644 --- a/tests/storage/test_parser.cpp +++ b/tests/storage/test_parser.cpp @@ -135,7 +135,7 @@ int main (int argc, char * argv []) for ( size_t i=0; i < poses->len; ++i){ PinyinKeyPos * pos = &g_array_index(poses, PinyinKeyPos, i); - printf("%d %d ", pos->get_pos(), pos->get_length()); + printf("%d %ld ", pos->get_pos(), pos->get_length()); } printf("\n"); diff --git a/tests/storage/test_phrase_index.cpp b/tests/storage/test_phrase_index.cpp index d71ce6d..c5d5828 100644 --- a/tests/storage/test_phrase_index.cpp +++ b/tests/storage/test_phrase_index.cpp @@ -64,7 +64,7 @@ int main(int argc, char * argv[]){ PhraseItem item2; guint32 time = record_time(); - for ( int i = 0; i < bench_times; ++i){ + for ( size_t i = 0; i < bench_times; ++i){ phrase_index.get_phrase_item(1, item2); assert(item2.get_unigram_frequency() == 0); assert(item2.get_n_pronunciation() == 2); diff --git a/tests/storage/test_phrase_table.cpp b/tests/storage/test_phrase_table.cpp index 758cf6c..e5fb24d 100644 --- a/tests/storage/test_phrase_table.cpp +++ b/tests/storage/test_phrase_table.cpp @@ -60,7 +60,7 @@ int main(int argc, char * argv[]){ phrase_token_t token; guint32 start = record_time(); - for ( int i = 0; i < bench_times; ++i){ + for ( size_t i = 0; i < bench_times; ++i){ largetable.search(phrase_len, new_phrase, token); } print_time(start, bench_times); diff --git a/tests/storage/test_pinyin_index.cpp b/tests/storage/test_pinyin_index.cpp index 7c8eb78..90f0437 100644 --- a/tests/storage/test_pinyin_index.cpp +++ b/tests/storage/test_pinyin_index.cpp @@ -89,26 +89,26 @@ int main( int argc, char * argv[]){ guint32 start = record_time(); PhraseIndexRanges ranges; - for( int i = 0 ; i < PHRASE_INDEX_LIBRARY_COUNT ; ++i){ + for( size_t i = 0 ; i < PHRASE_INDEX_LIBRARY_COUNT ; ++i){ ranges[i] = g_array_new(FALSE, FALSE, sizeof (PhraseIndexRange)); } - for ( int i = 0 ; i < bench_times; ++i){ + for ( size_t i = 0 ; i < bench_times; ++i){ largetable.search(keys->len, (PinyinKey *)keys->data, ranges); } - for( int i = 0 ; i < PHRASE_INDEX_LIBRARY_COUNT ; ++i){ + for( size_t i = 0 ; i < PHRASE_INDEX_LIBRARY_COUNT ; ++i){ GArray * range = ranges[i]; g_array_set_size( range, 0); } print_time(start, bench_times); largetable.search(keys->len, (PinyinKey *)keys->data, ranges); - for( int i = 0 ; i < PHRASE_INDEX_LIBRARY_COUNT ; ++i){ + for( size_t i = 0 ; i < PHRASE_INDEX_LIBRARY_COUNT ; ++i){ GArray * range = ranges[i]; if ( range ){ - for (int k = 0; k < range->len; ++k){ + for (size_t k = 0; k < range->len; ++k){ PhraseIndexRange* onerange = &g_array_index(range, PhraseIndexRange, k); - printf("start:%ld\tend:%ld\n", onerange->m_range_begin, onerange->m_range_end); + printf("start:%d\tend:%d\n", onerange->m_range_begin, onerange->m_range_end); PhraseItem item; for ( phrase_token_t token = onerange->m_range_begin; token != onerange->m_range_end; ++token){ phrase_index.get_phrase_item( token, item); |