* update test-mu-store test case

This commit is contained in:
Dirk-Jan C. Binnema
2011-01-12 23:13:36 +02:00
parent d1bf8b3c73
commit eb6ca790fb

View File

@ -34,53 +34,49 @@
static void static void
test_mu_store_new_destroy (void) test_mu_store_new_destroy (void)
{ {
MuStore *store; MuStore *store;
gchar* tmpdir; gchar* tmpdir;
GError *err; GError *err;
tmpdir = test_mu_common_get_random_tmpdir(); tmpdir = test_mu_common_get_random_tmpdir();
g_assert (tmpdir); g_assert (tmpdir);
err = NULL; err = NULL;
store = mu_store_new (tmpdir, 12345, &err); store = mu_store_new (tmpdir, 12345, &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));
mu_store_flush (store); mu_store_flush (store);
mu_store_destroy (store); mu_store_destroy (store);
g_free (tmpdir); g_free (tmpdir);
} }
static void static void
test_mu_store_version (void) test_mu_store_version (void)
{ {
MuStore *store; MuStore *store;
gchar* tmpdir; gchar* tmpdir;
GError *err; GError *err;
const char* my_version;
tmpdir = test_mu_common_get_random_tmpdir();
g_assert (tmpdir);
tmpdir = test_mu_common_get_random_tmpdir(); err = NULL;
g_assert (tmpdir); store = mu_store_new (tmpdir, 789, &err);
g_assert (store);
g_assert (err == NULL);
err = NULL; g_assert_cmpuint (0,==,mu_store_count (store));
store = mu_store_new (tmpdir, 789, &err); g_assert_cmpstr (MU_XAPIAN_DB_VERSION,==,
g_assert (store); mu_store_version(store));
g_assert (err == NULL);
mu_store_destroy (store);
g_assert_cmpuint (0,==,mu_store_count (store)); g_free (tmpdir);
g_assert_cmpstr (MU_XAPIAN_DB_VERSION,==,mu_store_version(store));
my_version = "test123";
g_assert (mu_store_set_version (store, my_version));
g_assert_cmpstr (mu_store_version(store), ==, my_version);
mu_store_destroy (store);
g_free (tmpdir);
} }
@ -172,20 +168,20 @@ test_mu_store_store_remove_and_count (void)
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
g_test_init (&argc, &argv, NULL); g_test_init (&argc, &argv, NULL);
/* mu_runtime_init/uninit */ /* mu_runtime_init/uninit */
g_test_add_func ("/mu-store/mu-store-new-destroy", g_test_add_func ("/mu-store/mu-store-new-destroy",
test_mu_store_new_destroy); test_mu_store_new_destroy);
g_test_add_func ("/mu-store/mu-store-version", g_test_add_func ("/mu-store/mu-store-version",
test_mu_store_version); test_mu_store_version);
g_test_add_func ("/mu-store/mu-store-store-and-count", g_test_add_func ("/mu-store/mu-store-store-and-count",
test_mu_store_store_and_count); test_mu_store_store_and_count);
g_test_add_func ("/mu-store/mu-store-store-remove-and-count", g_test_add_func ("/mu-store/mu-store-store-remove-and-count",
test_mu_store_store_remove_and_count); test_mu_store_store_remove_and_count);
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);
return g_test_run (); return g_test_run ();
} }