diff options
Diffstat (limited to 'tests/storage/test_ngram.cpp')
-rw-r--r-- | tests/storage/test_ngram.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/storage/test_ngram.cpp b/tests/storage/test_ngram.cpp index c33df32..3070ee9 100644 --- a/tests/storage/test_ngram.cpp +++ b/tests/storage/test_ngram.cpp @@ -6,7 +6,7 @@ int main(int argc, char * argv[]){ SingleGram single_gram; const guint32 total_freq = 16; - assert(single_gram.set_total_freq(total_freq)); + check_result(single_gram.set_total_freq(total_freq)); phrase_token_t tokens[6] = { 2, 6, 4, 3, 1, 3}; guint32 freqs[6] = { 1, 2, 4, 8, 16, 32}; @@ -15,9 +15,9 @@ int main(int argc, char * argv[]){ for(size_t i = 0; i < 6 ;++i){ if ( single_gram.get_freq(tokens[i], freq)) - assert(single_gram.set_freq(tokens[i], freqs[i])); + check_result(single_gram.set_freq(tokens[i], freqs[i])); else - assert(single_gram.insert_freq(tokens[i], freqs[i])); + check_result(single_gram.insert_freq(tokens[i], freqs[i])); } single_gram.get_freq(3, freq); @@ -33,14 +33,14 @@ int main(int argc, char * argv[]){ printf("item:%d:%f\n", item->m_token, item->m_freq); } - assert(single_gram.get_total_freq(freq)); + check_result(single_gram.get_total_freq(freq)); assert(freq == total_freq); Bigram bigram; - assert(bigram.attach("/tmp/test.db", ATTACH_CREATE|ATTACH_READWRITE)); + check_result(bigram.attach("/tmp/test.db", ATTACH_CREATE|ATTACH_READWRITE)); bigram.store(1, &single_gram); - assert(single_gram.insert_freq(5, 8)); - assert(single_gram.remove_freq(1, freq)); + check_result(single_gram.insert_freq(5, 8)); + check_result(single_gram.remove_freq(1, freq)); single_gram.set_total_freq(32); bigram.store(2, &single_gram); @@ -61,7 +61,7 @@ int main(int argc, char * argv[]){ } printf("--------------------------------------------------------\n"); - assert(single_gram.get_total_freq(freq)); + check_result(single_gram.get_total_freq(freq)); printf("total_freq:%d\n", freq); g_array_free(array, TRUE); @@ -75,8 +75,8 @@ int main(int argc, char * argv[]){ printf("item:%d\n", *token); } - assert(bigram.save_db("/tmp/snapshot.db")); - assert(bigram.load_db("/tmp/snapshot.db")); + check_result(bigram.save_db("/tmp/snapshot.db")); + check_result(bigram.load_db("/tmp/snapshot.db")); g_array_free(items, TRUE); |