os/ossrv/glib/tsrc/BC/tests/strfunc-test.c
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /* GLIB - Library of useful routines for C programming
     2  * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
     3  * Portion Copyright © 2008-09 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
     4  * This library is free software; you can redistribute it and/or
     5  * modify it under the terms of the GNU Lesser General Public
     6  * License as published by the Free Software Foundation; either
     7  * version 2 of the License, or (at your option) any later version.
     8  *
     9  * This library is distributed in the hope that it will be useful,
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    12  * Lesser General Public License for more details.
    13  *
    14  * You should have received a copy of the GNU Lesser General Public
    15  * License along with this library; if not, write to the
    16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    17  * Boston, MA 02111-1307, USA.
    18  */
    19 
    20 /*
    21  * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
    22  * file for a list of people on the GLib Team.  See the ChangeLog
    23  * files for a list of changes.  These files are distributed with
    24  * GLib at ftp://ftp.gtk.org/pub/gtk/. 
    25  */
    26 
    27 #undef G_DISABLE_ASSERT
    28 #undef G_LOG_DOMAIN
    29 
    30 #include <stdio.h>
    31 #include <string.h>
    32 #include "glib.h"
    33 #include <stdarg.h>
    34 #include <ctype.h>
    35 
    36 
    37 #ifdef SYMBIAN
    38 #include <glib_global.h>
    39 #include "mrt2_glib2_test.h"
    40 #endif /*SYMBIAN*/
    41 
    42 
    43 
    44 static gboolean any_failed = FALSE;
    45 static gboolean failed = FALSE;
    46 
    47 #define	TEST(m,cond)	G_STMT_START { failed = !(cond); \
    48 if (failed) \
    49   { assert_failed = TRUE; \
    50   if (!m) \
    51       g_print ("(%s:%d) failed for: %s\n", __FILE__, __LINE__, ( # cond )); \
    52     else \
    53       g_print ("(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), m ? (gchar*)m : ""); \
    54     fflush (stdout); \
    55     any_failed = TRUE; \
    56   } \
    57 } G_STMT_END
    58 
    59 #define TEST_FAILED(message) \
    60   G_STMT_START { g_print ("Error: "); g_print message; g_print ("\n"); any_failed = TRUE; assert_failed = TRUE;} G_STMT_END
    61 
    62 #define GLIB_TEST_STRING "el dorado "
    63 
    64 static gboolean
    65 strv_check (gchar **strv, ...)
    66 {
    67   gboolean ok = TRUE;
    68   gint i = 0;
    69   va_list list;
    70 
    71   va_start (list, strv);
    72   while (ok)
    73     {
    74       const gchar *str = va_arg (list, const char *);
    75       if (strv[i] == NULL)
    76 	{
    77 	  ok = str == NULL;
    78 	  break;
    79 	}
    80       if (str == NULL)
    81 	ok = FALSE;
    82       else if (strcmp (strv[i], str) != 0)
    83 	ok = FALSE;
    84       i++;
    85     }
    86   va_end (list);
    87 
    88   g_strfreev (strv);
    89 
    90   return ok;
    91 }
    92 
    93 static gboolean
    94 str_check (gchar *str,
    95 	   gchar *expected)
    96 {
    97   gboolean ok = (strcmp (str, expected) == 0);
    98 
    99   g_free (str);
   100 
   101   return ok;
   102 }
   103 
   104 static gboolean
   105 strchomp_check (gchar *str,
   106 		gchar *expected)
   107 {
   108   gchar *tmp = strdup (str);
   109   gboolean ok;
   110 
   111   g_strchomp (tmp);
   112   ok = (strcmp (tmp, expected) == 0);
   113   g_free (tmp);
   114 
   115   return ok;
   116 }
   117 
   118 #define FOR_ALL_CTYPE(macro)	\
   119 	macro(isalnum)		\
   120 	macro(isalpha)		\
   121 	macro(iscntrl)		\
   122 	macro(isdigit)		\
   123 	macro(isgraph)		\
   124 	macro(islower)		\
   125 	macro(isprint)		\
   126 	macro(ispunct)		\
   127 	macro(isspace)		\
   128 	macro(isupper)		\
   129 	macro(isxdigit)
   130 
   131 #define DEFINE_CALL_CTYPE(function)		\
   132 	static int				\
   133 	call_##function (int c)			\
   134 	{					\
   135 		return function (c);		\
   136 	}
   137 
   138 #define DEFINE_CALL_G_ASCII_CTYPE(function)	\
   139 	static gboolean				\
   140 	call_g_ascii_##function (gchar c)	\
   141 	{					\
   142 		return g_ascii_##function (c);	\
   143 	}
   144 
   145 FOR_ALL_CTYPE (DEFINE_CALL_CTYPE)
   146 FOR_ALL_CTYPE (DEFINE_CALL_G_ASCII_CTYPE)
   147 
   148 static void
   149 test_is_function (const char *name,
   150 		  gboolean (* ascii_function) (gchar),
   151 		  int (* c_library_function) (int),
   152 		  gboolean (* unicode_function) (gunichar))
   153 {
   154   int c;
   155 
   156   for (c = 0; c <= 0x7F; c++)
   157     {
   158       gboolean ascii_result = ascii_function ((gchar)c);
   159       gboolean c_library_result = c_library_function (c) != 0;
   160       gboolean unicode_result = unicode_function ((gunichar) c);
   161       if (ascii_result != c_library_result && c != '\v')
   162 	TEST_FAILED (("g_ascii_%s returned %d and %s returned %d for 0x%X",
   163 		      name, ascii_result, name, c_library_result, c));
   164       if (ascii_result != unicode_result)
   165 	TEST_FAILED (("g_ascii_%s returned %d and g_unichar_%s returned %d for 0x%X",
   166 		      name, ascii_result, name, unicode_result, c));
   167     }
   168   for (c = 0x80; c <= 0xFF; c++)
   169     {
   170       gboolean ascii_result = ascii_function ((gchar)c);
   171       if (ascii_result)
   172 	TEST_FAILED (("g_ascii_%s returned TRUE for 0x%X",
   173 		      name, c));
   174     }
   175 }
   176 
   177 static void
   178 test_to_function (const char *name,
   179 		  gchar (* ascii_function) (gchar),
   180 		  int (* c_library_function) (int),
   181 		  gunichar (* unicode_function) (gunichar))
   182 {
   183   int c;
   184 
   185   for (c = 0; c <= 0x7F; c++)
   186     {
   187       int ascii_result = (guchar) ascii_function ((gchar) c);
   188       int c_library_result = c_library_function (c);
   189       int unicode_result = unicode_function ((gunichar) c);
   190       if (ascii_result != c_library_result)
   191 	TEST_FAILED (("g_ascii_%s returned 0x%X and %s returned 0x%X for 0x%X",
   192 		      name, ascii_result, name, c_library_result, c));
   193       if (ascii_result != unicode_result)
   194 	TEST_FAILED (("g_ascii_%s returned 0x%X and g_unichar_%s returned 0x%X for 0x%X",
   195 		      name, ascii_result, name, unicode_result, c));
   196     }
   197   for (c = 0x80; c <= 0xFF; c++)
   198     {
   199       int ascii_result = (guchar) ascii_function ((gchar) c);
   200       if (ascii_result != c)
   201 	TEST_FAILED (("g_ascii_%s returned 0x%X for 0x%X",
   202 		      name, ascii_result, c));
   203     }
   204 }
   205 
   206 static void
   207 test_digit_function (const char *name,
   208 		     int (* ascii_function) (gchar),
   209 		     int (* unicode_function) (gunichar))
   210 {
   211   int c;
   212 
   213   for (c = 0; c <= 0x7F; c++)
   214     {
   215       int ascii_result = ascii_function ((gchar) c);
   216       int unicode_result = unicode_function ((gunichar) c);
   217       if (ascii_result != unicode_result)
   218 	TEST_FAILED (("g_ascii_%s_value returned %d and g_unichar_%s_value returned %d for 0x%X",
   219 		      name, ascii_result, name, unicode_result, c));
   220     }
   221   for (c = 0x80; c <= 0xFF; c++)
   222     {
   223       int ascii_result = ascii_function ((gchar) c);
   224       if (ascii_result != -1)
   225 	TEST_FAILED (("g_ascii_%s_value returned %d for 0x%X",
   226 		      name, ascii_result, c));
   227     }
   228 }
   229 
   230 int
   231 main (int   argc,
   232       char *argv[])
   233 {
   234   gchar *string;
   235   gchar *vec[] = { "Foo", "Bar", NULL };
   236   gchar **copy;
   237   gchar *args[10];
   238   
   239   #ifdef SYMBIAN
   240   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);
   241   g_set_print_handler(mrtPrintHandler);
   242   #endif /*SYMBIAN*/
   243 	  
   244 
   245   TEST (NULL, g_ascii_strcasecmp ("FroboZZ", "frobozz") == 0);
   246   TEST (NULL, g_ascii_strcasecmp ("frobozz", "frobozz") == 0);
   247   TEST (NULL, g_ascii_strcasecmp ("frobozz", "FROBOZZ") == 0);
   248   TEST (NULL, g_ascii_strcasecmp ("FROBOZZ", "froboz") != 0);
   249   TEST (NULL, g_ascii_strcasecmp ("", "") == 0);
   250   TEST (NULL, g_ascii_strcasecmp ("!#%&/()", "!#%&/()") == 0);
   251   TEST (NULL, g_ascii_strcasecmp ("a", "b") < 0);
   252   TEST (NULL, g_ascii_strcasecmp ("a", "B") < 0);
   253   TEST (NULL, g_ascii_strcasecmp ("A", "b") < 0);
   254   TEST (NULL, g_ascii_strcasecmp ("A", "B") < 0);
   255   TEST (NULL, g_ascii_strcasecmp ("b", "a") > 0);
   256   TEST (NULL, g_ascii_strcasecmp ("b", "A") > 0);
   257   TEST (NULL, g_ascii_strcasecmp ("B", "a") > 0);
   258   TEST (NULL, g_ascii_strcasecmp ("B", "A") > 0);
   259 
   260   TEST (NULL, g_strdup (NULL) == NULL);
   261   string = g_strdup (GLIB_TEST_STRING);
   262   TEST (NULL, string != NULL);
   263   TEST (NULL, strcmp (string, GLIB_TEST_STRING) == 0);
   264   g_free(string);
   265   
   266   string = g_strconcat (GLIB_TEST_STRING, NULL);
   267   TEST (NULL, string != NULL);
   268   TEST (NULL, strcmp (string, GLIB_TEST_STRING) == 0);
   269   g_free(string);
   270   
   271   string = g_strconcat (GLIB_TEST_STRING, GLIB_TEST_STRING, 
   272 			GLIB_TEST_STRING, NULL);
   273   TEST (NULL, string != NULL);
   274   TEST (NULL, strcmp (string, GLIB_TEST_STRING GLIB_TEST_STRING
   275 		      GLIB_TEST_STRING) == 0);
   276   g_free(string);
   277   
   278   string = g_strdup_printf ("%05d %-5s", 21, "test");
   279   TEST (NULL, string != NULL);
   280   TEST (NULL, strcmp(string, "00021 test ") == 0);
   281   g_free (string);
   282   
   283   TEST (NULL, strcmp
   284 	(g_strcompress ("abc\\\\\\\"\\b\\f\\n\\r\\t\\003\\177\\234\\313\\12345z"),
   285 	 "abc\\\"\b\f\n\r\t\003\177\234\313\12345z") == 0);
   286   TEST (NULL, strcmp (g_strescape("abc\\\"\b\f\n\r\t\003\177\234\313", NULL),
   287 		      "abc\\\\\\\"\\b\\f\\n\\r\\t\\003\\177\\234\\313") == 0);
   288   TEST (NULL, strcmp(g_strescape("abc\\\"\b\f\n\r\t\003\177\234\313",
   289 				 "\b\f\001\002\003\004"),
   290 		     "abc\\\\\\\"\b\f\\n\\r\\t\003\\177\\234\\313") == 0);
   291 
   292   copy = g_strdupv (vec);
   293   TEST (NULL, strcmp (copy[0], "Foo") == 0);
   294   TEST (NULL, strcmp (copy[1], "Bar") == 0);
   295   TEST (NULL, copy[2] == NULL);
   296   g_strfreev (copy);
   297   
   298   TEST (NULL, strcmp (g_strstr_len ("FooBarFooBarFoo", 6, "Bar"),
   299 		      "BarFooBarFoo") == 0);
   300   TEST (NULL, strcmp (g_strrstr ("FooBarFooBarFoo", "Bar"),
   301 		      "BarFoo") == 0);
   302   TEST (NULL, strcmp (g_strrstr_len ("FooBarFooBarFoo", 14, "BarFoo"),
   303 		      "BarFooBarFoo") == 0);
   304 
   305   /* Test g_strsplit() */
   306   TEST (NULL, strv_check (g_strsplit ("", ",", 0), NULL));
   307   TEST (NULL, strv_check (g_strsplit ("x", ",", 0), "x", NULL));
   308   TEST (NULL, strv_check (g_strsplit ("x,y", ",", 0), "x", "y", NULL));
   309   TEST (NULL, strv_check (g_strsplit ("x,y,", ",", 0), "x", "y", "", NULL));
   310   TEST (NULL, strv_check (g_strsplit (",x,y", ",", 0), "", "x", "y", NULL));
   311   TEST (NULL, strv_check (g_strsplit (",x,y,", ",", 0), "", "x", "y", "", NULL));
   312   TEST (NULL, strv_check (g_strsplit ("x,y,z", ",", 0), "x", "y", "z", NULL));
   313   TEST (NULL, strv_check (g_strsplit ("x,y,z,", ",", 0), "x", "y", "z", "", NULL));
   314   TEST (NULL, strv_check (g_strsplit (",x,y,z", ",", 0), "", "x", "y", "z", NULL));
   315   TEST (NULL, strv_check (g_strsplit (",x,y,z,", ",", 0), "", "x", "y", "z", "", NULL));
   316   TEST (NULL, strv_check (g_strsplit (",,x,,y,,z,,", ",", 0), "", "", "x", "", "y", "", "z", "", "", NULL));
   317   TEST (NULL, strv_check (g_strsplit (",,x,,y,,z,,", ",,", 0), "", "x", "y", "z", "", NULL));
   318 
   319   TEST (NULL, strv_check (g_strsplit ("", ",", 1), NULL));
   320   TEST (NULL, strv_check (g_strsplit ("x", ",", 1), "x", NULL));
   321   TEST (NULL, strv_check (g_strsplit ("x,y", ",", 1), "x,y", NULL));
   322   TEST (NULL, strv_check (g_strsplit ("x,y,", ",", 1), "x,y,", NULL));
   323   TEST (NULL, strv_check (g_strsplit (",x,y", ",", 1), ",x,y", NULL));
   324   TEST (NULL, strv_check (g_strsplit (",x,y,", ",", 1), ",x,y,", NULL));
   325   TEST (NULL, strv_check (g_strsplit ("x,y,z", ",", 1), "x,y,z", NULL));
   326   TEST (NULL, strv_check (g_strsplit ("x,y,z,", ",", 1), "x,y,z,", NULL));
   327   TEST (NULL, strv_check (g_strsplit (",x,y,z", ",", 1), ",x,y,z", NULL));
   328   TEST (NULL, strv_check (g_strsplit (",x,y,z,", ",", 1), ",x,y,z,", NULL));
   329   TEST (NULL, strv_check (g_strsplit (",,x,,y,,z,,", ",", 1), ",,x,,y,,z,,", NULL));
   330   TEST (NULL, strv_check (g_strsplit (",,x,,y,,z,,", ",,", 1), ",,x,,y,,z,,", NULL));
   331 
   332   TEST (NULL, strv_check (g_strsplit ("", ",", 2), NULL));
   333   TEST (NULL, strv_check (g_strsplit ("x", ",", 2), "x", NULL));
   334   TEST (NULL, strv_check (g_strsplit ("x,y", ",", 2), "x", "y", NULL));
   335   TEST (NULL, strv_check (g_strsplit ("x,y,", ",", 2), "x", "y,", NULL));
   336   TEST (NULL, strv_check (g_strsplit (",x,y", ",", 2), "", "x,y", NULL));
   337   TEST (NULL, strv_check (g_strsplit (",x,y,", ",", 2), "", "x,y,", NULL));
   338   TEST (NULL, strv_check (g_strsplit ("x,y,z", ",", 2), "x", "y,z", NULL));
   339   TEST (NULL, strv_check (g_strsplit ("x,y,z,", ",", 2), "x", "y,z,", NULL));
   340   TEST (NULL, strv_check (g_strsplit (",x,y,z", ",", 2), "", "x,y,z", NULL));
   341   TEST (NULL, strv_check (g_strsplit (",x,y,z,", ",", 2), "", "x,y,z,", NULL));
   342   TEST (NULL, strv_check (g_strsplit (",,x,,y,,z,,", ",", 2), "", ",x,,y,,z,,", NULL));
   343   TEST (NULL, strv_check (g_strsplit (",,x,,y,,z,,", ",,", 2), "", "x,,y,,z,,", NULL));
   344 
   345   /* Test g_strsplit_set() */
   346   TEST (NULL, strv_check (g_strsplit_set ("", ",/", 0), NULL));
   347   TEST (NULL, strv_check (g_strsplit_set (":def/ghi:", ":/", -1), "", "def", "ghi", "", NULL));
   348   TEST (NULL, strv_check (g_strsplit_set ("abc:def/ghi", ":/", -1), "abc", "def", "ghi", NULL));
   349   TEST (NULL, strv_check (g_strsplit_set (",;,;,;,;", ",;", -1), "", "", "", "", "", "", "", "", "", NULL));
   350   TEST (NULL, strv_check (g_strsplit_set (",,abc.def", ".,", -1), "", "", "abc", "def", NULL));
   351 
   352   TEST (NULL, strv_check (g_strsplit_set (",x.y", ",.", 0), "", "x", "y", NULL));
   353   TEST (NULL, strv_check (g_strsplit_set (".x,y,", ",.", 0), "", "x", "y", "", NULL));
   354   TEST (NULL, strv_check (g_strsplit_set ("x,y.z", ",.", 0), "x", "y", "z", NULL));
   355   TEST (NULL, strv_check (g_strsplit_set ("x.y,z,", ",.", 0), "x", "y", "z", "", NULL));
   356   TEST (NULL, strv_check (g_strsplit_set (",x.y,z", ",.", 0), "", "x", "y", "z", NULL));
   357   TEST (NULL, strv_check (g_strsplit_set (",x,y,z,", ",.", 0), "", "x", "y", "z", "", NULL));
   358   TEST (NULL, strv_check (g_strsplit_set (",.x,,y,;z..", ".,;", 0), "", "", "x", "", "y", "", "z", "", "", NULL));
   359   TEST (NULL, strv_check (g_strsplit_set (",,x,,y,,z,,", ",,", 0), "", "", "x", "", "y", "", "z", "", "", NULL));
   360 
   361   TEST (NULL, strv_check (g_strsplit_set ("x,y.z", ",.", 1), "x,y.z", NULL));
   362   TEST (NULL, strv_check (g_strsplit_set ("x.y,z,", ",.", 1), "x.y,z,", NULL));
   363   TEST (NULL, strv_check (g_strsplit_set (",x,y,z", ",.", 1), ",x,y,z", NULL));
   364   TEST (NULL, strv_check (g_strsplit_set (",x,y.z,", ",.", 1), ",x,y.z,", NULL));
   365   TEST (NULL, strv_check (g_strsplit_set (",,x,.y,,z,,", ",.", 1), ",,x,.y,,z,,", NULL));
   366   TEST (NULL, strv_check (g_strsplit_set (",.x,,y,,z,,", ",,..", 1), ",.x,,y,,z,,", NULL));
   367    
   368   TEST (NULL, strv_check (g_strsplit_set ("", ",", 0), NULL));
   369   TEST (NULL, strv_check (g_strsplit_set ("x", ",", 0), "x", NULL));
   370   TEST (NULL, strv_check (g_strsplit_set ("x,y", ",", 0), "x", "y", NULL));
   371   TEST (NULL, strv_check (g_strsplit_set ("x,y,", ",", 0), "x", "y", "", NULL));
   372   TEST (NULL, strv_check (g_strsplit_set (",x,y", ",", 0), "", "x", "y", NULL));
   373   TEST (NULL, strv_check (g_strsplit_set (",x,y,", ",", 0), "", "x", "y", "", NULL));
   374   TEST (NULL, strv_check (g_strsplit_set ("x,y,z", ",", 0), "x", "y", "z", NULL));
   375   TEST (NULL, strv_check (g_strsplit_set ("x,y,z,", ",", 0), "x", "y", "z", "", NULL));
   376   TEST (NULL, strv_check (g_strsplit_set (",x,y,z", ",", 0), "", "x", "y", "z", NULL));
   377   TEST (NULL, strv_check (g_strsplit_set (",x,y,z,", ",", 0), "", "x", "y", "z", "", NULL));
   378   TEST (NULL, strv_check (g_strsplit_set (",,x,,y,,z,,", ",", 0), "", "", "x", "", "y", "", "z", "", "", NULL));
   379 
   380   TEST (NULL, strv_check (g_strsplit_set ("", ",", 1), NULL));
   381   TEST (NULL, strv_check (g_strsplit_set ("x", ",", 1), "x", NULL));
   382   TEST (NULL, strv_check (g_strsplit_set ("x,y", ",", 1), "x,y", NULL));
   383   TEST (NULL, strv_check (g_strsplit_set ("x,y,", ",", 1), "x,y,", NULL));
   384   TEST (NULL, strv_check (g_strsplit_set (",x,y", ",", 1), ",x,y", NULL));
   385   TEST (NULL, strv_check (g_strsplit_set (",x,y,", ",", 1), ",x,y,", NULL));
   386   TEST (NULL, strv_check (g_strsplit_set ("x,y,z", ",", 1), "x,y,z", NULL));
   387   TEST (NULL, strv_check (g_strsplit_set ("x,y,z,", ",", 1), "x,y,z,", NULL));
   388   TEST (NULL, strv_check (g_strsplit_set (",x,y,z", ",", 1), ",x,y,z", NULL));
   389   TEST (NULL, strv_check (g_strsplit_set (",x,y,z,", ",", 1), ",x,y,z,", NULL));
   390   TEST (NULL, strv_check (g_strsplit_set (",,x,,y,,z,,", ",", 1), ",,x,,y,,z,,", NULL));
   391   TEST (NULL, strv_check (g_strsplit_set (",,x,,y,,z,,", ",,", 1), ",,x,,y,,z,,", NULL));
   392 
   393   TEST (NULL, strv_check (g_strsplit_set ("", ",", 2), NULL));
   394   TEST (NULL, strv_check (g_strsplit_set ("x", ",", 2), "x", NULL));
   395   TEST (NULL, strv_check (g_strsplit_set ("x,y", ",", 2), "x", "y", NULL));
   396   TEST (NULL, strv_check (g_strsplit_set ("x,y,", ",", 2), "x", "y,", NULL));
   397   TEST (NULL, strv_check (g_strsplit_set (",x,y", ",", 2), "", "x,y", NULL));
   398   TEST (NULL, strv_check (g_strsplit_set (",x,y,", ",", 2), "", "x,y,", NULL));
   399   TEST (NULL, strv_check (g_strsplit_set ("x,y,z", ",", 2), "x", "y,z", NULL));
   400   TEST (NULL, strv_check (g_strsplit_set ("x,y,z,", ",", 2), "x", "y,z,", NULL));
   401   TEST (NULL, strv_check (g_strsplit_set (",x,y,z", ",", 2), "", "x,y,z", NULL));
   402   TEST (NULL, strv_check (g_strsplit_set (",x,y,z,", ",", 2), "", "x,y,z,", NULL));
   403   TEST (NULL, strv_check (g_strsplit_set (",,x,,y,,z,,", ",", 2), "", ",x,,y,,z,,", NULL));
   404   
   405   TEST (NULL, strv_check (g_strsplit_set (",,x,.y,..z,,", ",.", 3), "", "", "x,.y,..z,,", NULL));
   406 
   407   
   408   
   409   #define TEST_IS(name) test_is_function (#name, call_g_ascii_##name, call_##name, g_unichar_##name);
   410 
   411   FOR_ALL_CTYPE(TEST_IS)
   412 
   413   #undef TEST_IS
   414 
   415   #define TEST_TO(name) test_to_function (#name, g_ascii_##name, name, g_unichar_##name)
   416 
   417   TEST_TO (tolower);
   418   TEST_TO (toupper);
   419 
   420   #undef TEST_TO
   421 
   422   #define TEST_DIGIT(name) test_digit_function (#name, g_ascii_##name##_value, g_unichar_##name##_value)
   423 
   424   TEST_DIGIT (digit);
   425   TEST_DIGIT (xdigit);
   426 
   427   #undef TEST_DIGIT
   428 
   429   /* Tests for strchomp () */
   430   TEST (NULL, strchomp_check ("", ""));
   431   TEST (NULL, strchomp_check (" ", ""));
   432   TEST (NULL, strchomp_check (" \t\r\n", ""));
   433   TEST (NULL, strchomp_check ("a ", "a"));
   434   TEST (NULL, strchomp_check ("a  ", "a"));
   435   TEST (NULL, strchomp_check ("a a", "a a"));
   436   TEST (NULL, strchomp_check ("a a ", "a a"));
   437 
   438   /* Tests for g_build_path, g_build_filename */
   439 
   440   TEST (NULL, str_check (g_build_path ("", NULL), ""));
   441   TEST (NULL, str_check (g_build_path ("", "", NULL), ""));
   442   TEST (NULL, str_check (g_build_path ("", "x", NULL), "x"));
   443   TEST (NULL, str_check (g_build_path ("", "x", "y",  NULL), "xy"));
   444   TEST (NULL, str_check (g_build_path ("", "x", "y", "z", NULL), "xyz"));
   445 
   446   TEST (NULL, str_check (g_build_path (":", NULL), ""));
   447   TEST (NULL, str_check (g_build_path (":", ":", NULL), ":"));
   448   TEST (NULL, str_check (g_build_path (":", ":x", NULL), ":x"));
   449   TEST (NULL, str_check (g_build_path (":", "x:", NULL), "x:"));
   450   TEST (NULL, str_check (g_build_path (":", "", "x", NULL), "x"));
   451   TEST (NULL, str_check (g_build_path (":", "", ":x", NULL), ":x"));
   452   TEST (NULL, str_check (g_build_path (":", ":", "x", NULL), ":x"));
   453   TEST (NULL, str_check (g_build_path (":", "::", "x", NULL), "::x"));
   454   TEST (NULL, str_check (g_build_path (":", "x", "", NULL), "x"));
   455   TEST (NULL, str_check (g_build_path (":", "x:", "", NULL), "x:"));
   456   TEST (NULL, str_check (g_build_path (":", "x", ":", NULL), "x:"));
   457   TEST (NULL, str_check (g_build_path (":", "x", "::", NULL), "x::"));
   458   TEST (NULL, str_check (g_build_path (":", "x", "y",  NULL), "x:y"));
   459   TEST (NULL, str_check (g_build_path (":", ":x", "y", NULL), ":x:y"));
   460   TEST (NULL, str_check (g_build_path (":", "x", "y:", NULL), "x:y:"));
   461   TEST (NULL, str_check (g_build_path (":", ":x:", ":y:", NULL), ":x:y:"));
   462   TEST (NULL, str_check (g_build_path (":", ":x::", "::y:", NULL), ":x:y:"));
   463   TEST (NULL, str_check (g_build_path (":", "x", "","y",  NULL), "x:y"));
   464   TEST (NULL, str_check (g_build_path (":", "x", ":", "y",  NULL), "x:y"));
   465   TEST (NULL, str_check (g_build_path (":", "x", "::", "y",  NULL), "x:y"));
   466   TEST (NULL, str_check (g_build_path (":", "x", "y", "z", NULL), "x:y:z"));
   467   TEST (NULL, str_check (g_build_path (":", ":x:", ":y:", ":z:", NULL), ":x:y:z:"));
   468   TEST (NULL, str_check (g_build_path (":", "::x::", "::y::", "::z::", NULL), "::x:y:z::"));
   469 
   470   TEST (NULL, str_check (g_build_path ("::", NULL), ""));
   471   TEST (NULL, str_check (g_build_path ("::", "::", NULL), "::"));
   472   TEST (NULL, str_check (g_build_path ("::", ":::", NULL), ":::"));
   473   TEST (NULL, str_check (g_build_path ("::", "::x", NULL), "::x"));
   474   TEST (NULL, str_check (g_build_path ("::", "x::", NULL), "x::"));
   475   TEST (NULL, str_check (g_build_path ("::", "", "x", NULL), "x"));
   476   TEST (NULL, str_check (g_build_path ("::", "", "::x", NULL), "::x"));
   477   TEST (NULL, str_check (g_build_path ("::", "::", "x", NULL), "::x"));
   478   TEST (NULL, str_check (g_build_path ("::", "::::", "x", NULL), "::::x"));
   479   TEST (NULL, str_check (g_build_path ("::", "x", "", NULL), "x"));
   480   TEST (NULL, str_check (g_build_path ("::", "x::", "", NULL), "x::"));
   481   TEST (NULL, str_check (g_build_path ("::", "x", "::", NULL), "x::"));
   482   /* This following is weird, but keeps the definition simple */
   483   TEST (NULL, str_check (g_build_path ("::", "x", ":::", NULL), "x:::::"));
   484   TEST (NULL, str_check (g_build_path ("::", "x", "::::", NULL), "x::::"));
   485   TEST (NULL, str_check (g_build_path ("::", "x", "y",  NULL), "x::y"));
   486   TEST (NULL, str_check (g_build_path ("::", "::x", "y", NULL), "::x::y"));
   487   TEST (NULL, str_check (g_build_path ("::", "x", "y::", NULL), "x::y::"));
   488   TEST (NULL, str_check (g_build_path ("::", "::x::", "::y::", NULL), "::x::y::"));
   489   TEST (NULL, str_check (g_build_path ("::", "::x:::", ":::y::", NULL), "::x::::y::"));
   490   TEST (NULL, str_check (g_build_path ("::", "::x::::", "::::y::", NULL), "::x::y::"));
   491   TEST (NULL, str_check (g_build_path ("::", "x", "", "y",  NULL), "x::y"));
   492   TEST (NULL, str_check (g_build_path ("::", "x", "::", "y",  NULL), "x::y"));
   493   TEST (NULL, str_check (g_build_path ("::", "x", "::::", "y",  NULL), "x::y"));
   494   TEST (NULL, str_check (g_build_path ("::", "x", "y", "z", NULL), "x::y::z"));
   495   TEST (NULL, str_check (g_build_path ("::", "::x::", "::y::", "::z::", NULL), "::x::y::z::"));
   496   TEST (NULL, str_check (g_build_path ("::", ":::x:::", ":::y:::", ":::z:::", NULL), ":::x::::y::::z:::"));
   497   TEST (NULL, str_check (g_build_path ("::", "::::x::::", "::::y::::", "::::z::::", NULL), "::::x::y::z::::"));
   498 
   499   args[0] = NULL;
   500   TEST (NULL, str_check (g_build_pathv ("", args), ""));
   501   args[0] = ""; args[1] = NULL;
   502   TEST (NULL, str_check (g_build_pathv ("", args), ""));
   503   args[0] = "x"; args[1] = NULL;
   504   TEST (NULL, str_check (g_build_pathv ("", args), "x"));
   505   args[0] = "x"; args[1] = "y"; args[2] = NULL;
   506   TEST (NULL, str_check (g_build_pathv ("", args), "xy"));
   507   args[0] = "x"; args[1] = "y"; args[2] = "z", args[3] = NULL;
   508   TEST (NULL, str_check (g_build_pathv ("", args), "xyz"));
   509 
   510   args[0] = NULL;
   511   TEST (NULL, str_check (g_build_pathv (":", args), ""));
   512   args[0] = ":"; args[1] = NULL;
   513   TEST (NULL, str_check (g_build_pathv (":", args), ":"));
   514   args[0] = ":x"; args[1] = NULL;
   515   TEST (NULL, str_check (g_build_pathv (":", args), ":x"));
   516   args[0] = "x:"; args[1] = NULL;
   517   TEST (NULL, str_check (g_build_pathv (":", args), "x:"));
   518   args[0] = ""; args[1] = "x"; args[2] = NULL;
   519   TEST (NULL, str_check (g_build_pathv (":", args), "x"));
   520   args[0] = ""; args[1] = ":x"; args[2] = NULL;
   521   TEST (NULL, str_check (g_build_pathv (":", args), ":x"));
   522   args[0] = ":"; args[1] = "x"; args[2] = NULL;
   523   TEST (NULL, str_check (g_build_pathv (":", args), ":x"));
   524   args[0] = "::"; args[1] = "x"; args[2] = NULL;
   525   TEST (NULL, str_check (g_build_pathv (":", args), "::x"));
   526   args[0] = "x"; args[1] = ""; args[2] = NULL;
   527   TEST (NULL, str_check (g_build_pathv (":", args), "x"));
   528   args[0] = "x:"; args[1] = ""; args[2] = NULL;
   529   TEST (NULL, str_check (g_build_pathv (":", args), "x:"));
   530   args[0] = "x"; args[1] = ":"; args[2] = NULL;
   531   TEST (NULL, str_check (g_build_pathv (":", args), "x:"));
   532   args[0] = "x"; args[1] = "::"; args[2] = NULL;
   533   TEST (NULL, str_check (g_build_pathv (":", args), "x::"));
   534   args[0] = "x"; args[1] = "y"; args[2] = NULL;
   535   TEST (NULL, str_check (g_build_pathv (":", args), "x:y"));
   536   args[0] = ":x"; args[1] = "y"; args[2] = NULL;
   537   TEST (NULL, str_check (g_build_pathv (":", args), ":x:y"));
   538   args[0] = "x"; args[1] = "y:"; args[2] = NULL;
   539   TEST (NULL, str_check (g_build_pathv (":", args), "x:y:"));
   540   args[0] = ":x:"; args[1] = ":y:"; args[2] = NULL;
   541   TEST (NULL, str_check (g_build_pathv (":", args), ":x:y:"));
   542   args[0] = ":x::"; args[1] = "::y:"; args[2] = NULL;
   543   TEST (NULL, str_check (g_build_pathv (":", args), ":x:y:"));
   544   args[0] = "x"; args[1] = ""; args[2] = "y"; args[3] = NULL;
   545   TEST (NULL, str_check (g_build_pathv (":", args), "x:y"));
   546   args[0] = "x"; args[1] = ":"; args[2] = "y"; args[3] = NULL;
   547   TEST (NULL, str_check (g_build_pathv (":", args), "x:y"));
   548   args[0] = "x"; args[1] = "::"; args[2] = "y"; args[3] = NULL;
   549   TEST (NULL, str_check (g_build_pathv (":", args), "x:y"));
   550   args[0] = "x"; args[1] = "y"; args[2] = "z"; args[3] = NULL;
   551   TEST (NULL, str_check (g_build_pathv (":", args), "x:y:z"));
   552   args[0] = ":x:"; args[1] = ":y:"; args[2] = ":z:"; args[3] = NULL;
   553   TEST (NULL, str_check (g_build_pathv (":", args), ":x:y:z:"));
   554   args[0] = "::x::"; args[1] = "::y::"; args[2] = "::z::"; args[3] = NULL;
   555   TEST (NULL, str_check (g_build_pathv (":", args), "::x:y:z::"));
   556 
   557   args[0] = NULL;
   558   TEST (NULL, str_check (g_build_pathv ("::", args), ""));
   559   args[0] = "::"; args[1] = NULL;
   560   TEST (NULL, str_check (g_build_pathv ("::", args), "::"));
   561   args[0] = ":::"; args[1] = NULL;
   562   TEST (NULL, str_check (g_build_pathv ("::", args), ":::"));
   563   args[0] = "::x"; args[1] = NULL;
   564   TEST (NULL, str_check (g_build_pathv ("::", args), "::x"));
   565   args[0] = "x::"; args[1] = NULL;
   566   TEST (NULL, str_check (g_build_pathv ("::", args), "x::"));
   567   args[0] = ""; args[1] = "x"; args[2] = NULL;
   568   TEST (NULL, str_check (g_build_pathv ("::", args), "x"));
   569   args[0] = ""; args[1] = "::x"; args[2] = NULL;
   570   TEST (NULL, str_check (g_build_pathv ("::", args), "::x"));
   571   args[0] = "::"; args[1] = "x"; args[2] = NULL;
   572   TEST (NULL, str_check (g_build_pathv ("::", args), "::x"));
   573   args[0] = "::::"; args[1] = "x"; args[2] = NULL;
   574   TEST (NULL, str_check (g_build_pathv ("::", args), "::::x"));
   575   args[0] = "x"; args[1] = ""; args[2] = NULL;
   576   TEST (NULL, str_check (g_build_pathv ("::", args), "x"));
   577   args[0] = "x::"; args[1] = ""; args[2] = NULL;
   578   TEST (NULL, str_check (g_build_pathv ("::", args), "x::"));
   579   args[0] = "x"; args[1] = "::"; args[2] = NULL;
   580   TEST (NULL, str_check (g_build_pathv ("::", args), "x::"));
   581   /* This following is weird, but keeps the definition simple */
   582   args[0] = "x"; args[1] = ":::"; args[2] = NULL;
   583   TEST (NULL, str_check (g_build_pathv ("::", args), "x:::::"));
   584   args[0] = "x"; args[1] = "::::"; args[2] = NULL;
   585   TEST (NULL, str_check (g_build_pathv ("::", args), "x::::"));
   586   args[0] = "x"; args[1] = "y"; args[2] = NULL;
   587   TEST (NULL, str_check (g_build_pathv ("::", args), "x::y"));
   588   args[0] = "::x"; args[1] = "y"; args[2] = NULL;
   589   TEST (NULL, str_check (g_build_pathv ("::", args), "::x::y"));
   590   args[0] = "x"; args[1] = "y::"; args[2] = NULL;
   591   TEST (NULL, str_check (g_build_pathv ("::", args), "x::y::"));
   592   args[0] = "::x::"; args[1] = "::y::"; args[2] = NULL;
   593   TEST (NULL, str_check (g_build_pathv ("::", args), "::x::y::"));
   594   args[0] = "::x:::"; args[1] = ":::y::"; args[2] = NULL;
   595   TEST (NULL, str_check (g_build_pathv ("::", args), "::x::::y::"));
   596   args[0] = "::x::::"; args[1] = "::::y::"; args[2] = NULL;
   597   TEST (NULL, str_check (g_build_pathv ("::", args), "::x::y::"));
   598   args[0] = "x"; args[1] = ""; args[2] = "y"; args[3] = NULL;
   599   TEST (NULL, str_check (g_build_pathv ("::", args), "x::y"));
   600   args[0] = "x"; args[1] = "::"; args[2] = "y"; args[3] = NULL;
   601   TEST (NULL, str_check (g_build_pathv ("::", args), "x::y"));
   602   args[0] = "x"; args[1] = "::::"; args[2] = "y"; args[3] = NULL;
   603   TEST (NULL, str_check (g_build_pathv ("::", args), "x::y"));
   604   args[0] = "x"; args[1] = "y"; args[2] = "z"; args[3] = NULL;
   605   TEST (NULL, str_check (g_build_pathv ("::", args), "x::y::z"));
   606   args[0] = "::x::"; args[1] = "::y::"; args[2] = "::z::"; args[3] = NULL;
   607   TEST (NULL, str_check (g_build_pathv ("::", args), "::x::y::z::"));
   608   args[0] = ":::x:::"; args[1] = ":::y:::"; args[2] = ":::z:::"; args[3] = NULL;
   609   TEST (NULL, str_check (g_build_pathv ("::", args), ":::x::::y::::z:::"));
   610   args[0] = "::::x::::"; args[1] = "::::y::::"; args[2] = "::::z::::"; args[3] = NULL;
   611   TEST (NULL, str_check (g_build_pathv ("::", args), "::::x::y::z::::"));
   612 
   613 #define S G_DIR_SEPARATOR_S
   614 
   615   TEST (NULL, str_check (g_build_filename (NULL), ""));
   616   TEST (NULL, str_check (g_build_filename (S, NULL), S));
   617   TEST (NULL, str_check (g_build_filename (S"x", NULL), S"x"));
   618   TEST (NULL, str_check (g_build_filename ("x"S, NULL), "x"S));
   619   TEST (NULL, str_check (g_build_filename ("", "x", NULL), "x"));
   620   TEST (NULL, str_check (g_build_filename ("", S"x", NULL), S"x"));
   621   TEST (NULL, str_check (g_build_filename (S, "x", NULL), S"x"));
   622   TEST (NULL, str_check (g_build_filename (S S, "x", NULL), S S"x"));
   623   TEST (NULL, str_check (g_build_filename ("x", "", NULL), "x"));
   624   TEST (NULL, str_check (g_build_filename ("x"S, "", NULL), "x"S));
   625   TEST (NULL, str_check (g_build_filename ("x", S, NULL), "x"S));
   626   TEST (NULL, str_check (g_build_filename ("x", S S, NULL), "x"S S));
   627   TEST (NULL, str_check (g_build_filename ("x", "y",  NULL), "x"S"y"));
   628   TEST (NULL, str_check (g_build_filename (S"x", "y", NULL), S"x"S"y"));
   629   TEST (NULL, str_check (g_build_filename ("x", "y"S, NULL), "x"S"y"S));
   630   TEST (NULL, str_check (g_build_filename (S"x"S, S"y"S, NULL), S"x"S"y"S));
   631   TEST (NULL, str_check (g_build_filename (S"x"S S, S S"y"S, NULL), S"x"S"y"S));
   632   TEST (NULL, str_check (g_build_filename ("x", "", "y",  NULL), "x"S"y"));
   633   TEST (NULL, str_check (g_build_filename ("x", S, "y",  NULL), "x"S"y"));
   634   TEST (NULL, str_check (g_build_filename ("x", S S, "y",  NULL), "x"S"y"));
   635   TEST (NULL, str_check (g_build_filename ("x", "y", "z", NULL), "x"S"y"S"z"));
   636   TEST (NULL, str_check (g_build_filename (S"x"S, S"y"S, S"z"S, NULL), S"x"S"y"S"z"S));
   637   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));
   638 
   639   args[0] = NULL;
   640   TEST (NULL, str_check (g_build_filenamev (args), ""));
   641   args[0] = S; args[1] = NULL;
   642   TEST (NULL, str_check (g_build_filenamev (args), S));
   643   args[0] = S"x"; args[1] = NULL;
   644   TEST (NULL, str_check (g_build_filenamev (args), S"x"));
   645   args[0] = "x"S; args[1] = NULL;
   646   TEST (NULL, str_check (g_build_filenamev (args), "x"S));
   647   args[0] = ""; args[1] = "x"; args[2] = NULL;
   648   TEST (NULL, str_check (g_build_filenamev (args), "x"));
   649   args[0] = ""; args[1] = S"x"; args[2] = NULL;
   650   TEST (NULL, str_check (g_build_filenamev (args), S"x"));
   651   args[0] = S; args[1] = "x"; args[2] = NULL;
   652   TEST (NULL, str_check (g_build_filenamev (args), S"x"));
   653   args[0] = S S; args[1] = "x"; args[2] = NULL;
   654   TEST (NULL, str_check (g_build_filenamev (args), S S"x"));
   655   args[0] = "x"; args[1] = ""; args[2] = NULL;
   656   TEST (NULL, str_check (g_build_filenamev (args), "x"));
   657   args[0] = "x"S; args[1] = ""; args[2] = NULL;
   658   TEST (NULL, str_check (g_build_filenamev (args), "x"S));
   659   args[0] = "x"; args[1] = S; args[2] = NULL;
   660   TEST (NULL, str_check (g_build_filenamev (args), "x"S));
   661   args[0] = "x"; args[1] = S S; args[2] = NULL;
   662   TEST (NULL, str_check (g_build_filenamev (args), "x"S S));
   663   args[0] = "x"; args[1] = "y"; args[2] = NULL;
   664   TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"));
   665   args[0] = S"x"; args[1] = "y"; args[2] = NULL;
   666   TEST (NULL, str_check (g_build_filenamev (args), S"x"S"y"));
   667   args[0] = "x"; args[1] = "y"S; args[2] = NULL;
   668   TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"S));
   669   args[0] = S"x"S; args[1] = S"y"S; args[2] = NULL;
   670   TEST (NULL, str_check (g_build_filenamev (args), S"x"S"y"S));
   671   args[0] = S"x"S S; args[1] = S S"y"S; args[2] = NULL;
   672   TEST (NULL, str_check (g_build_filenamev (args), S"x"S"y"S));
   673   args[0] = "x"; args[1] = ""; args[2] = "y"; args[3] = NULL;
   674   TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"));
   675   args[0] = "x"; args[1] = S; args[2] = "y"; args[3] = NULL;
   676   TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"));
   677   args[0] = "x"; args[1] = S S; args[2] = "y"; args[3] = NULL;
   678   TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"));
   679   args[0] = "x"; args[1] = "y"; args[2] = "z"; args[3] = NULL;
   680   TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"S"z"));
   681   args[0] = S"x"S; args[1] = S"y"S; args[2] = S"z"S; args[3] = NULL;
   682   TEST (NULL, str_check (g_build_filenamev (args), S"x"S"y"S"z"S));
   683   args[0] = S S"x"S S; args[1] = S S"y"S S; args[2] = S S"z"S S; args[3] = NULL;
   684   TEST (NULL, str_check (g_build_filenamev (args), S S"x"S"y"S"z"S S));
   685 
   686 #ifdef G_OS_WIN32
   687 
   688   /* Test also using the slash as file name separator */
   689 #define U "/"
   690   TEST (NULL, str_check (g_build_filename (NULL), ""));
   691   TEST (NULL, str_check (g_build_filename (U, NULL), U));
   692   TEST (NULL, str_check (g_build_filename (U"x", NULL), U"x"));
   693   TEST (NULL, str_check (g_build_filename ("x"U, NULL), "x"U));
   694   TEST (NULL, str_check (g_build_filename ("", U"x", NULL), U"x"));
   695   TEST (NULL, str_check (g_build_filename ("", U"x", NULL), U"x"));
   696   TEST (NULL, str_check (g_build_filename (U, "x", NULL), U"x"));
   697   TEST (NULL, str_check (g_build_filename (U U, "x", NULL), U U"x"));
   698   TEST (NULL, str_check (g_build_filename (U S, "x", NULL), U S"x"));
   699   TEST (NULL, str_check (g_build_filename ("x"U, "", NULL), "x"U));
   700   TEST (NULL, str_check (g_build_filename ("x"S"y", "z"U"a", NULL), "x"S"y"S"z"U"a"));
   701   TEST (NULL, str_check (g_build_filename ("x", U, NULL), "x"U));
   702   TEST (NULL, str_check (g_build_filename ("x", U U, NULL), "x"U U));
   703   TEST (NULL, str_check (g_build_filename ("x", S U, NULL), "x"S U));
   704   TEST (NULL, str_check (g_build_filename (U"x", "y", NULL), U"x"U"y"));
   705   TEST (NULL, str_check (g_build_filename ("x", "y"U, NULL), "x"U"y"U));
   706   TEST (NULL, str_check (g_build_filename (U"x"U, U"y"U, NULL), U"x"U"y"U));
   707   TEST (NULL, str_check (g_build_filename (U"x"U U, U U"y"U, NULL), U"x"U"y"U));
   708   TEST (NULL, str_check (g_build_filename ("x", U, "y",  NULL), "x"U"y"));
   709   TEST (NULL, str_check (g_build_filename ("x", U U, "y",  NULL), "x"U"y"));
   710   TEST (NULL, str_check (g_build_filename ("x", U S, "y",  NULL), "x"S"y"));
   711   TEST (NULL, str_check (g_build_filename ("x", S U, "y",  NULL), "x"U"y"));
   712   TEST (NULL, str_check (g_build_filename ("x", U "y", "z", NULL), "x"U"y"U"z"));
   713   TEST (NULL, str_check (g_build_filename ("x", S "y", "z", NULL), "x"S"y"S"z"));
   714   TEST (NULL, str_check (g_build_filename ("x", S "y", "z", U, "a", "b", NULL), "x"S"y"S"z"U"a"U"b"));
   715   TEST (NULL, str_check (g_build_filename (U"x"U, U"y"U, U"z"U, NULL), U"x"U"y"U"z"U));
   716   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));
   717 
   718   args[0] = NULL;
   719   TEST (NULL, str_check (g_build_filenamev (args), ""));
   720   args[0] = U; args[1] = NULL;
   721   TEST (NULL, str_check (g_build_filenamev (args), U));
   722   args[0] = U"x"; args[1] = NULL;
   723   TEST (NULL, str_check (g_build_filenamev (args), U"x"));
   724   args[0] = "x"U; args[1] = NULL;
   725   TEST (NULL, str_check (g_build_filenamev (args), "x"U));
   726   args[0] = ""; args[1] = U"x"; args[2] = NULL;
   727   TEST (NULL, str_check (g_build_filenamev (args), U"x"));
   728   args[0] = ""; args[1] = U"x"; args[2] = NULL;
   729   TEST (NULL, str_check (g_build_filenamev (args), U"x"));
   730   args[0] = U; args[1] = "x"; args[2] = NULL;
   731   TEST (NULL, str_check (g_build_filenamev (args), U"x"));
   732   args[0] = U U; args[1] = "x"; args[2] = NULL;
   733   TEST (NULL, str_check (g_build_filenamev (args), U U"x"));
   734   args[0] = U S; args[1] = "x"; args[2] = NULL;
   735   TEST (NULL, str_check (g_build_filenamev (args), U S"x"));
   736   args[0] = "x"U; args[1] = ""; args[2] = NULL;
   737   TEST (NULL, str_check (g_build_filenamev (args), "x"U));
   738   args[0] = "x"S"y"; args[1] = "z"U"a"; args[2] = NULL;
   739   TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"S"z"U"a"));
   740   args[0] = "x"; args[1] = U; args[2] = NULL;
   741   TEST (NULL, str_check (g_build_filenamev (args), "x"U));
   742   args[0] = "x"; args[1] = U U; args[2] = NULL;
   743   TEST (NULL, str_check (g_build_filenamev (args), "x"U U));
   744   args[0] = "x"; args[1] = S U; args[2] = NULL;
   745   TEST (NULL, str_check (g_build_filenamev (args), "x"S U));
   746   args[0] = U"x"; args[1] = "y"; args[2] = NULL;
   747   TEST (NULL, str_check (g_build_filenamev (args), U"x"U"y"));
   748   args[0] = "x"; args[1] = "y"U; args[2] = NULL;
   749   TEST (NULL, str_check (g_build_filenamev (args), "x"U"y"U));
   750   args[0] = U"x"U; args[1] = U"y"U; args[2] = NULL;
   751   TEST (NULL, str_check (g_build_filenamev (args), U"x"U"y"U));
   752   args[0] = U"x"U U; args[1] = U U"y"U; args[2] = NULL;
   753   TEST (NULL, str_check (g_build_filenamev (args), U"x"U"y"U));
   754   args[0] = "x"; args[1] = U; args[2] = "y", args[3] = NULL;
   755   TEST (NULL, str_check (g_build_filenamev (args), "x"U"y"));
   756   args[0] = "x"; args[1] = U U; args[2] = "y", args[3] = NULL;
   757   TEST (NULL, str_check (g_build_filenamev (args), "x"U"y"));
   758   args[0] = "x"; args[1] = U S; args[2] = "y", args[3] = NULL;
   759   TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"));
   760   args[0] = "x"; args[1] = S U; args[2] = "y", args[3] = NULL;
   761   TEST (NULL, str_check (g_build_filenamev (args), "x"U"y"));
   762   args[0] = "x"; args[1] = U "y"; args[2] = "z", args[3] = NULL;
   763   TEST (NULL, str_check (g_build_filenamev (args), "x"U"y"U"z"));
   764   args[0] = "x"; args[1] = S "y"; args[2] = "z", args[3] = NULL;
   765   TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"S"z"));
   766   args[0] = "x"; args[1] = S "y"; args[2] = "z", args[3] = U;
   767   args[4] = "a"; args[5] = "b"; args[6] = NULL;
   768   TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"S"z"U"a"U"b"));
   769   args[0] = U"x"U; args[1] = U"y"U; args[2] = U"z"U, args[3] = NULL;
   770   TEST (NULL, str_check (g_build_filenamev (args), U"x"U"y"U"z"U));
   771   args[0] = U U"x"U U; args[1] = U U"y"U U; args[2] = U U"z"U U, args[3] = NULL;
   772   TEST (NULL, str_check (g_build_filenamev (args), U U"x"U"y"U"z"U U));
   773 #endif /* G_OS_WIN32 */
   774 
   775 #undef S
   776 
   777   {
   778     gchar buf[5];
   779     
   780     TEST (NULL, 3 == g_snprintf (buf, 0, "%s", "abc"));
   781     TEST (NULL, 3 == g_snprintf (NULL,0, "%s", "abc"));
   782     TEST (NULL, 3 == g_snprintf (buf, 5, "%s", "abc"));
   783     TEST (NULL, 4 == g_snprintf (buf, 5, "%s", "abcd"));
   784     TEST (NULL, 9 == g_snprintf (buf, 5, "%s", "abcdefghi"));
   785   }
   786 
   787   TEST (NULL, g_strv_length (g_strsplit ("1,2,3,4", ",", -1)) == 4);
   788 
   789 	
   790 #ifdef SYMBIAN
   791   testResultXml("strfunc-test");
   792 #endif /* EMULATOR */
   793   return any_failed;
   794 }