[tracker/binary-log] Finish journal test cases



commit 7ead7f061ebfb1c177211a55372f107041189f51
Author: Martyn Russell <martyn lanedo com>
Date:   Wed Jan 6 16:40:26 2010 +0000

    Finish journal test cases

 tests/libtracker-db/tracker-db-journal.c |   64 ++++++++++++++++++++++++++++++
 1 files changed, 64 insertions(+), 0 deletions(-)
---
diff --git a/tests/libtracker-db/tracker-db-journal.c b/tests/libtracker-db/tracker-db-journal.c
index d4bfdaf..0778168 100644
--- a/tests/libtracker-db/tracker-db-journal.c
+++ b/tests/libtracker-db/tracker-db-journal.c
@@ -266,6 +266,70 @@ test_read_functions (void)
 	type = tracker_db_journal_reader_get_type ();
 	g_assert_cmpint (type, ==, TRACKER_DB_JOURNAL_END_TRANSACTION);
 
+	/* Third transaction */
+	result = tracker_db_journal_reader_next (&error);
+	g_assert_no_error (error);
+	g_assert_cmpint (result, ==, TRUE);
+
+	type = tracker_db_journal_reader_get_type ();
+	g_assert_cmpint (type, ==, TRACKER_DB_JOURNAL_START_TRANSACTION);
+
+	result = tracker_db_journal_reader_next (&error);
+	g_assert_no_error (error);
+	g_assert_cmpint (result, ==, TRUE);
+
+	type = tracker_db_journal_reader_get_type ();
+	g_assert_cmpint (type, ==, TRACKER_DB_JOURNAL_RESOURCE);
+
+	result = tracker_db_journal_reader_get_resource (&id, &uri);
+	g_assert_cmpint (result, ==, TRUE);
+	g_assert_cmpint (id, ==, 17);
+	g_assert_cmpstr (uri, ==, "http://resource";);
+
+	result = tracker_db_journal_reader_next (&error);
+	g_assert_no_error (error);
+	g_assert_cmpint (result, ==, TRUE);
+
+	type = tracker_db_journal_reader_get_type ();
+	g_assert_cmpint (type, ==, TRACKER_DB_JOURNAL_RESOURCE);
+
+	result = tracker_db_journal_reader_get_resource (&id, &uri);
+	g_assert_cmpint (result, ==, TRUE);
+	g_assert_cmpint (id, ==, 18);
+	g_assert_cmpstr (uri, ==, "http://predicate";);
+
+	result = tracker_db_journal_reader_next (&error);
+	g_assert_no_error (error);
+	g_assert_cmpint (result, ==, TRUE);
+
+	type = tracker_db_journal_reader_get_type ();
+	g_assert_cmpint (type, ==, TRACKER_DB_JOURNAL_RESOURCE);
+
+	result = tracker_db_journal_reader_get_resource (&id, &uri);
+	g_assert_cmpint (result, ==, TRUE);
+	g_assert_cmpint (id, ==, 19);
+	g_assert_cmpstr (uri, ==, "http://resource";);
+
+	result = tracker_db_journal_reader_next (&error);
+	g_assert_no_error (error);
+	g_assert_cmpint (result, ==, TRUE);
+
+	type = tracker_db_journal_reader_get_type ();
+	g_assert_cmpint (type, ==, TRACKER_DB_JOURNAL_INSERT_STATEMENT_ID);
+
+	result = tracker_db_journal_reader_get_statement_id (&s_id, &p_id, &o_id);
+	g_assert_cmpint (result, ==, TRUE);
+	g_assert_cmpint (s_id, ==, 17);
+	g_assert_cmpint (p_id, ==, 18);
+	g_assert_cmpint (o_id, ==, 19);
+
+	result = tracker_db_journal_reader_next (&error);
+	g_assert_no_error (error);
+	g_assert_cmpint (result, ==, TRUE);
+
+	type = tracker_db_journal_reader_get_type ();
+	g_assert_cmpint (type, ==, TRACKER_DB_JOURNAL_END_TRANSACTION);
+
 	/* Shutdown */
 	result = tracker_db_journal_reader_shutdown ();
 	g_assert_cmpint (result, ==, TRUE);



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