tracker r2165 - in branches/indexer-split: . src/libtracker-common tests/libtracker-common
- From: ifrade svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r2165 - in branches/indexer-split: . src/libtracker-common tests/libtracker-common
- Date: Wed, 27 Aug 2008 09:17:21 +0000 (UTC)
Author: ifrade
Date: Wed Aug 27 09:17:21 2008
New Revision: 2165
URL: http://svn.gnome.org/viewvc/tracker?rev=2165&view=rev
Log:
Fix and test for tracker-field
Added:
branches/indexer-split/tests/libtracker-common/tracker-field-test.c
Modified:
branches/indexer-split/ChangeLog
branches/indexer-split/src/libtracker-common/tracker-field.c
branches/indexer-split/tests/libtracker-common/Makefile.am
Modified: branches/indexer-split/src/libtracker-common/tracker-field.c
==============================================================================
--- branches/indexer-split/src/libtracker-common/tracker-field.c (original)
+++ branches/indexer-split/src/libtracker-common/tracker-field.c Wed Aug 27 09:17:21 2008
@@ -85,7 +85,7 @@
"TRACKER_FIELD_TYPE_INDEX",
"index" },
{ TRACKER_FIELD_TYPE_FULLTEXT,
- " TRACKER_FIELD_TYPE_FULLTEXT",
+ "TRACKER_FIELD_TYPE_FULLTEXT",
"fulltext" },
{ TRACKER_FIELD_TYPE_STRING,
"TRACKER_FIELD_TYPE_STRING",
Modified: branches/indexer-split/tests/libtracker-common/Makefile.am
==============================================================================
--- branches/indexer-split/tests/libtracker-common/Makefile.am (original)
+++ branches/indexer-split/tests/libtracker-common/Makefile.am Wed Aug 27 09:17:21 2008
@@ -6,7 +6,8 @@
tracker-dbus \
tracker-type-utils \
tracker-file-utils \
- tracker-parser
+ tracker-parser \
+ tracker-field
INCLUDES = \
-DG_LOG_DOMAIN=\"Tracker\" \
@@ -75,4 +76,15 @@
$(PANGO_LIBS) \
$(GLIB2_LIBS)
-EXTRA_DIST = non-utf8.txt
\ No newline at end of file
+EXTRA_DIST = non-utf8.txt
+
+tracker_field_SOURCES = \
+ tracker-field-test.c
+
+tracker_field_LDADD = \
+ $(top_builddir)/src/libtracker-common/libtracker-common.la \
+ $(top_builddir)/tests/common/libtracker-testcommon.la \
+ $(GMODULE_LIBS) \
+ $(GTHREAD_LIBS) \
+ $(PANGO_LIBS) \
+ $(GLIB2_LIBS)
Added: branches/indexer-split/tests/libtracker-common/tracker-field-test.c
==============================================================================
--- (empty file)
+++ branches/indexer-split/tests/libtracker-common/tracker-field-test.c Wed Aug 27 09:17:21 2008
@@ -0,0 +1,76 @@
+#include <glib.h>
+#include <glib/gtestutils.h>
+#include <libtracker-common/tracker-field.h>
+#include <tracker-test-helpers.h>
+
+static void
+test_type_to_string ()
+{
+ const gchar *result;
+ TrackerFieldType type;
+
+ type = TRACKER_FIELD_TYPE_KEYWORD;
+ result = tracker_field_type_to_string (type);
+ g_assert (tracker_test_helpers_cmpstr_equal (result, "keyword"));
+
+ type = TRACKER_FIELD_TYPE_INDEX;
+ result = tracker_field_type_to_string (type);
+ g_assert (tracker_test_helpers_cmpstr_equal (result, "index"));
+
+ type = TRACKER_FIELD_TYPE_FULLTEXT;
+ result = tracker_field_type_to_string (type);
+ g_assert (tracker_test_helpers_cmpstr_equal (result, "fulltext"));
+
+ type = TRACKER_FIELD_TYPE_STRING;
+ result = tracker_field_type_to_string (type);
+ g_assert (tracker_test_helpers_cmpstr_equal (result, "string"));
+
+ type = TRACKER_FIELD_TYPE_INTEGER;
+ result = tracker_field_type_to_string (type);
+ g_assert (tracker_test_helpers_cmpstr_equal (result, "integer"));
+
+ type = TRACKER_FIELD_TYPE_DOUBLE;
+ result = tracker_field_type_to_string (type);
+ g_assert (tracker_test_helpers_cmpstr_equal (result, "double"));
+
+ type = TRACKER_FIELD_TYPE_DATE;
+ result = tracker_field_type_to_string (type);
+ g_assert (tracker_test_helpers_cmpstr_equal (result, "date"));
+
+ type = TRACKER_FIELD_TYPE_BLOB;
+ result = tracker_field_type_to_string (type);
+ g_assert (tracker_test_helpers_cmpstr_equal (result, "blob"));
+
+ type = TRACKER_FIELD_TYPE_STRUCT;
+ result = tracker_field_type_to_string (type);
+ g_assert (tracker_test_helpers_cmpstr_equal (result, "struct"));
+
+ type = TRACKER_FIELD_TYPE_LINK;
+ result = tracker_field_type_to_string (type);
+ g_assert (tracker_test_helpers_cmpstr_equal (result, "link"));
+
+}
+
+int
+main (int argc, char **argv) {
+
+ int result;
+
+ g_type_init ();
+ g_test_init (&argc, &argv, NULL);
+
+ /* Something is not initialized without these lines */
+ TrackerField *field = tracker_field_new ();
+ g_object_unref (field);
+
+ /* Init */
+
+ g_test_add_func ("/libtracker-common/tracker-field/type_to_string",
+ test_type_to_string);
+
+ result = g_test_run ();
+
+ /* End */
+
+ return result;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]