Bug 539770 - migrate gstrfunc unit tests to gtest
authorPaolo Borelli <pborelli@katamail.com>
Tue, 24 Jun 2008 13:55:22 +0000 (13:55 +0000)
committerPaolo Borelli <pborelli@src.gnome.org>
Tue, 24 Jun 2008 13:55:22 +0000 (13:55 +0000)
2008-06-24  Paolo Borelli  <pborelli@katamail.com>

Bug 539770 - migrate gstrfunc unit tests to gtest

* tests/strfunc-test.c:
* tests/testglib.c:
* tests/strtoll-test.c:
* tests/strtod-test.c:
* tests/string-test.c:
* tests/Makefile.am:
Removed old tests.

* glib/tests/fileutils.c:
* glib/tests/strfuncs.c:
* glib/tests/Makefile.am:
Added all the old tests migrated to the new unit test framework
and add new unit tests for some of the functions.

svn path=/trunk/; revision=7097

ChangeLog
glib/tests/Makefile.am
glib/tests/fileutils.c [new file with mode: 0644]
glib/tests/strfuncs.c [new file with mode: 0644]
tests/Makefile.am
tests/strfunc-test.c [deleted file]
tests/string-test.c
tests/strtod-test.c [deleted file]
tests/strtoll-test.c [deleted file]
tests/testglib.c

index 8cf319b..376327d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2008-06-24  Paolo Borelli  <pborelli@katamail.com>
+
+       Bug 539770 - migrate gstrfunc unit tests to gtest
+
+       * tests/strfunc-test.c:
+       * tests/testglib.c:
+       * tests/strtoll-test.c:
+       * tests/strtod-test.c:
+       * tests/string-test.c:
+       * tests/Makefile.am:
+       Removed old tests.
+
+       * glib/tests/fileutils.c:
+       * glib/tests/strfuncs.c:
+       * glib/tests/Makefile.am:
+       Added all the old tests migrated to the new unit test framework
+       and add new unit tests for some of the functions.
+
 2008-06-23  Kristian Rietveld  <kris@imendio.com>
 
        * gobject/glib-mkenums.in: introduce an ENUMPREFIX substitution.
index 26f6d37..f729953 100644 (file)
@@ -14,6 +14,14 @@ TEST_PROGS            += option-context
 option_context_SOURCES   = option-context.c
 option_context_LDADD     = $(progs_ldadd)
 
+TEST_PROGS        += fileutils
+fileutils_SOURCES   = fileutils.c
+fileutils_LDADD           = $(progs_ldadd)
+
+TEST_PROGS        += strfuncs
+strfuncs_SOURCES   = strfuncs.c
+strfuncs_LDADD    = $(progs_ldadd) -lm
+
 # some testing of gtester funcitonality
 XMLLINT=xmllint
 gtester-xmllint-check: # check testreport xml with xmllint if present
diff --git a/glib/tests/fileutils.c b/glib/tests/fileutils.c
new file mode 100644 (file)
index 0000000..225c6ce
--- /dev/null
@@ -0,0 +1,508 @@
+/* Unit tests for gfileutils
+ * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This work is provided "as is"; redistribution and modification
+ * in whole or in part, in any medium, physical or electronic is
+ * permitted without restriction.
+ *
+ * This work 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.
+ *
+ * In no event shall the authors or contributors be liable for any
+ * direct, indirect, incidental, special, exemplary, or consequential
+ * damages (including, but not limited to, procurement of substitute
+ * goods or services; loss of use, data, or profits; or business
+ * interruption) however caused and on any theory of liability, whether
+ * in contract, strict liability, or tort (including negligence or
+ * otherwise) arising in any way out of the use of this software, even
+ * if advised of the possibility of such damage.
+ */
+
+#include <string.h>
+#include <errno.h>
+#include <glib.h>
+#include <glib/gstdio.h>
+
+#define S G_DIR_SEPARATOR_S
+
+static void
+check_string (gchar *str, gchar *expected)
+{
+  g_assert (str != NULL);
+  g_assert_cmpstr (str, ==, expected);
+  g_free (str);
+}
+
+static void
+test_build_path (void)
+{
+/*  check_string (g_build_path ("", NULL), "");*/
+  check_string (g_build_path ("", "", NULL), "");
+  check_string (g_build_path ("", "x", NULL), "x");
+  check_string (g_build_path ("", "x", "y",  NULL), "xy");
+  check_string (g_build_path ("", "x", "y", "z", NULL), "xyz");
+
+/*  check_string (g_build_path (":", NULL), "");*/
+  check_string (g_build_path (":", ":", NULL), ":");
+  check_string (g_build_path (":", ":x", NULL), ":x");
+  check_string (g_build_path (":", "x:", NULL), "x:");
+  check_string (g_build_path (":", "", "x", NULL), "x");
+  check_string (g_build_path (":", "", ":x", NULL), ":x");
+  check_string (g_build_path (":", ":", "x", NULL), ":x");
+  check_string (g_build_path (":", "::", "x", NULL), "::x");
+  check_string (g_build_path (":", "x", "", NULL), "x");
+  check_string (g_build_path (":", "x:", "", NULL), "x:");
+  check_string (g_build_path (":", "x", ":", NULL), "x:");
+  check_string (g_build_path (":", "x", "::", NULL), "x::");
+  check_string (g_build_path (":", "x", "y",  NULL), "x:y");
+  check_string (g_build_path (":", ":x", "y", NULL), ":x:y");
+  check_string (g_build_path (":", "x", "y:", NULL), "x:y:");
+  check_string (g_build_path (":", ":x:", ":y:", NULL), ":x:y:");
+  check_string (g_build_path (":", ":x::", "::y:", NULL), ":x:y:");
+  check_string (g_build_path (":", "x", "","y",  NULL), "x:y");
+  check_string (g_build_path (":", "x", ":", "y",  NULL), "x:y");
+  check_string (g_build_path (":", "x", "::", "y",  NULL), "x:y");
+  check_string (g_build_path (":", "x", "y", "z", NULL), "x:y:z");
+  check_string (g_build_path (":", ":x:", ":y:", ":z:", NULL), ":x:y:z:");
+  check_string (g_build_path (":", "::x::", "::y::", "::z::", NULL), "::x:y:z::");
+
+/*  check_string (g_build_path ("::", NULL), "");*/
+  check_string (g_build_path ("::", "::", NULL), "::");
+  check_string (g_build_path ("::", ":::", NULL), ":::");
+  check_string (g_build_path ("::", "::x", NULL), "::x");
+  check_string (g_build_path ("::", "x::", NULL), "x::");
+  check_string (g_build_path ("::", "", "x", NULL), "x");
+  check_string (g_build_path ("::", "", "::x", NULL), "::x");
+  check_string (g_build_path ("::", "::", "x", NULL), "::x");
+  check_string (g_build_path ("::", "::::", "x", NULL), "::::x");
+  check_string (g_build_path ("::", "x", "", NULL), "x");
+  check_string (g_build_path ("::", "x::", "", NULL), "x::");
+  check_string (g_build_path ("::", "x", "::", NULL), "x::");
+
+  /* This following is weird, but keeps the definition simple */
+  check_string (g_build_path ("::", "x", ":::", NULL), "x:::::");
+  check_string (g_build_path ("::", "x", "::::", NULL), "x::::");
+  check_string (g_build_path ("::", "x", "y",  NULL), "x::y");
+  check_string (g_build_path ("::", "::x", "y", NULL), "::x::y");
+  check_string (g_build_path ("::", "x", "y::", NULL), "x::y::");
+  check_string (g_build_path ("::", "::x::", "::y::", NULL), "::x::y::");
+  check_string (g_build_path ("::", "::x:::", ":::y::", NULL), "::x::::y::");
+  check_string (g_build_path ("::", "::x::::", "::::y::", NULL), "::x::y::");
+  check_string (g_build_path ("::", "x", "", "y",  NULL), "x::y");
+  check_string (g_build_path ("::", "x", "::", "y",  NULL), "x::y");
+  check_string (g_build_path ("::", "x", "::::", "y",  NULL), "x::y");
+  check_string (g_build_path ("::", "x", "y", "z", NULL), "x::y::z");
+  check_string (g_build_path ("::", "::x::", "::y::", "::z::", NULL), "::x::y::z::");
+  check_string (g_build_path ("::", ":::x:::", ":::y:::", ":::z:::", NULL), ":::x::::y::::z:::");
+  check_string (g_build_path ("::", "::::x::::", "::::y::::", "::::z::::", NULL), "::::x::y::z::::");
+}
+
+static void
+test_build_pathv (void)
+{
+  gchar *args[10];
+
+  args[0] = NULL;
+  check_string (g_build_pathv ("", args), "");
+  args[0] = ""; args[1] = NULL;
+  check_string (g_build_pathv ("", args), "");
+  args[0] = "x"; args[1] = NULL;
+  check_string (g_build_pathv ("", args), "x");
+  args[0] = "x"; args[1] = "y"; args[2] = NULL;
+  check_string (g_build_pathv ("", args), "xy");
+  args[0] = "x"; args[1] = "y"; args[2] = "z", args[3] = NULL;
+  check_string (g_build_pathv ("", args), "xyz");
+
+  args[0] = NULL;
+  check_string (g_build_pathv (":", args), "");
+  args[0] = ":"; args[1] = NULL;
+  check_string (g_build_pathv (":", args), ":");
+  args[0] = ":x"; args[1] = NULL;
+  check_string (g_build_pathv (":", args), ":x");
+  args[0] = "x:"; args[1] = NULL;
+  check_string (g_build_pathv (":", args), "x:");
+  args[0] = ""; args[1] = "x"; args[2] = NULL;
+  check_string (g_build_pathv (":", args), "x");
+  args[0] = ""; args[1] = ":x"; args[2] = NULL;
+  check_string (g_build_pathv (":", args), ":x");
+  args[0] = ":"; args[1] = "x"; args[2] = NULL;
+  check_string (g_build_pathv (":", args), ":x");
+  args[0] = "::"; args[1] = "x"; args[2] = NULL;
+  check_string (g_build_pathv (":", args), "::x");
+  args[0] = "x"; args[1] = ""; args[2] = NULL;
+  check_string (g_build_pathv (":", args), "x");
+  args[0] = "x:"; args[1] = ""; args[2] = NULL;
+  check_string (g_build_pathv (":", args), "x:");
+  args[0] = "x"; args[1] = ":"; args[2] = NULL;
+  check_string (g_build_pathv (":", args), "x:");
+  args[0] = "x"; args[1] = "::"; args[2] = NULL;
+  check_string (g_build_pathv (":", args), "x::");
+  args[0] = "x"; args[1] = "y"; args[2] = NULL;
+  check_string (g_build_pathv (":", args), "x:y");
+  args[0] = ":x"; args[1] = "y"; args[2] = NULL;
+  check_string (g_build_pathv (":", args), ":x:y");
+  args[0] = "x"; args[1] = "y:"; args[2] = NULL;
+  check_string (g_build_pathv (":", args), "x:y:");
+  args[0] = ":x:"; args[1] = ":y:"; args[2] = NULL;
+  check_string (g_build_pathv (":", args), ":x:y:");
+  args[0] = ":x::"; args[1] = "::y:"; args[2] = NULL;
+  check_string (g_build_pathv (":", args), ":x:y:");
+  args[0] = "x"; args[1] = ""; args[2] = "y"; args[3] = NULL;
+  check_string (g_build_pathv (":", args), "x:y");
+  args[0] = "x"; args[1] = ":"; args[2] = "y"; args[3] = NULL;
+  check_string (g_build_pathv (":", args), "x:y");
+  args[0] = "x"; args[1] = "::"; args[2] = "y"; args[3] = NULL;
+  check_string (g_build_pathv (":", args), "x:y");
+  args[0] = "x"; args[1] = "y"; args[2] = "z"; args[3] = NULL;
+  check_string (g_build_pathv (":", args), "x:y:z");
+  args[0] = ":x:"; args[1] = ":y:"; args[2] = ":z:"; args[3] = NULL;
+  check_string (g_build_pathv (":", args), ":x:y:z:");
+  args[0] = "::x::"; args[1] = "::y::"; args[2] = "::z::"; args[3] = NULL;
+  check_string (g_build_pathv (":", args), "::x:y:z::");
+
+  args[0] = NULL;
+  check_string (g_build_pathv ("::", args), "");
+  args[0] = "::"; args[1] = NULL;
+  check_string (g_build_pathv ("::", args), "::");
+  args[0] = ":::"; args[1] = NULL;
+  check_string (g_build_pathv ("::", args), ":::");
+  args[0] = "::x"; args[1] = NULL;
+  check_string (g_build_pathv ("::", args), "::x");
+  args[0] = "x::"; args[1] = NULL;
+  check_string (g_build_pathv ("::", args), "x::");
+  args[0] = ""; args[1] = "x"; args[2] = NULL;
+  check_string (g_build_pathv ("::", args), "x");
+  args[0] = ""; args[1] = "::x"; args[2] = NULL;
+  check_string (g_build_pathv ("::", args), "::x");
+  args[0] = "::"; args[1] = "x"; args[2] = NULL;
+  check_string (g_build_pathv ("::", args), "::x");
+  args[0] = "::::"; args[1] = "x"; args[2] = NULL;
+  check_string (g_build_pathv ("::", args), "::::x");
+  args[0] = "x"; args[1] = ""; args[2] = NULL;
+  check_string (g_build_pathv ("::", args), "x");
+  args[0] = "x::"; args[1] = ""; args[2] = NULL;
+  check_string (g_build_pathv ("::", args), "x::");
+  args[0] = "x"; args[1] = "::"; args[2] = NULL;
+  check_string (g_build_pathv ("::", args), "x::");
+  /* This following is weird, but keeps the definition simple */
+  args[0] = "x"; args[1] = ":::"; args[2] = NULL;
+  check_string (g_build_pathv ("::", args), "x:::::");
+  args[0] = "x"; args[1] = "::::"; args[2] = NULL;
+  check_string (g_build_pathv ("::", args), "x::::");
+  args[0] = "x"; args[1] = "y"; args[2] = NULL;
+  check_string (g_build_pathv ("::", args), "x::y");
+  args[0] = "::x"; args[1] = "y"; args[2] = NULL;
+  check_string (g_build_pathv ("::", args), "::x::y");
+  args[0] = "x"; args[1] = "y::"; args[2] = NULL;
+  check_string (g_build_pathv ("::", args), "x::y::");
+  args[0] = "::x::"; args[1] = "::y::"; args[2] = NULL;
+  check_string (g_build_pathv ("::", args), "::x::y::");
+  args[0] = "::x:::"; args[1] = ":::y::"; args[2] = NULL;
+  check_string (g_build_pathv ("::", args), "::x::::y::");
+  args[0] = "::x::::"; args[1] = "::::y::"; args[2] = NULL;
+  check_string (g_build_pathv ("::", args), "::x::y::");
+  args[0] = "x"; args[1] = ""; args[2] = "y"; args[3] = NULL;
+  check_string (g_build_pathv ("::", args), "x::y");
+  args[0] = "x"; args[1] = "::"; args[2] = "y"; args[3] = NULL;
+  check_string (g_build_pathv ("::", args), "x::y");
+  args[0] = "x"; args[1] = "::::"; args[2] = "y"; args[3] = NULL;
+  check_string (g_build_pathv ("::", args), "x::y");
+  args[0] = "x"; args[1] = "y"; args[2] = "z"; args[3] = NULL;
+  check_string (g_build_pathv ("::", args), "x::y::z");
+  args[0] = "::x::"; args[1] = "::y::"; args[2] = "::z::"; args[3] = NULL;
+  check_string (g_build_pathv ("::", args), "::x::y::z::");
+  args[0] = ":::x:::"; args[1] = ":::y:::"; args[2] = ":::z:::"; args[3] = NULL;
+  check_string (g_build_pathv ("::", args), ":::x::::y::::z:::");
+  args[0] = "::::x::::"; args[1] = "::::y::::"; args[2] = "::::z::::"; args[3] = NULL;
+  check_string (g_build_pathv ("::", args), "::::x::y::z::::");
+}
+
+static void
+test_build_filename (void)
+{
+/*  check_string (g_build_filename (NULL), "");*/
+  check_string (g_build_filename (S, NULL), S);
+  check_string (g_build_filename (S"x", NULL), S"x");
+  check_string (g_build_filename ("x"S, NULL), "x"S);
+  check_string (g_build_filename ("", "x", NULL), "x");
+  check_string (g_build_filename ("", S"x", NULL), S"x");
+  check_string (g_build_filename (S, "x", NULL), S"x");
+  check_string (g_build_filename (S S, "x", NULL), S S"x");
+  check_string (g_build_filename ("x", "", NULL), "x");
+  check_string (g_build_filename ("x"S, "", NULL), "x"S);
+  check_string (g_build_filename ("x", S, NULL), "x"S);
+  check_string (g_build_filename ("x", S S, NULL), "x"S S);
+  check_string (g_build_filename ("x", "y",  NULL), "x"S"y");
+  check_string (g_build_filename (S"x", "y", NULL), S"x"S"y");
+  check_string (g_build_filename ("x", "y"S, NULL), "x"S"y"S);
+  check_string (g_build_filename (S"x"S, S"y"S, NULL), S"x"S"y"S);
+  check_string (g_build_filename (S"x"S S, S S"y"S, NULL), S"x"S"y"S);
+  check_string (g_build_filename ("x", "", "y",  NULL), "x"S"y");
+  check_string (g_build_filename ("x", S, "y",  NULL), "x"S"y");
+  check_string (g_build_filename ("x", S S, "y",  NULL), "x"S"y");
+  check_string (g_build_filename ("x", "y", "z", NULL), "x"S"y"S"z");
+  check_string (g_build_filename (S"x"S, S"y"S, S"z"S, NULL), S"x"S"y"S"z"S);
+  check_string (g_build_filename (S S"x"S S, S S"y"S S, S S"z"S S, NULL), S S"x"S"y"S"z"S S);
+
+#ifdef G_OS_WIN32
+
+  /* Test also using the slash as file name separator */
+#define U "/"
+  check_string (g_build_filename (NULL), "");
+  check_string (g_build_filename (U, NULL), U);
+  check_string (g_build_filename (U"x", NULL), U"x");
+  check_string (g_build_filename ("x"U, NULL), "x"U);
+  check_string (g_build_filename ("", U"x", NULL), U"x");
+  check_string (g_build_filename ("", U"x", NULL), U"x");
+  check_string (g_build_filename (U, "x", NULL), U"x");
+  check_string (g_build_filename (U U, "x", NULL), U U"x");
+  check_string (g_build_filename (U S, "x", NULL), U S"x");
+  check_string (g_build_filename ("x"U, "", NULL), "x"U);
+  check_string (g_build_filename ("x"S"y", "z"U"a", NULL), "x"S"y"S"z"U"a");
+  check_string (g_build_filename ("x", U, NULL), "x"U);
+  check_string (g_build_filename ("x", U U, NULL), "x"U U);
+  check_string (g_build_filename ("x", S U, NULL), "x"S U);
+  check_string (g_build_filename (U"x", "y", NULL), U"x"U"y");
+  check_string (g_build_filename ("x", "y"U, NULL), "x"U"y"U);
+  check_string (g_build_filename (U"x"U, U"y"U, NULL), U"x"U"y"U);
+  check_string (g_build_filename (U"x"U U, U U"y"U, NULL), U"x"U"y"U);
+  check_string (g_build_filename ("x", U, "y",  NULL), "x"U"y");
+  check_string (g_build_filename ("x", U U, "y",  NULL), "x"U"y");
+  check_string (g_build_filename ("x", U S, "y",  NULL), "x"S"y");
+  check_string (g_build_filename ("x", S U, "y",  NULL), "x"U"y");
+  check_string (g_build_filename ("x", U "y", "z", NULL), "x"U"y"U"z");
+  check_string (g_build_filename ("x", S "y", "z", NULL), "x"S"y"S"z");
+  check_string (g_build_filename ("x", S "y", "z", U, "a", "b", NULL), "x"S"y"S"z"U"a"U"b");
+  check_string (g_build_filename (U"x"U, U"y"U, U"z"U, NULL), U"x"U"y"U"z"U);
+  check_string (g_build_filename (U U"x"U U, U U"y"U U, U U"z"U U, NULL), U U"x"U"y"U"z"U U);
+
+#undef U
+
+#endif /* G_OS_WIN32 */
+
+}
+
+static void
+test_build_filenamev (void)
+{
+  gchar *args[10];
+
+  args[0] = NULL;
+  check_string (g_build_filenamev (args), "");
+  args[0] = S; args[1] = NULL;
+  check_string (g_build_filenamev (args), S);
+  args[0] = S"x"; args[1] = NULL;
+  check_string (g_build_filenamev (args), S"x");
+  args[0] = "x"S; args[1] = NULL;
+  check_string (g_build_filenamev (args), "x"S);
+  args[0] = ""; args[1] = "x"; args[2] = NULL;
+  check_string (g_build_filenamev (args), "x");
+  args[0] = ""; args[1] = S"x"; args[2] = NULL;
+  check_string (g_build_filenamev (args), S"x");
+  args[0] = S; args[1] = "x"; args[2] = NULL;
+  check_string (g_build_filenamev (args), S"x");
+  args[0] = S S; args[1] = "x"; args[2] = NULL;
+  check_string (g_build_filenamev (args), S S"x");
+  args[0] = "x"; args[1] = ""; args[2] = NULL;
+  check_string (g_build_filenamev (args), "x");
+  args[0] = "x"S; args[1] = ""; args[2] = NULL;
+  check_string (g_build_filenamev (args), "x"S);
+  args[0] = "x"; args[1] = S; args[2] = NULL;
+  check_string (g_build_filenamev (args), "x"S);
+  args[0] = "x"; args[1] = S S; args[2] = NULL;
+  check_string (g_build_filenamev (args), "x"S S);
+  args[0] = "x"; args[1] = "y"; args[2] = NULL;
+  check_string (g_build_filenamev (args), "x"S"y");
+  args[0] = S"x"; args[1] = "y"; args[2] = NULL;
+  check_string (g_build_filenamev (args), S"x"S"y");
+  args[0] = "x"; args[1] = "y"S; args[2] = NULL;
+  check_string (g_build_filenamev (args), "x"S"y"S);
+  args[0] = S"x"S; args[1] = S"y"S; args[2] = NULL;
+  check_string (g_build_filenamev (args), S"x"S"y"S);
+  args[0] = S"x"S S; args[1] = S S"y"S; args[2] = NULL;
+  check_string (g_build_filenamev (args), S"x"S"y"S);
+  args[0] = "x"; args[1] = ""; args[2] = "y"; args[3] = NULL;
+  check_string (g_build_filenamev (args), "x"S"y");
+  args[0] = "x"; args[1] = S; args[2] = "y"; args[3] = NULL;
+  check_string (g_build_filenamev (args), "x"S"y");
+  args[0] = "x"; args[1] = S S; args[2] = "y"; args[3] = NULL;
+  check_string (g_build_filenamev (args), "x"S"y");
+  args[0] = "x"; args[1] = "y"; args[2] = "z"; args[3] = NULL;
+  check_string (g_build_filenamev (args), "x"S"y"S"z");
+  args[0] = S"x"S; args[1] = S"y"S; args[2] = S"z"S; args[3] = NULL;
+  check_string (g_build_filenamev (args), S"x"S"y"S"z"S);
+  args[0] = S S"x"S S; args[1] = S S"y"S S; args[2] = S S"z"S S; args[3] = NULL;
+  check_string (g_build_filenamev (args), S S"x"S"y"S"z"S S);
+
+#ifdef G_OS_WIN32
+
+  /* Test also using the slash as file name separator */
+#define U "/"
+  args[0] = NULL;
+  check_string (g_build_filenamev (args), "");
+  args[0] = U; args[1] = NULL;
+  check_string (g_build_filenamev (args), U);
+  args[0] = U"x"; args[1] = NULL;
+  check_string (g_build_filenamev (args), U"x");
+  args[0] = "x"U; args[1] = NULL;
+  check_string (g_build_filenamev (args), "x"U);
+  args[0] = ""; args[1] = U"x"; args[2] = NULL;
+  check_string (g_build_filenamev (args), U"x");
+  args[0] = ""; args[1] = U"x"; args[2] = NULL;
+  check_string (g_build_filenamev (args), U"x");
+  args[0] = U; args[1] = "x"; args[2] = NULL;
+  check_string (g_build_filenamev (args), U"x");
+  args[0] = U U; args[1] = "x"; args[2] = NULL;
+  check_string (g_build_filenamev (args), U U"x");
+  args[0] = U S; args[1] = "x"; args[2] = NULL;
+  check_string (g_build_filenamev (args), U S"x");
+  args[0] = "x"U; args[1] = ""; args[2] = NULL;
+  check_string (g_build_filenamev (args), "x"U);
+  args[0] = "x"S"y"; args[1] = "z"U"a"; args[2] = NULL;
+  check_string (g_build_filenamev (args), "x"S"y"S"z"U"a");
+  args[0] = "x"; args[1] = U; args[2] = NULL;
+  check_string (g_build_filenamev (args), "x"U);
+  args[0] = "x"; args[1] = U U; args[2] = NULL;
+  check_string (g_build_filenamev (args), "x"U U);
+  args[0] = "x"; args[1] = S U; args[2] = NULL;
+  check_string (g_build_filenamev (args), "x"S U);
+  args[0] = U"x"; args[1] = "y"; args[2] = NULL;
+  check_string (g_build_filenamev (args), U"x"U"y");
+  args[0] = "x"; args[1] = "y"U; args[2] = NULL;
+  check_string (g_build_filenamev (args), "x"U"y"U);
+  args[0] = U"x"U; args[1] = U"y"U; args[2] = NULL;
+  check_string (g_build_filenamev (args), U"x"U"y"U);
+  args[0] = U"x"U U; args[1] = U U"y"U; args[2] = NULL;
+  check_string (g_build_filenamev (args), U"x"U"y"U);
+  args[0] = "x"; args[1] = U; args[2] = "y", args[3] = NULL;
+  check_string (g_build_filenamev (args), "x"U"y");
+  args[0] = "x"; args[1] = U U; args[2] = "y", args[3] = NULL;
+  check_string (g_build_filenamev (args), "x"U"y");
+  args[0] = "x"; args[1] = U S; args[2] = "y", args[3] = NULL;
+  check_string (g_build_filenamev (args), "x"S"y");
+  args[0] = "x"; args[1] = S U; args[2] = "y", args[3] = NULL;
+  check_string (g_build_filenamev (args), "x"U"y");
+  args[0] = "x"; args[1] = U "y"; args[2] = "z", args[3] = NULL;
+  check_string (g_build_filenamev (args), "x"U"y"U"z");
+  args[0] = "x"; args[1] = S "y"; args[2] = "z", args[3] = NULL;
+  check_string (g_build_filenamev (args), "x"S"y"S"z");
+  args[0] = "x"; args[1] = S "y"; args[2] = "z", args[3] = U;
+  args[4] = "a"; args[5] = "b"; args[6] = NULL;
+  check_string (g_build_filenamev (args), "x"S"y"S"z"U"a"U"b");
+  args[0] = U"x"U; args[1] = U"y"U; args[2] = U"z"U, args[3] = NULL;
+  check_string (g_build_filenamev (args), U"x"U"y"U"z"U);
+  args[0] = U U"x"U U; args[1] = U U"y"U U; args[2] = U U"z"U U, args[3] = NULL;
+  check_string (g_build_filenamev (args), U U"x"U"y"U"z"U U);
+
+#undef U
+
+#endif /* G_OS_WIN32 */
+}
+
+#undef S
+
+static void
+test_mkdir_with_parents_1 (const gchar *base)
+{
+  char *p0 = g_build_filename (base, "fum", NULL);
+  char *p1 = g_build_filename (p0, "tem", NULL);
+  char *p2 = g_build_filename (p1, "zap", NULL);
+  FILE *f;
+
+  g_remove (p2);
+  g_remove (p1);
+  g_remove (p0);
+
+  if (g_file_test (p0, G_FILE_TEST_EXISTS))
+    g_error ("failed, %s exists, cannot test g_mkdir_with_parents\n", p0);
+
+  if (g_file_test (p1, G_FILE_TEST_EXISTS))
+    g_error ("failed, %s exists, cannot test g_mkdir_with_parents\n", p1);
+
+  if (g_file_test (p2, G_FILE_TEST_EXISTS))
+    g_error ("failed, %s exists, cannot test g_mkdir_with_parents\n", p2);
+
+  if (g_mkdir_with_parents (p2, 0777) == -1)
+    g_error ("failed, g_mkdir_with_parents(%s) failed: %s\n", p2, g_strerror (errno));
+
+  if (!g_file_test (p2, G_FILE_TEST_IS_DIR))
+    g_error ("failed, g_mkdir_with_parents(%s) succeeded, but %s is not a directory\n", p2, p2);
+
+  if (!g_file_test (p1, G_FILE_TEST_IS_DIR))
+    g_error ("failed, g_mkdir_with_parents(%s) succeeded, but %s is not a directory\n", p2, p1);
+
+  if (!g_file_test (p0, G_FILE_TEST_IS_DIR))
+    g_error ("failed, g_mkdir_with_parents(%s) succeeded, but %s is not a directory\n", p2, p0);
+
+  g_rmdir (p2);
+  if (g_file_test (p2, G_FILE_TEST_EXISTS))
+    g_error ("failed, did g_rmdir(%s), but %s is still there\n", p2, p2);
+
+  g_rmdir (p1);
+  if (g_file_test (p1, G_FILE_TEST_EXISTS))
+    g_error ("failed, did g_rmdir(%s), but %s is still there\n", p1, p1);
+
+  f = g_fopen (p1, "w");
+  if (f == NULL)
+    g_error ("failed, couldn't create file %s\n", p1);
+  fclose (f);
+
+  if (g_mkdir_with_parents (p1, 0666) == 0)
+    g_error ("failed, g_mkdir_with_parents(%s) succeeded, even if %s is a file\n", p1, p1);
+
+  if (g_mkdir_with_parents (p2, 0666) == 0)
+    g_error("failed, g_mkdir_with_parents(%s) succeeded, even if %s is a file\n", p2, p1);
+
+  g_remove (p2);
+  g_remove (p1);
+  g_remove (p0);
+}
+
+static void
+test_mkdir_with_parents (void)
+{
+  gchar *cwd;
+  if (g_test_verbose())
+    g_print ("checking g_mkdir_with_parents() in subdir ./hum/");
+  test_mkdir_with_parents_1 ("hum");
+  g_remove ("hum");
+  if (g_test_verbose())
+    g_print ("checking g_mkdir_with_parents() in subdir ./hii///haa/hee/");
+  test_mkdir_with_parents_1 ("hii///haa/hee");
+  g_remove ("hii/haa/hee");
+  g_remove ("hii/haa");
+  g_remove ("hii");
+  cwd = g_get_current_dir ();
+  if (g_test_verbose())
+    g_print ("checking g_mkdir_with_parents() in cwd: %s", cwd);
+  test_mkdir_with_parents_1 (cwd);
+  g_free (cwd);
+}
+
+static void
+test_format_size_for_display (void)
+{
+  check_string (g_format_size_for_display (0), "0 bytes");
+  check_string (g_format_size_for_display (1), "1 byte");
+  check_string (g_format_size_for_display (2), "2 bytes");
+  check_string (g_format_size_for_display (1024), "1.0 KB");
+  check_string (g_format_size_for_display (1024 * 1024), "1.0 MB");
+  check_string (g_format_size_for_display (1024 * 1024 * 1024), "1.0 GB");
+}
+
+int
+main (int   argc,
+      char *argv[])
+{
+  g_test_init (&argc, &argv, NULL);
+
+  g_test_add_func ("/fileutils/build-path", test_build_path);
+  g_test_add_func ("/fileutils/build-pathv", test_build_pathv);
+  g_test_add_func ("/fileutils/build-filename", test_build_filename);
+  g_test_add_func ("/fileutils/build-filenamev", test_build_filenamev);
+  g_test_add_func ("/fileutils/mkdir-with-parents", test_mkdir_with_parents);
+  g_test_add_func ("/fileutils/format-size-for-display", test_format_size_for_display);
+
+  return g_test_run();
+}
diff --git a/glib/tests/strfuncs.c b/glib/tests/strfuncs.c
new file mode 100644 (file)
index 0000000..4915b40
--- /dev/null
@@ -0,0 +1,1053 @@
+/* Unit tests for gstrfuncs
+ * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This work is provided "as is"; redistribution and modification
+ * in whole or in part, in any medium, physical or electronic is
+ * permitted without restriction.
+ *
+ * This work 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.
+ *
+ * In no event shall the authors or contributors be liable for any
+ * direct, indirect, incidental, special, exemplary, or consequential
+ * damages (including, but not limited to, procurement of substitute
+ * goods or services; loss of use, data, or profits; or business
+ * interruption) however caused and on any theory of liability, whether
+ * in contract, strict liability, or tort (including negligence or
+ * otherwise) arising in any way out of the use of this software, even
+ * if advised of the possibility of such damage.
+ */
+
+#include <ctype.h>
+#include <errno.h>
+#include <locale.h>
+#include <math.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "glib.h"
+
+#define GLIB_TEST_STRING "el dorado "
+
+#define FOR_ALL_CTYPE(macro)   \
+       macro(isalnum)          \
+       macro(isalpha)          \
+       macro(iscntrl)          \
+       macro(isdigit)          \
+       macro(isgraph)          \
+       macro(islower)          \
+       macro(isprint)          \
+       macro(ispunct)          \
+       macro(isspace)          \
+       macro(isupper)          \
+       macro(isxdigit)
+
+#define DEFINE_CALL_CTYPE(function)            \
+       static int                              \
+       call_##function (int c)                 \
+       {                                       \
+               return function (c);            \
+       }
+
+#define DEFINE_CALL_G_ASCII_CTYPE(function)    \
+       static gboolean                         \
+       call_g_ascii_##function (gchar c)       \
+       {                                       \
+               return g_ascii_##function (c);  \
+       }
+
+FOR_ALL_CTYPE (DEFINE_CALL_CTYPE)
+FOR_ALL_CTYPE (DEFINE_CALL_G_ASCII_CTYPE)
+
+static void
+test_is_function (const char *name,
+                 gboolean (* ascii_function) (gchar),
+                 int (* c_library_function) (int),
+                 gboolean (* unicode_function) (gunichar))
+{
+  int c;
+
+  for (c = 0; c <= 0x7F; c++)
+    {
+      gboolean ascii_result = ascii_function ((gchar)c);
+      gboolean c_library_result = c_library_function (c) != 0;
+      gboolean unicode_result = unicode_function ((gunichar) c);
+      if (ascii_result != c_library_result && c != '\v')
+        {
+         g_error ("g_ascii_%s returned %d and %s returned %d for 0x%X",
+                  name, ascii_result, name, c_library_result, c);
+       }
+      if (ascii_result != unicode_result)
+       {
+         g_error ("g_ascii_%s returned %d and g_unichar_%s returned %d for 0x%X",
+                  name, ascii_result, name, unicode_result, c);
+       }
+    }
+  for (c = 0x80; c <= 0xFF; c++)
+    {
+      gboolean ascii_result = ascii_function ((gchar)c);
+      if (ascii_result)
+       {
+         g_error ("g_ascii_%s returned TRUE for 0x%X", name, c);
+       }
+    }
+}
+
+static void
+test_to_function (const char *name,
+                 gchar (* ascii_function) (gchar),
+                 int (* c_library_function) (int),
+                 gunichar (* unicode_function) (gunichar))
+{
+  int c;
+
+  for (c = 0; c <= 0x7F; c++)
+    {
+      int ascii_result = (guchar) ascii_function ((gchar) c);
+      int c_library_result = c_library_function (c);
+      int unicode_result = unicode_function ((gunichar) c);
+      if (ascii_result != c_library_result)
+       {
+         g_error ("g_ascii_%s returned 0x%X and %s returned 0x%X for 0x%X",
+                  name, ascii_result, name, c_library_result, c);
+       }
+      if (ascii_result != unicode_result)
+       {
+         g_error ("g_ascii_%s returned 0x%X and g_unichar_%s returned 0x%X for 0x%X",
+                  name, ascii_result, name, unicode_result, c);
+       }
+    }
+  for (c = 0x80; c <= 0xFF; c++)
+    {
+      int ascii_result = (guchar) ascii_function ((gchar) c);
+      if (ascii_result != c)
+       {
+         g_error ("g_ascii_%s returned 0x%X for 0x%X",
+                  name, ascii_result, c);
+       }
+    }
+}
+
+static void
+test_digit_function (const char *name,
+                    int (* ascii_function) (gchar),
+                    int (* unicode_function) (gunichar))
+{
+  int c;
+
+  for (c = 0; c <= 0x7F; c++)
+    {
+      int ascii_result = ascii_function ((gchar) c);
+      int unicode_result = unicode_function ((gunichar) c);
+      if (ascii_result != unicode_result)
+       {
+         g_error ("g_ascii_%s_value returned %d and g_unichar_%s_value returned %d for 0x%X",
+                  name, ascii_result, name, unicode_result, c);
+       }
+    }
+  for (c = 0x80; c <= 0xFF; c++)
+    {
+      int ascii_result = ascii_function ((gchar) c);
+      if (ascii_result != -1)
+       {
+         g_error ("g_ascii_%s_value returned %d for 0x%X",
+                  name, ascii_result, c);
+       }
+    }
+}
+
+static void
+test_is_to_digit (void)
+{
+  #define TEST_IS(name) test_is_function (#name, call_g_ascii_##name, call_##name, g_unichar_##name);
+
+  FOR_ALL_CTYPE(TEST_IS)
+
+  #undef TEST_IS
+
+  #define TEST_TO(name) test_to_function (#name, g_ascii_##name, name, g_unichar_##name)
+
+  TEST_TO (tolower);
+  TEST_TO (toupper);
+
+  #undef TEST_TO
+
+  #define TEST_DIGIT(name) test_digit_function (#name, g_ascii_##name##_value, g_unichar_##name##_value)
+
+  TEST_DIGIT (digit);
+  TEST_DIGIT (xdigit);
+
+  #undef TEST_DIGIT
+}
+
+static void
+test_strdup (void)
+{
+  gchar *str;
+
+  str = g_strdup (NULL);
+  g_assert (str == NULL);
+
+  str = g_strdup (GLIB_TEST_STRING);
+  g_assert (str != NULL);
+  g_assert_cmpstr (str, ==, GLIB_TEST_STRING);
+  g_free (str);
+}
+
+static void
+test_strndup (void)
+{
+  gchar *str;
+
+  str = g_strndup (NULL, 3);
+  g_assert (str == NULL);
+
+  str = g_strndup ("aaaa", 5);
+  g_assert (str != NULL);
+  g_assert_cmpstr (str, ==, "aaaa");
+  g_free (str);
+
+  str = g_strndup ("aaaa", 2);
+  g_assert (str != NULL);
+  g_assert_cmpstr (str, ==, "aa");
+  g_free (str);
+}
+
+static void
+test_strdup_printf (void)
+{
+  gchar *str;
+
+  str = g_strdup_printf ("%05d %-5s", 21, "test");
+  g_assert (str != NULL);
+  g_assert_cmpstr (str, ==, "00021 test ");
+  g_free (str);
+}
+
+static void
+test_strdupv (void)
+{
+  gchar *vec[] = { "Foo", "Bar", NULL };
+  gchar **copy;
+
+  copy = g_strdupv (NULL);
+  g_assert (copy == NULL);  
+
+  copy = g_strdupv (vec);
+  g_assert (copy != NULL);
+  g_assert_cmpstr (copy[0], ==, "Foo");
+  g_assert_cmpstr (copy[1], ==, "Bar");
+  g_assert (copy[2] == NULL);
+  g_strfreev (copy);
+}
+
+static void
+test_strnfill (void)
+{
+  gchar *str;
+
+  str = g_strnfill (0, 'a');
+  g_assert (str != NULL);
+  g_assert (*str == '\0');
+  g_free (str);
+
+  str = g_strnfill (5, 'a');
+  g_assert (str != NULL);
+  g_assert_cmpstr (str, ==, "aaaaa");
+  g_free (str);
+}
+
+static void
+test_strconcat (void)
+{
+  gchar *str;
+
+  str = g_strconcat (GLIB_TEST_STRING, NULL);
+  g_assert (str != NULL);
+  g_assert_cmpstr (str, ==, GLIB_TEST_STRING);
+  g_free (str);
+
+  str = g_strconcat (GLIB_TEST_STRING,
+                    GLIB_TEST_STRING, 
+                    GLIB_TEST_STRING,
+                    NULL);
+  g_assert (str != NULL);
+  g_assert_cmpstr (str, ==, GLIB_TEST_STRING GLIB_TEST_STRING GLIB_TEST_STRING);
+  g_free (str);
+}
+
+static void
+test_strjoin (void)
+{
+  gchar *str;
+
+  str = g_strjoin (NULL, NULL);
+  g_assert (str != NULL);
+  g_assert (*str == '\0');
+  g_free (str);
+
+  str = g_strjoin (":", NULL);
+  g_assert (str != NULL);
+  g_assert (*str == '\0');
+  g_free (str);
+
+  str = g_strjoin (NULL, GLIB_TEST_STRING, NULL);
+  g_assert (str != NULL);
+  g_assert_cmpstr (str, ==, GLIB_TEST_STRING);
+  g_free (str);
+
+  str = g_strjoin (NULL,
+                  GLIB_TEST_STRING,
+                  GLIB_TEST_STRING, 
+                  GLIB_TEST_STRING,
+                  NULL);
+  g_assert (str != NULL);
+  g_assert_cmpstr (str, ==, GLIB_TEST_STRING GLIB_TEST_STRING GLIB_TEST_STRING);
+  g_free (str);
+
+  str = g_strjoin (":",
+                  GLIB_TEST_STRING,
+                  GLIB_TEST_STRING, 
+                  GLIB_TEST_STRING,
+                  NULL);
+  g_assert (str != NULL);
+  g_assert_cmpstr (str, ==, GLIB_TEST_STRING ":" GLIB_TEST_STRING ":" GLIB_TEST_STRING);
+  g_free (str);
+}
+
+static void
+test_strcanon (void)
+{
+  gchar *str;
+
+  if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
+    {
+      str = g_strcanon (NULL, "ab", 'y');
+    }
+  g_test_trap_assert_failed ();
+
+  if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
+    {
+      str = g_strdup ("abxabxab");
+      str = g_strcanon (str, NULL, 'y');
+      g_free (str);
+    }
+  g_test_trap_assert_failed ();
+
+  str = g_strdup ("abxabxab");
+  str = g_strcanon (str, "ab", 'y');
+  g_assert (str != NULL);
+  g_assert_cmpstr (str, ==, "abyabyab");
+  g_free (str);
+}
+
+static void
+test_strcompress_strescape (void)
+{
+  gchar *str;
+  gchar *tmp;
+
+  /* test compress */
+  if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
+    {
+      str = g_strcompress (NULL);
+    }
+  g_test_trap_assert_failed ();
+
+  /* trailing slashes are not allowed */
+  if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
+    {
+      str = g_strcompress ("abc\\");
+    }
+  g_test_trap_assert_failed ();
+
+  str = g_strcompress ("abc\\\\\\\"\\b\\f\\n\\r\\t\\003\\177\\234\\313\\12345z");
+  g_assert (str != NULL);
+  g_assert_cmpstr (str, ==, "abc\\\"\b\f\n\r\t\003\177\234\313\12345z");
+  g_free (str);
+
+  /* test escape */
+  if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
+    {
+      str = g_strescape (NULL, NULL);
+    }
+  g_test_trap_assert_failed ();
+
+  str = g_strescape ("abc\\\"\b\f\n\r\t\003\177\234\313", NULL);
+  g_assert (str != NULL);
+  g_assert_cmpstr (str, ==, "abc\\\\\\\"\\b\\f\\n\\r\\t\\003\\177\\234\\313");
+  g_free (str);
+
+  str = g_strescape ("abc\\\"\b\f\n\r\t\003\177\234\313",
+                    "\b\f\001\002\003\004");
+  g_assert (str != NULL);
+  g_assert_cmpstr (str, ==, "abc\\\\\\\"\b\f\\n\\r\\t\003\\177\\234\\313");
+  g_free (str);
+
+  /* round trip */
+  tmp = g_strescape ("abc\\\"\b\f\n\r\t\003\177\234\313", NULL);
+  str = g_strcompress (tmp);
+  g_assert (str != NULL); 
+  g_assert_cmpstr (str, ==, "abc\\\"\b\f\n\r\t\003\177\234\313");
+  g_free (str);
+  g_free (tmp);
+}
+
+static void
+test_ascii_strcasecmp (void)
+{
+  gboolean res;
+
+  if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
+    {
+      res = g_ascii_strcasecmp ("foo", NULL);
+    }
+  g_test_trap_assert_failed ();
+
+  if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
+    {
+      res = g_ascii_strcasecmp (NULL, "foo");
+    }
+  g_test_trap_assert_failed ();
+
+  res = g_ascii_strcasecmp ("FroboZZ", "frobozz");
+  g_assert_cmpint (res, ==, 0);
+
+  res = g_ascii_strcasecmp ("frobozz", "frobozz");
+  g_assert_cmpint (res, ==, 0);
+
+  res = g_ascii_strcasecmp ("frobozz", "FROBOZZ");
+  g_assert_cmpint (res, ==, 0);
+
+  res = g_ascii_strcasecmp ("FROBOZZ", "froboz");
+  g_assert_cmpint (res, !=, 0);
+
+  res = g_ascii_strcasecmp ("", "");
+  g_assert_cmpint (res, ==, 0);
+
+  res = g_ascii_strcasecmp ("!#%&/()", "!#%&/()");
+  g_assert_cmpint (res, ==, 0);
+
+  res = g_ascii_strcasecmp ("a", "b");
+  g_assert_cmpint (res, <, 0);
+
+  res = g_ascii_strcasecmp ("a", "B");
+  g_assert_cmpint (res, <, 0);
+
+  res = g_ascii_strcasecmp ("A", "b");
+  g_assert_cmpint (res, <, 0);
+
+  res = g_ascii_strcasecmp ("A", "B");
+  g_assert_cmpint (res, <, 0);
+
+  res = g_ascii_strcasecmp ("b", "a");
+  g_assert_cmpint (res, >, 0);
+
+  res = g_ascii_strcasecmp ("b", "A");
+  g_assert_cmpint (res, >, 0);
+
+  res = g_ascii_strcasecmp ("B", "a");
+  g_assert_cmpint (res, >, 0);
+
+  res = g_ascii_strcasecmp ("B", "A");
+  g_assert_cmpint (res, >, 0);
+}
+
+static void
+do_test_strchug (const gchar *str, const gchar *expected)
+{
+  gchar *tmp;
+  gboolean res;
+
+  tmp = g_strdup (str);
+
+  g_strchug (tmp);
+  res = (strcmp (tmp, expected) == 0);
+  g_free (tmp);
+
+  g_assert_cmpint (res, ==, TRUE);
+}
+
+static void
+test_strchug (void)
+{
+  if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
+    {
+      g_strchug (NULL);
+    }
+  g_test_trap_assert_failed ();
+
+  do_test_strchug ("", "");
+  do_test_strchug (" ", "");
+  do_test_strchug ("\t\r\n ", "");
+  do_test_strchug (" a", "a");
+  do_test_strchug ("  a", "a");
+  do_test_strchug ("a a", "a a");
+  do_test_strchug (" a a", "a a");
+}
+
+static void
+do_test_strchomp (const gchar *str, const gchar *expected)
+{
+  gchar *tmp;
+  gboolean res;
+
+  tmp = g_strdup (str);
+
+  g_strchomp (tmp);
+  res = (strcmp (tmp, expected) == 0);
+  g_free (tmp);
+
+  g_assert_cmpint (res, ==, TRUE);
+}
+
+static void
+test_strchomp (void)
+{
+  if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
+    {
+      g_strchomp (NULL);
+    }
+  g_test_trap_assert_failed ();
+
+  do_test_strchomp ("", "");
+  do_test_strchomp (" ", "");
+  do_test_strchomp (" \t\r\n", "");
+  do_test_strchomp ("a ", "a");
+  do_test_strchomp ("a  ", "a");
+  do_test_strchomp ("a a", "a a");
+  do_test_strchomp ("a a ", "a a");
+}
+
+static void
+test_strreverse (void)
+{
+  gchar *str;
+  gchar *p;
+
+  if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
+    {
+      str = g_strreverse (NULL);
+    }
+  g_test_trap_assert_failed ();
+
+  str = p = g_strdup ("abcde");
+  str = g_strreverse (str);
+  g_assert (str != NULL);
+  g_assert (p == str);
+  g_assert_cmpstr (str, ==, "edcba");
+  g_free (str);
+}
+
+static void
+test_strstr (void)
+{
+  gchar *haystack;
+  gchar *res;
+
+  haystack = g_strdup ("FooBarFooBarFoo");
+
+  /* strstr_len */
+  res = g_strstr_len (haystack, 6, "xxx");
+  g_assert (res == NULL);
+
+  res = g_strstr_len (haystack, 6, "FooBarFooBarFooBar");
+  g_assert (res == NULL);
+
+  res = g_strstr_len (haystack, 6, "");
+  g_assert (res == haystack);
+
+  res = g_strstr_len (haystack, 6, "Bar");
+  g_assert_cmpstr (res, ==, "BarFooBarFoo");
+
+  /* strrstr */
+  res = g_strrstr (haystack, "xxx");
+  g_assert (res == NULL);
+
+  res = g_strrstr (haystack, "FooBarFooBarFooBar");
+  g_assert (res == NULL);
+
+  res = g_strrstr (haystack, "");
+  g_assert (res == haystack);
+
+  res = g_strrstr (haystack, "Bar");
+  g_assert_cmpstr (res, ==, "BarFoo");
+
+  /* strrstr_len */
+  res = g_strrstr_len (haystack, 14, "xxx");
+  g_assert (res == NULL);
+
+  res = g_strrstr_len (haystack, 14, "FooBarFooBarFooBar");
+  g_assert (res == NULL);
+
+  res = g_strrstr_len (haystack, 14, "BarFoo");
+  g_assert_cmpstr (res, ==, "BarFooBarFoo");
+
+  g_free (haystack);
+}
+
+static void
+test_has_prefix (void)
+{
+  gboolean res;
+
+  if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
+    {
+      res = g_str_has_prefix ("foo", NULL);
+    }
+  g_test_trap_assert_failed ();
+
+  if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
+    {
+      res = g_str_has_prefix (NULL, "foo");
+    }
+  g_test_trap_assert_failed ();
+
+  res = g_str_has_prefix ("foo", "bar");
+  g_assert_cmpint (res, ==, FALSE);
+
+  res = g_str_has_prefix ("foo", "foobar");
+  g_assert_cmpint (res, ==, FALSE);
+
+  res = g_str_has_prefix ("foobar", "bar");
+  g_assert_cmpint (res, ==, FALSE);
+
+  res = g_str_has_prefix ("foobar", "foo");
+  g_assert_cmpint (res, ==, TRUE);
+
+  res = g_str_has_prefix ("foo", "");
+  g_assert_cmpint (res, ==, TRUE);
+
+  res = g_str_has_prefix ("foo", "foo");
+  g_assert_cmpint (res, ==, TRUE);
+
+  res = g_str_has_prefix ("", "");
+  g_assert_cmpint (res, ==, TRUE);
+}
+
+static void
+test_has_suffix (void)
+{
+  gboolean res;
+
+  if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
+    {
+      res = g_str_has_suffix ("foo", NULL);
+    }
+  g_test_trap_assert_failed ();
+
+  if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
+    {
+      res = g_str_has_suffix (NULL, "foo");
+    }
+  g_test_trap_assert_failed ();
+
+  res = g_str_has_suffix ("foo", "bar");
+  g_assert_cmpint (res, ==, FALSE);
+
+  res = g_str_has_suffix ("bar", "foobar");
+  g_assert_cmpint (res, ==, FALSE);
+
+  res = g_str_has_suffix ("foobar", "foo");
+  g_assert_cmpint (res, ==, FALSE);
+
+  res = g_str_has_suffix ("foobar", "bar");
+  g_assert_cmpint (res, ==, TRUE);
+
+  res = g_str_has_suffix ("foo", "");
+  g_assert_cmpint (res, ==, TRUE);
+
+  res = g_str_has_suffix ("foo", "foo");
+  g_assert_cmpint (res, ==, TRUE);
+
+  res = g_str_has_suffix ("", "");
+  g_assert_cmpint (res, ==, TRUE);
+}
+
+static void
+strv_check (gchar **strv, ...)
+{
+  gboolean ok = TRUE;
+  gint i = 0;
+  va_list list;
+
+  va_start (list, strv);
+  while (ok)
+    {
+      const gchar *str = va_arg (list, const char *);
+      if (strv[i] == NULL)
+       {
+         g_assert (str == NULL);
+         break;
+       }
+      if (str == NULL)
+        {
+         ok = FALSE;
+        }
+      else
+        {
+          g_assert_cmpstr (strv[i], ==, str);
+        }
+      i++;
+    }
+  va_end (list);
+
+  g_strfreev (strv);
+}
+
+static void
+test_strsplit (void)
+{
+  strv_check (g_strsplit ("", ",", 0), NULL);
+  strv_check (g_strsplit ("x", ",", 0), "x", NULL);
+  strv_check (g_strsplit ("x,y", ",", 0), "x", "y", NULL);
+  strv_check (g_strsplit ("x,y,", ",", 0), "x", "y", "", NULL);
+  strv_check (g_strsplit (",x,y", ",", 0), "", "x", "y", NULL);
+  strv_check (g_strsplit (",x,y,", ",", 0), "", "x", "y", "", NULL);
+  strv_check (g_strsplit ("x,y,z", ",", 0), "x", "y", "z", NULL);
+  strv_check (g_strsplit ("x,y,z,", ",", 0), "x", "y", "z", "", NULL);
+  strv_check (g_strsplit (",x,y,z", ",", 0), "", "x", "y", "z", NULL);
+  strv_check (g_strsplit (",x,y,z,", ",", 0), "", "x", "y", "z", "", NULL);
+  strv_check (g_strsplit (",,x,,y,,z,,", ",", 0), "", "", "x", "", "y", "", "z", "", "", NULL);
+  strv_check (g_strsplit (",,x,,y,,z,,", ",,", 0), "", "x", "y", "z", "", NULL);
+
+  strv_check (g_strsplit ("", ",", 1), NULL);
+  strv_check (g_strsplit ("x", ",", 1), "x", NULL);
+  strv_check (g_strsplit ("x,y", ",", 1), "x,y", NULL);
+  strv_check (g_strsplit ("x,y,", ",", 1), "x,y,", NULL);
+  strv_check (g_strsplit (",x,y", ",", 1), ",x,y", NULL);
+  strv_check (g_strsplit (",x,y,", ",", 1), ",x,y,", NULL);
+  strv_check (g_strsplit ("x,y,z", ",", 1), "x,y,z", NULL);
+  strv_check (g_strsplit ("x,y,z,", ",", 1), "x,y,z,", NULL);
+  strv_check (g_strsplit (",x,y,z", ",", 1), ",x,y,z", NULL);
+  strv_check (g_strsplit (",x,y,z,", ",", 1), ",x,y,z,", NULL);
+  strv_check (g_strsplit (",,x,,y,,z,,", ",", 1), ",,x,,y,,z,,", NULL);
+  strv_check (g_strsplit (",,x,,y,,z,,", ",,", 1), ",,x,,y,,z,,", NULL);
+
+  strv_check (g_strsplit ("", ",", 2), NULL);
+  strv_check (g_strsplit ("x", ",", 2), "x", NULL);
+  strv_check (g_strsplit ("x,y", ",", 2), "x", "y", NULL);
+  strv_check (g_strsplit ("x,y,", ",", 2), "x", "y,", NULL);
+  strv_check (g_strsplit (",x,y", ",", 2), "", "x,y", NULL);
+  strv_check (g_strsplit (",x,y,", ",", 2), "", "x,y,", NULL);
+  strv_check (g_strsplit ("x,y,z", ",", 2), "x", "y,z", NULL);
+  strv_check (g_strsplit ("x,y,z,", ",", 2), "x", "y,z,", NULL);
+  strv_check (g_strsplit (",x,y,z", ",", 2), "", "x,y,z", NULL);
+  strv_check (g_strsplit (",x,y,z,", ",", 2), "", "x,y,z,", NULL);
+  strv_check (g_strsplit (",,x,,y,,z,,", ",", 2), "", ",x,,y,,z,,", NULL);
+  strv_check (g_strsplit (",,x,,y,,z,,", ",,", 2), "", "x,,y,,z,,", NULL);
+}
+
+static void
+test_strsplit_set (void)
+{
+  strv_check (g_strsplit_set ("", ",/", 0), NULL);
+  strv_check (g_strsplit_set (":def/ghi:", ":/", -1), "", "def", "ghi", "", NULL);
+  strv_check (g_strsplit_set ("abc:def/ghi", ":/", -1), "abc", "def", "ghi", NULL);
+  strv_check (g_strsplit_set (",;,;,;,;", ",;", -1), "", "", "", "", "", "", "", "", "", NULL);
+  strv_check (g_strsplit_set (",,abc.def", ".,", -1), "", "", "abc", "def", NULL);
+
+  strv_check (g_strsplit_set (",x.y", ",.", 0), "", "x", "y", NULL);
+  strv_check (g_strsplit_set (".x,y,", ",.", 0), "", "x", "y", "", NULL);
+  strv_check (g_strsplit_set ("x,y.z", ",.", 0), "x", "y", "z", NULL);
+  strv_check (g_strsplit_set ("x.y,z,", ",.", 0), "x", "y", "z", "", NULL);
+  strv_check (g_strsplit_set (",x.y,z", ",.", 0), "", "x", "y", "z", NULL);
+  strv_check (g_strsplit_set (",x,y,z,", ",.", 0), "", "x", "y", "z", "", NULL);
+  strv_check (g_strsplit_set (",.x,,y,;z..", ".,;", 0), "", "", "x", "", "y", "", "z", "", "", NULL);
+  strv_check (g_strsplit_set (",,x,,y,,z,,", ",,", 0), "", "", "x", "", "y", "", "z", "", "", NULL);
+
+  strv_check (g_strsplit_set ("x,y.z", ",.", 1), "x,y.z", NULL);
+  strv_check (g_strsplit_set ("x.y,z,", ",.", 1), "x.y,z,", NULL);
+  strv_check (g_strsplit_set (",x,y,z", ",.", 1), ",x,y,z", NULL);
+  strv_check (g_strsplit_set (",x,y.z,", ",.", 1), ",x,y.z,", NULL);
+  strv_check (g_strsplit_set (",,x,.y,,z,,", ",.", 1), ",,x,.y,,z,,", NULL);
+  strv_check (g_strsplit_set (",.x,,y,,z,,", ",,..", 1), ",.x,,y,,z,,", NULL);
+   
+  strv_check (g_strsplit_set ("", ",", 0), NULL);
+  strv_check (g_strsplit_set ("x", ",", 0), "x", NULL);
+  strv_check (g_strsplit_set ("x,y", ",", 0), "x", "y", NULL);
+  strv_check (g_strsplit_set ("x,y,", ",", 0), "x", "y", "", NULL);
+  strv_check (g_strsplit_set (",x,y", ",", 0), "", "x", "y", NULL);
+  strv_check (g_strsplit_set (",x,y,", ",", 0), "", "x", "y", "", NULL);
+  strv_check (g_strsplit_set ("x,y,z", ",", 0), "x", "y", "z", NULL);
+  strv_check (g_strsplit_set ("x,y,z,", ",", 0), "x", "y", "z", "", NULL);
+  strv_check (g_strsplit_set (",x,y,z", ",", 0), "", "x", "y", "z", NULL);
+  strv_check (g_strsplit_set (",x,y,z,", ",", 0), "", "x", "y", "z", "", NULL);
+  strv_check (g_strsplit_set (",,x,,y,,z,,", ",", 0), "", "", "x", "", "y", "", "z", "", "", NULL);
+
+  strv_check (g_strsplit_set ("", ",", 1), NULL);
+  strv_check (g_strsplit_set ("x", ",", 1), "x", NULL);
+  strv_check (g_strsplit_set ("x,y", ",", 1), "x,y", NULL);
+  strv_check (g_strsplit_set ("x,y,", ",", 1), "x,y,", NULL);
+  strv_check (g_strsplit_set (",x,y", ",", 1), ",x,y", NULL);
+  strv_check (g_strsplit_set (",x,y,", ",", 1), ",x,y,", NULL);
+  strv_check (g_strsplit_set ("x,y,z", ",", 1), "x,y,z", NULL);
+  strv_check (g_strsplit_set ("x,y,z,", ",", 1), "x,y,z,", NULL);
+  strv_check (g_strsplit_set (",x,y,z", ",", 1), ",x,y,z", NULL);
+  strv_check (g_strsplit_set (",x,y,z,", ",", 1), ",x,y,z,", NULL);
+  strv_check (g_strsplit_set (",,x,,y,,z,,", ",", 1), ",,x,,y,,z,,", NULL);
+  strv_check (g_strsplit_set (",,x,,y,,z,,", ",,", 1), ",,x,,y,,z,,", NULL);
+
+  strv_check (g_strsplit_set ("", ",", 2), NULL);
+  strv_check (g_strsplit_set ("x", ",", 2), "x", NULL);
+  strv_check (g_strsplit_set ("x,y", ",", 2), "x", "y", NULL);
+  strv_check (g_strsplit_set ("x,y,", ",", 2), "x", "y,", NULL);
+  strv_check (g_strsplit_set (",x,y", ",", 2), "", "x,y", NULL);
+  strv_check (g_strsplit_set (",x,y,", ",", 2), "", "x,y,", NULL);
+  strv_check (g_strsplit_set ("x,y,z", ",", 2), "x", "y,z", NULL);
+  strv_check (g_strsplit_set ("x,y,z,", ",", 2), "x", "y,z,", NULL);
+  strv_check (g_strsplit_set (",x,y,z", ",", 2), "", "x,y,z", NULL);
+  strv_check (g_strsplit_set (",x,y,z,", ",", 2), "", "x,y,z,", NULL);
+  strv_check (g_strsplit_set (",,x,,y,,z,,", ",", 2), "", ",x,,y,,z,,", NULL);
+  
+  strv_check (g_strsplit_set (",,x,.y,..z,,", ",.", 3), "", "", "x,.y,..z,,", NULL);
+}
+
+static void
+test_strv_length (void)
+{
+  guint l;
+
+  if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
+    {
+      l = g_strv_length (NULL);
+    }
+  g_test_trap_assert_failed ();
+
+  l = g_strv_length (g_strsplit ("1,2,3,4", ",", -1));
+  g_assert_cmpuint (l, ==, 4);
+}
+
+static char *locales[] = {"sv_SE", "en_US", "fa_IR", "C", "ru_RU"};
+
+void
+check_strtod_string (gchar    *number,
+                    double    res,
+                    gboolean  check_end,
+                    gint      correct_len)
+{
+  double d;
+  gint l;
+  gchar *dummy;
+
+  /* we try a copy of number, with some free space for malloc before that. 
+   * This is supposed to smash the some wrong pointer calculations. */
+
+  dummy = g_malloc (100000);
+  number = g_strdup (number);
+  g_free (dummy);
+
+  for (l = 0; l < G_N_ELEMENTS (locales); l++)
+    {
+      gboolean ok;
+      gchar *end = "(unset)";
+
+      setlocale (LC_NUMERIC, locales[l]);
+      d = g_ascii_strtod (number, &end);
+      ok = isnan (res) ? isnan (d) : (d == res);
+      if (!ok)
+       {
+         g_error ("g_ascii_strtod on \"%s\" for locale %s failed\n" \
+                   "expected %f (nan %d) actual %f (nan %d)\n", 
+                  number, locales[l],
+                  res, isnan (res),
+                  d, isnan (d));
+       }
+
+      ok = (end - number) == (check_end ? correct_len : strlen (number));
+      if (!ok) {
+       if (end == NULL)
+         g_error ("g_ascii_strtod on \"%s\" for locale %s endptr was NULL\n",
+                  number, locales[l]);
+       else if (end >= number && end <= number + strlen (number))
+         g_error ("g_ascii_strtod on \"%s\" for locale %s endptr was wrong, leftover: \"%s\"\n",
+                  number, locales[l], end);
+       else
+         g_error ("g_ascii_strtod on \"%s\" for locale %s endptr was REALLY wrong (number=%p, end=%p)\n",
+                  number, locales[l], number, end);
+      }
+    }
+
+  g_free (number);
+}
+
+static void
+check_strtod_number (gdouble num, gchar *fmt, gchar *str)
+{
+  int l;
+  gchar buf[G_ASCII_DTOSTR_BUF_SIZE];
+
+  for (l = 0; l < G_N_ELEMENTS (locales); l++)
+    {
+      g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, fmt, num);
+      g_assert_cmpstr (buf, ==, str);
+    }
+}
+
+static void
+test_strtod (void)
+{
+  gdouble d, our_nan, our_inf;
+  char buffer[G_ASCII_DTOSTR_BUF_SIZE];
+
+#ifdef NAN
+  our_nan = NAN;
+#else
+  /* Do this before any call to setlocale.  */
+  our_nan = atof ("NaN");
+#endif
+  g_assert (isnan (our_nan));
+
+#ifdef INFINITY
+  our_inf = INFINITY;
+#else
+  our_inf = atof ("Infinity");
+#endif
+  g_assert (our_inf > 1 && our_inf == our_inf / 2);
+
+  check_strtod_string ("123.123", 123.123, FALSE, 0);
+  check_strtod_string ("123.123e2", 123.123e2, FALSE, 0);
+  check_strtod_string ("123.123e-2", 123.123e-2, FALSE, 0);
+  check_strtod_string ("-123.123", -123.123, FALSE, 0);
+  check_strtod_string ("-123.123e2", -123.123e2, FALSE, 0);
+  check_strtod_string ("-123.123e-2", -123.123e-2, FALSE, 0);
+  check_strtod_string ("5.4", 5.4, TRUE, 3);
+  check_strtod_string ("5.4,5.5", 5.4, TRUE, 3);
+  check_strtod_string ("5,4", 5.0, TRUE, 1);
+  /* the following are for #156421 */
+  check_strtod_string ("1e1", 1e1, FALSE, 0); 
+  check_strtod_string ("NAN", our_nan, FALSE, 0);
+  check_strtod_string ("-nan", -our_nan, FALSE, 0);
+  check_strtod_string ("INF", our_inf, FALSE, 0);
+  check_strtod_string ("-infinity", -our_inf, FALSE, 0);
+  check_strtod_string ("-.75,0", -0.75, TRUE, 4);
+  
+  d = 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0;
+  g_assert (d == g_ascii_strtod (g_ascii_dtostr (buffer, sizeof (buffer), d), NULL));
+
+  d = -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0;
+  g_assert (d == g_ascii_strtod (g_ascii_dtostr (buffer, sizeof (buffer), d), NULL));
+  
+  d = pow (2.0, -1024.1);
+  g_assert (d == g_ascii_strtod (g_ascii_dtostr (buffer, sizeof (buffer), d), NULL));
+  
+  d = -pow (2.0, -1024.1);
+  g_assert (d == g_ascii_strtod (g_ascii_dtostr (buffer, sizeof (buffer), d), NULL));
+
+  /* for #343899 */
+  check_strtod_string (" 0.75", 0.75, FALSE, 0);
+  check_strtod_string (" +0.75", 0.75, FALSE, 0);
+  check_strtod_string (" -0.75", -0.75, FALSE, 0);
+  check_strtod_string ("\f0.75", 0.75, FALSE, 0);
+  check_strtod_string ("\n0.75", 0.75, FALSE, 0);
+  check_strtod_string ("\r0.75", 0.75, FALSE, 0);
+  check_strtod_string ("\t0.75", 0.75, FALSE, 0);
+
+#if 0
+  /* g_ascii_isspace() returns FALSE for vertical tab, see #59388 */
+  check_strtod_string ("\v0.75", 0.75, FALSE, 0);
+#endif
+
+  /* for #343899 */
+  check_strtod_number (0.75, "%0.2f", "0.75");
+  check_strtod_number (0.75, "%5.2f", " 0.75");
+  check_strtod_number (-0.75, "%0.2f", "-0.75");
+  check_strtod_number (-0.75, "%5.2f", "-0.75");
+  check_strtod_number (1e99, "%.0e", "1e+99");
+}
+
+static void
+check_uint64 (const gchar *str,
+             const gchar *end,
+             gint         base,
+             guint64      result,
+             gint         error)
+{
+  guint64 actual;
+  gchar *endptr = NULL;
+  gint err;
+
+  errno = 0;
+  actual = g_ascii_strtoull (str, &endptr, base);
+  err = errno;
+
+  g_assert (actual == result);
+  g_assert_cmpstr (end, ==, endptr);
+  g_assert (err == error);
+}
+
+static void
+check_int64 (const gchar *str,
+            const gchar *end,
+            gint         base,
+            gint64       result,
+            gint         error)
+{
+  gint64 actual;
+  gchar *endptr = NULL;
+  gint err;
+
+  errno = 0;
+  actual = g_ascii_strtoll (str, &endptr, base);
+  err = errno;
+
+  g_assert (actual == result);
+  g_assert_cmpstr (end, ==, endptr);
+  g_assert (err == error);
+}
+
+static void
+test_strtoll (void)
+{
+  check_uint64 ("0", "", 10, 0, 0);
+  check_uint64 ("+0", "", 10, 0, 0);
+  check_uint64 ("-0", "", 10, 0, 0);
+  check_uint64 ("18446744073709551615", "", 10, G_MAXUINT64, 0);
+  check_uint64 ("18446744073709551616", "", 10, G_MAXUINT64, ERANGE);
+  check_uint64 ("20xyz", "xyz", 10, 20, 0);
+  check_uint64 ("-1", "", 10, G_MAXUINT64, 0);
+
+  check_int64 ("0", "", 10, 0, 0);
+  check_int64 ("9223372036854775807", "", 10, G_MAXINT64, 0);
+  check_int64 ("9223372036854775808", "", 10, G_MAXINT64, ERANGE);
+  check_int64 ("-9223372036854775808", "", 10, G_MININT64, 0);
+  check_int64 ("-9223372036854775809", "", 10, G_MININT64, ERANGE);
+  check_int64 ("32768", "", 10, 32768, 0);
+  check_int64 ("-32768", "", 10, -32768, 0);
+  check_int64 ("001", "", 10, 1, 0);
+  check_int64 ("-001", "", 10, -1, 0);
+}
+
+int
+main (int   argc,
+      char *argv[])
+{
+  g_test_init (&argc, &argv, NULL);
+
+  g_test_add_func ("/strfuncs/test-is-to-digit", test_is_to_digit);
+  g_test_add_func ("/strfuncs/strdup", test_strdup);
+  g_test_add_func ("/strfuncs/strndup", test_strndup);
+  g_test_add_func ("/strfuncs/strdup-printf", test_strdup_printf);
+  g_test_add_func ("/strfuncs/strdupv", test_strdupv);
+  g_test_add_func ("/strfuncs/strnfill", test_strnfill);
+  g_test_add_func ("/strfuncs/strconcat", test_strconcat);
+  g_test_add_func ("/strfuncs/strjoin", test_strjoin);
+  g_test_add_func ("/strfuncs/strcanon", test_strcanon);
+  g_test_add_func ("/strfuncs/strcompress-strescape", test_strcompress_strescape);
+  g_test_add_func ("/strfuncs/ascii-strcasecmp", test_ascii_strcasecmp);
+  g_test_add_func ("/strfuncs/strchug", test_strchug);
+  g_test_add_func ("/strfuncs/strchomp", test_strchomp);
+  g_test_add_func ("/strfuncs/strreverse", test_strreverse);
+  g_test_add_func ("/strfuncs/strstr", test_strstr);
+  g_test_add_func ("/strfuncs/has-prefix", test_has_prefix);
+  g_test_add_func ("/strfuncs/has-suffix", test_has_suffix);
+  g_test_add_func ("/strfuncs/strsplit", test_strsplit);
+  g_test_add_func ("/strfuncs/strsplit-set", test_strsplit_set);
+  g_test_add_func ("/strfuncs/strv-length", test_strv_length);
+  g_test_add_func ("/strfuncs/strtod", test_strtod);
+  g_test_add_func ("/strfuncs/strtoull-strtoll", test_strtoll);
+
+  return g_test_run();
+}
index 9a6fbcf..820bec0 100644 (file)
@@ -137,10 +137,7 @@ test_programs =                                    \
        slice-threadinit                        \
        spawn-test                              \
        $(spawn_test_win32_gui)                 \
-       strfunc-test                            \
        string-test                             \
-       strtod-test                             \
-       strtoll-test                            \
        thread-test                             \
        threadpool-test                         \
        tree-test                               \
@@ -213,10 +210,7 @@ slice_concurrent_LDADD = $(thread_ldadd)
 slice_threadinit_SOURCES = slice-threadinit.c
 slice_threadinit_LDADD = $(thread_ldadd)
 spawn_test_LDADD = $(progs_ldadd)
-strfunc_test_LDADD = $(progs_ldadd)
 string_test_LDADD = $(progs_ldadd)
-strtod_test_LDADD = $(progs_ldadd) -lm
-strtoll_test_LDADD = $(progs_ldadd) -lm
 thread_test_LDADD = $(thread_ldadd)
 threadpool_test_LDADD = $(thread_ldadd)
 tree_test_LDADD = $(progs_ldadd)
diff --git a/tests/strfunc-test.c b/tests/strfunc-test.c
deleted file mode 100644 (file)
index f861b44..0000000
+++ /dev/null
@@ -1,775 +0,0 @@
-/* GLIB - Library of useful routines for C programming
- * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
- * file for a list of people on the GLib Team.  See the ChangeLog
- * files for a list of changes.  These files are distributed with
- * GLib at ftp://ftp.gtk.org/pub/gtk/. 
- */
-
-#undef G_DISABLE_ASSERT
-#undef G_LOG_DOMAIN
-
-#include <stdio.h>
-#include <string.h>
-#include "glib.h"
-#include <stdarg.h>
-#include <ctype.h>
-
-static gboolean any_failed = FALSE;
-static gboolean failed = FALSE;
-
-#define        TEST(m,cond)    G_STMT_START { failed = !(cond); \
-if (failed) \
-  { if (!m) \
-      g_print ("(%s:%d) failed for: %s\n", __FILE__, __LINE__, ( # cond )); \
-    else \
-      g_print ("(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), m ? (gchar*)m : ""); \
-    fflush (stdout); \
-    any_failed = TRUE; \
-  } \
-} G_STMT_END
-
-#define TEST_FAILED(message) \
-  G_STMT_START { g_print ("Error: "); g_print message; g_print ("\n"); any_failed = TRUE; } G_STMT_END
-
-#define GLIB_TEST_STRING "el dorado "
-
-static gboolean
-strv_check (gchar **strv, ...)
-{
-  gboolean ok = TRUE;
-  gint i = 0;
-  va_list list;
-
-  va_start (list, strv);
-  while (ok)
-    {
-      const gchar *str = va_arg (list, const char *);
-      if (strv[i] == NULL)
-       {
-         ok = str == NULL;
-         break;
-       }
-      if (str == NULL)
-       ok = FALSE;
-      else if (strcmp (strv[i], str) != 0)
-       ok = FALSE;
-      i++;
-    }
-  va_end (list);
-
-  g_strfreev (strv);
-
-  return ok;
-}
-
-static gboolean
-str_check (gchar *str,
-          gchar *expected)
-{
-  gboolean ok = (strcmp (str, expected) == 0);
-
-  g_free (str);
-
-  return ok;
-}
-
-static gboolean
-strchomp_check (gchar *str,
-               gchar *expected)
-{
-  gchar *tmp = strdup (str);
-  gboolean ok;
-
-  g_strchomp (tmp);
-  ok = (strcmp (tmp, expected) == 0);
-  g_free (tmp);
-
-  return ok;
-}
-
-#define FOR_ALL_CTYPE(macro)   \
-       macro(isalnum)          \
-       macro(isalpha)          \
-       macro(iscntrl)          \
-       macro(isdigit)          \
-       macro(isgraph)          \
-       macro(islower)          \
-       macro(isprint)          \
-       macro(ispunct)          \
-       macro(isspace)          \
-       macro(isupper)          \
-       macro(isxdigit)
-
-#define DEFINE_CALL_CTYPE(function)            \
-       static int                              \
-       call_##function (int c)                 \
-       {                                       \
-               return function (c);            \
-       }
-
-#define DEFINE_CALL_G_ASCII_CTYPE(function)    \
-       static gboolean                         \
-       call_g_ascii_##function (gchar c)       \
-       {                                       \
-               return g_ascii_##function (c);  \
-       }
-
-FOR_ALL_CTYPE (DEFINE_CALL_CTYPE)
-FOR_ALL_CTYPE (DEFINE_CALL_G_ASCII_CTYPE)
-
-static void
-test_is_function (const char *name,
-                 gboolean (* ascii_function) (gchar),
-                 int (* c_library_function) (int),
-                 gboolean (* unicode_function) (gunichar))
-{
-  int c;
-
-  for (c = 0; c <= 0x7F; c++)
-    {
-      gboolean ascii_result = ascii_function ((gchar)c);
-      gboolean c_library_result = c_library_function (c) != 0;
-      gboolean unicode_result = unicode_function ((gunichar) c);
-      if (ascii_result != c_library_result && c != '\v')
-       TEST_FAILED (("g_ascii_%s returned %d and %s returned %d for 0x%X",
-                     name, ascii_result, name, c_library_result, c));
-      if (ascii_result != unicode_result)
-       TEST_FAILED (("g_ascii_%s returned %d and g_unichar_%s returned %d for 0x%X",
-                     name, ascii_result, name, unicode_result, c));
-    }
-  for (c = 0x80; c <= 0xFF; c++)
-    {
-      gboolean ascii_result = ascii_function ((gchar)c);
-      if (ascii_result)
-       TEST_FAILED (("g_ascii_%s returned TRUE for 0x%X",
-                     name, c));
-    }
-}
-
-static void
-test_to_function (const char *name,
-                 gchar (* ascii_function) (gchar),
-                 int (* c_library_function) (int),
-                 gunichar (* unicode_function) (gunichar))
-{
-  int c;
-
-  for (c = 0; c <= 0x7F; c++)
-    {
-      int ascii_result = (guchar) ascii_function ((gchar) c);
-      int c_library_result = c_library_function (c);
-      int unicode_result = unicode_function ((gunichar) c);
-      if (ascii_result != c_library_result)
-       TEST_FAILED (("g_ascii_%s returned 0x%X and %s returned 0x%X for 0x%X",
-                     name, ascii_result, name, c_library_result, c));
-      if (ascii_result != unicode_result)
-       TEST_FAILED (("g_ascii_%s returned 0x%X and g_unichar_%s returned 0x%X for 0x%X",
-                     name, ascii_result, name, unicode_result, c));
-    }
-  for (c = 0x80; c <= 0xFF; c++)
-    {
-      int ascii_result = (guchar) ascii_function ((gchar) c);
-      if (ascii_result != c)
-       TEST_FAILED (("g_ascii_%s returned 0x%X for 0x%X",
-                     name, ascii_result, c));
-    }
-}
-
-static void
-test_digit_function (const char *name,
-                    int (* ascii_function) (gchar),
-                    int (* unicode_function) (gunichar))
-{
-  int c;
-
-  for (c = 0; c <= 0x7F; c++)
-    {
-      int ascii_result = ascii_function ((gchar) c);
-      int unicode_result = unicode_function ((gunichar) c);
-      if (ascii_result != unicode_result)
-       TEST_FAILED (("g_ascii_%s_value returned %d and g_unichar_%s_value returned %d for 0x%X",
-                     name, ascii_result, name, unicode_result, c));
-    }
-  for (c = 0x80; c <= 0xFF; c++)
-    {
-      int ascii_result = ascii_function ((gchar) c);
-      if (ascii_result != -1)
-       TEST_FAILED (("g_ascii_%s_value returned %d for 0x%X",
-                     name, ascii_result, c));
-    }
-}
-
-int
-main (int   argc,
-      char *argv[])
-{
-  gchar *string;
-  gchar *vec[] = { "Foo", "Bar", NULL };
-  gchar **copy;
-  gchar *args[10];
-  
-  TEST (NULL, g_ascii_strcasecmp ("FroboZZ", "frobozz") == 0);
-  TEST (NULL, g_ascii_strcasecmp ("frobozz", "frobozz") == 0);
-  TEST (NULL, g_ascii_strcasecmp ("frobozz", "FROBOZZ") == 0);
-  TEST (NULL, g_ascii_strcasecmp ("FROBOZZ", "froboz") != 0);
-  TEST (NULL, g_ascii_strcasecmp ("", "") == 0);
-  TEST (NULL, g_ascii_strcasecmp ("!#%&/()", "!#%&/()") == 0);
-  TEST (NULL, g_ascii_strcasecmp ("a", "b") < 0);
-  TEST (NULL, g_ascii_strcasecmp ("a", "B") < 0);
-  TEST (NULL, g_ascii_strcasecmp ("A", "b") < 0);
-  TEST (NULL, g_ascii_strcasecmp ("A", "B") < 0);
-  TEST (NULL, g_ascii_strcasecmp ("b", "a") > 0);
-  TEST (NULL, g_ascii_strcasecmp ("b", "A") > 0);
-  TEST (NULL, g_ascii_strcasecmp ("B", "a") > 0);
-  TEST (NULL, g_ascii_strcasecmp ("B", "A") > 0);
-
-  TEST (NULL, g_strdup (NULL) == NULL);
-  string = g_strdup (GLIB_TEST_STRING);
-  TEST (NULL, string != NULL);
-  TEST (NULL, strcmp (string, GLIB_TEST_STRING) == 0);
-  g_free(string);
-  
-  string = g_strconcat (GLIB_TEST_STRING, NULL);
-  TEST (NULL, string != NULL);
-  TEST (NULL, strcmp (string, GLIB_TEST_STRING) == 0);
-  g_free(string);
-  
-  string = g_strconcat (GLIB_TEST_STRING, GLIB_TEST_STRING, 
-                       GLIB_TEST_STRING, NULL);
-  TEST (NULL, string != NULL);
-  TEST (NULL, strcmp (string, GLIB_TEST_STRING GLIB_TEST_STRING
-                     GLIB_TEST_STRING) == 0);
-  g_free(string);
-  
-  string = g_strdup_printf ("%05d %-5s", 21, "test");
-  TEST (NULL, string != NULL);
-  TEST (NULL, strcmp(string, "00021 test ") == 0);
-  g_free (string);
-  
-  TEST (NULL, strcmp
-       (g_strcompress ("abc\\\\\\\"\\b\\f\\n\\r\\t\\003\\177\\234\\313\\12345z"),
-        "abc\\\"\b\f\n\r\t\003\177\234\313\12345z") == 0);
-  TEST (NULL, strcmp (g_strescape("abc\\\"\b\f\n\r\t\003\177\234\313", NULL),
-                     "abc\\\\\\\"\\b\\f\\n\\r\\t\\003\\177\\234\\313") == 0);
-  TEST (NULL, strcmp(g_strescape("abc\\\"\b\f\n\r\t\003\177\234\313",
-                                "\b\f\001\002\003\004"),
-                    "abc\\\\\\\"\b\f\\n\\r\\t\003\\177\\234\\313") == 0);
-
-  copy = g_strdupv (vec);
-  TEST (NULL, strcmp (copy[0], "Foo") == 0);
-  TEST (NULL, strcmp (copy[1], "Bar") == 0);
-  TEST (NULL, copy[2] == NULL);
-  g_strfreev (copy);
-  
-  TEST (NULL, strcmp (g_strstr_len ("FooBarFooBarFoo", 6, "Bar"),
-                     "BarFooBarFoo") == 0);
-  TEST (NULL, strcmp (g_strrstr ("FooBarFooBarFoo", "Bar"),
-                     "BarFoo") == 0);
-  TEST (NULL, strcmp (g_strrstr_len ("FooBarFooBarFoo", 14, "BarFoo"),
-                     "BarFooBarFoo") == 0);
-
-  /* Test g_strsplit() */
-  TEST (NULL, strv_check (g_strsplit ("", ",", 0), NULL));
-  TEST (NULL, strv_check (g_strsplit ("x", ",", 0), "x", NULL));
-  TEST (NULL, strv_check (g_strsplit ("x,y", ",", 0), "x", "y", NULL));
-  TEST (NULL, strv_check (g_strsplit ("x,y,", ",", 0), "x", "y", "", NULL));
-  TEST (NULL, strv_check (g_strsplit (",x,y", ",", 0), "", "x", "y", NULL));
-  TEST (NULL, strv_check (g_strsplit (",x,y,", ",", 0), "", "x", "y", "", NULL));
-  TEST (NULL, strv_check (g_strsplit ("x,y,z", ",", 0), "x", "y", "z", NULL));
-  TEST (NULL, strv_check (g_strsplit ("x,y,z,", ",", 0), "x", "y", "z", "", NULL));
-  TEST (NULL, strv_check (g_strsplit (",x,y,z", ",", 0), "", "x", "y", "z", NULL));
-  TEST (NULL, strv_check (g_strsplit (",x,y,z,", ",", 0), "", "x", "y", "z", "", NULL));
-  TEST (NULL, strv_check (g_strsplit (",,x,,y,,z,,", ",", 0), "", "", "x", "", "y", "", "z", "", "", NULL));
-  TEST (NULL, strv_check (g_strsplit (",,x,,y,,z,,", ",,", 0), "", "x", "y", "z", "", NULL));
-
-  TEST (NULL, strv_check (g_strsplit ("", ",", 1), NULL));
-  TEST (NULL, strv_check (g_strsplit ("x", ",", 1), "x", NULL));
-  TEST (NULL, strv_check (g_strsplit ("x,y", ",", 1), "x,y", NULL));
-  TEST (NULL, strv_check (g_strsplit ("x,y,", ",", 1), "x,y,", NULL));
-  TEST (NULL, strv_check (g_strsplit (",x,y", ",", 1), ",x,y", NULL));
-  TEST (NULL, strv_check (g_strsplit (",x,y,", ",", 1), ",x,y,", NULL));
-  TEST (NULL, strv_check (g_strsplit ("x,y,z", ",", 1), "x,y,z", NULL));
-  TEST (NULL, strv_check (g_strsplit ("x,y,z,", ",", 1), "x,y,z,", NULL));
-  TEST (NULL, strv_check (g_strsplit (",x,y,z", ",", 1), ",x,y,z", NULL));
-  TEST (NULL, strv_check (g_strsplit (",x,y,z,", ",", 1), ",x,y,z,", NULL));
-  TEST (NULL, strv_check (g_strsplit (",,x,,y,,z,,", ",", 1), ",,x,,y,,z,,", NULL));
-  TEST (NULL, strv_check (g_strsplit (",,x,,y,,z,,", ",,", 1), ",,x,,y,,z,,", NULL));
-
-  TEST (NULL, strv_check (g_strsplit ("", ",", 2), NULL));
-  TEST (NULL, strv_check (g_strsplit ("x", ",", 2), "x", NULL));
-  TEST (NULL, strv_check (g_strsplit ("x,y", ",", 2), "x", "y", NULL));
-  TEST (NULL, strv_check (g_strsplit ("x,y,", ",", 2), "x", "y,", NULL));
-  TEST (NULL, strv_check (g_strsplit (",x,y", ",", 2), "", "x,y", NULL));
-  TEST (NULL, strv_check (g_strsplit (",x,y,", ",", 2), "", "x,y,", NULL));
-  TEST (NULL, strv_check (g_strsplit ("x,y,z", ",", 2), "x", "y,z", NULL));
-  TEST (NULL, strv_check (g_strsplit ("x,y,z,", ",", 2), "x", "y,z,", NULL));
-  TEST (NULL, strv_check (g_strsplit (",x,y,z", ",", 2), "", "x,y,z", NULL));
-  TEST (NULL, strv_check (g_strsplit (",x,y,z,", ",", 2), "", "x,y,z,", NULL));
-  TEST (NULL, strv_check (g_strsplit (",,x,,y,,z,,", ",", 2), "", ",x,,y,,z,,", NULL));
-  TEST (NULL, strv_check (g_strsplit (",,x,,y,,z,,", ",,", 2), "", "x,,y,,z,,", NULL));
-
-  /* Test g_strsplit_set() */
-  TEST (NULL, strv_check (g_strsplit_set ("", ",/", 0), NULL));
-  TEST (NULL, strv_check (g_strsplit_set (":def/ghi:", ":/", -1), "", "def", "ghi", "", NULL));
-  TEST (NULL, strv_check (g_strsplit_set ("abc:def/ghi", ":/", -1), "abc", "def", "ghi", NULL));
-  TEST (NULL, strv_check (g_strsplit_set (",;,;,;,;", ",;", -1), "", "", "", "", "", "", "", "", "", NULL));
-  TEST (NULL, strv_check (g_strsplit_set (",,abc.def", ".,", -1), "", "", "abc", "def", NULL));
-
-  TEST (NULL, strv_check (g_strsplit_set (",x.y", ",.", 0), "", "x", "y", NULL));
-  TEST (NULL, strv_check (g_strsplit_set (".x,y,", ",.", 0), "", "x", "y", "", NULL));
-  TEST (NULL, strv_check (g_strsplit_set ("x,y.z", ",.", 0), "x", "y", "z", NULL));
-  TEST (NULL, strv_check (g_strsplit_set ("x.y,z,", ",.", 0), "x", "y", "z", "", NULL));
-  TEST (NULL, strv_check (g_strsplit_set (",x.y,z", ",.", 0), "", "x", "y", "z", NULL));
-  TEST (NULL, strv_check (g_strsplit_set (",x,y,z,", ",.", 0), "", "x", "y", "z", "", NULL));
-  TEST (NULL, strv_check (g_strsplit_set (",.x,,y,;z..", ".,;", 0), "", "", "x", "", "y", "", "z", "", "", NULL));
-  TEST (NULL, strv_check (g_strsplit_set (",,x,,y,,z,,", ",,", 0), "", "", "x", "", "y", "", "z", "", "", NULL));
-
-  TEST (NULL, strv_check (g_strsplit_set ("x,y.z", ",.", 1), "x,y.z", NULL));
-  TEST (NULL, strv_check (g_strsplit_set ("x.y,z,", ",.", 1), "x.y,z,", NULL));
-  TEST (NULL, strv_check (g_strsplit_set (",x,y,z", ",.", 1), ",x,y,z", NULL));
-  TEST (NULL, strv_check (g_strsplit_set (",x,y.z,", ",.", 1), ",x,y.z,", NULL));
-  TEST (NULL, strv_check (g_strsplit_set (",,x,.y,,z,,", ",.", 1), ",,x,.y,,z,,", NULL));
-  TEST (NULL, strv_check (g_strsplit_set (",.x,,y,,z,,", ",,..", 1), ",.x,,y,,z,,", NULL));
-   
-  TEST (NULL, strv_check (g_strsplit_set ("", ",", 0), NULL));
-  TEST (NULL, strv_check (g_strsplit_set ("x", ",", 0), "x", NULL));
-  TEST (NULL, strv_check (g_strsplit_set ("x,y", ",", 0), "x", "y", NULL));
-  TEST (NULL, strv_check (g_strsplit_set ("x,y,", ",", 0), "x", "y", "", NULL));
-  TEST (NULL, strv_check (g_strsplit_set (",x,y", ",", 0), "", "x", "y", NULL));
-  TEST (NULL, strv_check (g_strsplit_set (",x,y,", ",", 0), "", "x", "y", "", NULL));
-  TEST (NULL, strv_check (g_strsplit_set ("x,y,z", ",", 0), "x", "y", "z", NULL));
-  TEST (NULL, strv_check (g_strsplit_set ("x,y,z,", ",", 0), "x", "y", "z", "", NULL));
-  TEST (NULL, strv_check (g_strsplit_set (",x,y,z", ",", 0), "", "x", "y", "z", NULL));
-  TEST (NULL, strv_check (g_strsplit_set (",x,y,z,", ",", 0), "", "x", "y", "z", "", NULL));
-  TEST (NULL, strv_check (g_strsplit_set (",,x,,y,,z,,", ",", 0), "", "", "x", "", "y", "", "z", "", "", NULL));
-
-  TEST (NULL, strv_check (g_strsplit_set ("", ",", 1), NULL));
-  TEST (NULL, strv_check (g_strsplit_set ("x", ",", 1), "x", NULL));
-  TEST (NULL, strv_check (g_strsplit_set ("x,y", ",", 1), "x,y", NULL));
-  TEST (NULL, strv_check (g_strsplit_set ("x,y,", ",", 1), "x,y,", NULL));
-  TEST (NULL, strv_check (g_strsplit_set (",x,y", ",", 1), ",x,y", NULL));
-  TEST (NULL, strv_check (g_strsplit_set (",x,y,", ",", 1), ",x,y,", NULL));
-  TEST (NULL, strv_check (g_strsplit_set ("x,y,z", ",", 1), "x,y,z", NULL));
-  TEST (NULL, strv_check (g_strsplit_set ("x,y,z,", ",", 1), "x,y,z,", NULL));
-  TEST (NULL, strv_check (g_strsplit_set (",x,y,z", ",", 1), ",x,y,z", NULL));
-  TEST (NULL, strv_check (g_strsplit_set (",x,y,z,", ",", 1), ",x,y,z,", NULL));
-  TEST (NULL, strv_check (g_strsplit_set (",,x,,y,,z,,", ",", 1), ",,x,,y,,z,,", NULL));
-  TEST (NULL, strv_check (g_strsplit_set (",,x,,y,,z,,", ",,", 1), ",,x,,y,,z,,", NULL));
-
-  TEST (NULL, strv_check (g_strsplit_set ("", ",", 2), NULL));
-  TEST (NULL, strv_check (g_strsplit_set ("x", ",", 2), "x", NULL));
-  TEST (NULL, strv_check (g_strsplit_set ("x,y", ",", 2), "x", "y", NULL));
-  TEST (NULL, strv_check (g_strsplit_set ("x,y,", ",", 2), "x", "y,", NULL));
-  TEST (NULL, strv_check (g_strsplit_set (",x,y", ",", 2), "", "x,y", NULL));
-  TEST (NULL, strv_check (g_strsplit_set (",x,y,", ",", 2), "", "x,y,", NULL));
-  TEST (NULL, strv_check (g_strsplit_set ("x,y,z", ",", 2), "x", "y,z", NULL));
-  TEST (NULL, strv_check (g_strsplit_set ("x,y,z,", ",", 2), "x", "y,z,", NULL));
-  TEST (NULL, strv_check (g_strsplit_set (",x,y,z", ",", 2), "", "x,y,z", NULL));
-  TEST (NULL, strv_check (g_strsplit_set (",x,y,z,", ",", 2), "", "x,y,z,", NULL));
-  TEST (NULL, strv_check (g_strsplit_set (",,x,,y,,z,,", ",", 2), "", ",x,,y,,z,,", NULL));
-  
-  TEST (NULL, strv_check (g_strsplit_set (",,x,.y,..z,,", ",.", 3), "", "", "x,.y,..z,,", NULL));
-
-  
-  
-  #define TEST_IS(name) test_is_function (#name, call_g_ascii_##name, call_##name, g_unichar_##name);
-
-  FOR_ALL_CTYPE(TEST_IS)
-
-  #undef TEST_IS
-
-  #define TEST_TO(name) test_to_function (#name, g_ascii_##name, name, g_unichar_##name)
-
-  TEST_TO (tolower);
-  TEST_TO (toupper);
-
-  #undef TEST_TO
-
-  #define TEST_DIGIT(name) test_digit_function (#name, g_ascii_##name##_value, g_unichar_##name##_value)
-
-  TEST_DIGIT (digit);
-  TEST_DIGIT (xdigit);
-
-  #undef TEST_DIGIT
-
-  /* Tests for strchomp () */
-  TEST (NULL, strchomp_check ("", ""));
-  TEST (NULL, strchomp_check (" ", ""));
-  TEST (NULL, strchomp_check (" \t\r\n", ""));
-  TEST (NULL, strchomp_check ("a ", "a"));
-  TEST (NULL, strchomp_check ("a  ", "a"));
-  TEST (NULL, strchomp_check ("a a", "a a"));
-  TEST (NULL, strchomp_check ("a a ", "a a"));
-
-  /* Tests for g_build_path, g_build_filename */
-
-  TEST (NULL, str_check (g_build_path ("", NULL), ""));
-  TEST (NULL, str_check (g_build_path ("", "", NULL), ""));
-  TEST (NULL, str_check (g_build_path ("", "x", NULL), "x"));
-  TEST (NULL, str_check (g_build_path ("", "x", "y",  NULL), "xy"));
-  TEST (NULL, str_check (g_build_path ("", "x", "y", "z", NULL), "xyz"));
-
-  TEST (NULL, str_check (g_build_path (":", NULL), ""));
-  TEST (NULL, str_check (g_build_path (":", ":", NULL), ":"));
-  TEST (NULL, str_check (g_build_path (":", ":x", NULL), ":x"));
-  TEST (NULL, str_check (g_build_path (":", "x:", NULL), "x:"));
-  TEST (NULL, str_check (g_build_path (":", "", "x", NULL), "x"));
-  TEST (NULL, str_check (g_build_path (":", "", ":x", NULL), ":x"));
-  TEST (NULL, str_check (g_build_path (":", ":", "x", NULL), ":x"));
-  TEST (NULL, str_check (g_build_path (":", "::", "x", NULL), "::x"));
-  TEST (NULL, str_check (g_build_path (":", "x", "", NULL), "x"));
-  TEST (NULL, str_check (g_build_path (":", "x:", "", NULL), "x:"));
-  TEST (NULL, str_check (g_build_path (":", "x", ":", NULL), "x:"));
-  TEST (NULL, str_check (g_build_path (":", "x", "::", NULL), "x::"));
-  TEST (NULL, str_check (g_build_path (":", "x", "y",  NULL), "x:y"));
-  TEST (NULL, str_check (g_build_path (":", ":x", "y", NULL), ":x:y"));
-  TEST (NULL, str_check (g_build_path (":", "x", "y:", NULL), "x:y:"));
-  TEST (NULL, str_check (g_build_path (":", ":x:", ":y:", NULL), ":x:y:"));
-  TEST (NULL, str_check (g_build_path (":", ":x::", "::y:", NULL), ":x:y:"));
-  TEST (NULL, str_check (g_build_path (":", "x", "","y",  NULL), "x:y"));
-  TEST (NULL, str_check (g_build_path (":", "x", ":", "y",  NULL), "x:y"));
-  TEST (NULL, str_check (g_build_path (":", "x", "::", "y",  NULL), "x:y"));
-  TEST (NULL, str_check (g_build_path (":", "x", "y", "z", NULL), "x:y:z"));
-  TEST (NULL, str_check (g_build_path (":", ":x:", ":y:", ":z:", NULL), ":x:y:z:"));
-  TEST (NULL, str_check (g_build_path (":", "::x::", "::y::", "::z::", NULL), "::x:y:z::"));
-
-  TEST (NULL, str_check (g_build_path ("::", NULL), ""));
-  TEST (NULL, str_check (g_build_path ("::", "::", NULL), "::"));
-  TEST (NULL, str_check (g_build_path ("::", ":::", NULL), ":::"));
-  TEST (NULL, str_check (g_build_path ("::", "::x", NULL), "::x"));
-  TEST (NULL, str_check (g_build_path ("::", "x::", NULL), "x::"));
-  TEST (NULL, str_check (g_build_path ("::", "", "x", NULL), "x"));
-  TEST (NULL, str_check (g_build_path ("::", "", "::x", NULL), "::x"));
-  TEST (NULL, str_check (g_build_path ("::", "::", "x", NULL), "::x"));
-  TEST (NULL, str_check (g_build_path ("::", "::::", "x", NULL), "::::x"));
-  TEST (NULL, str_check (g_build_path ("::", "x", "", NULL), "x"));
-  TEST (NULL, str_check (g_build_path ("::", "x::", "", NULL), "x::"));
-  TEST (NULL, str_check (g_build_path ("::", "x", "::", NULL), "x::"));
-  /* This following is weird, but keeps the definition simple */
-  TEST (NULL, str_check (g_build_path ("::", "x", ":::", NULL), "x:::::"));
-  TEST (NULL, str_check (g_build_path ("::", "x", "::::", NULL), "x::::"));
-  TEST (NULL, str_check (g_build_path ("::", "x", "y",  NULL), "x::y"));
-  TEST (NULL, str_check (g_build_path ("::", "::x", "y", NULL), "::x::y"));
-  TEST (NULL, str_check (g_build_path ("::", "x", "y::", NULL), "x::y::"));
-  TEST (NULL, str_check (g_build_path ("::", "::x::", "::y::", NULL), "::x::y::"));
-  TEST (NULL, str_check (g_build_path ("::", "::x:::", ":::y::", NULL), "::x::::y::"));
-  TEST (NULL, str_check (g_build_path ("::", "::x::::", "::::y::", NULL), "::x::y::"));
-  TEST (NULL, str_check (g_build_path ("::", "x", "", "y",  NULL), "x::y"));
-  TEST (NULL, str_check (g_build_path ("::", "x", "::", "y",  NULL), "x::y"));
-  TEST (NULL, str_check (g_build_path ("::", "x", "::::", "y",  NULL), "x::y"));
-  TEST (NULL, str_check (g_build_path ("::", "x", "y", "z", NULL), "x::y::z"));
-  TEST (NULL, str_check (g_build_path ("::", "::x::", "::y::", "::z::", NULL), "::x::y::z::"));
-  TEST (NULL, str_check (g_build_path ("::", ":::x:::", ":::y:::", ":::z:::", NULL), ":::x::::y::::z:::"));
-  TEST (NULL, str_check (g_build_path ("::", "::::x::::", "::::y::::", "::::z::::", NULL), "::::x::y::z::::"));
-
-  args[0] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("", args), ""));
-  args[0] = ""; args[1] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("", args), ""));
-  args[0] = "x"; args[1] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("", args), "x"));
-  args[0] = "x"; args[1] = "y"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("", args), "xy"));
-  args[0] = "x"; args[1] = "y"; args[2] = "z", args[3] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("", args), "xyz"));
-
-  args[0] = NULL;
-  TEST (NULL, str_check (g_build_pathv (":", args), ""));
-  args[0] = ":"; args[1] = NULL;
-  TEST (NULL, str_check (g_build_pathv (":", args), ":"));
-  args[0] = ":x"; args[1] = NULL;
-  TEST (NULL, str_check (g_build_pathv (":", args), ":x"));
-  args[0] = "x:"; args[1] = NULL;
-  TEST (NULL, str_check (g_build_pathv (":", args), "x:"));
-  args[0] = ""; args[1] = "x"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_pathv (":", args), "x"));
-  args[0] = ""; args[1] = ":x"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_pathv (":", args), ":x"));
-  args[0] = ":"; args[1] = "x"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_pathv (":", args), ":x"));
-  args[0] = "::"; args[1] = "x"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_pathv (":", args), "::x"));
-  args[0] = "x"; args[1] = ""; args[2] = NULL;
-  TEST (NULL, str_check (g_build_pathv (":", args), "x"));
-  args[0] = "x:"; args[1] = ""; args[2] = NULL;
-  TEST (NULL, str_check (g_build_pathv (":", args), "x:"));
-  args[0] = "x"; args[1] = ":"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_pathv (":", args), "x:"));
-  args[0] = "x"; args[1] = "::"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_pathv (":", args), "x::"));
-  args[0] = "x"; args[1] = "y"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_pathv (":", args), "x:y"));
-  args[0] = ":x"; args[1] = "y"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_pathv (":", args), ":x:y"));
-  args[0] = "x"; args[1] = "y:"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_pathv (":", args), "x:y:"));
-  args[0] = ":x:"; args[1] = ":y:"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_pathv (":", args), ":x:y:"));
-  args[0] = ":x::"; args[1] = "::y:"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_pathv (":", args), ":x:y:"));
-  args[0] = "x"; args[1] = ""; args[2] = "y"; args[3] = NULL;
-  TEST (NULL, str_check (g_build_pathv (":", args), "x:y"));
-  args[0] = "x"; args[1] = ":"; args[2] = "y"; args[3] = NULL;
-  TEST (NULL, str_check (g_build_pathv (":", args), "x:y"));
-  args[0] = "x"; args[1] = "::"; args[2] = "y"; args[3] = NULL;
-  TEST (NULL, str_check (g_build_pathv (":", args), "x:y"));
-  args[0] = "x"; args[1] = "y"; args[2] = "z"; args[3] = NULL;
-  TEST (NULL, str_check (g_build_pathv (":", args), "x:y:z"));
-  args[0] = ":x:"; args[1] = ":y:"; args[2] = ":z:"; args[3] = NULL;
-  TEST (NULL, str_check (g_build_pathv (":", args), ":x:y:z:"));
-  args[0] = "::x::"; args[1] = "::y::"; args[2] = "::z::"; args[3] = NULL;
-  TEST (NULL, str_check (g_build_pathv (":", args), "::x:y:z::"));
-
-  args[0] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("::", args), ""));
-  args[0] = "::"; args[1] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("::", args), "::"));
-  args[0] = ":::"; args[1] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("::", args), ":::"));
-  args[0] = "::x"; args[1] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("::", args), "::x"));
-  args[0] = "x::"; args[1] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("::", args), "x::"));
-  args[0] = ""; args[1] = "x"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("::", args), "x"));
-  args[0] = ""; args[1] = "::x"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("::", args), "::x"));
-  args[0] = "::"; args[1] = "x"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("::", args), "::x"));
-  args[0] = "::::"; args[1] = "x"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("::", args), "::::x"));
-  args[0] = "x"; args[1] = ""; args[2] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("::", args), "x"));
-  args[0] = "x::"; args[1] = ""; args[2] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("::", args), "x::"));
-  args[0] = "x"; args[1] = "::"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("::", args), "x::"));
-  /* This following is weird, but keeps the definition simple */
-  args[0] = "x"; args[1] = ":::"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("::", args), "x:::::"));
-  args[0] = "x"; args[1] = "::::"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("::", args), "x::::"));
-  args[0] = "x"; args[1] = "y"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("::", args), "x::y"));
-  args[0] = "::x"; args[1] = "y"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("::", args), "::x::y"));
-  args[0] = "x"; args[1] = "y::"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("::", args), "x::y::"));
-  args[0] = "::x::"; args[1] = "::y::"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("::", args), "::x::y::"));
-  args[0] = "::x:::"; args[1] = ":::y::"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("::", args), "::x::::y::"));
-  args[0] = "::x::::"; args[1] = "::::y::"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("::", args), "::x::y::"));
-  args[0] = "x"; args[1] = ""; args[2] = "y"; args[3] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("::", args), "x::y"));
-  args[0] = "x"; args[1] = "::"; args[2] = "y"; args[3] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("::", args), "x::y"));
-  args[0] = "x"; args[1] = "::::"; args[2] = "y"; args[3] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("::", args), "x::y"));
-  args[0] = "x"; args[1] = "y"; args[2] = "z"; args[3] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("::", args), "x::y::z"));
-  args[0] = "::x::"; args[1] = "::y::"; args[2] = "::z::"; args[3] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("::", args), "::x::y::z::"));
-  args[0] = ":::x:::"; args[1] = ":::y:::"; args[2] = ":::z:::"; args[3] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("::", args), ":::x::::y::::z:::"));
-  args[0] = "::::x::::"; args[1] = "::::y::::"; args[2] = "::::z::::"; args[3] = NULL;
-  TEST (NULL, str_check (g_build_pathv ("::", args), "::::x::y::z::::"));
-
-#define S G_DIR_SEPARATOR_S
-
-  TEST (NULL, str_check (g_build_filename (NULL), ""));
-  TEST (NULL, str_check (g_build_filename (S, NULL), S));
-  TEST (NULL, str_check (g_build_filename (S"x", NULL), S"x"));
-  TEST (NULL, str_check (g_build_filename ("x"S, NULL), "x"S));
-  TEST (NULL, str_check (g_build_filename ("", "x", NULL), "x"));
-  TEST (NULL, str_check (g_build_filename ("", S"x", NULL), S"x"));
-  TEST (NULL, str_check (g_build_filename (S, "x", NULL), S"x"));
-  TEST (NULL, str_check (g_build_filename (S S, "x", NULL), S S"x"));
-  TEST (NULL, str_check (g_build_filename ("x", "", NULL), "x"));
-  TEST (NULL, str_check (g_build_filename ("x"S, "", NULL), "x"S));
-  TEST (NULL, str_check (g_build_filename ("x", S, NULL), "x"S));
-  TEST (NULL, str_check (g_build_filename ("x", S S, NULL), "x"S S));
-  TEST (NULL, str_check (g_build_filename ("x", "y",  NULL), "x"S"y"));
-  TEST (NULL, str_check (g_build_filename (S"x", "y", NULL), S"x"S"y"));
-  TEST (NULL, str_check (g_build_filename ("x", "y"S, NULL), "x"S"y"S));
-  TEST (NULL, str_check (g_build_filename (S"x"S, S"y"S, NULL), S"x"S"y"S));
-  TEST (NULL, str_check (g_build_filename (S"x"S S, S S"y"S, NULL), S"x"S"y"S));
-  TEST (NULL, str_check (g_build_filename ("x", "", "y",  NULL), "x"S"y"));
-  TEST (NULL, str_check (g_build_filename ("x", S, "y",  NULL), "x"S"y"));
-  TEST (NULL, str_check (g_build_filename ("x", S S, "y",  NULL), "x"S"y"));
-  TEST (NULL, str_check (g_build_filename ("x", "y", "z", NULL), "x"S"y"S"z"));
-  TEST (NULL, str_check (g_build_filename (S"x"S, S"y"S, S"z"S, NULL), S"x"S"y"S"z"S));
-  TEST (NULL, str_check (g_build_filename (S S"x"S S, S S"y"S S, S S"z"S S, NULL), S S"x"S"y"S"z"S S));
-
-  args[0] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), ""));
-  args[0] = S; args[1] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), S));
-  args[0] = S"x"; args[1] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), S"x"));
-  args[0] = "x"S; args[1] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), "x"S));
-  args[0] = ""; args[1] = "x"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), "x"));
-  args[0] = ""; args[1] = S"x"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), S"x"));
-  args[0] = S; args[1] = "x"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), S"x"));
-  args[0] = S S; args[1] = "x"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), S S"x"));
-  args[0] = "x"; args[1] = ""; args[2] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), "x"));
-  args[0] = "x"S; args[1] = ""; args[2] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), "x"S));
-  args[0] = "x"; args[1] = S; args[2] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), "x"S));
-  args[0] = "x"; args[1] = S S; args[2] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), "x"S S));
-  args[0] = "x"; args[1] = "y"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"));
-  args[0] = S"x"; args[1] = "y"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), S"x"S"y"));
-  args[0] = "x"; args[1] = "y"S; args[2] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"S));
-  args[0] = S"x"S; args[1] = S"y"S; args[2] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), S"x"S"y"S));
-  args[0] = S"x"S S; args[1] = S S"y"S; args[2] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), S"x"S"y"S));
-  args[0] = "x"; args[1] = ""; args[2] = "y"; args[3] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"));
-  args[0] = "x"; args[1] = S; args[2] = "y"; args[3] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"));
-  args[0] = "x"; args[1] = S S; args[2] = "y"; args[3] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"));
-  args[0] = "x"; args[1] = "y"; args[2] = "z"; args[3] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"S"z"));
-  args[0] = S"x"S; args[1] = S"y"S; args[2] = S"z"S; args[3] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), S"x"S"y"S"z"S));
-  args[0] = S S"x"S S; args[1] = S S"y"S S; args[2] = S S"z"S S; args[3] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), S S"x"S"y"S"z"S S));
-
-#ifdef G_OS_WIN32
-
-  /* Test also using the slash as file name separator */
-#define U "/"
-  TEST (NULL, str_check (g_build_filename (NULL), ""));
-  TEST (NULL, str_check (g_build_filename (U, NULL), U));
-  TEST (NULL, str_check (g_build_filename (U"x", NULL), U"x"));
-  TEST (NULL, str_check (g_build_filename ("x"U, NULL), "x"U));
-  TEST (NULL, str_check (g_build_filename ("", U"x", NULL), U"x"));
-  TEST (NULL, str_check (g_build_filename ("", U"x", NULL), U"x"));
-  TEST (NULL, str_check (g_build_filename (U, "x", NULL), U"x"));
-  TEST (NULL, str_check (g_build_filename (U U, "x", NULL), U U"x"));
-  TEST (NULL, str_check (g_build_filename (U S, "x", NULL), U S"x"));
-  TEST (NULL, str_check (g_build_filename ("x"U, "", NULL), "x"U));
-  TEST (NULL, str_check (g_build_filename ("x"S"y", "z"U"a", NULL), "x"S"y"S"z"U"a"));
-  TEST (NULL, str_check (g_build_filename ("x", U, NULL), "x"U));
-  TEST (NULL, str_check (g_build_filename ("x", U U, NULL), "x"U U));
-  TEST (NULL, str_check (g_build_filename ("x", S U, NULL), "x"S U));
-  TEST (NULL, str_check (g_build_filename (U"x", "y", NULL), U"x"U"y"));
-  TEST (NULL, str_check (g_build_filename ("x", "y"U, NULL), "x"U"y"U));
-  TEST (NULL, str_check (g_build_filename (U"x"U, U"y"U, NULL), U"x"U"y"U));
-  TEST (NULL, str_check (g_build_filename (U"x"U U, U U"y"U, NULL), U"x"U"y"U));
-  TEST (NULL, str_check (g_build_filename ("x", U, "y",  NULL), "x"U"y"));
-  TEST (NULL, str_check (g_build_filename ("x", U U, "y",  NULL), "x"U"y"));
-  TEST (NULL, str_check (g_build_filename ("x", U S, "y",  NULL), "x"S"y"));
-  TEST (NULL, str_check (g_build_filename ("x", S U, "y",  NULL), "x"U"y"));
-  TEST (NULL, str_check (g_build_filename ("x", U "y", "z", NULL), "x"U"y"U"z"));
-  TEST (NULL, str_check (g_build_filename ("x", S "y", "z", NULL), "x"S"y"S"z"));
-  TEST (NULL, str_check (g_build_filename ("x", S "y", "z", U, "a", "b", NULL), "x"S"y"S"z"U"a"U"b"));
-  TEST (NULL, str_check (g_build_filename (U"x"U, U"y"U, U"z"U, NULL), U"x"U"y"U"z"U));
-  TEST (NULL, str_check (g_build_filename (U U"x"U U, U U"y"U U, U U"z"U U, NULL), U U"x"U"y"U"z"U U));
-
-  args[0] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), ""));
-  args[0] = U; args[1] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), U));
-  args[0] = U"x"; args[1] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), U"x"));
-  args[0] = "x"U; args[1] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), "x"U));
-  args[0] = ""; args[1] = U"x"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), U"x"));
-  args[0] = ""; args[1] = U"x"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), U"x"));
-  args[0] = U; args[1] = "x"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), U"x"));
-  args[0] = U U; args[1] = "x"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), U U"x"));
-  args[0] = U S; args[1] = "x"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), U S"x"));
-  args[0] = "x"U; args[1] = ""; args[2] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), "x"U));
-  args[0] = "x"S"y"; args[1] = "z"U"a"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"S"z"U"a"));
-  args[0] = "x"; args[1] = U; args[2] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), "x"U));
-  args[0] = "x"; args[1] = U U; args[2] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), "x"U U));
-  args[0] = "x"; args[1] = S U; args[2] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), "x"S U));
-  args[0] = U"x"; args[1] = "y"; args[2] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), U"x"U"y"));
-  args[0] = "x"; args[1] = "y"U; args[2] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), "x"U"y"U));
-  args[0] = U"x"U; args[1] = U"y"U; args[2] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), U"x"U"y"U));
-  args[0] = U"x"U U; args[1] = U U"y"U; args[2] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), U"x"U"y"U));
-  args[0] = "x"; args[1] = U; args[2] = "y", args[3] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), "x"U"y"));
-  args[0] = "x"; args[1] = U U; args[2] = "y", args[3] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), "x"U"y"));
-  args[0] = "x"; args[1] = U S; args[2] = "y", args[3] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"));
-  args[0] = "x"; args[1] = S U; args[2] = "y", args[3] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), "x"U"y"));
-  args[0] = "x"; args[1] = U "y"; args[2] = "z", args[3] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), "x"U"y"U"z"));
-  args[0] = "x"; args[1] = S "y"; args[2] = "z", args[3] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"S"z"));
-  args[0] = "x"; args[1] = S "y"; args[2] = "z", args[3] = U;
-  args[4] = "a"; args[5] = "b"; args[6] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"S"z"U"a"U"b"));
-  args[0] = U"x"U; args[1] = U"y"U; args[2] = U"z"U, args[3] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), U"x"U"y"U"z"U));
-  args[0] = U U"x"U U; args[1] = U U"y"U U; args[2] = U U"z"U U, args[3] = NULL;
-  TEST (NULL, str_check (g_build_filenamev (args), U U"x"U"y"U"z"U U));
-#endif /* G_OS_WIN32 */
-
-#undef S
-
-  {
-    gchar buf[5];
-    
-    TEST (NULL, 3 == g_snprintf (buf, 0, "%s", "abc"));
-    TEST (NULL, 3 == g_snprintf (NULL,0, "%s", "abc"));
-    TEST (NULL, 3 == g_snprintf (buf, 5, "%s", "abc"));
-    TEST (NULL, 4 == g_snprintf (buf, 5, "%s", "abcd"));
-    TEST (NULL, 9 == g_snprintf (buf, 5, "%s", "abcdefghi"));
-  }
-
-  TEST (NULL, g_strv_length (g_strsplit ("1,2,3,4", ",", -1)) == 4);
-
-  return any_failed;
-}
index f80c438..7da4128 100644 (file)
@@ -301,22 +301,6 @@ main (int   argc,
 
   g_string_free (string1, TRUE);
   g_string_free (string2, TRUE);
-  
-  g_assert (g_str_has_prefix("foobar", "gazonk") == FALSE);
-  g_assert (g_str_has_prefix("xyzzy", "xyzzy") == TRUE);
-  g_assert (g_str_has_prefix("xyzzy", "xy") == TRUE);
-  g_assert (g_str_has_prefix("xyzzy", "") == TRUE);
-  g_assert (g_str_has_prefix("xyz", "xyzzy") == FALSE);
-  g_assert (g_str_has_prefix("", "xyzzy") == FALSE);
-  g_assert (g_str_has_prefix("", "") == TRUE);
-
-  g_assert (g_str_has_suffix("foobar", "gazonk") == FALSE);
-  g_assert (g_str_has_suffix("xyzzy", "xyzzy") == TRUE);
-  g_assert (g_str_has_suffix("xyzzy", "zy") == TRUE);
-  g_assert (g_str_has_suffix("xyzzy", "") == TRUE);
-  g_assert (g_str_has_suffix("zzy", "xyzzy") == FALSE);
-  g_assert (g_str_has_suffix("", "xyzzy") == FALSE);
-  g_assert (g_str_has_suffix("", "") == TRUE);
 
   tmp_string = (gchar *) g_malloc (10);
   g_snprintf (tmp_string, 10, "%2$s %1$s", "a", "b");
diff --git a/tests/strtod-test.c b/tests/strtod-test.c
deleted file mode 100644 (file)
index 8da7f37..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-#undef G_DISABLE_ASSERT
-#undef G_LOG_DOMAIN
-
-/* for NAN and INFINITY */
-#define _ISOC99_SOURCE
-
-#include <glib.h>
-#include <locale.h>
-#include <string.h>
-#include <stdlib.h>
-#include <math.h>
-
-static char *locales[] = {"sv_SE", "en_US", "fa_IR", "C", "ru_RU"};
-
-void
-test_string (char *number, double res, gboolean check_end, int correct_len)
-{
-  double d;
-  int l;
-  char *dummy;
-  
-  /* we try a copy of number, with some free space for malloc before that. 
-   * This is supposed to smash the some wrong pointer calculations. */
-
-  dummy = g_malloc (100000);
-  number = g_strdup (number);
-  g_free (dummy);
-
-  for (l = 0; l < G_N_ELEMENTS (locales); l++)
-    {
-      gboolean ok;
-      char *end = "(unset)";
-
-      setlocale (LC_NUMERIC, locales[l]);
-      d = g_ascii_strtod (number, &end);
-      ok = isnan (res) ? isnan (d) : (d == res);
-      if (!ok)
-       {
-         g_print ("g_ascii_strtod on \"%s\" for locale %s failed\n", number, locales[l]);
-         g_print ("expected %f (nan %d) actual %f (nan %d)\n", 
-                  res, isnan (res),
-                  d, isnan (d));
-       }
-
-      ok = (end - number) == (check_end ? correct_len : strlen (number));
-      if (!ok) {
-       if (end == NULL)
-         g_print ("g_ascii_strtod on \"%s\" for locale %s endptr was NULL\n",
-                  number, locales[l]);
-       else if (end >= number && end <= number + strlen (number))
-         g_print ("g_ascii_strtod on \"%s\" for locale %s endptr was wrong, leftover: \"%s\"\n",
-                  number, locales[l], end);
-       else
-         g_print ("g_ascii_strtod on \"%s\" for locale %s endptr was REALLY wrong (number=%p, end=%p)\n",
-                  number, locales[l], number, end);
-      }
-    }
-
-  g_free (number);
-}
-
-
-static void
-test_number (gdouble num, gchar *fmt, gchar *str)
-{
-  int l;
-  gchar buf[G_ASCII_DTOSTR_BUF_SIZE];
-
-  for (l = 0; l < G_N_ELEMENTS (locales); l++)
-    {
-      g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, fmt, num);
-      g_assert (strcmp (buf, str) == 0);
-    }
-}
-
-int 
-main ()
-{
-  gdouble d, our_nan, our_inf;
-  char buffer[G_ASCII_DTOSTR_BUF_SIZE];
-
-#ifdef NAN
-  our_nan = NAN;
-#else
-  /* Do this before any call to setlocale.  */
-  our_nan = atof ("NaN");
-#endif
-  g_assert (isnan (our_nan));
-
-#ifdef INFINITY
-  our_inf = INFINITY;
-#else
-  our_inf = atof ("Infinity");
-#endif
-  g_assert (our_inf > 1 && our_inf == our_inf / 2);
-
-  test_string ("123.123", 123.123, FALSE, 0);
-  test_string ("123.123e2", 123.123e2, FALSE, 0);
-  test_string ("123.123e-2", 123.123e-2, FALSE, 0);
-  test_string ("-123.123", -123.123, FALSE, 0);
-  test_string ("-123.123e2", -123.123e2, FALSE, 0);
-  test_string ("-123.123e-2", -123.123e-2, FALSE, 0);
-  test_string ("5.4", 5.4, TRUE, 3);
-  test_string ("5.4,5.5", 5.4, TRUE, 3);
-  test_string ("5,4", 5.0, TRUE, 1);
-  /* the following are for #156421 */
-  test_string ("1e1", 1e1, FALSE, 0); 
-  test_string ("NAN", our_nan, FALSE, 0);
-  test_string ("-nan", -our_nan, FALSE, 0);
-  test_string ("INF", our_inf, FALSE, 0);
-  test_string ("-infinity", -our_inf, FALSE, 0);
-  test_string ("-.75,0", -0.75, TRUE, 4);
-  
-  d = 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0;
-  g_assert (d == g_ascii_strtod (g_ascii_dtostr (buffer, sizeof (buffer), d), NULL));
-
-  d = -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0;
-  g_assert (d == g_ascii_strtod (g_ascii_dtostr (buffer, sizeof (buffer), d), NULL));
-  
-  d = pow (2.0, -1024.1);
-  g_assert (d == g_ascii_strtod (g_ascii_dtostr (buffer, sizeof (buffer), d), NULL));
-  
-  d = -pow (2.0, -1024.1);
-  g_assert (d == g_ascii_strtod (g_ascii_dtostr (buffer, sizeof (buffer), d), NULL));
-
-  /* for #343899 */
-  test_string (" 0.75", 0.75, FALSE, 0);
-  test_string (" +0.75", 0.75, FALSE, 0);
-  test_string (" -0.75", -0.75, FALSE, 0);
-  test_string ("\f0.75", 0.75, FALSE, 0);
-  test_string ("\n0.75", 0.75, FALSE, 0);
-  test_string ("\r0.75", 0.75, FALSE, 0);
-  test_string ("\t0.75", 0.75, FALSE, 0);
-#if 0
-  /* g_ascii_isspace() returns FALSE for vertical tab, see #59388 */
-  test_string ("\v0.75", 0.75, FALSE, 0);
-#endif
-
-  /* for #343899 */
-  test_number (0.75, "%0.2f", "0.75");
-  test_number (0.75, "%5.2f", " 0.75");
-  test_number (-0.75, "%0.2f", "-0.75");
-  test_number (-0.75, "%5.2f", "-0.75");
-  test_number (1e99, "%.0e", "1e+99");
-  return 0;
-}
diff --git a/tests/strtoll-test.c b/tests/strtoll-test.c
deleted file mode 100644 (file)
index 43005d5..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-#undef G_DISABLE_ASSERT
-#undef G_LOG_DOMAIN
-
-#include <errno.h>
-#include <string.h>
-#include <glib.h>
-
-
-static void
-test_uint64 (const gchar *str,
-            const gchar *end,
-            gint         base,
-            guint64      result,
-            gint         error)
-{
-  guint64 actual;
-  gchar *endptr = NULL;
-  gint err;
-
-  errno = 0;
-  actual = g_ascii_strtoull (str, &endptr, base);
-  err = errno;
-
-  g_assert (actual == result);
-  g_assert (strcmp (end, endptr) == 0);
-  g_assert (err == error);
-}
-
-static void
-test_int64 (const gchar *str,
-           const gchar *end,
-           gint         base,
-           gint64       result,
-           gint         error)
-{
-  gint64 actual;
-  gchar *endptr = NULL;
-  gint err;
-
-  errno = 0;
-  actual = g_ascii_strtoll (str, &endptr, base);
-  err = errno;
-
-  g_assert (actual == result);
-  g_assert (strcmp (end, endptr) == 0);
-  g_assert (err == error);
-}
-
-int 
-main (int argc, char *argv[])
-{
-  test_uint64 ("0", "", 10, 0, 0);
-  test_uint64 ("+0", "", 10, 0, 0);
-  test_uint64 ("-0", "", 10, 0, 0);
-  test_uint64 ("18446744073709551615", "", 10, G_MAXUINT64, 0);
-  test_uint64 ("18446744073709551616", "", 10, G_MAXUINT64, ERANGE);
-  test_uint64 ("20xyz", "xyz", 10, 20, 0);
-  test_uint64 ("-1", "", 10, G_MAXUINT64, 0);
-
-  test_int64 ("0", "", 10, 0, 0);
-  test_int64 ("9223372036854775807", "", 10, G_MAXINT64, 0);
-  test_int64 ("9223372036854775808", "", 10, G_MAXINT64, ERANGE);
-  test_int64 ("-9223372036854775808", "", 10, G_MININT64, 0);
-  test_int64 ("-9223372036854775809", "", 10, G_MININT64, ERANGE);
-  test_int64 ("32768", "", 10, 32768, 0);
-  test_int64 ("-32768", "", 10, -32768, 0);
-  test_int64 ("001", "", 10, 1, 0);
-  test_int64 ("-001", "", 10, -1, 0);
-
-  return 0;
-}
index f14158f..255e340 100644 (file)
@@ -506,85 +506,6 @@ find_first_that(gpointer key,
   return (*v == *test);
 }
 
-
-static void
-test_g_mkdir_with_parents_1 (const gchar *base)
-{
-  char *p0 = g_build_filename (base, "fum", NULL);
-  char *p1 = g_build_filename (p0, "tem", NULL);
-  char *p2 = g_build_filename (p1, "zap", NULL);
-  FILE *f;
-
-  g_remove (p2);
-  g_remove (p1);
-  g_remove (p0);
-
-  if (g_file_test (p0, G_FILE_TEST_EXISTS))
-    g_error ("failed, %s exists, cannot test g_mkdir_with_parents\n", p0);
-
-  if (g_file_test (p1, G_FILE_TEST_EXISTS))
-    g_error ("failed, %s exists, cannot test g_mkdir_with_parents\n", p1);
-
-  if (g_file_test (p2, G_FILE_TEST_EXISTS))
-    g_error ("failed, %s exists, cannot test g_mkdir_with_parents\n", p2);
-
-  if (g_mkdir_with_parents (p2, 0777) == -1)
-    g_error ("failed, g_mkdir_with_parents(%s) failed: %s\n", p2, g_strerror (errno));
-
-  if (!g_file_test (p2, G_FILE_TEST_IS_DIR))
-    g_error ("failed, g_mkdir_with_parents(%s) succeeded, but %s is not a directory\n", p2, p2);
-
-  if (!g_file_test (p1, G_FILE_TEST_IS_DIR))
-    g_error ("failed, g_mkdir_with_parents(%s) succeeded, but %s is not a directory\n", p2, p1);
-
-  if (!g_file_test (p0, G_FILE_TEST_IS_DIR))
-    g_error ("failed, g_mkdir_with_parents(%s) succeeded, but %s is not a directory\n", p2, p0);
-
-  g_rmdir (p2);
-  if (g_file_test (p2, G_FILE_TEST_EXISTS))
-    g_error ("failed, did g_rmdir(%s), but %s is still there\n", p2, p2);
-
-  g_rmdir (p1);
-  if (g_file_test (p1, G_FILE_TEST_EXISTS))
-    g_error ("failed, did g_rmdir(%s), but %s is still there\n", p1, p1);
-
-  f = g_fopen (p1, "w");
-  if (f == NULL)
-    g_error ("failed, couldn't create file %s\n", p1);
-  fclose (f);
-
-  if (g_mkdir_with_parents (p1, 0666) == 0)
-    g_error ("failed, g_mkdir_with_parents(%s) succeeded, even if %s is a file\n", p1, p1);
-
-  if (g_mkdir_with_parents (p2, 0666) == 0)
-    g_error("failed, g_mkdir_with_parents(%s) succeeded, even if %s is a file\n", p2, p1);
-
-  g_remove (p2);
-  g_remove (p1);
-  g_remove (p0);
-}
-
-static void
-test_g_mkdir_with_parents (void)
-{
-  gchar *cwd;
-  if (g_test_verbose())
-    g_print ("checking g_mkdir_with_parents() in subdir ./hum/");
-  test_g_mkdir_with_parents_1 ("hum");
-  g_remove ("hum");
-  if (g_test_verbose())
-    g_print ("checking g_mkdir_with_parents() in subdir ./hii///haa/hee/");
-  test_g_mkdir_with_parents_1 ("hii///haa/hee");
-  g_remove ("hii/haa/hee");
-  g_remove ("hii/haa");
-  g_remove ("hii");
-  cwd = g_get_current_dir ();
-  if (g_test_verbose())
-    g_print ("checking g_mkdir_with_parents() in cwd: %s", cwd);
-  test_g_mkdir_with_parents_1 (cwd);
-  g_free (cwd);
-}
-
 static void
 test_g_parse_debug_string (void)
 {
@@ -1601,7 +1522,6 @@ main (int   argc,
   g_test_add_func ("/testglib/Relation", relation_test);
   g_test_add_func ("/testglib/File Paths", test_paths);
   g_test_add_func ("/testglib/File Functions", test_file_functions);
-  g_test_add_func ("/testglib/Mkdir", test_g_mkdir_with_parents);
   g_test_add_func ("/testglib/Parse Debug Strings", test_g_parse_debug_string);
   g_test_add_func ("/testglib/GMemChunk (deprecated)", test_mem_chunks);
   g_test_add_func ("/testglib/Warnings & Errors", log_warning_error_tests);