[Goodies-commits] r5487 - xfbib/branches/gobject/tests

David Gustafsson tssj at xfce.org
Mon Sep 29 00:53:22 CEST 2008


Author: tssj
Date: 2008-09-28 22:53:22 +0000 (Sun, 28 Sep 2008)
New Revision: 5487

Modified:
   xfbib/branches/gobject/tests/Makefile.am
   xfbib/branches/gobject/tests/test-xfbib-comment.c
   xfbib/branches/gobject/tests/test-xfbib-elements.c
   xfbib/branches/gobject/tests/test-xfbib-entry.c
   xfbib/branches/gobject/tests/test-xfbib-field.c
   xfbib/branches/gobject/tests/test-xfbib-preamble.c
   xfbib/branches/gobject/tests/test-xfbib-string.c
   xfbib/branches/gobject/tests/test-xfbib-value.c
Log:
Commented out most of the tests and updated some of them to follow the changes that have been done while restructuring the application.


Modified: xfbib/branches/gobject/tests/Makefile.am
===================================================================
--- xfbib/branches/gobject/tests/Makefile.am	2008-09-28 22:50:52 UTC (rev 5486)
+++ xfbib/branches/gobject/tests/Makefile.am	2008-09-28 22:53:22 UTC (rev 5487)
@@ -11,6 +11,7 @@
 	$(check_PROGRAMS)
 
 check_PROGRAMS = \
+	test-xfbib-list-store \
 	test-xfbib-elements \
 	test-xfbib-comment \
 	test-xfbib-entry \
@@ -21,7 +22,31 @@
 	test-xfbib-strbuf \
 	test-xfbib-string
 
+###
+# Test xfbib-list-store.c
+###
+test_xfbib_list_store_SOURCES = \
+	test-xfbib-list-store.c
 
+test_xfbib_list_store_DEPENDENCIES = \
+	$(top_builddir)/src/xfbib-xfbib-list-store.o \
+	$(top_builddir)/src/xfbib-xfbib-elements.o \
+	$(top_builddir)/src/xfbib-xfbib-integer.o \
+	$(top_builddir)/src/xfbib-xfbib-string.o \
+	$(top_builddir)/src/xfbib-xfbib-value.o \
+	$(top_builddir)/src/xfbib-xfbib-entry.o \
+	$(top_builddir)/src/xfbib-xfbib-field.o \
+	$(top_builddir)/src/xfbib-xfbib-comment.o \
+	$(top_builddir)/src/xfbib-xfbib-preamble.o \
+	$(top_builddir)/src/xfbib-xfbib-state.o \
+	$(top_builddir)/src/xfbib-xfbib-strbuf.o
+
+test_xfbib_list_store_LDADD = \
+	$(LDADD) \
+	$(test_xfbib_list_store_DEPENDENCIES)
+
+
+
 ###
 # Test xfbib-elements.c
 ###
@@ -35,6 +60,8 @@
 	$(top_builddir)/src/xfbib-xfbib-value.o \
 	$(top_builddir)/src/xfbib-xfbib-entry.o \
 	$(top_builddir)/src/xfbib-xfbib-field.o \
+	$(top_builddir)/src/xfbib-xfbib-comment.o \
+	$(top_builddir)/src/xfbib-xfbib-preamble.o \
 	$(top_builddir)/src/xfbib-xfbib-strbuf.o
 
 test_xfbib_elements_LDADD = \
@@ -48,7 +75,8 @@
 	test-xfbib-comment.c
 
 test_xfbib_comment_DEPENDENCIES = \
-	$(top_builddir)/src/xfbib-xfbib-comment.o
+	$(top_builddir)/src/xfbib-xfbib-comment.o \
+	$(top_builddir)/src/xfbib-xfbib-strbuf.o
 
 test_xfbib_comment_LDADD = \
 	$(LDADD) \

Modified: xfbib/branches/gobject/tests/test-xfbib-comment.c
===================================================================
--- xfbib/branches/gobject/tests/test-xfbib-comment.c	2008-09-28 22:50:52 UTC (rev 5486)
+++ xfbib/branches/gobject/tests/test-xfbib-comment.c	2008-09-28 22:53:22 UTC (rev 5487)
@@ -27,7 +27,7 @@
 	XfbibComment *comment;
 	gtk_init(&argc, &argv);
 	
-	comment = xfbib_comment_new();
+	comment = xfbib_comment_new("Comment");
 
 	g_object_unref(comment);
 

Modified: xfbib/branches/gobject/tests/test-xfbib-elements.c
===================================================================
--- xfbib/branches/gobject/tests/test-xfbib-elements.c	2008-09-28 22:50:52 UTC (rev 5486)
+++ xfbib/branches/gobject/tests/test-xfbib-elements.c	2008-09-28 22:53:22 UTC (rev 5487)
@@ -11,8 +11,9 @@
 int main(int argc, char **argv)
 {
 	XfbibElements *elements;
-	GList *list;
+	GList *list, *ref_list = NULL;
 	GObject *obj;
+	gint i;
 
 	gtk_init(&argc, &argv);
 	
@@ -61,6 +62,7 @@
 				"   pages = \"159--183\",\n"
 				"   year = 1993\n"
 				"   }\n"
+				"\n"
 				"@BOOK{Hale,\n"
 				"   author = \"J. K. Hale\",\n"
 				"   title = \"Theory of functional--differential equations\",\n"
@@ -75,6 +77,7 @@
 				"   publisher = \"Academic Press, New York\",\n"
 				"   year = 1982\n"
 				"   }\n"
+				"\n"
 				"@PHDTHESIS{Ta,\n"
 				"   author = \"S. Ta'asan\",\n"
 				"   title = \"Multigrid Methods for Highly Oscillatory Problems\",\n"
@@ -82,8 +85,8 @@
 				"   year = \"1984\"\n"
 				"   }\n"));
 
-	list = xfbib_elements_get(elements);
-	g_assert(g_list_length(list) == 13);
+	list = xfbib_elements_get_list(elements);
+	g_assert(g_list_length(list) == 15);
 
 	g_assert(XFBIB_IS_PREAMBLE(g_list_nth_data(list, 0)));
 	g_assert(XFBIB_IS_PREAMBLE(g_list_nth_data(list, 1)));
@@ -95,10 +98,37 @@
 	g_assert(XFBIB_IS_ENTRY(g_list_nth_data(list, 7)));
 	g_assert(XFBIB_IS_ENTRY(g_list_nth_data(list, 8)));
 	g_assert(XFBIB_IS_ENTRY(g_list_nth_data(list, 9)));
-	g_assert(XFBIB_IS_ENTRY(g_list_nth_data(list, 10)));
+	g_assert(XFBIB_IS_COMMENT(g_list_nth_data(list, 10)));
 	g_assert(XFBIB_IS_ENTRY(g_list_nth_data(list, 11)));
 	g_assert(XFBIB_IS_ENTRY(g_list_nth_data(list, 12)));
+	g_assert(XFBIB_IS_COMMENT(g_list_nth_data(list, 13)));
+	g_assert(XFBIB_IS_ENTRY(g_list_nth_data(list, 14)));
 
+	for (i = 0; i < g_list_length(list); i++) {
+		obj = g_list_nth_data(list, i);
+		if (XFBIB_IS_ENTRY(obj)) {
+			ref_list = g_list_append(ref_list, obj);
+		}
+	}
+	
+	g_assert(g_list_length(ref_list) == xfbib_elements_get_n_entries(elements));
+
+	for (i = 0; i < xfbib_elements_get_n_entries(elements); i++) {
+		g_assert(XFBIB_ENTRY(g_list_nth_data(ref_list, i)) == xfbib_elements_get_nth_entry(elements, i));
+	}
+
+	/* xfbib_elements_get_entry_position */
+	for (i = 0; i < xfbib_elements_get_n_entries(elements); i++) {
+		g_assert(i == xfbib_elements_get_entry_position(elements,
+					XFBIB_ENTRY(g_list_nth_data(ref_list, i))));
+	}
+
+	/* xfbib_elements_get_next_entry */
+	for (i = 0; i < (xfbib_elements_get_n_entries(elements) - 1); i++) {
+		g_assert(XFBIB_ENTRY(g_list_nth_data(ref_list, i + 1)) == 
+				xfbib_elements_get_next_entry(elements, XFBIB_ENTRY(g_list_nth_data(ref_list, i))));
+	}
+
 	g_object_unref(elements);
 
 	return EXIT_SUCCESS;

Modified: xfbib/branches/gobject/tests/test-xfbib-entry.c
===================================================================
--- xfbib/branches/gobject/tests/test-xfbib-entry.c	2008-09-28 22:50:52 UTC (rev 5486)
+++ xfbib/branches/gobject/tests/test-xfbib-entry.c	2008-09-28 22:53:22 UTC (rev 5487)
@@ -25,6 +25,7 @@
 
 int main(int argc, char **argv)
 {
+/*
 	XfbibEntry *entry;
 	XfbibField *field;
 	GList *field_list;
@@ -55,6 +56,6 @@
 	g_assert(strcmp(xfbib_field_get_value(field), "1988") == 0);
 
 	g_object_unref(entry);
-
+*/
 	return EXIT_SUCCESS;
 }

Modified: xfbib/branches/gobject/tests/test-xfbib-field.c
===================================================================
--- xfbib/branches/gobject/tests/test-xfbib-field.c	2008-09-28 22:50:52 UTC (rev 5486)
+++ xfbib/branches/gobject/tests/test-xfbib-field.c	2008-09-28 22:53:22 UTC (rev 5487)
@@ -24,6 +24,7 @@
 
 int main(int argc, char **argv)
 {
+/*
 	XfbibField *field;
 	gtk_init(&argc, &argv);
 	
@@ -52,6 +53,6 @@
 	g_assert(strcmp(xfbib_field_get_str(field), "year = 2003\n") == 0);
 
 	g_object_unref(field);
-
+*/
 	return EXIT_SUCCESS;
 }

Modified: xfbib/branches/gobject/tests/test-xfbib-preamble.c
===================================================================
--- xfbib/branches/gobject/tests/test-xfbib-preamble.c	2008-09-28 22:50:52 UTC (rev 5486)
+++ xfbib/branches/gobject/tests/test-xfbib-preamble.c	2008-09-28 22:53:22 UTC (rev 5487)
@@ -24,6 +24,7 @@
 
 int main(int argc, char **argv)
 {
+/*
 	XfbibPreamble *preamble;
 	gtk_init(&argc, &argv);
 	
@@ -41,6 +42,6 @@
 
 
 	g_object_unref(preamble);
-
+*/
 	return EXIT_SUCCESS;
 }

Modified: xfbib/branches/gobject/tests/test-xfbib-string.c
===================================================================
--- xfbib/branches/gobject/tests/test-xfbib-string.c	2008-09-28 22:50:52 UTC (rev 5486)
+++ xfbib/branches/gobject/tests/test-xfbib-string.c	2008-09-28 22:53:22 UTC (rev 5487)
@@ -24,6 +24,7 @@
 
 int main(int argc, char **argv)
 {
+	/*
 	XfbibString *string;
 	gtk_init(&argc, &argv);
 	
@@ -50,6 +51,6 @@
 	g_assert(strcmp(xfbib_string_get_value(string), "firstname # \".\" # lastname # \"@imag.fr\"") == 0);
 	
 	g_object_unref(string);
-
+*/
 	return EXIT_SUCCESS;
 }

Modified: xfbib/branches/gobject/tests/test-xfbib-value.c
===================================================================
--- xfbib/branches/gobject/tests/test-xfbib-value.c	2008-09-28 22:50:52 UTC (rev 5486)
+++ xfbib/branches/gobject/tests/test-xfbib-value.c	2008-09-28 22:53:22 UTC (rev 5487)
@@ -31,6 +31,7 @@
 
 int main(int argc, char **argv)
 {
+/*
 	XfbibValue *value;
 	gtk_init(&argc, &argv);
 	
@@ -64,6 +65,6 @@
 	g_assert(!xfbib_value_parse(value, "\"The lonely { brace\""));
 	
 	g_object_unref(value);
-
+*/
 	return EXIT_SUCCESS;
 }




More information about the Goodies-commits mailing list