r18829 - gnucash/trunk/src - Move filepath related tests to core-utils/test
Geert Janssens
gjanssens at code.gnucash.org
Thu Mar 4 17:13:58 EST 2010
Author: gjanssens
Date: 2010-03-04 17:13:58 -0500 (Thu, 04 Mar 2010)
New Revision: 18829
Trac: http://svn.gnucash.org/trac/changeset/18829
Added:
gnucash/trunk/src/core-utils/test/
gnucash/trunk/src/core-utils/test/Makefile.am
gnucash/trunk/src/core-utils/test/test-resolve-file-path.c
gnucash/trunk/src/core-utils/test/test-resolve-url.c
Removed:
gnucash/trunk/src/engine/test/test-resolve-file-path.c
gnucash/trunk/src/engine/test/test-resolve-url.c
Modified:
gnucash/trunk/src/engine/test/Makefile.am
Log:
Move filepath related tests to core-utils/test
Added: gnucash/trunk/src/core-utils/test/Makefile.am
===================================================================
--- gnucash/trunk/src/core-utils/test/Makefile.am (rev 0)
+++ gnucash/trunk/src/core-utils/test/Makefile.am 2010-03-04 22:13:58 UTC (rev 18829)
@@ -0,0 +1,44 @@
+
+AM_CPPFLAGS = \
+ -I${top_srcdir} \
+ -I${top_srcdir}/src \
+ -I${top_srcdir}/src/libqof/qof \
+ -I${top_srcdir}/src/core-utils \
+ ${GUILE_INCS} \
+ ${GLIB_CFLAGS}
+
+LDADD = \
+ ../libgnc-core-utils.la \
+ ${top_builddir}/src/libqof/qof/libgnc-qof.la \
+ ${GLIB_LIBS}
+
+# these tests are ordered kind more or less in the order
+# that they should be executed, with more basic tests coming first.
+#
+TESTS = \
+ test-resolve-file-path \
+ test-resolve-url
+
+GNC_TEST_DEPS = \
+ --library-dir ${top_builddir}/lib/libqof/qof \
+ --library-dir ${top_builddir}/src/core-utils
+
+TESTS_ENVIRONMENT = \
+ SRCDIR=${srcdir} \
+ $(shell ${top_srcdir}/src/gnc-test-env --no-exports ${GNC_TEST_DEPS})
+
+check_PROGRAMS = \
+ test-resolve-file-path \
+ test-resolve-url
+
+
+test_link_SOURCES = test-link.c
+test_link_LDADD = ../libgnc-core-utils.la \
+ ${top_builddir}/src/libqof/qof/libgnc-qof.la
+
+EXTRA_DIST =
+
+clean-local:
+ rm -f translog.*
+
+distclean-local: clean-local
Copied: gnucash/trunk/src/core-utils/test/test-resolve-file-path.c (from rev 18820, gnucash/trunk/src/engine/test/test-resolve-file-path.c)
===================================================================
--- gnucash/trunk/src/core-utils/test/test-resolve-file-path.c (rev 0)
+++ gnucash/trunk/src/core-utils/test/test-resolve-file-path.c 2010-03-04 22:13:58 UTC (rev 18829)
@@ -0,0 +1,118 @@
+/***************************************************************************
+ * test-resolve-file-path.c
+ *
+ * Thu Sep 29 22:48:57 2005
+ * Copyright 2005 GnuCash team
+ ****************************************************************************/
+/*
+ * This program 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 program 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 program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#include "config.h"
+#include <stdlib.h>
+#include <string.h>
+
+#include <glib.h>
+#include "qof.h"
+#include "test-stuff.h"
+#include "gnc-filepath-utils.h"
+
+struct test_strings_struct
+{
+ char *input;
+ char *output;
+ int prefix_home;
+};
+
+typedef struct test_strings_struct test_strings;
+
+test_strings strs[] =
+{
+ {
+ G_DIR_SEPARATOR_S ".gnucash" G_DIR_SEPARATOR_S "test-account-name",
+ G_DIR_SEPARATOR_S ".gnucash" G_DIR_SEPARATOR_S "test-account-name", 1
+ },
+ {
+ G_DIR_SEPARATOR_S "tmp" G_DIR_SEPARATOR_S "test-account-name2",
+ G_DIR_SEPARATOR_S "tmp" G_DIR_SEPARATOR_S "test-account-name2", 0
+ },
+ {
+ "postgres://localhost/foo/bar",
+ G_DIR_SEPARATOR_S ".gnucash" G_DIR_SEPARATOR_S "data" G_DIR_SEPARATOR_S "postgres___localhost_foo_bar", 2
+ },
+ {
+ "file:/tmp/test-account-name3",
+ G_DIR_SEPARATOR_S "tmp" G_DIR_SEPARATOR_S "test-account-name3", 0
+ },
+ {
+ "file:///tmp/test-account-name3",
+ G_DIR_SEPARATOR_S "tmp" G_DIR_SEPARATOR_S "test-account-name3", 0
+ },
+ {
+ "xml:/tmp/test-account-name3",
+ G_DIR_SEPARATOR_S "tmp" G_DIR_SEPARATOR_S "test-account-name3", 0
+ },
+ {
+ "xml:///tmp/test-account-name3",
+ G_DIR_SEPARATOR_S "tmp" G_DIR_SEPARATOR_S "test-account-name3", 0
+ },
+ { NULL, NULL, 0 },
+};
+
+int
+main(int argc, char **argv)
+{
+ int i;
+
+ qof_init();
+
+ for (i = 0; strs[i].input != NULL; i++)
+ {
+ char *daout;
+ char *dain;
+ char *wantout;
+
+ if (strs[i].prefix_home == 1)
+ {
+ dain = g_build_filename(g_get_home_dir(), strs[i].input,
+ (gchar *)NULL);
+ wantout = g_build_filename(g_get_home_dir(), strs[i].output,
+ (gchar *)NULL);
+ }
+ else if (strs[i].prefix_home == 2)
+ {
+ dain = g_strdup(strs[i].input);
+ wantout = g_build_filename(g_get_home_dir(), strs[i].output,
+ (gchar *)NULL);
+ }
+ else
+ {
+ dain = g_strdup(strs[i].input);
+ wantout = g_strdup(strs[i].output);
+ }
+
+ daout = xaccResolveFilePath(dain);
+ do_test_args(safe_strcmp(daout, wantout) == 0,
+ "xaccResolveFilePath",
+ __FILE__, __LINE__,
+ "%s (%s) vs %s", daout, dain, wantout);
+ g_free(dain);
+ g_free(wantout);
+ g_free(daout);
+ }
+ print_test_results();
+ return get_rv();
+}
Copied: gnucash/trunk/src/core-utils/test/test-resolve-url.c (from rev 18827, gnucash/trunk/src/engine/test/test-resolve-url.c)
===================================================================
--- gnucash/trunk/src/core-utils/test/test-resolve-url.c (rev 0)
+++ gnucash/trunk/src/core-utils/test/test-resolve-url.c 2010-03-04 22:13:58 UTC (rev 18829)
@@ -0,0 +1,126 @@
+/***************************************************************************
+ * test-resolve-file-path.c
+ *
+ * Thu Sep 29 22:48:57 2005
+ * Copyright 2005 GnuCash team
+ ****************************************************************************/
+/*
+ * This program 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 program 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 program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#include "config.h"
+#include <stdlib.h>
+#include <string.h>
+
+#include <glib.h>
+#include "qof.h"
+#include "test-stuff.h"
+#include "gnc-filepath-utils.h"
+
+struct test_strings_struct
+{
+ char *input;
+ char *output;
+ int prefix_home;
+};
+
+typedef struct test_strings_struct test_strings;
+
+test_strings strs[] =
+{
+ {
+ G_DIR_SEPARATOR_S ".gnucash" G_DIR_SEPARATOR_S "test-account-name",
+ G_DIR_SEPARATOR_S ".gnucash" G_DIR_SEPARATOR_S "test-account-name", 1
+ },
+ {
+ G_DIR_SEPARATOR_S "tmp" G_DIR_SEPARATOR_S "test-account-name2",
+ G_DIR_SEPARATOR_S "tmp" G_DIR_SEPARATOR_S "test-account-name2", 0
+ },
+ {
+ "postgres://localhost/foo/bar",
+ G_DIR_SEPARATOR_S ".gnucash" G_DIR_SEPARATOR_S "data" G_DIR_SEPARATOR_S "postgres___localhost_foo_bar", 2
+ },
+ {
+ "http://www.gnucash.org/index.html",
+ "http://www.gnucash.org/index.html", 0
+ },
+ {
+ "https://www.gnucash.org/index.html",
+ "https://www.gnucash.org/index.html", 0
+ },
+ {
+ "file:/tmp/test-account-name3",
+ G_DIR_SEPARATOR_S "tmp" G_DIR_SEPARATOR_S "test-account-name3", 0
+ },
+ {
+ "file:///tmp/test-account-name3",
+ G_DIR_SEPARATOR_S "tmp" G_DIR_SEPARATOR_S "test-account-name3", 0
+ },
+ {
+ "xml:/tmp/test-account-name3",
+ "xml:" G_DIR_SEPARATOR_S "tmp" G_DIR_SEPARATOR_S "test-account-name3", 0
+ },
+ {
+ "xml:///tmp/test-account-name3",
+ "xml:" G_DIR_SEPARATOR_S "tmp" G_DIR_SEPARATOR_S "test-account-name3", 0
+ },
+ { NULL, NULL, 0 },
+};
+
+int
+main(int argc, char **argv)
+{
+ int i;
+
+ qof_init();
+
+ for (i = 0; strs[i].input != NULL; i++)
+ {
+ char *daout;
+ char *dain;
+ char *wantout;
+
+ if (strs[i].prefix_home == 1)
+ {
+ dain = g_build_filename(g_get_home_dir(), strs[i].input,
+ (gchar *)NULL);
+ wantout = g_build_filename(g_get_home_dir(), strs[i].output,
+ (gchar *)NULL);
+ }
+ else if (strs[i].prefix_home == 2)
+ {
+ dain = g_strdup(strs[i].input);
+ wantout = g_build_filename(g_get_home_dir(), strs[i].output,
+ (gchar *)NULL);
+ }
+ else
+ {
+ dain = g_strdup(strs[i].input);
+ wantout = g_strdup(strs[i].output);
+ }
+
+ daout = xaccResolveURL(dain);
+ do_test_args(safe_strcmp(daout, wantout) == 0,
+ "xaccResolveFilePath",
+ __FILE__, __LINE__,
+ "%s (%s) vs %s", daout, dain, wantout);
+ g_free(dain);
+ g_free(wantout);
+ g_free(daout);
+ }
+ print_test_results();
+ return get_rv();
+}
Modified: gnucash/trunk/src/engine/test/Makefile.am
===================================================================
--- gnucash/trunk/src/engine/test/Makefile.am 2010-03-04 22:06:23 UTC (rev 18828)
+++ gnucash/trunk/src/engine/test/Makefile.am 2010-03-04 22:13:58 UTC (rev 18829)
@@ -39,8 +39,6 @@
test-querynew \
test-query \
test-recursive \
- test-resolve-file-path \
- test-resolve-url \
test-split-vs-account \
test-transaction-reversal \
test-transaction-voiding \
@@ -78,8 +76,6 @@
test-query \
test-querynew \
test-recursive \
- test-resolve-file-path \
- test-resolve-url \
test-scm-query \
test-split-vs-account \
test-transaction-reversal \
Deleted: gnucash/trunk/src/engine/test/test-resolve-file-path.c
===================================================================
--- gnucash/trunk/src/engine/test/test-resolve-file-path.c 2010-03-04 22:06:23 UTC (rev 18828)
+++ gnucash/trunk/src/engine/test/test-resolve-file-path.c 2010-03-04 22:13:58 UTC (rev 18829)
@@ -1,118 +0,0 @@
-/***************************************************************************
- * test-resolve-file-path.c
- *
- * Thu Sep 29 22:48:57 2005
- * Copyright 2005 GnuCash team
- ****************************************************************************/
-/*
- * This program 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 program 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 program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-#include "config.h"
-#include <stdlib.h>
-#include <string.h>
-
-#include <glib.h>
-#include "qof.h"
-#include "test-stuff.h"
-#include "gnc-filepath-utils.h"
-
-struct test_strings_struct
-{
- char *input;
- char *output;
- int prefix_home;
-};
-
-typedef struct test_strings_struct test_strings;
-
-test_strings strs[] =
-{
- {
- G_DIR_SEPARATOR_S ".gnucash" G_DIR_SEPARATOR_S "test-account-name",
- G_DIR_SEPARATOR_S ".gnucash" G_DIR_SEPARATOR_S "test-account-name", 1
- },
- {
- G_DIR_SEPARATOR_S "tmp" G_DIR_SEPARATOR_S "test-account-name2",
- G_DIR_SEPARATOR_S "tmp" G_DIR_SEPARATOR_S "test-account-name2", 0
- },
- {
- "postgres://localhost/foo/bar",
- G_DIR_SEPARATOR_S ".gnucash" G_DIR_SEPARATOR_S "data" G_DIR_SEPARATOR_S "postgres___localhost_foo_bar", 2
- },
- {
- "file:/tmp/test-account-name3",
- G_DIR_SEPARATOR_S "tmp" G_DIR_SEPARATOR_S "test-account-name3", 0
- },
- {
- "file:///tmp/test-account-name3",
- G_DIR_SEPARATOR_S "tmp" G_DIR_SEPARATOR_S "test-account-name3", 0
- },
- {
- "xml:/tmp/test-account-name3",
- G_DIR_SEPARATOR_S "tmp" G_DIR_SEPARATOR_S "test-account-name3", 0
- },
- {
- "xml:///tmp/test-account-name3",
- G_DIR_SEPARATOR_S "tmp" G_DIR_SEPARATOR_S "test-account-name3", 0
- },
- { NULL, NULL, 0 },
-};
-
-int
-main(int argc, char **argv)
-{
- int i;
-
- qof_init();
-
- for (i = 0; strs[i].input != NULL; i++)
- {
- char *daout;
- char *dain;
- char *wantout;
-
- if (strs[i].prefix_home == 1)
- {
- dain = g_build_filename(g_get_home_dir(), strs[i].input,
- (gchar *)NULL);
- wantout = g_build_filename(g_get_home_dir(), strs[i].output,
- (gchar *)NULL);
- }
- else if (strs[i].prefix_home == 2)
- {
- dain = g_strdup(strs[i].input);
- wantout = g_build_filename(g_get_home_dir(), strs[i].output,
- (gchar *)NULL);
- }
- else
- {
- dain = g_strdup(strs[i].input);
- wantout = g_strdup(strs[i].output);
- }
-
- daout = xaccResolveFilePath(dain);
- do_test_args(safe_strcmp(daout, wantout) == 0,
- "xaccResolveFilePath",
- __FILE__, __LINE__,
- "%s (%s) vs %s", daout, dain, wantout);
- g_free(dain);
- g_free(wantout);
- g_free(daout);
- }
- print_test_results();
- return get_rv();
-}
Deleted: gnucash/trunk/src/engine/test/test-resolve-url.c
===================================================================
--- gnucash/trunk/src/engine/test/test-resolve-url.c 2010-03-04 22:06:23 UTC (rev 18828)
+++ gnucash/trunk/src/engine/test/test-resolve-url.c 2010-03-04 22:13:58 UTC (rev 18829)
@@ -1,126 +0,0 @@
-/***************************************************************************
- * test-resolve-file-path.c
- *
- * Thu Sep 29 22:48:57 2005
- * Copyright 2005 GnuCash team
- ****************************************************************************/
-/*
- * This program 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 program 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 program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-#include "config.h"
-#include <stdlib.h>
-#include <string.h>
-
-#include <glib.h>
-#include "qof.h"
-#include "test-stuff.h"
-#include "gnc-filepath-utils.h"
-
-struct test_strings_struct
-{
- char *input;
- char *output;
- int prefix_home;
-};
-
-typedef struct test_strings_struct test_strings;
-
-test_strings strs[] =
-{
- {
- G_DIR_SEPARATOR_S ".gnucash" G_DIR_SEPARATOR_S "test-account-name",
- G_DIR_SEPARATOR_S ".gnucash" G_DIR_SEPARATOR_S "test-account-name", 1
- },
- {
- G_DIR_SEPARATOR_S "tmp" G_DIR_SEPARATOR_S "test-account-name2",
- G_DIR_SEPARATOR_S "tmp" G_DIR_SEPARATOR_S "test-account-name2", 0
- },
- {
- "postgres://localhost/foo/bar",
- G_DIR_SEPARATOR_S ".gnucash" G_DIR_SEPARATOR_S "data" G_DIR_SEPARATOR_S "postgres___localhost_foo_bar", 2
- },
- {
- "http://www.gnucash.org/index.html",
- "http://www.gnucash.org/index.html", 0
- },
- {
- "https://www.gnucash.org/index.html",
- "https://www.gnucash.org/index.html", 0
- },
- {
- "file:/tmp/test-account-name3",
- G_DIR_SEPARATOR_S "tmp" G_DIR_SEPARATOR_S "test-account-name3", 0
- },
- {
- "file:///tmp/test-account-name3",
- G_DIR_SEPARATOR_S "tmp" G_DIR_SEPARATOR_S "test-account-name3", 0
- },
- {
- "xml:/tmp/test-account-name3",
- "xml:" G_DIR_SEPARATOR_S "tmp" G_DIR_SEPARATOR_S "test-account-name3", 0
- },
- {
- "xml:///tmp/test-account-name3",
- "xml:" G_DIR_SEPARATOR_S "tmp" G_DIR_SEPARATOR_S "test-account-name3", 0
- },
- { NULL, NULL, 0 },
-};
-
-int
-main(int argc, char **argv)
-{
- int i;
-
- qof_init();
-
- for (i = 0; strs[i].input != NULL; i++)
- {
- char *daout;
- char *dain;
- char *wantout;
-
- if (strs[i].prefix_home == 1)
- {
- dain = g_build_filename(g_get_home_dir(), strs[i].input,
- (gchar *)NULL);
- wantout = g_build_filename(g_get_home_dir(), strs[i].output,
- (gchar *)NULL);
- }
- else if (strs[i].prefix_home == 2)
- {
- dain = g_strdup(strs[i].input);
- wantout = g_build_filename(g_get_home_dir(), strs[i].output,
- (gchar *)NULL);
- }
- else
- {
- dain = g_strdup(strs[i].input);
- wantout = g_strdup(strs[i].output);
- }
-
- daout = xaccResolveURL(dain);
- do_test_args(safe_strcmp(daout, wantout) == 0,
- "xaccResolveFilePath",
- __FILE__, __LINE__,
- "%s (%s) vs %s", daout, dain, wantout);
- g_free(dain);
- g_free(wantout);
- g_free(daout);
- }
- print_test_results();
- return get_rv();
-}
More information about the gnucash-changes
mailing list