[tracker/miner-fs-refactor] tests/steroids: multi-insert: Add unit test



commit 79bc6c1ae17cca5d8eb02fe2b2c277de33a9a48b
Author: Philip Van Hoof <philip codeminded be>
Date:   Thu Oct 7 12:30:08 2010 +0200

    tests/steroids: multi-insert: Add unit test

 tests/tracker-steroids/tracker-test.c |   56 +++++++++++++++++++++++++++++++++
 1 files changed, 56 insertions(+), 0 deletions(-)
---
diff --git a/tests/tracker-steroids/tracker-test.c b/tests/tracker-steroids/tracker-test.c
index 7a2ddfb..03d2aa4 100644
--- a/tests/tracker-steroids/tracker-test.c
+++ b/tests/tracker-steroids/tracker-test.c
@@ -295,6 +295,62 @@ test_tracker_sparql_update_fast_large ()
 }
 
 static void
+async_update_array_callback (GObject      *source_object,
+                             GAsyncResult *result,
+                             gpointer      user_data)
+{
+	AsyncData *data = user_data;
+	GPtrArray *errors;
+
+	errors = tracker_sparql_connection_update_array_finish (connection, result);
+
+	g_assert (errors->len == 6);
+
+	g_assert (g_ptr_array_index (errors, 0) == NULL);
+	g_assert (g_ptr_array_index (errors, 1) == NULL);
+	g_assert (g_ptr_array_index (errors, 2) == NULL);
+	g_assert (g_ptr_array_index (errors, 3) != NULL);
+	g_assert (g_ptr_array_index (errors, 4) == NULL);
+	g_assert (g_ptr_array_index (errors, 5) == NULL);
+
+	g_ptr_array_unref (errors);
+
+	g_main_loop_quit (data->main_loop);
+}
+
+
+static void
+test_tracker_sparql_update_array_fast ()
+{
+	const gchar *queries[6] = { "INSERT { _:a a nmo:Message }",
+	                            "INSERT { _:b a nmo:Message }",
+	                            "INSERT { _:c a nmo:Message }",
+	                            "INSERT { _:d syntax error a nmo:Message }",
+	                            "INSERT { _:e a nmo:Message }",
+	                            "INSERT { _:f a nmo:Message }" };
+
+	GMainLoop *main_loop;
+	AsyncData *data;
+
+	main_loop = g_main_loop_new (NULL, FALSE);
+
+	data = g_slice_new (AsyncData);
+	data->main_loop = main_loop;
+
+	tracker_sparql_connection_update_array_async (connection,
+	                                              queries, 6,
+	                                              0, NULL,
+	                                              async_update_array_callback,
+	                                              data);
+
+	g_main_loop_run (main_loop);
+
+	g_slice_free (AsyncData, data);
+	g_main_loop_unref (main_loop);
+
+}
+
+static void
 test_tracker_sparql_update_fast_error ()
 {
 	GError *error = NULL;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]