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