* update test cases for other changes
This commit is contained in:
@ -116,7 +116,7 @@ test_mu_index (void)
|
|||||||
g_assert (store);
|
g_assert (store);
|
||||||
|
|
||||||
g_assert_cmpuint (mu_store_count (store), ==, 9);
|
g_assert_cmpuint (mu_store_count (store), ==, 9);
|
||||||
mu_store_destroy (store);
|
mu_store_unref (store);
|
||||||
|
|
||||||
g_free (muhome);
|
g_free (muhome);
|
||||||
g_free (xpath);
|
g_free (xpath);
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
#include "test-mu-common.h"
|
#include "test-mu-common.h"
|
||||||
#include "src/mu-query.h"
|
#include "src/mu-query.h"
|
||||||
#include "src/mu-str.h"
|
#include "src/mu-str.h"
|
||||||
|
#include "src/mu-store.h"
|
||||||
|
|
||||||
static gchar*
|
static gchar*
|
||||||
fill_database (const char *testdir)
|
fill_database (const char *testdir)
|
||||||
@ -69,7 +69,8 @@ assert_no_dups (MuMsgIter *iter)
|
|||||||
|
|
||||||
mu_msg_iter_reset (iter);
|
mu_msg_iter_reset (iter);
|
||||||
while (!mu_msg_iter_is_done(iter)) {
|
while (!mu_msg_iter_is_done(iter)) {
|
||||||
MuMsg *msg = mu_msg_iter_get_msg (iter, NULL);
|
MuMsg *msg;
|
||||||
|
msg = mu_msg_iter_get_msg_floating (iter);
|
||||||
/* make sure there are no duplicates */
|
/* make sure there are no duplicates */
|
||||||
g_assert (!g_hash_table_lookup (hash, mu_msg_get_path (msg)));
|
g_assert (!g_hash_table_lookup (hash, mu_msg_get_path (msg)));
|
||||||
g_hash_table_insert (hash, g_strdup (mu_msg_get_path(msg)),
|
g_hash_table_insert (hash, g_strdup (mu_msg_get_path(msg)),
|
||||||
@ -87,11 +88,17 @@ run_and_count_matches (const char *xpath, const char *query)
|
|||||||
{
|
{
|
||||||
MuQuery *mquery;
|
MuQuery *mquery;
|
||||||
MuMsgIter *iter;
|
MuMsgIter *iter;
|
||||||
|
MuStore *store;
|
||||||
guint count1, count2;
|
guint count1, count2;
|
||||||
|
|
||||||
mquery = mu_query_new (xpath, NULL);
|
store = mu_store_new_read_only (xpath, NULL);
|
||||||
|
g_assert (store);
|
||||||
|
|
||||||
|
mquery = mu_query_new (store, NULL);
|
||||||
g_assert (query);
|
g_assert (query);
|
||||||
|
|
||||||
|
mu_store_unref (store);
|
||||||
|
|
||||||
/* g_printerr ("\n=>'%s'\n", query); */
|
/* g_printerr ("\n=>'%s'\n", query); */
|
||||||
|
|
||||||
/* { /\* debug *\/ */
|
/* { /\* debug *\/ */
|
||||||
@ -257,6 +264,7 @@ test_mu_query_accented_chars_01 (void)
|
|||||||
MuQuery *query;
|
MuQuery *query;
|
||||||
MuMsgIter *iter;
|
MuMsgIter *iter;
|
||||||
MuMsg *msg;
|
MuMsg *msg;
|
||||||
|
MuStore *store;
|
||||||
gchar *xpath;
|
gchar *xpath;
|
||||||
GError *err;
|
GError *err;
|
||||||
gchar *summ;
|
gchar *summ;
|
||||||
@ -264,11 +272,16 @@ test_mu_query_accented_chars_01 (void)
|
|||||||
xpath = fill_database (MU_TESTMAILDIR);
|
xpath = fill_database (MU_TESTMAILDIR);
|
||||||
g_assert (xpath != NULL);
|
g_assert (xpath != NULL);
|
||||||
|
|
||||||
query = mu_query_new (xpath, NULL);
|
store = mu_store_new_read_only (xpath, NULL);
|
||||||
|
g_assert (store);
|
||||||
|
|
||||||
|
query = mu_query_new (store, NULL);
|
||||||
|
mu_store_unref (store);
|
||||||
|
|
||||||
iter = mu_query_run (query, "fünkÿ", FALSE, MU_MSG_FIELD_ID_NONE,
|
iter = mu_query_run (query, "fünkÿ", FALSE, MU_MSG_FIELD_ID_NONE,
|
||||||
FALSE, NULL);
|
FALSE, NULL);
|
||||||
err = NULL;
|
err = NULL;
|
||||||
msg = mu_msg_iter_get_msg (iter, &err); /* don't unref */
|
msg = mu_msg_iter_get_msg_floating (iter); /* don't unref */
|
||||||
if (!msg) {
|
if (!msg) {
|
||||||
g_warning ("error getting message: %s", err->message);
|
g_warning ("error getting message: %s", err->message);
|
||||||
g_error_free (err);
|
g_error_free (err);
|
||||||
@ -585,9 +598,9 @@ main (int argc, char *argv[])
|
|||||||
g_test_add_func ("/mu-query/test-mu-query-tags_02",
|
g_test_add_func ("/mu-query/test-mu-query-tags_02",
|
||||||
test_mu_query_tags_02);
|
test_mu_query_tags_02);
|
||||||
|
|
||||||
/* g_log_set_handler (NULL, */
|
g_log_set_handler (NULL,
|
||||||
/* G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION, */
|
G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION,
|
||||||
/* (GLogFunc)black_hole, NULL); */
|
(GLogFunc)black_hole, NULL);
|
||||||
|
|
||||||
rv = g_test_run ();
|
rv = g_test_run ();
|
||||||
|
|
||||||
|
|||||||
@ -51,7 +51,7 @@ test_mu_store_new_destroy (void)
|
|||||||
g_assert_cmpuint (0,==,mu_store_count (store));
|
g_assert_cmpuint (0,==,mu_store_count (store));
|
||||||
|
|
||||||
mu_store_flush (store);
|
mu_store_flush (store);
|
||||||
mu_store_destroy (store);
|
mu_store_unref (store);
|
||||||
|
|
||||||
g_free (tmpdir);
|
g_free (tmpdir);
|
||||||
}
|
}
|
||||||
@ -70,17 +70,17 @@ test_mu_store_version (void)
|
|||||||
err = NULL;
|
err = NULL;
|
||||||
store = mu_store_new_writable (tmpdir, NULL, &err);
|
store = mu_store_new_writable (tmpdir, NULL, &err);
|
||||||
g_assert (store);
|
g_assert (store);
|
||||||
mu_store_destroy (store);
|
mu_store_unref (store);
|
||||||
store = mu_store_new_read_only (tmpdir, &err);
|
store = mu_store_new_read_only (tmpdir, &err);
|
||||||
g_assert (store);
|
g_assert (store);
|
||||||
|
|
||||||
g_assert (err == NULL);
|
g_assert (err == NULL);
|
||||||
|
|
||||||
g_assert_cmpuint (0,==,mu_store_count (store));
|
g_assert_cmpuint (0,==,mu_store_count (store));
|
||||||
g_assert_cmpstr (MU_XAPIAN_DB_VERSION,==,
|
g_assert_cmpstr (MU_STORE_SCHEMA_VERSION,==,
|
||||||
mu_store_version(store));
|
mu_store_version(store));
|
||||||
|
|
||||||
mu_store_destroy (store);
|
mu_store_unref (store);
|
||||||
g_free (tmpdir);
|
g_free (tmpdir);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ test_mu_store_store_msg_and_count (void)
|
|||||||
|
|
||||||
mu_msg_unref (msg);
|
mu_msg_unref (msg);
|
||||||
|
|
||||||
mu_store_destroy (store);
|
mu_store_unref (store);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -171,7 +171,7 @@ test_mu_store_store_msg_remove_and_count (void)
|
|||||||
(store,
|
(store,
|
||||||
MU_TESTMAILDIR "cur/1283599333.1840_11.cthulhu!2,"));
|
MU_TESTMAILDIR "cur/1283599333.1840_11.cthulhu!2,"));
|
||||||
|
|
||||||
mu_store_destroy (store);
|
mu_store_unref (store);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -60,9 +60,14 @@ static MuMsgIter*
|
|||||||
run_and_get_iter (const char *xpath, const char *query)
|
run_and_get_iter (const char *xpath, const char *query)
|
||||||
{
|
{
|
||||||
MuQuery *mquery;
|
MuQuery *mquery;
|
||||||
|
MuStore *store;
|
||||||
MuMsgIter *iter;
|
MuMsgIter *iter;
|
||||||
|
|
||||||
mquery = mu_query_new (xpath, NULL);
|
store = mu_store_new_read_only (xpath, NULL);
|
||||||
|
g_assert (store);
|
||||||
|
|
||||||
|
mquery = mu_query_new (store, NULL);
|
||||||
|
mu_store_unref (store);
|
||||||
g_assert (query);
|
g_assert (query);
|
||||||
|
|
||||||
iter = mu_query_run (mquery, query, TRUE, MU_MSG_FIELD_ID_DATE,
|
iter = mu_query_run (mquery, query, TRUE, MU_MSG_FIELD_ID_DATE,
|
||||||
@ -116,12 +121,12 @@ test_mu_threads_01 (void)
|
|||||||
|
|
||||||
ti = mu_msg_iter_get_thread_info (iter);
|
ti = mu_msg_iter_get_thread_info (iter);
|
||||||
if (!ti)
|
if (!ti)
|
||||||
g_print ("%s: thread info not found\n",
|
g_print ("%s: thread info not found for %u\n",
|
||||||
mu_msg_get_msgid(mu_msg_iter_get_msg (iter, NULL)));
|
__FUNCTION__, (unsigned)mu_msg_iter_get_docid(iter));
|
||||||
|
|
||||||
g_assert(ti);
|
g_assert(ti);
|
||||||
|
|
||||||
msg = mu_msg_iter_get_msg (iter, NULL);
|
msg = mu_msg_iter_get_msg_floating (iter);
|
||||||
|
g_assert (msg);
|
||||||
/* g_print ("%s %s %s\n", ti->threadpath, */
|
/* g_print ("%s %s %s\n", ti->threadpath, */
|
||||||
/* mu_msg_get_msgid(msg), */
|
/* mu_msg_get_msgid(msg), */
|
||||||
/* mu_msg_get_path (msg) */
|
/* mu_msg_get_path (msg) */
|
||||||
@ -181,7 +186,7 @@ test_mu_threads_rogue (void)
|
|||||||
|
|
||||||
/* due to the random order in files can be indexed, there are two possible ways
|
/* due to the random order in files can be indexed, there are two possible ways
|
||||||
* for the threads to be built-up; both are okay */
|
* for the threads to be built-up; both are okay */
|
||||||
if (g_strcmp0 (mu_msg_get_msgid(mu_msg_iter_get_msg (iter, NULL)),
|
if (g_strcmp0 (mu_msg_get_msgid(mu_msg_iter_get_msg_floating (iter)),
|
||||||
"cycle0@msg.id") == 0)
|
"cycle0@msg.id") == 0)
|
||||||
items = items1;
|
items = items1;
|
||||||
else
|
else
|
||||||
@ -195,11 +200,10 @@ test_mu_threads_rogue (void)
|
|||||||
ti = mu_msg_iter_get_thread_info (iter);
|
ti = mu_msg_iter_get_thread_info (iter);
|
||||||
if (!ti)
|
if (!ti)
|
||||||
g_print ("%s: thread info not found\n",
|
g_print ("%s: thread info not found\n",
|
||||||
mu_msg_get_msgid(mu_msg_iter_get_msg (iter, NULL)));
|
mu_msg_get_msgid(mu_msg_iter_get_msg_floating (iter)));
|
||||||
|
|
||||||
g_assert(ti);
|
g_assert(ti);
|
||||||
|
|
||||||
msg = mu_msg_iter_get_msg (iter, NULL);
|
msg = mu_msg_iter_get_msg_floating (iter); /* don't unref */
|
||||||
/* g_print ("%s %s %s\n", ti->threadpath, */
|
/* g_print ("%s %s %s\n", ti->threadpath, */
|
||||||
/* mu_msg_get_msgid(msg), */
|
/* mu_msg_get_msgid(msg), */
|
||||||
/* mu_msg_get_path (msg) */
|
/* mu_msg_get_path (msg) */
|
||||||
@ -232,9 +236,9 @@ main (int argc, char *argv[])
|
|||||||
g_test_add_func ("/mu-query/test-mu-threads-01", test_mu_threads_01);
|
g_test_add_func ("/mu-query/test-mu-threads-01", test_mu_threads_01);
|
||||||
g_test_add_func ("/mu-query/test-mu-threads-rogue", test_mu_threads_rogue);
|
g_test_add_func ("/mu-query/test-mu-threads-rogue", test_mu_threads_rogue);
|
||||||
|
|
||||||
/* g_log_set_handler (NULL, */
|
g_log_set_handler (NULL,
|
||||||
/* G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION, */
|
G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION,
|
||||||
/* (GLogFunc)black_hole, NULL); */
|
(GLogFunc)black_hole, NULL);
|
||||||
|
|
||||||
rv = g_test_run ();
|
rv = g_test_run ();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user