os/ossrv/glib/tsrc/BC/tests/strfunc-test.c
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/glib/tsrc/BC/tests/strfunc-test.c	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,794 @@
     1.4 +/* GLIB - Library of useful routines for C programming
     1.5 + * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
     1.6 + * Portion Copyright © 2008-09 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
     1.7 + * This library is free software; you can redistribute it and/or
     1.8 + * modify it under the terms of the GNU Lesser General Public
     1.9 + * License as published by the Free Software Foundation; either
    1.10 + * version 2 of the License, or (at your option) any later version.
    1.11 + *
    1.12 + * This library is distributed in the hope that it will be useful,
    1.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.15 + * Lesser General Public License for more details.
    1.16 + *
    1.17 + * You should have received a copy of the GNU Lesser General Public
    1.18 + * License along with this library; if not, write to the
    1.19 + * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    1.20 + * Boston, MA 02111-1307, USA.
    1.21 + */
    1.22 +
    1.23 +/*
    1.24 + * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
    1.25 + * file for a list of people on the GLib Team.  See the ChangeLog
    1.26 + * files for a list of changes.  These files are distributed with
    1.27 + * GLib at ftp://ftp.gtk.org/pub/gtk/. 
    1.28 + */
    1.29 +
    1.30 +#undef G_DISABLE_ASSERT
    1.31 +#undef G_LOG_DOMAIN
    1.32 +
    1.33 +#include <stdio.h>
    1.34 +#include <string.h>
    1.35 +#include "glib.h"
    1.36 +#include <stdarg.h>
    1.37 +#include <ctype.h>
    1.38 +
    1.39 +
    1.40 +#ifdef SYMBIAN
    1.41 +#include <glib_global.h>
    1.42 +#include "mrt2_glib2_test.h"
    1.43 +#endif /*SYMBIAN*/
    1.44 +
    1.45 +
    1.46 +
    1.47 +static gboolean any_failed = FALSE;
    1.48 +static gboolean failed = FALSE;
    1.49 +
    1.50 +#define	TEST(m,cond)	G_STMT_START { failed = !(cond); \
    1.51 +if (failed) \
    1.52 +  { assert_failed = TRUE; \
    1.53 +  if (!m) \
    1.54 +      g_print ("(%s:%d) failed for: %s\n", __FILE__, __LINE__, ( # cond )); \
    1.55 +    else \
    1.56 +      g_print ("(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), m ? (gchar*)m : ""); \
    1.57 +    fflush (stdout); \
    1.58 +    any_failed = TRUE; \
    1.59 +  } \
    1.60 +} G_STMT_END
    1.61 +
    1.62 +#define TEST_FAILED(message) \
    1.63 +  G_STMT_START { g_print ("Error: "); g_print message; g_print ("\n"); any_failed = TRUE; assert_failed = TRUE;} G_STMT_END
    1.64 +
    1.65 +#define GLIB_TEST_STRING "el dorado "
    1.66 +
    1.67 +static gboolean
    1.68 +strv_check (gchar **strv, ...)
    1.69 +{
    1.70 +  gboolean ok = TRUE;
    1.71 +  gint i = 0;
    1.72 +  va_list list;
    1.73 +
    1.74 +  va_start (list, strv);
    1.75 +  while (ok)
    1.76 +    {
    1.77 +      const gchar *str = va_arg (list, const char *);
    1.78 +      if (strv[i] == NULL)
    1.79 +	{
    1.80 +	  ok = str == NULL;
    1.81 +	  break;
    1.82 +	}
    1.83 +      if (str == NULL)
    1.84 +	ok = FALSE;
    1.85 +      else if (strcmp (strv[i], str) != 0)
    1.86 +	ok = FALSE;
    1.87 +      i++;
    1.88 +    }
    1.89 +  va_end (list);
    1.90 +
    1.91 +  g_strfreev (strv);
    1.92 +
    1.93 +  return ok;
    1.94 +}
    1.95 +
    1.96 +static gboolean
    1.97 +str_check (gchar *str,
    1.98 +	   gchar *expected)
    1.99 +{
   1.100 +  gboolean ok = (strcmp (str, expected) == 0);
   1.101 +
   1.102 +  g_free (str);
   1.103 +
   1.104 +  return ok;
   1.105 +}
   1.106 +
   1.107 +static gboolean
   1.108 +strchomp_check (gchar *str,
   1.109 +		gchar *expected)
   1.110 +{
   1.111 +  gchar *tmp = strdup (str);
   1.112 +  gboolean ok;
   1.113 +
   1.114 +  g_strchomp (tmp);
   1.115 +  ok = (strcmp (tmp, expected) == 0);
   1.116 +  g_free (tmp);
   1.117 +
   1.118 +  return ok;
   1.119 +}
   1.120 +
   1.121 +#define FOR_ALL_CTYPE(macro)	\
   1.122 +	macro(isalnum)		\
   1.123 +	macro(isalpha)		\
   1.124 +	macro(iscntrl)		\
   1.125 +	macro(isdigit)		\
   1.126 +	macro(isgraph)		\
   1.127 +	macro(islower)		\
   1.128 +	macro(isprint)		\
   1.129 +	macro(ispunct)		\
   1.130 +	macro(isspace)		\
   1.131 +	macro(isupper)		\
   1.132 +	macro(isxdigit)
   1.133 +
   1.134 +#define DEFINE_CALL_CTYPE(function)		\
   1.135 +	static int				\
   1.136 +	call_##function (int c)			\
   1.137 +	{					\
   1.138 +		return function (c);		\
   1.139 +	}
   1.140 +
   1.141 +#define DEFINE_CALL_G_ASCII_CTYPE(function)	\
   1.142 +	static gboolean				\
   1.143 +	call_g_ascii_##function (gchar c)	\
   1.144 +	{					\
   1.145 +		return g_ascii_##function (c);	\
   1.146 +	}
   1.147 +
   1.148 +FOR_ALL_CTYPE (DEFINE_CALL_CTYPE)
   1.149 +FOR_ALL_CTYPE (DEFINE_CALL_G_ASCII_CTYPE)
   1.150 +
   1.151 +static void
   1.152 +test_is_function (const char *name,
   1.153 +		  gboolean (* ascii_function) (gchar),
   1.154 +		  int (* c_library_function) (int),
   1.155 +		  gboolean (* unicode_function) (gunichar))
   1.156 +{
   1.157 +  int c;
   1.158 +
   1.159 +  for (c = 0; c <= 0x7F; c++)
   1.160 +    {
   1.161 +      gboolean ascii_result = ascii_function ((gchar)c);
   1.162 +      gboolean c_library_result = c_library_function (c) != 0;
   1.163 +      gboolean unicode_result = unicode_function ((gunichar) c);
   1.164 +      if (ascii_result != c_library_result && c != '\v')
   1.165 +	TEST_FAILED (("g_ascii_%s returned %d and %s returned %d for 0x%X",
   1.166 +		      name, ascii_result, name, c_library_result, c));
   1.167 +      if (ascii_result != unicode_result)
   1.168 +	TEST_FAILED (("g_ascii_%s returned %d and g_unichar_%s returned %d for 0x%X",
   1.169 +		      name, ascii_result, name, unicode_result, c));
   1.170 +    }
   1.171 +  for (c = 0x80; c <= 0xFF; c++)
   1.172 +    {
   1.173 +      gboolean ascii_result = ascii_function ((gchar)c);
   1.174 +      if (ascii_result)
   1.175 +	TEST_FAILED (("g_ascii_%s returned TRUE for 0x%X",
   1.176 +		      name, c));
   1.177 +    }
   1.178 +}
   1.179 +
   1.180 +static void
   1.181 +test_to_function (const char *name,
   1.182 +		  gchar (* ascii_function) (gchar),
   1.183 +		  int (* c_library_function) (int),
   1.184 +		  gunichar (* unicode_function) (gunichar))
   1.185 +{
   1.186 +  int c;
   1.187 +
   1.188 +  for (c = 0; c <= 0x7F; c++)
   1.189 +    {
   1.190 +      int ascii_result = (guchar) ascii_function ((gchar) c);
   1.191 +      int c_library_result = c_library_function (c);
   1.192 +      int unicode_result = unicode_function ((gunichar) c);
   1.193 +      if (ascii_result != c_library_result)
   1.194 +	TEST_FAILED (("g_ascii_%s returned 0x%X and %s returned 0x%X for 0x%X",
   1.195 +		      name, ascii_result, name, c_library_result, c));
   1.196 +      if (ascii_result != unicode_result)
   1.197 +	TEST_FAILED (("g_ascii_%s returned 0x%X and g_unichar_%s returned 0x%X for 0x%X",
   1.198 +		      name, ascii_result, name, unicode_result, c));
   1.199 +    }
   1.200 +  for (c = 0x80; c <= 0xFF; c++)
   1.201 +    {
   1.202 +      int ascii_result = (guchar) ascii_function ((gchar) c);
   1.203 +      if (ascii_result != c)
   1.204 +	TEST_FAILED (("g_ascii_%s returned 0x%X for 0x%X",
   1.205 +		      name, ascii_result, c));
   1.206 +    }
   1.207 +}
   1.208 +
   1.209 +static void
   1.210 +test_digit_function (const char *name,
   1.211 +		     int (* ascii_function) (gchar),
   1.212 +		     int (* unicode_function) (gunichar))
   1.213 +{
   1.214 +  int c;
   1.215 +
   1.216 +  for (c = 0; c <= 0x7F; c++)
   1.217 +    {
   1.218 +      int ascii_result = ascii_function ((gchar) c);
   1.219 +      int unicode_result = unicode_function ((gunichar) c);
   1.220 +      if (ascii_result != unicode_result)
   1.221 +	TEST_FAILED (("g_ascii_%s_value returned %d and g_unichar_%s_value returned %d for 0x%X",
   1.222 +		      name, ascii_result, name, unicode_result, c));
   1.223 +    }
   1.224 +  for (c = 0x80; c <= 0xFF; c++)
   1.225 +    {
   1.226 +      int ascii_result = ascii_function ((gchar) c);
   1.227 +      if (ascii_result != -1)
   1.228 +	TEST_FAILED (("g_ascii_%s_value returned %d for 0x%X",
   1.229 +		      name, ascii_result, c));
   1.230 +    }
   1.231 +}
   1.232 +
   1.233 +int
   1.234 +main (int   argc,
   1.235 +      char *argv[])
   1.236 +{
   1.237 +  gchar *string;
   1.238 +  gchar *vec[] = { "Foo", "Bar", NULL };
   1.239 +  gchar **copy;
   1.240 +  gchar *args[10];
   1.241 +  
   1.242 +  #ifdef SYMBIAN
   1.243 +  g_log_set_handler (NULL,  G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, &mrtLogHandler, NULL);
   1.244 +  g_set_print_handler(mrtPrintHandler);
   1.245 +  #endif /*SYMBIAN*/
   1.246 +	  
   1.247 +
   1.248 +  TEST (NULL, g_ascii_strcasecmp ("FroboZZ", "frobozz") == 0);
   1.249 +  TEST (NULL, g_ascii_strcasecmp ("frobozz", "frobozz") == 0);
   1.250 +  TEST (NULL, g_ascii_strcasecmp ("frobozz", "FROBOZZ") == 0);
   1.251 +  TEST (NULL, g_ascii_strcasecmp ("FROBOZZ", "froboz") != 0);
   1.252 +  TEST (NULL, g_ascii_strcasecmp ("", "") == 0);
   1.253 +  TEST (NULL, g_ascii_strcasecmp ("!#%&/()", "!#%&/()") == 0);
   1.254 +  TEST (NULL, g_ascii_strcasecmp ("a", "b") < 0);
   1.255 +  TEST (NULL, g_ascii_strcasecmp ("a", "B") < 0);
   1.256 +  TEST (NULL, g_ascii_strcasecmp ("A", "b") < 0);
   1.257 +  TEST (NULL, g_ascii_strcasecmp ("A", "B") < 0);
   1.258 +  TEST (NULL, g_ascii_strcasecmp ("b", "a") > 0);
   1.259 +  TEST (NULL, g_ascii_strcasecmp ("b", "A") > 0);
   1.260 +  TEST (NULL, g_ascii_strcasecmp ("B", "a") > 0);
   1.261 +  TEST (NULL, g_ascii_strcasecmp ("B", "A") > 0);
   1.262 +
   1.263 +  TEST (NULL, g_strdup (NULL) == NULL);
   1.264 +  string = g_strdup (GLIB_TEST_STRING);
   1.265 +  TEST (NULL, string != NULL);
   1.266 +  TEST (NULL, strcmp (string, GLIB_TEST_STRING) == 0);
   1.267 +  g_free(string);
   1.268 +  
   1.269 +  string = g_strconcat (GLIB_TEST_STRING, NULL);
   1.270 +  TEST (NULL, string != NULL);
   1.271 +  TEST (NULL, strcmp (string, GLIB_TEST_STRING) == 0);
   1.272 +  g_free(string);
   1.273 +  
   1.274 +  string = g_strconcat (GLIB_TEST_STRING, GLIB_TEST_STRING, 
   1.275 +			GLIB_TEST_STRING, NULL);
   1.276 +  TEST (NULL, string != NULL);
   1.277 +  TEST (NULL, strcmp (string, GLIB_TEST_STRING GLIB_TEST_STRING
   1.278 +		      GLIB_TEST_STRING) == 0);
   1.279 +  g_free(string);
   1.280 +  
   1.281 +  string = g_strdup_printf ("%05d %-5s", 21, "test");
   1.282 +  TEST (NULL, string != NULL);
   1.283 +  TEST (NULL, strcmp(string, "00021 test ") == 0);
   1.284 +  g_free (string);
   1.285 +  
   1.286 +  TEST (NULL, strcmp
   1.287 +	(g_strcompress ("abc\\\\\\\"\\b\\f\\n\\r\\t\\003\\177\\234\\313\\12345z"),
   1.288 +	 "abc\\\"\b\f\n\r\t\003\177\234\313\12345z") == 0);
   1.289 +  TEST (NULL, strcmp (g_strescape("abc\\\"\b\f\n\r\t\003\177\234\313", NULL),
   1.290 +		      "abc\\\\\\\"\\b\\f\\n\\r\\t\\003\\177\\234\\313") == 0);
   1.291 +  TEST (NULL, strcmp(g_strescape("abc\\\"\b\f\n\r\t\003\177\234\313",
   1.292 +				 "\b\f\001\002\003\004"),
   1.293 +		     "abc\\\\\\\"\b\f\\n\\r\\t\003\\177\\234\\313") == 0);
   1.294 +
   1.295 +  copy = g_strdupv (vec);
   1.296 +  TEST (NULL, strcmp (copy[0], "Foo") == 0);
   1.297 +  TEST (NULL, strcmp (copy[1], "Bar") == 0);
   1.298 +  TEST (NULL, copy[2] == NULL);
   1.299 +  g_strfreev (copy);
   1.300 +  
   1.301 +  TEST (NULL, strcmp (g_strstr_len ("FooBarFooBarFoo", 6, "Bar"),
   1.302 +		      "BarFooBarFoo") == 0);
   1.303 +  TEST (NULL, strcmp (g_strrstr ("FooBarFooBarFoo", "Bar"),
   1.304 +		      "BarFoo") == 0);
   1.305 +  TEST (NULL, strcmp (g_strrstr_len ("FooBarFooBarFoo", 14, "BarFoo"),
   1.306 +		      "BarFooBarFoo") == 0);
   1.307 +
   1.308 +  /* Test g_strsplit() */
   1.309 +  TEST (NULL, strv_check (g_strsplit ("", ",", 0), NULL));
   1.310 +  TEST (NULL, strv_check (g_strsplit ("x", ",", 0), "x", NULL));
   1.311 +  TEST (NULL, strv_check (g_strsplit ("x,y", ",", 0), "x", "y", NULL));
   1.312 +  TEST (NULL, strv_check (g_strsplit ("x,y,", ",", 0), "x", "y", "", NULL));
   1.313 +  TEST (NULL, strv_check (g_strsplit (",x,y", ",", 0), "", "x", "y", NULL));
   1.314 +  TEST (NULL, strv_check (g_strsplit (",x,y,", ",", 0), "", "x", "y", "", NULL));
   1.315 +  TEST (NULL, strv_check (g_strsplit ("x,y,z", ",", 0), "x", "y", "z", NULL));
   1.316 +  TEST (NULL, strv_check (g_strsplit ("x,y,z,", ",", 0), "x", "y", "z", "", NULL));
   1.317 +  TEST (NULL, strv_check (g_strsplit (",x,y,z", ",", 0), "", "x", "y", "z", NULL));
   1.318 +  TEST (NULL, strv_check (g_strsplit (",x,y,z,", ",", 0), "", "x", "y", "z", "", NULL));
   1.319 +  TEST (NULL, strv_check (g_strsplit (",,x,,y,,z,,", ",", 0), "", "", "x", "", "y", "", "z", "", "", NULL));
   1.320 +  TEST (NULL, strv_check (g_strsplit (",,x,,y,,z,,", ",,", 0), "", "x", "y", "z", "", NULL));
   1.321 +
   1.322 +  TEST (NULL, strv_check (g_strsplit ("", ",", 1), NULL));
   1.323 +  TEST (NULL, strv_check (g_strsplit ("x", ",", 1), "x", NULL));
   1.324 +  TEST (NULL, strv_check (g_strsplit ("x,y", ",", 1), "x,y", NULL));
   1.325 +  TEST (NULL, strv_check (g_strsplit ("x,y,", ",", 1), "x,y,", NULL));
   1.326 +  TEST (NULL, strv_check (g_strsplit (",x,y", ",", 1), ",x,y", NULL));
   1.327 +  TEST (NULL, strv_check (g_strsplit (",x,y,", ",", 1), ",x,y,", NULL));
   1.328 +  TEST (NULL, strv_check (g_strsplit ("x,y,z", ",", 1), "x,y,z", NULL));
   1.329 +  TEST (NULL, strv_check (g_strsplit ("x,y,z,", ",", 1), "x,y,z,", NULL));
   1.330 +  TEST (NULL, strv_check (g_strsplit (",x,y,z", ",", 1), ",x,y,z", NULL));
   1.331 +  TEST (NULL, strv_check (g_strsplit (",x,y,z,", ",", 1), ",x,y,z,", NULL));
   1.332 +  TEST (NULL, strv_check (g_strsplit (",,x,,y,,z,,", ",", 1), ",,x,,y,,z,,", NULL));
   1.333 +  TEST (NULL, strv_check (g_strsplit (",,x,,y,,z,,", ",,", 1), ",,x,,y,,z,,", NULL));
   1.334 +
   1.335 +  TEST (NULL, strv_check (g_strsplit ("", ",", 2), NULL));
   1.336 +  TEST (NULL, strv_check (g_strsplit ("x", ",", 2), "x", NULL));
   1.337 +  TEST (NULL, strv_check (g_strsplit ("x,y", ",", 2), "x", "y", NULL));
   1.338 +  TEST (NULL, strv_check (g_strsplit ("x,y,", ",", 2), "x", "y,", NULL));
   1.339 +  TEST (NULL, strv_check (g_strsplit (",x,y", ",", 2), "", "x,y", NULL));
   1.340 +  TEST (NULL, strv_check (g_strsplit (",x,y,", ",", 2), "", "x,y,", NULL));
   1.341 +  TEST (NULL, strv_check (g_strsplit ("x,y,z", ",", 2), "x", "y,z", NULL));
   1.342 +  TEST (NULL, strv_check (g_strsplit ("x,y,z,", ",", 2), "x", "y,z,", NULL));
   1.343 +  TEST (NULL, strv_check (g_strsplit (",x,y,z", ",", 2), "", "x,y,z", NULL));
   1.344 +  TEST (NULL, strv_check (g_strsplit (",x,y,z,", ",", 2), "", "x,y,z,", NULL));
   1.345 +  TEST (NULL, strv_check (g_strsplit (",,x,,y,,z,,", ",", 2), "", ",x,,y,,z,,", NULL));
   1.346 +  TEST (NULL, strv_check (g_strsplit (",,x,,y,,z,,", ",,", 2), "", "x,,y,,z,,", NULL));
   1.347 +
   1.348 +  /* Test g_strsplit_set() */
   1.349 +  TEST (NULL, strv_check (g_strsplit_set ("", ",/", 0), NULL));
   1.350 +  TEST (NULL, strv_check (g_strsplit_set (":def/ghi:", ":/", -1), "", "def", "ghi", "", NULL));
   1.351 +  TEST (NULL, strv_check (g_strsplit_set ("abc:def/ghi", ":/", -1), "abc", "def", "ghi", NULL));
   1.352 +  TEST (NULL, strv_check (g_strsplit_set (",;,;,;,;", ",;", -1), "", "", "", "", "", "", "", "", "", NULL));
   1.353 +  TEST (NULL, strv_check (g_strsplit_set (",,abc.def", ".,", -1), "", "", "abc", "def", NULL));
   1.354 +
   1.355 +  TEST (NULL, strv_check (g_strsplit_set (",x.y", ",.", 0), "", "x", "y", NULL));
   1.356 +  TEST (NULL, strv_check (g_strsplit_set (".x,y,", ",.", 0), "", "x", "y", "", NULL));
   1.357 +  TEST (NULL, strv_check (g_strsplit_set ("x,y.z", ",.", 0), "x", "y", "z", NULL));
   1.358 +  TEST (NULL, strv_check (g_strsplit_set ("x.y,z,", ",.", 0), "x", "y", "z", "", NULL));
   1.359 +  TEST (NULL, strv_check (g_strsplit_set (",x.y,z", ",.", 0), "", "x", "y", "z", NULL));
   1.360 +  TEST (NULL, strv_check (g_strsplit_set (",x,y,z,", ",.", 0), "", "x", "y", "z", "", NULL));
   1.361 +  TEST (NULL, strv_check (g_strsplit_set (",.x,,y,;z..", ".,;", 0), "", "", "x", "", "y", "", "z", "", "", NULL));
   1.362 +  TEST (NULL, strv_check (g_strsplit_set (",,x,,y,,z,,", ",,", 0), "", "", "x", "", "y", "", "z", "", "", NULL));
   1.363 +
   1.364 +  TEST (NULL, strv_check (g_strsplit_set ("x,y.z", ",.", 1), "x,y.z", NULL));
   1.365 +  TEST (NULL, strv_check (g_strsplit_set ("x.y,z,", ",.", 1), "x.y,z,", NULL));
   1.366 +  TEST (NULL, strv_check (g_strsplit_set (",x,y,z", ",.", 1), ",x,y,z", NULL));
   1.367 +  TEST (NULL, strv_check (g_strsplit_set (",x,y.z,", ",.", 1), ",x,y.z,", NULL));
   1.368 +  TEST (NULL, strv_check (g_strsplit_set (",,x,.y,,z,,", ",.", 1), ",,x,.y,,z,,", NULL));
   1.369 +  TEST (NULL, strv_check (g_strsplit_set (",.x,,y,,z,,", ",,..", 1), ",.x,,y,,z,,", NULL));
   1.370 +   
   1.371 +  TEST (NULL, strv_check (g_strsplit_set ("", ",", 0), NULL));
   1.372 +  TEST (NULL, strv_check (g_strsplit_set ("x", ",", 0), "x", NULL));
   1.373 +  TEST (NULL, strv_check (g_strsplit_set ("x,y", ",", 0), "x", "y", NULL));
   1.374 +  TEST (NULL, strv_check (g_strsplit_set ("x,y,", ",", 0), "x", "y", "", NULL));
   1.375 +  TEST (NULL, strv_check (g_strsplit_set (",x,y", ",", 0), "", "x", "y", NULL));
   1.376 +  TEST (NULL, strv_check (g_strsplit_set (",x,y,", ",", 0), "", "x", "y", "", NULL));
   1.377 +  TEST (NULL, strv_check (g_strsplit_set ("x,y,z", ",", 0), "x", "y", "z", NULL));
   1.378 +  TEST (NULL, strv_check (g_strsplit_set ("x,y,z,", ",", 0), "x", "y", "z", "", NULL));
   1.379 +  TEST (NULL, strv_check (g_strsplit_set (",x,y,z", ",", 0), "", "x", "y", "z", NULL));
   1.380 +  TEST (NULL, strv_check (g_strsplit_set (",x,y,z,", ",", 0), "", "x", "y", "z", "", NULL));
   1.381 +  TEST (NULL, strv_check (g_strsplit_set (",,x,,y,,z,,", ",", 0), "", "", "x", "", "y", "", "z", "", "", NULL));
   1.382 +
   1.383 +  TEST (NULL, strv_check (g_strsplit_set ("", ",", 1), NULL));
   1.384 +  TEST (NULL, strv_check (g_strsplit_set ("x", ",", 1), "x", NULL));
   1.385 +  TEST (NULL, strv_check (g_strsplit_set ("x,y", ",", 1), "x,y", NULL));
   1.386 +  TEST (NULL, strv_check (g_strsplit_set ("x,y,", ",", 1), "x,y,", NULL));
   1.387 +  TEST (NULL, strv_check (g_strsplit_set (",x,y", ",", 1), ",x,y", NULL));
   1.388 +  TEST (NULL, strv_check (g_strsplit_set (",x,y,", ",", 1), ",x,y,", NULL));
   1.389 +  TEST (NULL, strv_check (g_strsplit_set ("x,y,z", ",", 1), "x,y,z", NULL));
   1.390 +  TEST (NULL, strv_check (g_strsplit_set ("x,y,z,", ",", 1), "x,y,z,", NULL));
   1.391 +  TEST (NULL, strv_check (g_strsplit_set (",x,y,z", ",", 1), ",x,y,z", NULL));
   1.392 +  TEST (NULL, strv_check (g_strsplit_set (",x,y,z,", ",", 1), ",x,y,z,", NULL));
   1.393 +  TEST (NULL, strv_check (g_strsplit_set (",,x,,y,,z,,", ",", 1), ",,x,,y,,z,,", NULL));
   1.394 +  TEST (NULL, strv_check (g_strsplit_set (",,x,,y,,z,,", ",,", 1), ",,x,,y,,z,,", NULL));
   1.395 +
   1.396 +  TEST (NULL, strv_check (g_strsplit_set ("", ",", 2), NULL));
   1.397 +  TEST (NULL, strv_check (g_strsplit_set ("x", ",", 2), "x", NULL));
   1.398 +  TEST (NULL, strv_check (g_strsplit_set ("x,y", ",", 2), "x", "y", NULL));
   1.399 +  TEST (NULL, strv_check (g_strsplit_set ("x,y,", ",", 2), "x", "y,", NULL));
   1.400 +  TEST (NULL, strv_check (g_strsplit_set (",x,y", ",", 2), "", "x,y", NULL));
   1.401 +  TEST (NULL, strv_check (g_strsplit_set (",x,y,", ",", 2), "", "x,y,", NULL));
   1.402 +  TEST (NULL, strv_check (g_strsplit_set ("x,y,z", ",", 2), "x", "y,z", NULL));
   1.403 +  TEST (NULL, strv_check (g_strsplit_set ("x,y,z,", ",", 2), "x", "y,z,", NULL));
   1.404 +  TEST (NULL, strv_check (g_strsplit_set (",x,y,z", ",", 2), "", "x,y,z", NULL));
   1.405 +  TEST (NULL, strv_check (g_strsplit_set (",x,y,z,", ",", 2), "", "x,y,z,", NULL));
   1.406 +  TEST (NULL, strv_check (g_strsplit_set (",,x,,y,,z,,", ",", 2), "", ",x,,y,,z,,", NULL));
   1.407 +  
   1.408 +  TEST (NULL, strv_check (g_strsplit_set (",,x,.y,..z,,", ",.", 3), "", "", "x,.y,..z,,", NULL));
   1.409 +
   1.410 +  
   1.411 +  
   1.412 +  #define TEST_IS(name) test_is_function (#name, call_g_ascii_##name, call_##name, g_unichar_##name);
   1.413 +
   1.414 +  FOR_ALL_CTYPE(TEST_IS)
   1.415 +
   1.416 +  #undef TEST_IS
   1.417 +
   1.418 +  #define TEST_TO(name) test_to_function (#name, g_ascii_##name, name, g_unichar_##name)
   1.419 +
   1.420 +  TEST_TO (tolower);
   1.421 +  TEST_TO (toupper);
   1.422 +
   1.423 +  #undef TEST_TO
   1.424 +
   1.425 +  #define TEST_DIGIT(name) test_digit_function (#name, g_ascii_##name##_value, g_unichar_##name##_value)
   1.426 +
   1.427 +  TEST_DIGIT (digit);
   1.428 +  TEST_DIGIT (xdigit);
   1.429 +
   1.430 +  #undef TEST_DIGIT
   1.431 +
   1.432 +  /* Tests for strchomp () */
   1.433 +  TEST (NULL, strchomp_check ("", ""));
   1.434 +  TEST (NULL, strchomp_check (" ", ""));
   1.435 +  TEST (NULL, strchomp_check (" \t\r\n", ""));
   1.436 +  TEST (NULL, strchomp_check ("a ", "a"));
   1.437 +  TEST (NULL, strchomp_check ("a  ", "a"));
   1.438 +  TEST (NULL, strchomp_check ("a a", "a a"));
   1.439 +  TEST (NULL, strchomp_check ("a a ", "a a"));
   1.440 +
   1.441 +  /* Tests for g_build_path, g_build_filename */
   1.442 +
   1.443 +  TEST (NULL, str_check (g_build_path ("", NULL), ""));
   1.444 +  TEST (NULL, str_check (g_build_path ("", "", NULL), ""));
   1.445 +  TEST (NULL, str_check (g_build_path ("", "x", NULL), "x"));
   1.446 +  TEST (NULL, str_check (g_build_path ("", "x", "y",  NULL), "xy"));
   1.447 +  TEST (NULL, str_check (g_build_path ("", "x", "y", "z", NULL), "xyz"));
   1.448 +
   1.449 +  TEST (NULL, str_check (g_build_path (":", NULL), ""));
   1.450 +  TEST (NULL, str_check (g_build_path (":", ":", NULL), ":"));
   1.451 +  TEST (NULL, str_check (g_build_path (":", ":x", NULL), ":x"));
   1.452 +  TEST (NULL, str_check (g_build_path (":", "x:", NULL), "x:"));
   1.453 +  TEST (NULL, str_check (g_build_path (":", "", "x", NULL), "x"));
   1.454 +  TEST (NULL, str_check (g_build_path (":", "", ":x", NULL), ":x"));
   1.455 +  TEST (NULL, str_check (g_build_path (":", ":", "x", NULL), ":x"));
   1.456 +  TEST (NULL, str_check (g_build_path (":", "::", "x", NULL), "::x"));
   1.457 +  TEST (NULL, str_check (g_build_path (":", "x", "", NULL), "x"));
   1.458 +  TEST (NULL, str_check (g_build_path (":", "x:", "", NULL), "x:"));
   1.459 +  TEST (NULL, str_check (g_build_path (":", "x", ":", NULL), "x:"));
   1.460 +  TEST (NULL, str_check (g_build_path (":", "x", "::", NULL), "x::"));
   1.461 +  TEST (NULL, str_check (g_build_path (":", "x", "y",  NULL), "x:y"));
   1.462 +  TEST (NULL, str_check (g_build_path (":", ":x", "y", NULL), ":x:y"));
   1.463 +  TEST (NULL, str_check (g_build_path (":", "x", "y:", NULL), "x:y:"));
   1.464 +  TEST (NULL, str_check (g_build_path (":", ":x:", ":y:", NULL), ":x:y:"));
   1.465 +  TEST (NULL, str_check (g_build_path (":", ":x::", "::y:", NULL), ":x:y:"));
   1.466 +  TEST (NULL, str_check (g_build_path (":", "x", "","y",  NULL), "x:y"));
   1.467 +  TEST (NULL, str_check (g_build_path (":", "x", ":", "y",  NULL), "x:y"));
   1.468 +  TEST (NULL, str_check (g_build_path (":", "x", "::", "y",  NULL), "x:y"));
   1.469 +  TEST (NULL, str_check (g_build_path (":", "x", "y", "z", NULL), "x:y:z"));
   1.470 +  TEST (NULL, str_check (g_build_path (":", ":x:", ":y:", ":z:", NULL), ":x:y:z:"));
   1.471 +  TEST (NULL, str_check (g_build_path (":", "::x::", "::y::", "::z::", NULL), "::x:y:z::"));
   1.472 +
   1.473 +  TEST (NULL, str_check (g_build_path ("::", NULL), ""));
   1.474 +  TEST (NULL, str_check (g_build_path ("::", "::", NULL), "::"));
   1.475 +  TEST (NULL, str_check (g_build_path ("::", ":::", NULL), ":::"));
   1.476 +  TEST (NULL, str_check (g_build_path ("::", "::x", NULL), "::x"));
   1.477 +  TEST (NULL, str_check (g_build_path ("::", "x::", NULL), "x::"));
   1.478 +  TEST (NULL, str_check (g_build_path ("::", "", "x", NULL), "x"));
   1.479 +  TEST (NULL, str_check (g_build_path ("::", "", "::x", NULL), "::x"));
   1.480 +  TEST (NULL, str_check (g_build_path ("::", "::", "x", NULL), "::x"));
   1.481 +  TEST (NULL, str_check (g_build_path ("::", "::::", "x", NULL), "::::x"));
   1.482 +  TEST (NULL, str_check (g_build_path ("::", "x", "", NULL), "x"));
   1.483 +  TEST (NULL, str_check (g_build_path ("::", "x::", "", NULL), "x::"));
   1.484 +  TEST (NULL, str_check (g_build_path ("::", "x", "::", NULL), "x::"));
   1.485 +  /* This following is weird, but keeps the definition simple */
   1.486 +  TEST (NULL, str_check (g_build_path ("::", "x", ":::", NULL), "x:::::"));
   1.487 +  TEST (NULL, str_check (g_build_path ("::", "x", "::::", NULL), "x::::"));
   1.488 +  TEST (NULL, str_check (g_build_path ("::", "x", "y",  NULL), "x::y"));
   1.489 +  TEST (NULL, str_check (g_build_path ("::", "::x", "y", NULL), "::x::y"));
   1.490 +  TEST (NULL, str_check (g_build_path ("::", "x", "y::", NULL), "x::y::"));
   1.491 +  TEST (NULL, str_check (g_build_path ("::", "::x::", "::y::", NULL), "::x::y::"));
   1.492 +  TEST (NULL, str_check (g_build_path ("::", "::x:::", ":::y::", NULL), "::x::::y::"));
   1.493 +  TEST (NULL, str_check (g_build_path ("::", "::x::::", "::::y::", NULL), "::x::y::"));
   1.494 +  TEST (NULL, str_check (g_build_path ("::", "x", "", "y",  NULL), "x::y"));
   1.495 +  TEST (NULL, str_check (g_build_path ("::", "x", "::", "y",  NULL), "x::y"));
   1.496 +  TEST (NULL, str_check (g_build_path ("::", "x", "::::", "y",  NULL), "x::y"));
   1.497 +  TEST (NULL, str_check (g_build_path ("::", "x", "y", "z", NULL), "x::y::z"));
   1.498 +  TEST (NULL, str_check (g_build_path ("::", "::x::", "::y::", "::z::", NULL), "::x::y::z::"));
   1.499 +  TEST (NULL, str_check (g_build_path ("::", ":::x:::", ":::y:::", ":::z:::", NULL), ":::x::::y::::z:::"));
   1.500 +  TEST (NULL, str_check (g_build_path ("::", "::::x::::", "::::y::::", "::::z::::", NULL), "::::x::y::z::::"));
   1.501 +
   1.502 +  args[0] = NULL;
   1.503 +  TEST (NULL, str_check (g_build_pathv ("", args), ""));
   1.504 +  args[0] = ""; args[1] = NULL;
   1.505 +  TEST (NULL, str_check (g_build_pathv ("", args), ""));
   1.506 +  args[0] = "x"; args[1] = NULL;
   1.507 +  TEST (NULL, str_check (g_build_pathv ("", args), "x"));
   1.508 +  args[0] = "x"; args[1] = "y"; args[2] = NULL;
   1.509 +  TEST (NULL, str_check (g_build_pathv ("", args), "xy"));
   1.510 +  args[0] = "x"; args[1] = "y"; args[2] = "z", args[3] = NULL;
   1.511 +  TEST (NULL, str_check (g_build_pathv ("", args), "xyz"));
   1.512 +
   1.513 +  args[0] = NULL;
   1.514 +  TEST (NULL, str_check (g_build_pathv (":", args), ""));
   1.515 +  args[0] = ":"; args[1] = NULL;
   1.516 +  TEST (NULL, str_check (g_build_pathv (":", args), ":"));
   1.517 +  args[0] = ":x"; args[1] = NULL;
   1.518 +  TEST (NULL, str_check (g_build_pathv (":", args), ":x"));
   1.519 +  args[0] = "x:"; args[1] = NULL;
   1.520 +  TEST (NULL, str_check (g_build_pathv (":", args), "x:"));
   1.521 +  args[0] = ""; args[1] = "x"; args[2] = NULL;
   1.522 +  TEST (NULL, str_check (g_build_pathv (":", args), "x"));
   1.523 +  args[0] = ""; args[1] = ":x"; args[2] = NULL;
   1.524 +  TEST (NULL, str_check (g_build_pathv (":", args), ":x"));
   1.525 +  args[0] = ":"; args[1] = "x"; args[2] = NULL;
   1.526 +  TEST (NULL, str_check (g_build_pathv (":", args), ":x"));
   1.527 +  args[0] = "::"; args[1] = "x"; args[2] = NULL;
   1.528 +  TEST (NULL, str_check (g_build_pathv (":", args), "::x"));
   1.529 +  args[0] = "x"; args[1] = ""; args[2] = NULL;
   1.530 +  TEST (NULL, str_check (g_build_pathv (":", args), "x"));
   1.531 +  args[0] = "x:"; args[1] = ""; args[2] = NULL;
   1.532 +  TEST (NULL, str_check (g_build_pathv (":", args), "x:"));
   1.533 +  args[0] = "x"; args[1] = ":"; args[2] = NULL;
   1.534 +  TEST (NULL, str_check (g_build_pathv (":", args), "x:"));
   1.535 +  args[0] = "x"; args[1] = "::"; args[2] = NULL;
   1.536 +  TEST (NULL, str_check (g_build_pathv (":", args), "x::"));
   1.537 +  args[0] = "x"; args[1] = "y"; args[2] = NULL;
   1.538 +  TEST (NULL, str_check (g_build_pathv (":", args), "x:y"));
   1.539 +  args[0] = ":x"; args[1] = "y"; args[2] = NULL;
   1.540 +  TEST (NULL, str_check (g_build_pathv (":", args), ":x:y"));
   1.541 +  args[0] = "x"; args[1] = "y:"; args[2] = NULL;
   1.542 +  TEST (NULL, str_check (g_build_pathv (":", args), "x:y:"));
   1.543 +  args[0] = ":x:"; args[1] = ":y:"; args[2] = NULL;
   1.544 +  TEST (NULL, str_check (g_build_pathv (":", args), ":x:y:"));
   1.545 +  args[0] = ":x::"; args[1] = "::y:"; args[2] = NULL;
   1.546 +  TEST (NULL, str_check (g_build_pathv (":", args), ":x:y:"));
   1.547 +  args[0] = "x"; args[1] = ""; args[2] = "y"; args[3] = NULL;
   1.548 +  TEST (NULL, str_check (g_build_pathv (":", args), "x:y"));
   1.549 +  args[0] = "x"; args[1] = ":"; args[2] = "y"; args[3] = NULL;
   1.550 +  TEST (NULL, str_check (g_build_pathv (":", args), "x:y"));
   1.551 +  args[0] = "x"; args[1] = "::"; args[2] = "y"; args[3] = NULL;
   1.552 +  TEST (NULL, str_check (g_build_pathv (":", args), "x:y"));
   1.553 +  args[0] = "x"; args[1] = "y"; args[2] = "z"; args[3] = NULL;
   1.554 +  TEST (NULL, str_check (g_build_pathv (":", args), "x:y:z"));
   1.555 +  args[0] = ":x:"; args[1] = ":y:"; args[2] = ":z:"; args[3] = NULL;
   1.556 +  TEST (NULL, str_check (g_build_pathv (":", args), ":x:y:z:"));
   1.557 +  args[0] = "::x::"; args[1] = "::y::"; args[2] = "::z::"; args[3] = NULL;
   1.558 +  TEST (NULL, str_check (g_build_pathv (":", args), "::x:y:z::"));
   1.559 +
   1.560 +  args[0] = NULL;
   1.561 +  TEST (NULL, str_check (g_build_pathv ("::", args), ""));
   1.562 +  args[0] = "::"; args[1] = NULL;
   1.563 +  TEST (NULL, str_check (g_build_pathv ("::", args), "::"));
   1.564 +  args[0] = ":::"; args[1] = NULL;
   1.565 +  TEST (NULL, str_check (g_build_pathv ("::", args), ":::"));
   1.566 +  args[0] = "::x"; args[1] = NULL;
   1.567 +  TEST (NULL, str_check (g_build_pathv ("::", args), "::x"));
   1.568 +  args[0] = "x::"; args[1] = NULL;
   1.569 +  TEST (NULL, str_check (g_build_pathv ("::", args), "x::"));
   1.570 +  args[0] = ""; args[1] = "x"; args[2] = NULL;
   1.571 +  TEST (NULL, str_check (g_build_pathv ("::", args), "x"));
   1.572 +  args[0] = ""; args[1] = "::x"; args[2] = NULL;
   1.573 +  TEST (NULL, str_check (g_build_pathv ("::", args), "::x"));
   1.574 +  args[0] = "::"; args[1] = "x"; args[2] = NULL;
   1.575 +  TEST (NULL, str_check (g_build_pathv ("::", args), "::x"));
   1.576 +  args[0] = "::::"; args[1] = "x"; args[2] = NULL;
   1.577 +  TEST (NULL, str_check (g_build_pathv ("::", args), "::::x"));
   1.578 +  args[0] = "x"; args[1] = ""; args[2] = NULL;
   1.579 +  TEST (NULL, str_check (g_build_pathv ("::", args), "x"));
   1.580 +  args[0] = "x::"; args[1] = ""; args[2] = NULL;
   1.581 +  TEST (NULL, str_check (g_build_pathv ("::", args), "x::"));
   1.582 +  args[0] = "x"; args[1] = "::"; args[2] = NULL;
   1.583 +  TEST (NULL, str_check (g_build_pathv ("::", args), "x::"));
   1.584 +  /* This following is weird, but keeps the definition simple */
   1.585 +  args[0] = "x"; args[1] = ":::"; args[2] = NULL;
   1.586 +  TEST (NULL, str_check (g_build_pathv ("::", args), "x:::::"));
   1.587 +  args[0] = "x"; args[1] = "::::"; args[2] = NULL;
   1.588 +  TEST (NULL, str_check (g_build_pathv ("::", args), "x::::"));
   1.589 +  args[0] = "x"; args[1] = "y"; args[2] = NULL;
   1.590 +  TEST (NULL, str_check (g_build_pathv ("::", args), "x::y"));
   1.591 +  args[0] = "::x"; args[1] = "y"; args[2] = NULL;
   1.592 +  TEST (NULL, str_check (g_build_pathv ("::", args), "::x::y"));
   1.593 +  args[0] = "x"; args[1] = "y::"; args[2] = NULL;
   1.594 +  TEST (NULL, str_check (g_build_pathv ("::", args), "x::y::"));
   1.595 +  args[0] = "::x::"; args[1] = "::y::"; args[2] = NULL;
   1.596 +  TEST (NULL, str_check (g_build_pathv ("::", args), "::x::y::"));
   1.597 +  args[0] = "::x:::"; args[1] = ":::y::"; args[2] = NULL;
   1.598 +  TEST (NULL, str_check (g_build_pathv ("::", args), "::x::::y::"));
   1.599 +  args[0] = "::x::::"; args[1] = "::::y::"; args[2] = NULL;
   1.600 +  TEST (NULL, str_check (g_build_pathv ("::", args), "::x::y::"));
   1.601 +  args[0] = "x"; args[1] = ""; args[2] = "y"; args[3] = NULL;
   1.602 +  TEST (NULL, str_check (g_build_pathv ("::", args), "x::y"));
   1.603 +  args[0] = "x"; args[1] = "::"; args[2] = "y"; args[3] = NULL;
   1.604 +  TEST (NULL, str_check (g_build_pathv ("::", args), "x::y"));
   1.605 +  args[0] = "x"; args[1] = "::::"; args[2] = "y"; args[3] = NULL;
   1.606 +  TEST (NULL, str_check (g_build_pathv ("::", args), "x::y"));
   1.607 +  args[0] = "x"; args[1] = "y"; args[2] = "z"; args[3] = NULL;
   1.608 +  TEST (NULL, str_check (g_build_pathv ("::", args), "x::y::z"));
   1.609 +  args[0] = "::x::"; args[1] = "::y::"; args[2] = "::z::"; args[3] = NULL;
   1.610 +  TEST (NULL, str_check (g_build_pathv ("::", args), "::x::y::z::"));
   1.611 +  args[0] = ":::x:::"; args[1] = ":::y:::"; args[2] = ":::z:::"; args[3] = NULL;
   1.612 +  TEST (NULL, str_check (g_build_pathv ("::", args), ":::x::::y::::z:::"));
   1.613 +  args[0] = "::::x::::"; args[1] = "::::y::::"; args[2] = "::::z::::"; args[3] = NULL;
   1.614 +  TEST (NULL, str_check (g_build_pathv ("::", args), "::::x::y::z::::"));
   1.615 +
   1.616 +#define S G_DIR_SEPARATOR_S
   1.617 +
   1.618 +  TEST (NULL, str_check (g_build_filename (NULL), ""));
   1.619 +  TEST (NULL, str_check (g_build_filename (S, NULL), S));
   1.620 +  TEST (NULL, str_check (g_build_filename (S"x", NULL), S"x"));
   1.621 +  TEST (NULL, str_check (g_build_filename ("x"S, NULL), "x"S));
   1.622 +  TEST (NULL, str_check (g_build_filename ("", "x", NULL), "x"));
   1.623 +  TEST (NULL, str_check (g_build_filename ("", S"x", NULL), S"x"));
   1.624 +  TEST (NULL, str_check (g_build_filename (S, "x", NULL), S"x"));
   1.625 +  TEST (NULL, str_check (g_build_filename (S S, "x", NULL), S S"x"));
   1.626 +  TEST (NULL, str_check (g_build_filename ("x", "", NULL), "x"));
   1.627 +  TEST (NULL, str_check (g_build_filename ("x"S, "", NULL), "x"S));
   1.628 +  TEST (NULL, str_check (g_build_filename ("x", S, NULL), "x"S));
   1.629 +  TEST (NULL, str_check (g_build_filename ("x", S S, NULL), "x"S S));
   1.630 +  TEST (NULL, str_check (g_build_filename ("x", "y",  NULL), "x"S"y"));
   1.631 +  TEST (NULL, str_check (g_build_filename (S"x", "y", NULL), S"x"S"y"));
   1.632 +  TEST (NULL, str_check (g_build_filename ("x", "y"S, NULL), "x"S"y"S));
   1.633 +  TEST (NULL, str_check (g_build_filename (S"x"S, S"y"S, NULL), S"x"S"y"S));
   1.634 +  TEST (NULL, str_check (g_build_filename (S"x"S S, S S"y"S, NULL), S"x"S"y"S));
   1.635 +  TEST (NULL, str_check (g_build_filename ("x", "", "y",  NULL), "x"S"y"));
   1.636 +  TEST (NULL, str_check (g_build_filename ("x", S, "y",  NULL), "x"S"y"));
   1.637 +  TEST (NULL, str_check (g_build_filename ("x", S S, "y",  NULL), "x"S"y"));
   1.638 +  TEST (NULL, str_check (g_build_filename ("x", "y", "z", NULL), "x"S"y"S"z"));
   1.639 +  TEST (NULL, str_check (g_build_filename (S"x"S, S"y"S, S"z"S, NULL), S"x"S"y"S"z"S));
   1.640 +  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));
   1.641 +
   1.642 +  args[0] = NULL;
   1.643 +  TEST (NULL, str_check (g_build_filenamev (args), ""));
   1.644 +  args[0] = S; args[1] = NULL;
   1.645 +  TEST (NULL, str_check (g_build_filenamev (args), S));
   1.646 +  args[0] = S"x"; args[1] = NULL;
   1.647 +  TEST (NULL, str_check (g_build_filenamev (args), S"x"));
   1.648 +  args[0] = "x"S; args[1] = NULL;
   1.649 +  TEST (NULL, str_check (g_build_filenamev (args), "x"S));
   1.650 +  args[0] = ""; args[1] = "x"; args[2] = NULL;
   1.651 +  TEST (NULL, str_check (g_build_filenamev (args), "x"));
   1.652 +  args[0] = ""; args[1] = S"x"; args[2] = NULL;
   1.653 +  TEST (NULL, str_check (g_build_filenamev (args), S"x"));
   1.654 +  args[0] = S; args[1] = "x"; args[2] = NULL;
   1.655 +  TEST (NULL, str_check (g_build_filenamev (args), S"x"));
   1.656 +  args[0] = S S; args[1] = "x"; args[2] = NULL;
   1.657 +  TEST (NULL, str_check (g_build_filenamev (args), S S"x"));
   1.658 +  args[0] = "x"; args[1] = ""; args[2] = NULL;
   1.659 +  TEST (NULL, str_check (g_build_filenamev (args), "x"));
   1.660 +  args[0] = "x"S; args[1] = ""; args[2] = NULL;
   1.661 +  TEST (NULL, str_check (g_build_filenamev (args), "x"S));
   1.662 +  args[0] = "x"; args[1] = S; args[2] = NULL;
   1.663 +  TEST (NULL, str_check (g_build_filenamev (args), "x"S));
   1.664 +  args[0] = "x"; args[1] = S S; args[2] = NULL;
   1.665 +  TEST (NULL, str_check (g_build_filenamev (args), "x"S S));
   1.666 +  args[0] = "x"; args[1] = "y"; args[2] = NULL;
   1.667 +  TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"));
   1.668 +  args[0] = S"x"; args[1] = "y"; args[2] = NULL;
   1.669 +  TEST (NULL, str_check (g_build_filenamev (args), S"x"S"y"));
   1.670 +  args[0] = "x"; args[1] = "y"S; args[2] = NULL;
   1.671 +  TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"S));
   1.672 +  args[0] = S"x"S; args[1] = S"y"S; args[2] = NULL;
   1.673 +  TEST (NULL, str_check (g_build_filenamev (args), S"x"S"y"S));
   1.674 +  args[0] = S"x"S S; args[1] = S S"y"S; args[2] = NULL;
   1.675 +  TEST (NULL, str_check (g_build_filenamev (args), S"x"S"y"S));
   1.676 +  args[0] = "x"; args[1] = ""; args[2] = "y"; args[3] = NULL;
   1.677 +  TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"));
   1.678 +  args[0] = "x"; args[1] = S; args[2] = "y"; args[3] = NULL;
   1.679 +  TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"));
   1.680 +  args[0] = "x"; args[1] = S S; args[2] = "y"; args[3] = NULL;
   1.681 +  TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"));
   1.682 +  args[0] = "x"; args[1] = "y"; args[2] = "z"; args[3] = NULL;
   1.683 +  TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"S"z"));
   1.684 +  args[0] = S"x"S; args[1] = S"y"S; args[2] = S"z"S; args[3] = NULL;
   1.685 +  TEST (NULL, str_check (g_build_filenamev (args), S"x"S"y"S"z"S));
   1.686 +  args[0] = S S"x"S S; args[1] = S S"y"S S; args[2] = S S"z"S S; args[3] = NULL;
   1.687 +  TEST (NULL, str_check (g_build_filenamev (args), S S"x"S"y"S"z"S S));
   1.688 +
   1.689 +#ifdef G_OS_WIN32
   1.690 +
   1.691 +  /* Test also using the slash as file name separator */
   1.692 +#define U "/"
   1.693 +  TEST (NULL, str_check (g_build_filename (NULL), ""));
   1.694 +  TEST (NULL, str_check (g_build_filename (U, NULL), U));
   1.695 +  TEST (NULL, str_check (g_build_filename (U"x", NULL), U"x"));
   1.696 +  TEST (NULL, str_check (g_build_filename ("x"U, NULL), "x"U));
   1.697 +  TEST (NULL, str_check (g_build_filename ("", U"x", NULL), U"x"));
   1.698 +  TEST (NULL, str_check (g_build_filename ("", U"x", NULL), U"x"));
   1.699 +  TEST (NULL, str_check (g_build_filename (U, "x", NULL), U"x"));
   1.700 +  TEST (NULL, str_check (g_build_filename (U U, "x", NULL), U U"x"));
   1.701 +  TEST (NULL, str_check (g_build_filename (U S, "x", NULL), U S"x"));
   1.702 +  TEST (NULL, str_check (g_build_filename ("x"U, "", NULL), "x"U));
   1.703 +  TEST (NULL, str_check (g_build_filename ("x"S"y", "z"U"a", NULL), "x"S"y"S"z"U"a"));
   1.704 +  TEST (NULL, str_check (g_build_filename ("x", U, NULL), "x"U));
   1.705 +  TEST (NULL, str_check (g_build_filename ("x", U U, NULL), "x"U U));
   1.706 +  TEST (NULL, str_check (g_build_filename ("x", S U, NULL), "x"S U));
   1.707 +  TEST (NULL, str_check (g_build_filename (U"x", "y", NULL), U"x"U"y"));
   1.708 +  TEST (NULL, str_check (g_build_filename ("x", "y"U, NULL), "x"U"y"U));
   1.709 +  TEST (NULL, str_check (g_build_filename (U"x"U, U"y"U, NULL), U"x"U"y"U));
   1.710 +  TEST (NULL, str_check (g_build_filename (U"x"U U, U U"y"U, NULL), U"x"U"y"U));
   1.711 +  TEST (NULL, str_check (g_build_filename ("x", U, "y",  NULL), "x"U"y"));
   1.712 +  TEST (NULL, str_check (g_build_filename ("x", U U, "y",  NULL), "x"U"y"));
   1.713 +  TEST (NULL, str_check (g_build_filename ("x", U S, "y",  NULL), "x"S"y"));
   1.714 +  TEST (NULL, str_check (g_build_filename ("x", S U, "y",  NULL), "x"U"y"));
   1.715 +  TEST (NULL, str_check (g_build_filename ("x", U "y", "z", NULL), "x"U"y"U"z"));
   1.716 +  TEST (NULL, str_check (g_build_filename ("x", S "y", "z", NULL), "x"S"y"S"z"));
   1.717 +  TEST (NULL, str_check (g_build_filename ("x", S "y", "z", U, "a", "b", NULL), "x"S"y"S"z"U"a"U"b"));
   1.718 +  TEST (NULL, str_check (g_build_filename (U"x"U, U"y"U, U"z"U, NULL), U"x"U"y"U"z"U));
   1.719 +  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));
   1.720 +
   1.721 +  args[0] = NULL;
   1.722 +  TEST (NULL, str_check (g_build_filenamev (args), ""));
   1.723 +  args[0] = U; args[1] = NULL;
   1.724 +  TEST (NULL, str_check (g_build_filenamev (args), U));
   1.725 +  args[0] = U"x"; args[1] = NULL;
   1.726 +  TEST (NULL, str_check (g_build_filenamev (args), U"x"));
   1.727 +  args[0] = "x"U; args[1] = NULL;
   1.728 +  TEST (NULL, str_check (g_build_filenamev (args), "x"U));
   1.729 +  args[0] = ""; args[1] = U"x"; args[2] = NULL;
   1.730 +  TEST (NULL, str_check (g_build_filenamev (args), U"x"));
   1.731 +  args[0] = ""; args[1] = U"x"; args[2] = NULL;
   1.732 +  TEST (NULL, str_check (g_build_filenamev (args), U"x"));
   1.733 +  args[0] = U; args[1] = "x"; args[2] = NULL;
   1.734 +  TEST (NULL, str_check (g_build_filenamev (args), U"x"));
   1.735 +  args[0] = U U; args[1] = "x"; args[2] = NULL;
   1.736 +  TEST (NULL, str_check (g_build_filenamev (args), U U"x"));
   1.737 +  args[0] = U S; args[1] = "x"; args[2] = NULL;
   1.738 +  TEST (NULL, str_check (g_build_filenamev (args), U S"x"));
   1.739 +  args[0] = "x"U; args[1] = ""; args[2] = NULL;
   1.740 +  TEST (NULL, str_check (g_build_filenamev (args), "x"U));
   1.741 +  args[0] = "x"S"y"; args[1] = "z"U"a"; args[2] = NULL;
   1.742 +  TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"S"z"U"a"));
   1.743 +  args[0] = "x"; args[1] = U; args[2] = NULL;
   1.744 +  TEST (NULL, str_check (g_build_filenamev (args), "x"U));
   1.745 +  args[0] = "x"; args[1] = U U; args[2] = NULL;
   1.746 +  TEST (NULL, str_check (g_build_filenamev (args), "x"U U));
   1.747 +  args[0] = "x"; args[1] = S U; args[2] = NULL;
   1.748 +  TEST (NULL, str_check (g_build_filenamev (args), "x"S U));
   1.749 +  args[0] = U"x"; args[1] = "y"; args[2] = NULL;
   1.750 +  TEST (NULL, str_check (g_build_filenamev (args), U"x"U"y"));
   1.751 +  args[0] = "x"; args[1] = "y"U; args[2] = NULL;
   1.752 +  TEST (NULL, str_check (g_build_filenamev (args), "x"U"y"U));
   1.753 +  args[0] = U"x"U; args[1] = U"y"U; args[2] = NULL;
   1.754 +  TEST (NULL, str_check (g_build_filenamev (args), U"x"U"y"U));
   1.755 +  args[0] = U"x"U U; args[1] = U U"y"U; args[2] = NULL;
   1.756 +  TEST (NULL, str_check (g_build_filenamev (args), U"x"U"y"U));
   1.757 +  args[0] = "x"; args[1] = U; args[2] = "y", args[3] = NULL;
   1.758 +  TEST (NULL, str_check (g_build_filenamev (args), "x"U"y"));
   1.759 +  args[0] = "x"; args[1] = U U; args[2] = "y", args[3] = NULL;
   1.760 +  TEST (NULL, str_check (g_build_filenamev (args), "x"U"y"));
   1.761 +  args[0] = "x"; args[1] = U S; args[2] = "y", args[3] = NULL;
   1.762 +  TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"));
   1.763 +  args[0] = "x"; args[1] = S U; args[2] = "y", args[3] = NULL;
   1.764 +  TEST (NULL, str_check (g_build_filenamev (args), "x"U"y"));
   1.765 +  args[0] = "x"; args[1] = U "y"; args[2] = "z", args[3] = NULL;
   1.766 +  TEST (NULL, str_check (g_build_filenamev (args), "x"U"y"U"z"));
   1.767 +  args[0] = "x"; args[1] = S "y"; args[2] = "z", args[3] = NULL;
   1.768 +  TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"S"z"));
   1.769 +  args[0] = "x"; args[1] = S "y"; args[2] = "z", args[3] = U;
   1.770 +  args[4] = "a"; args[5] = "b"; args[6] = NULL;
   1.771 +  TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"S"z"U"a"U"b"));
   1.772 +  args[0] = U"x"U; args[1] = U"y"U; args[2] = U"z"U, args[3] = NULL;
   1.773 +  TEST (NULL, str_check (g_build_filenamev (args), U"x"U"y"U"z"U));
   1.774 +  args[0] = U U"x"U U; args[1] = U U"y"U U; args[2] = U U"z"U U, args[3] = NULL;
   1.775 +  TEST (NULL, str_check (g_build_filenamev (args), U U"x"U"y"U"z"U U));
   1.776 +#endif /* G_OS_WIN32 */
   1.777 +
   1.778 +#undef S
   1.779 +
   1.780 +  {
   1.781 +    gchar buf[5];
   1.782 +    
   1.783 +    TEST (NULL, 3 == g_snprintf (buf, 0, "%s", "abc"));
   1.784 +    TEST (NULL, 3 == g_snprintf (NULL,0, "%s", "abc"));
   1.785 +    TEST (NULL, 3 == g_snprintf (buf, 5, "%s", "abc"));
   1.786 +    TEST (NULL, 4 == g_snprintf (buf, 5, "%s", "abcd"));
   1.787 +    TEST (NULL, 9 == g_snprintf (buf, 5, "%s", "abcdefghi"));
   1.788 +  }
   1.789 +
   1.790 +  TEST (NULL, g_strv_length (g_strsplit ("1,2,3,4", ",", -1)) == 4);
   1.791 +
   1.792 +	
   1.793 +#ifdef SYMBIAN
   1.794 +  testResultXml("strfunc-test");
   1.795 +#endif /* EMULATOR */
   1.796 +  return any_failed;
   1.797 +}