Add get_word_frequency function
Change-Id: Idef55f5a8f84c4bcba0a1bfdbe563eb74f26857a
diff --git a/tests/basic_test.c b/tests/basic_test.c
index 276837a..d6d236e 100644
--- a/tests/basic_test.c
+++ b/tests/basic_test.c
@@ -141,6 +141,15 @@
TEST_MSG("Unexpected corpus size: %lu", size);
}
+void test_get_word_frequency() {
+ COLLOCATORDB* cdb = open_collocatordb(dbpath);
+ TEST_ASSERT(cdb != NULL);
+ int w1 = get_word_id(cdb, "Test");
+ uint64_t freq = get_word_frequency(cdb, w1);
+ TEST_CHECK(freq == 3);
+ TEST_MSG("Unexpected word frequency: %lu", freq);
+}
+
TEST_LIST = {
{ "open database for reading", test_open_db },
{ "get word", test_get_word },
@@ -151,6 +160,7 @@
{ "version function", test_version_function },
{ "get word id", test_get_word_id },
{ "get corpus size", test_get_corpus_size},
+ { "get word frequency", test_get_word_frequency},
{ "collocatordb_query command line tool", test_collocatordb_query_command_line_tool},
{ NULL, NULL }
};