[tracker/binary-log-2: 24/63] libtracker-db: Moved test to tests/libtracker-db/tracker-db-journal
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/binary-log-2: 24/63] libtracker-db: Moved test to tests/libtracker-db/tracker-db-journal
- Date: Fri, 8 Jan 2010 09:44:27 +0000 (UTC)
commit 319664faedcb55ba010e90d0310aabd19461eb2f
Author: Martyn Russell <martyn lanedo com>
Date: Mon Jan 4 14:31:47 2010 +0000
libtracker-db: Moved test to tests/libtracker-db/tracker-db-journal
src/libtracker-db/tracker-db-journal.c | 42 -----------------
tests/libtracker-db/Makefile.am | 22 ++++++++-
tests/libtracker-db/tracker-db-journal.c | 75 ++++++++++++++++++++++++++++++
3 files changed, 94 insertions(+), 45 deletions(-)
---
diff --git a/src/libtracker-db/tracker-db-journal.c b/src/libtracker-db/tracker-db-journal.c
index d39c0d8..c24d9c3 100644
--- a/src/libtracker-db/tracker-db-journal.c
+++ b/src/libtracker-db/tracker-db-journal.c
@@ -573,45 +573,3 @@ tracker_db_journal_get_statement_code (guint32 *s_code,
*p_code = journal_reader.p_code;
*o_code = journal_reader.o_code;
}
-
-#ifdef TEST
-
-#include "libtracker-common/tracker-crc32.c"
-
-int main () {
- guint i;
-
- tracker_db_journal_open ("/tmp/test");
-
- tracker_db_journal_start_transaction ();
- tracker_db_journal_append_resource (10, "http://resource");
- tracker_db_journal_append_resource (11, "http://predicate");
- tracker_db_journal_append_delete_statement (10, 11, "test");
- tracker_db_journal_commit_transaction ();
-
- tracker_db_journal_start_transaction ();
- tracker_db_journal_append_resource (12, "http://resource");
- tracker_db_journal_append_resource (13, "http://predicate");
- tracker_db_journal_append_resource (14, "http://resource");
- tracker_db_journal_append_delete_statement_code (12, 13, 14);
- tracker_db_journal_commit_transaction ();
-
-
- tracker_db_journal_start_transaction ();
- tracker_db_journal_append_resource (15, "http://resource");
- tracker_db_journal_append_resource (16, "http://predicate");
- tracker_db_journal_append_insert_statement (15, 16, "test");
- tracker_db_journal_commit_transaction ();
-
- tracker_db_journal_start_transaction ();
- tracker_db_journal_append_resource (17, "http://resource");
- tracker_db_journal_append_resource (18, "http://predicate");
- tracker_db_journal_append_resource (19, "http://resource");
- tracker_db_journal_append_insert_statement_code (17, 18, 19);
- tracker_db_journal_commit_transaction ();
-
- tracker_db_journal_fsync ();
- tracker_db_journal_close ();
- return 0;
-}
-#endif
diff --git a/tests/libtracker-db/Makefile.am b/tests/libtracker-db/Makefile.am
index 8397c17..4a871d8 100644
--- a/tests/libtracker-db/Makefile.am
+++ b/tests/libtracker-db/Makefile.am
@@ -29,11 +29,27 @@ INCLUDES = \
$(DBUS_CFLAGS) \
$(SQLITE3_CFLAGS)
-# TEST_PROGS += \
-# tracker-db-dbus \
+TEST_PROGS += \
+ tracker-db-journal
+
# tracker-db-manager-unattach \
# tracker-db-manager-attach \
-# tracker-db-manager-custom \
+# tracker-db-manager-custom
+
+
+tracker_db_journal_SOURCES = \
+ tracker-db-journal.c
+
+tracker_db_journal_LDADD = \
+ $(top_builddir)/src/libtracker-db/libtracker-db.la \
+ $(top_builddir)/src/libtracker-common/libtracker-common.la \
+ $(top_builddir)/tests/common/libtracker-testcommon.la \
+ $(SQLITE3_LIBS) \
+ $(GMODULE_LIBS) \
+ $(GTHREAD_LIBS) \
+ $(GLIB2_LIBS) \
+ -lz
+
#
# tracker_db_manager_attach_SOURCES = \
# tracker-db-manager-test-attach.c \
diff --git a/tests/libtracker-db/tracker-db-journal.c b/tests/libtracker-db/tracker-db-journal.c
new file mode 100644
index 0000000..258584f
--- /dev/null
+++ b/tests/libtracker-db/tracker-db-journal.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2008, Nokia (urho konttori nokia com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <libtracker-common/tracker-crc32.h>
+
+#include <libtracker-db/tracker-db-journal.h>
+
+static void
+test_all (void)
+{
+ tracker_db_journal_open ("/tmp/test");
+
+ tracker_db_journal_start_transaction ();
+ tracker_db_journal_append_resource (10, "http://resource");
+ tracker_db_journal_append_resource (11, "http://predicate");
+ tracker_db_journal_append_delete_statement (10, 11, "test");
+ tracker_db_journal_commit_transaction ();
+
+ tracker_db_journal_start_transaction ();
+ tracker_db_journal_append_resource (12, "http://resource");
+ tracker_db_journal_append_resource (13, "http://predicate");
+ tracker_db_journal_append_resource (14, "http://resource");
+ tracker_db_journal_append_delete_statement_code (12, 13, 14);
+ tracker_db_journal_commit_transaction ();
+
+
+ tracker_db_journal_start_transaction ();
+ tracker_db_journal_append_resource (15, "http://resource");
+ tracker_db_journal_append_resource (16, "http://predicate");
+ tracker_db_journal_append_insert_statement (15, 16, "test");
+ tracker_db_journal_commit_transaction ();
+
+ tracker_db_journal_start_transaction ();
+ tracker_db_journal_append_resource (17, "http://resource");
+ tracker_db_journal_append_resource (18, "http://predicate");
+ tracker_db_journal_append_resource (19, "http://resource");
+ tracker_db_journal_append_insert_statement_code (17, 18, 19);
+ tracker_db_journal_commit_transaction ();
+
+ tracker_db_journal_fsync ();
+ tracker_db_journal_close ();
+}
+
+int
+main (int argc, char **argv)
+{
+ int result;
+
+ g_type_init ();
+ g_thread_init (NULL);
+ g_test_init (&argc, &argv, NULL);
+
+ g_test_add_func ("/libtracker-db/tracker-db-journal/open-append-commit-close",
+ test_all);
+
+ result = g_test_run ();
+
+ return result;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]