sl@0: /* GLIB - Library of useful routines for C programming sl@0: * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald sl@0: * Portion Copyright © 2008-09 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. sl@0: * This library is free software; you can redistribute it and/or sl@0: * modify it under the terms of the GNU Lesser General Public sl@0: * License as published by the Free Software Foundation; either sl@0: * version 2 of the License, or (at your option) any later version. sl@0: * sl@0: * This library is distributed in the hope that it will be useful, sl@0: * but WITHOUT ANY WARRANTY; without even the implied warranty of sl@0: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU sl@0: * Lesser General Public License for more details. sl@0: * sl@0: * You should have received a copy of the GNU Lesser General Public sl@0: * License along with this library; if not, write to the sl@0: * Free Software Foundation, Inc., 59 Temple Place - Suite 330, sl@0: * Boston, MA 02111-1307, USA. sl@0: */ sl@0: sl@0: /* sl@0: * Modified by the GLib Team and others 1997-2000. See the AUTHORS sl@0: * file for a list of people on the GLib Team. See the ChangeLog sl@0: * files for a list of changes. These files are distributed with sl@0: * GLib at ftp://ftp.gtk.org/pub/gtk/. sl@0: */ sl@0: sl@0: #undef G_DISABLE_ASSERT sl@0: #undef G_LOG_DOMAIN sl@0: sl@0: #include sl@0: #include sl@0: #include "glib.h" sl@0: #include sl@0: #include sl@0: sl@0: sl@0: #ifdef SYMBIAN sl@0: #include sl@0: #include "mrt2_glib2_test.h" sl@0: #endif /*SYMBIAN*/ sl@0: sl@0: sl@0: sl@0: static gboolean any_failed = FALSE; sl@0: static gboolean failed = FALSE; sl@0: sl@0: #define TEST(m,cond) G_STMT_START { failed = !(cond); \ sl@0: if (failed) \ sl@0: { assert_failed = TRUE; \ sl@0: if (!m) \ sl@0: g_print ("(%s:%d) failed for: %s\n", __FILE__, __LINE__, ( # cond )); \ sl@0: else \ sl@0: g_print ("(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), m ? (gchar*)m : ""); \ sl@0: fflush (stdout); \ sl@0: any_failed = TRUE; \ sl@0: } \ sl@0: } G_STMT_END sl@0: sl@0: #define TEST_FAILED(message) \ sl@0: G_STMT_START { g_print ("Error: "); g_print message; g_print ("\n"); any_failed = TRUE; assert_failed = TRUE;} G_STMT_END sl@0: sl@0: #define GLIB_TEST_STRING "el dorado " sl@0: sl@0: static gboolean sl@0: strv_check (gchar **strv, ...) sl@0: { sl@0: gboolean ok = TRUE; sl@0: gint i = 0; sl@0: va_list list; sl@0: sl@0: va_start (list, strv); sl@0: while (ok) sl@0: { sl@0: const gchar *str = va_arg (list, const char *); sl@0: if (strv[i] == NULL) sl@0: { sl@0: ok = str == NULL; sl@0: break; sl@0: } sl@0: if (str == NULL) sl@0: ok = FALSE; sl@0: else if (strcmp (strv[i], str) != 0) sl@0: ok = FALSE; sl@0: i++; sl@0: } sl@0: va_end (list); sl@0: sl@0: g_strfreev (strv); sl@0: sl@0: return ok; sl@0: } sl@0: sl@0: static gboolean sl@0: str_check (gchar *str, sl@0: gchar *expected) sl@0: { sl@0: gboolean ok = (strcmp (str, expected) == 0); sl@0: sl@0: g_free (str); sl@0: sl@0: return ok; sl@0: } sl@0: sl@0: static gboolean sl@0: strchomp_check (gchar *str, sl@0: gchar *expected) sl@0: { sl@0: gchar *tmp = strdup (str); sl@0: gboolean ok; sl@0: sl@0: g_strchomp (tmp); sl@0: ok = (strcmp (tmp, expected) == 0); sl@0: g_free (tmp); sl@0: sl@0: return ok; sl@0: } sl@0: sl@0: #define FOR_ALL_CTYPE(macro) \ sl@0: macro(isalnum) \ sl@0: macro(isalpha) \ sl@0: macro(iscntrl) \ sl@0: macro(isdigit) \ sl@0: macro(isgraph) \ sl@0: macro(islower) \ sl@0: macro(isprint) \ sl@0: macro(ispunct) \ sl@0: macro(isspace) \ sl@0: macro(isupper) \ sl@0: macro(isxdigit) sl@0: sl@0: #define DEFINE_CALL_CTYPE(function) \ sl@0: static int \ sl@0: call_##function (int c) \ sl@0: { \ sl@0: return function (c); \ sl@0: } sl@0: sl@0: #define DEFINE_CALL_G_ASCII_CTYPE(function) \ sl@0: static gboolean \ sl@0: call_g_ascii_##function (gchar c) \ sl@0: { \ sl@0: return g_ascii_##function (c); \ sl@0: } sl@0: sl@0: FOR_ALL_CTYPE (DEFINE_CALL_CTYPE) sl@0: FOR_ALL_CTYPE (DEFINE_CALL_G_ASCII_CTYPE) sl@0: sl@0: static void sl@0: test_is_function (const char *name, sl@0: gboolean (* ascii_function) (gchar), sl@0: int (* c_library_function) (int), sl@0: gboolean (* unicode_function) (gunichar)) sl@0: { sl@0: int c; sl@0: sl@0: for (c = 0; c <= 0x7F; c++) sl@0: { sl@0: gboolean ascii_result = ascii_function ((gchar)c); sl@0: gboolean c_library_result = c_library_function (c) != 0; sl@0: gboolean unicode_result = unicode_function ((gunichar) c); sl@0: if (ascii_result != c_library_result && c != '\v') sl@0: TEST_FAILED (("g_ascii_%s returned %d and %s returned %d for 0x%X", sl@0: name, ascii_result, name, c_library_result, c)); sl@0: if (ascii_result != unicode_result) sl@0: TEST_FAILED (("g_ascii_%s returned %d and g_unichar_%s returned %d for 0x%X", sl@0: name, ascii_result, name, unicode_result, c)); sl@0: } sl@0: for (c = 0x80; c <= 0xFF; c++) sl@0: { sl@0: gboolean ascii_result = ascii_function ((gchar)c); sl@0: if (ascii_result) sl@0: TEST_FAILED (("g_ascii_%s returned TRUE for 0x%X", sl@0: name, c)); sl@0: } sl@0: } sl@0: sl@0: static void sl@0: test_to_function (const char *name, sl@0: gchar (* ascii_function) (gchar), sl@0: int (* c_library_function) (int), sl@0: gunichar (* unicode_function) (gunichar)) sl@0: { sl@0: int c; sl@0: sl@0: for (c = 0; c <= 0x7F; c++) sl@0: { sl@0: int ascii_result = (guchar) ascii_function ((gchar) c); sl@0: int c_library_result = c_library_function (c); sl@0: int unicode_result = unicode_function ((gunichar) c); sl@0: if (ascii_result != c_library_result) sl@0: TEST_FAILED (("g_ascii_%s returned 0x%X and %s returned 0x%X for 0x%X", sl@0: name, ascii_result, name, c_library_result, c)); sl@0: if (ascii_result != unicode_result) sl@0: TEST_FAILED (("g_ascii_%s returned 0x%X and g_unichar_%s returned 0x%X for 0x%X", sl@0: name, ascii_result, name, unicode_result, c)); sl@0: } sl@0: for (c = 0x80; c <= 0xFF; c++) sl@0: { sl@0: int ascii_result = (guchar) ascii_function ((gchar) c); sl@0: if (ascii_result != c) sl@0: TEST_FAILED (("g_ascii_%s returned 0x%X for 0x%X", sl@0: name, ascii_result, c)); sl@0: } sl@0: } sl@0: sl@0: static void sl@0: test_digit_function (const char *name, sl@0: int (* ascii_function) (gchar), sl@0: int (* unicode_function) (gunichar)) sl@0: { sl@0: int c; sl@0: sl@0: for (c = 0; c <= 0x7F; c++) sl@0: { sl@0: int ascii_result = ascii_function ((gchar) c); sl@0: int unicode_result = unicode_function ((gunichar) c); sl@0: if (ascii_result != unicode_result) sl@0: TEST_FAILED (("g_ascii_%s_value returned %d and g_unichar_%s_value returned %d for 0x%X", sl@0: name, ascii_result, name, unicode_result, c)); sl@0: } sl@0: for (c = 0x80; c <= 0xFF; c++) sl@0: { sl@0: int ascii_result = ascii_function ((gchar) c); sl@0: if (ascii_result != -1) sl@0: TEST_FAILED (("g_ascii_%s_value returned %d for 0x%X", sl@0: name, ascii_result, c)); sl@0: } sl@0: } sl@0: sl@0: int sl@0: main (int argc, sl@0: char *argv[]) sl@0: { sl@0: gchar *string; sl@0: gchar *vec[] = { "Foo", "Bar", NULL }; sl@0: gchar **copy; sl@0: gchar *args[10]; sl@0: sl@0: #ifdef SYMBIAN sl@0: 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: g_set_print_handler(mrtPrintHandler); sl@0: #endif /*SYMBIAN*/ sl@0: sl@0: sl@0: TEST (NULL, g_ascii_strcasecmp ("FroboZZ", "frobozz") == 0); sl@0: TEST (NULL, g_ascii_strcasecmp ("frobozz", "frobozz") == 0); sl@0: TEST (NULL, g_ascii_strcasecmp ("frobozz", "FROBOZZ") == 0); sl@0: TEST (NULL, g_ascii_strcasecmp ("FROBOZZ", "froboz") != 0); sl@0: TEST (NULL, g_ascii_strcasecmp ("", "") == 0); sl@0: TEST (NULL, g_ascii_strcasecmp ("!#%&/()", "!#%&/()") == 0); sl@0: TEST (NULL, g_ascii_strcasecmp ("a", "b") < 0); sl@0: TEST (NULL, g_ascii_strcasecmp ("a", "B") < 0); sl@0: TEST (NULL, g_ascii_strcasecmp ("A", "b") < 0); sl@0: TEST (NULL, g_ascii_strcasecmp ("A", "B") < 0); sl@0: TEST (NULL, g_ascii_strcasecmp ("b", "a") > 0); sl@0: TEST (NULL, g_ascii_strcasecmp ("b", "A") > 0); sl@0: TEST (NULL, g_ascii_strcasecmp ("B", "a") > 0); sl@0: TEST (NULL, g_ascii_strcasecmp ("B", "A") > 0); sl@0: sl@0: TEST (NULL, g_strdup (NULL) == NULL); sl@0: string = g_strdup (GLIB_TEST_STRING); sl@0: TEST (NULL, string != NULL); sl@0: TEST (NULL, strcmp (string, GLIB_TEST_STRING) == 0); sl@0: g_free(string); sl@0: sl@0: string = g_strconcat (GLIB_TEST_STRING, NULL); sl@0: TEST (NULL, string != NULL); sl@0: TEST (NULL, strcmp (string, GLIB_TEST_STRING) == 0); sl@0: g_free(string); sl@0: sl@0: string = g_strconcat (GLIB_TEST_STRING, GLIB_TEST_STRING, sl@0: GLIB_TEST_STRING, NULL); sl@0: TEST (NULL, string != NULL); sl@0: TEST (NULL, strcmp (string, GLIB_TEST_STRING GLIB_TEST_STRING sl@0: GLIB_TEST_STRING) == 0); sl@0: g_free(string); sl@0: sl@0: string = g_strdup_printf ("%05d %-5s", 21, "test"); sl@0: TEST (NULL, string != NULL); sl@0: TEST (NULL, strcmp(string, "00021 test ") == 0); sl@0: g_free (string); sl@0: sl@0: TEST (NULL, strcmp sl@0: (g_strcompress ("abc\\\\\\\"\\b\\f\\n\\r\\t\\003\\177\\234\\313\\12345z"), sl@0: "abc\\\"\b\f\n\r\t\003\177\234\313\12345z") == 0); sl@0: TEST (NULL, strcmp (g_strescape("abc\\\"\b\f\n\r\t\003\177\234\313", NULL), sl@0: "abc\\\\\\\"\\b\\f\\n\\r\\t\\003\\177\\234\\313") == 0); sl@0: TEST (NULL, strcmp(g_strescape("abc\\\"\b\f\n\r\t\003\177\234\313", sl@0: "\b\f\001\002\003\004"), sl@0: "abc\\\\\\\"\b\f\\n\\r\\t\003\\177\\234\\313") == 0); sl@0: sl@0: copy = g_strdupv (vec); sl@0: TEST (NULL, strcmp (copy[0], "Foo") == 0); sl@0: TEST (NULL, strcmp (copy[1], "Bar") == 0); sl@0: TEST (NULL, copy[2] == NULL); sl@0: g_strfreev (copy); sl@0: sl@0: TEST (NULL, strcmp (g_strstr_len ("FooBarFooBarFoo", 6, "Bar"), sl@0: "BarFooBarFoo") == 0); sl@0: TEST (NULL, strcmp (g_strrstr ("FooBarFooBarFoo", "Bar"), sl@0: "BarFoo") == 0); sl@0: TEST (NULL, strcmp (g_strrstr_len ("FooBarFooBarFoo", 14, "BarFoo"), sl@0: "BarFooBarFoo") == 0); sl@0: sl@0: /* Test g_strsplit() */ sl@0: TEST (NULL, strv_check (g_strsplit ("", ",", 0), NULL)); sl@0: TEST (NULL, strv_check (g_strsplit ("x", ",", 0), "x", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit ("x,y", ",", 0), "x", "y", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit ("x,y,", ",", 0), "x", "y", "", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit (",x,y", ",", 0), "", "x", "y", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit (",x,y,", ",", 0), "", "x", "y", "", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit ("x,y,z", ",", 0), "x", "y", "z", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit ("x,y,z,", ",", 0), "x", "y", "z", "", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit (",x,y,z", ",", 0), "", "x", "y", "z", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit (",x,y,z,", ",", 0), "", "x", "y", "z", "", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit (",,x,,y,,z,,", ",", 0), "", "", "x", "", "y", "", "z", "", "", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit (",,x,,y,,z,,", ",,", 0), "", "x", "y", "z", "", NULL)); sl@0: sl@0: TEST (NULL, strv_check (g_strsplit ("", ",", 1), NULL)); sl@0: TEST (NULL, strv_check (g_strsplit ("x", ",", 1), "x", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit ("x,y", ",", 1), "x,y", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit ("x,y,", ",", 1), "x,y,", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit (",x,y", ",", 1), ",x,y", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit (",x,y,", ",", 1), ",x,y,", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit ("x,y,z", ",", 1), "x,y,z", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit ("x,y,z,", ",", 1), "x,y,z,", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit (",x,y,z", ",", 1), ",x,y,z", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit (",x,y,z,", ",", 1), ",x,y,z,", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit (",,x,,y,,z,,", ",", 1), ",,x,,y,,z,,", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit (",,x,,y,,z,,", ",,", 1), ",,x,,y,,z,,", NULL)); sl@0: sl@0: TEST (NULL, strv_check (g_strsplit ("", ",", 2), NULL)); sl@0: TEST (NULL, strv_check (g_strsplit ("x", ",", 2), "x", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit ("x,y", ",", 2), "x", "y", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit ("x,y,", ",", 2), "x", "y,", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit (",x,y", ",", 2), "", "x,y", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit (",x,y,", ",", 2), "", "x,y,", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit ("x,y,z", ",", 2), "x", "y,z", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit ("x,y,z,", ",", 2), "x", "y,z,", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit (",x,y,z", ",", 2), "", "x,y,z", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit (",x,y,z,", ",", 2), "", "x,y,z,", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit (",,x,,y,,z,,", ",", 2), "", ",x,,y,,z,,", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit (",,x,,y,,z,,", ",,", 2), "", "x,,y,,z,,", NULL)); sl@0: sl@0: /* Test g_strsplit_set() */ sl@0: TEST (NULL, strv_check (g_strsplit_set ("", ",/", 0), NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set (":def/ghi:", ":/", -1), "", "def", "ghi", "", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set ("abc:def/ghi", ":/", -1), "abc", "def", "ghi", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set (",;,;,;,;", ",;", -1), "", "", "", "", "", "", "", "", "", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set (",,abc.def", ".,", -1), "", "", "abc", "def", NULL)); sl@0: sl@0: TEST (NULL, strv_check (g_strsplit_set (",x.y", ",.", 0), "", "x", "y", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set (".x,y,", ",.", 0), "", "x", "y", "", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set ("x,y.z", ",.", 0), "x", "y", "z", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set ("x.y,z,", ",.", 0), "x", "y", "z", "", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set (",x.y,z", ",.", 0), "", "x", "y", "z", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set (",x,y,z,", ",.", 0), "", "x", "y", "z", "", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set (",.x,,y,;z..", ".,;", 0), "", "", "x", "", "y", "", "z", "", "", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set (",,x,,y,,z,,", ",,", 0), "", "", "x", "", "y", "", "z", "", "", NULL)); sl@0: sl@0: TEST (NULL, strv_check (g_strsplit_set ("x,y.z", ",.", 1), "x,y.z", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set ("x.y,z,", ",.", 1), "x.y,z,", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set (",x,y,z", ",.", 1), ",x,y,z", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set (",x,y.z,", ",.", 1), ",x,y.z,", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set (",,x,.y,,z,,", ",.", 1), ",,x,.y,,z,,", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set (",.x,,y,,z,,", ",,..", 1), ",.x,,y,,z,,", NULL)); sl@0: sl@0: TEST (NULL, strv_check (g_strsplit_set ("", ",", 0), NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set ("x", ",", 0), "x", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set ("x,y", ",", 0), "x", "y", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set ("x,y,", ",", 0), "x", "y", "", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set (",x,y", ",", 0), "", "x", "y", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set (",x,y,", ",", 0), "", "x", "y", "", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set ("x,y,z", ",", 0), "x", "y", "z", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set ("x,y,z,", ",", 0), "x", "y", "z", "", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set (",x,y,z", ",", 0), "", "x", "y", "z", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set (",x,y,z,", ",", 0), "", "x", "y", "z", "", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set (",,x,,y,,z,,", ",", 0), "", "", "x", "", "y", "", "z", "", "", NULL)); sl@0: sl@0: TEST (NULL, strv_check (g_strsplit_set ("", ",", 1), NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set ("x", ",", 1), "x", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set ("x,y", ",", 1), "x,y", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set ("x,y,", ",", 1), "x,y,", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set (",x,y", ",", 1), ",x,y", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set (",x,y,", ",", 1), ",x,y,", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set ("x,y,z", ",", 1), "x,y,z", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set ("x,y,z,", ",", 1), "x,y,z,", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set (",x,y,z", ",", 1), ",x,y,z", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set (",x,y,z,", ",", 1), ",x,y,z,", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set (",,x,,y,,z,,", ",", 1), ",,x,,y,,z,,", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set (",,x,,y,,z,,", ",,", 1), ",,x,,y,,z,,", NULL)); sl@0: sl@0: TEST (NULL, strv_check (g_strsplit_set ("", ",", 2), NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set ("x", ",", 2), "x", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set ("x,y", ",", 2), "x", "y", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set ("x,y,", ",", 2), "x", "y,", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set (",x,y", ",", 2), "", "x,y", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set (",x,y,", ",", 2), "", "x,y,", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set ("x,y,z", ",", 2), "x", "y,z", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set ("x,y,z,", ",", 2), "x", "y,z,", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set (",x,y,z", ",", 2), "", "x,y,z", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set (",x,y,z,", ",", 2), "", "x,y,z,", NULL)); sl@0: TEST (NULL, strv_check (g_strsplit_set (",,x,,y,,z,,", ",", 2), "", ",x,,y,,z,,", NULL)); sl@0: sl@0: TEST (NULL, strv_check (g_strsplit_set (",,x,.y,..z,,", ",.", 3), "", "", "x,.y,..z,,", NULL)); sl@0: sl@0: sl@0: sl@0: #define TEST_IS(name) test_is_function (#name, call_g_ascii_##name, call_##name, g_unichar_##name); sl@0: sl@0: FOR_ALL_CTYPE(TEST_IS) sl@0: sl@0: #undef TEST_IS sl@0: sl@0: #define TEST_TO(name) test_to_function (#name, g_ascii_##name, name, g_unichar_##name) sl@0: sl@0: TEST_TO (tolower); sl@0: TEST_TO (toupper); sl@0: sl@0: #undef TEST_TO sl@0: sl@0: #define TEST_DIGIT(name) test_digit_function (#name, g_ascii_##name##_value, g_unichar_##name##_value) sl@0: sl@0: TEST_DIGIT (digit); sl@0: TEST_DIGIT (xdigit); sl@0: sl@0: #undef TEST_DIGIT sl@0: sl@0: /* Tests for strchomp () */ sl@0: TEST (NULL, strchomp_check ("", "")); sl@0: TEST (NULL, strchomp_check (" ", "")); sl@0: TEST (NULL, strchomp_check (" \t\r\n", "")); sl@0: TEST (NULL, strchomp_check ("a ", "a")); sl@0: TEST (NULL, strchomp_check ("a ", "a")); sl@0: TEST (NULL, strchomp_check ("a a", "a a")); sl@0: TEST (NULL, strchomp_check ("a a ", "a a")); sl@0: sl@0: /* Tests for g_build_path, g_build_filename */ sl@0: sl@0: TEST (NULL, str_check (g_build_path ("", NULL), "")); sl@0: TEST (NULL, str_check (g_build_path ("", "", NULL), "")); sl@0: TEST (NULL, str_check (g_build_path ("", "x", NULL), "x")); sl@0: TEST (NULL, str_check (g_build_path ("", "x", "y", NULL), "xy")); sl@0: TEST (NULL, str_check (g_build_path ("", "x", "y", "z", NULL), "xyz")); sl@0: sl@0: TEST (NULL, str_check (g_build_path (":", NULL), "")); sl@0: TEST (NULL, str_check (g_build_path (":", ":", NULL), ":")); sl@0: TEST (NULL, str_check (g_build_path (":", ":x", NULL), ":x")); sl@0: TEST (NULL, str_check (g_build_path (":", "x:", NULL), "x:")); sl@0: TEST (NULL, str_check (g_build_path (":", "", "x", NULL), "x")); sl@0: TEST (NULL, str_check (g_build_path (":", "", ":x", NULL), ":x")); sl@0: TEST (NULL, str_check (g_build_path (":", ":", "x", NULL), ":x")); sl@0: TEST (NULL, str_check (g_build_path (":", "::", "x", NULL), "::x")); sl@0: TEST (NULL, str_check (g_build_path (":", "x", "", NULL), "x")); sl@0: TEST (NULL, str_check (g_build_path (":", "x:", "", NULL), "x:")); sl@0: TEST (NULL, str_check (g_build_path (":", "x", ":", NULL), "x:")); sl@0: TEST (NULL, str_check (g_build_path (":", "x", "::", NULL), "x::")); sl@0: TEST (NULL, str_check (g_build_path (":", "x", "y", NULL), "x:y")); sl@0: TEST (NULL, str_check (g_build_path (":", ":x", "y", NULL), ":x:y")); sl@0: TEST (NULL, str_check (g_build_path (":", "x", "y:", NULL), "x:y:")); sl@0: TEST (NULL, str_check (g_build_path (":", ":x:", ":y:", NULL), ":x:y:")); sl@0: TEST (NULL, str_check (g_build_path (":", ":x::", "::y:", NULL), ":x:y:")); sl@0: TEST (NULL, str_check (g_build_path (":", "x", "","y", NULL), "x:y")); sl@0: TEST (NULL, str_check (g_build_path (":", "x", ":", "y", NULL), "x:y")); sl@0: TEST (NULL, str_check (g_build_path (":", "x", "::", "y", NULL), "x:y")); sl@0: TEST (NULL, str_check (g_build_path (":", "x", "y", "z", NULL), "x:y:z")); sl@0: TEST (NULL, str_check (g_build_path (":", ":x:", ":y:", ":z:", NULL), ":x:y:z:")); sl@0: TEST (NULL, str_check (g_build_path (":", "::x::", "::y::", "::z::", NULL), "::x:y:z::")); sl@0: sl@0: TEST (NULL, str_check (g_build_path ("::", NULL), "")); sl@0: TEST (NULL, str_check (g_build_path ("::", "::", NULL), "::")); sl@0: TEST (NULL, str_check (g_build_path ("::", ":::", NULL), ":::")); sl@0: TEST (NULL, str_check (g_build_path ("::", "::x", NULL), "::x")); sl@0: TEST (NULL, str_check (g_build_path ("::", "x::", NULL), "x::")); sl@0: TEST (NULL, str_check (g_build_path ("::", "", "x", NULL), "x")); sl@0: TEST (NULL, str_check (g_build_path ("::", "", "::x", NULL), "::x")); sl@0: TEST (NULL, str_check (g_build_path ("::", "::", "x", NULL), "::x")); sl@0: TEST (NULL, str_check (g_build_path ("::", "::::", "x", NULL), "::::x")); sl@0: TEST (NULL, str_check (g_build_path ("::", "x", "", NULL), "x")); sl@0: TEST (NULL, str_check (g_build_path ("::", "x::", "", NULL), "x::")); sl@0: TEST (NULL, str_check (g_build_path ("::", "x", "::", NULL), "x::")); sl@0: /* This following is weird, but keeps the definition simple */ sl@0: TEST (NULL, str_check (g_build_path ("::", "x", ":::", NULL), "x:::::")); sl@0: TEST (NULL, str_check (g_build_path ("::", "x", "::::", NULL), "x::::")); sl@0: TEST (NULL, str_check (g_build_path ("::", "x", "y", NULL), "x::y")); sl@0: TEST (NULL, str_check (g_build_path ("::", "::x", "y", NULL), "::x::y")); sl@0: TEST (NULL, str_check (g_build_path ("::", "x", "y::", NULL), "x::y::")); sl@0: TEST (NULL, str_check (g_build_path ("::", "::x::", "::y::", NULL), "::x::y::")); sl@0: TEST (NULL, str_check (g_build_path ("::", "::x:::", ":::y::", NULL), "::x::::y::")); sl@0: TEST (NULL, str_check (g_build_path ("::", "::x::::", "::::y::", NULL), "::x::y::")); sl@0: TEST (NULL, str_check (g_build_path ("::", "x", "", "y", NULL), "x::y")); sl@0: TEST (NULL, str_check (g_build_path ("::", "x", "::", "y", NULL), "x::y")); sl@0: TEST (NULL, str_check (g_build_path ("::", "x", "::::", "y", NULL), "x::y")); sl@0: TEST (NULL, str_check (g_build_path ("::", "x", "y", "z", NULL), "x::y::z")); sl@0: TEST (NULL, str_check (g_build_path ("::", "::x::", "::y::", "::z::", NULL), "::x::y::z::")); sl@0: TEST (NULL, str_check (g_build_path ("::", ":::x:::", ":::y:::", ":::z:::", NULL), ":::x::::y::::z:::")); sl@0: TEST (NULL, str_check (g_build_path ("::", "::::x::::", "::::y::::", "::::z::::", NULL), "::::x::y::z::::")); sl@0: sl@0: args[0] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("", args), "")); sl@0: args[0] = ""; args[1] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("", args), "")); sl@0: args[0] = "x"; args[1] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("", args), "x")); sl@0: args[0] = "x"; args[1] = "y"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("", args), "xy")); sl@0: args[0] = "x"; args[1] = "y"; args[2] = "z", args[3] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("", args), "xyz")); sl@0: sl@0: args[0] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv (":", args), "")); sl@0: args[0] = ":"; args[1] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv (":", args), ":")); sl@0: args[0] = ":x"; args[1] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv (":", args), ":x")); sl@0: args[0] = "x:"; args[1] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv (":", args), "x:")); sl@0: args[0] = ""; args[1] = "x"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv (":", args), "x")); sl@0: args[0] = ""; args[1] = ":x"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv (":", args), ":x")); sl@0: args[0] = ":"; args[1] = "x"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv (":", args), ":x")); sl@0: args[0] = "::"; args[1] = "x"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv (":", args), "::x")); sl@0: args[0] = "x"; args[1] = ""; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv (":", args), "x")); sl@0: args[0] = "x:"; args[1] = ""; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv (":", args), "x:")); sl@0: args[0] = "x"; args[1] = ":"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv (":", args), "x:")); sl@0: args[0] = "x"; args[1] = "::"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv (":", args), "x::")); sl@0: args[0] = "x"; args[1] = "y"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv (":", args), "x:y")); sl@0: args[0] = ":x"; args[1] = "y"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv (":", args), ":x:y")); sl@0: args[0] = "x"; args[1] = "y:"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv (":", args), "x:y:")); sl@0: args[0] = ":x:"; args[1] = ":y:"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv (":", args), ":x:y:")); sl@0: args[0] = ":x::"; args[1] = "::y:"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv (":", args), ":x:y:")); sl@0: args[0] = "x"; args[1] = ""; args[2] = "y"; args[3] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv (":", args), "x:y")); sl@0: args[0] = "x"; args[1] = ":"; args[2] = "y"; args[3] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv (":", args), "x:y")); sl@0: args[0] = "x"; args[1] = "::"; args[2] = "y"; args[3] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv (":", args), "x:y")); sl@0: args[0] = "x"; args[1] = "y"; args[2] = "z"; args[3] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv (":", args), "x:y:z")); sl@0: args[0] = ":x:"; args[1] = ":y:"; args[2] = ":z:"; args[3] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv (":", args), ":x:y:z:")); sl@0: args[0] = "::x::"; args[1] = "::y::"; args[2] = "::z::"; args[3] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv (":", args), "::x:y:z::")); sl@0: sl@0: args[0] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("::", args), "")); sl@0: args[0] = "::"; args[1] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("::", args), "::")); sl@0: args[0] = ":::"; args[1] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("::", args), ":::")); sl@0: args[0] = "::x"; args[1] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("::", args), "::x")); sl@0: args[0] = "x::"; args[1] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("::", args), "x::")); sl@0: args[0] = ""; args[1] = "x"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("::", args), "x")); sl@0: args[0] = ""; args[1] = "::x"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("::", args), "::x")); sl@0: args[0] = "::"; args[1] = "x"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("::", args), "::x")); sl@0: args[0] = "::::"; args[1] = "x"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("::", args), "::::x")); sl@0: args[0] = "x"; args[1] = ""; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("::", args), "x")); sl@0: args[0] = "x::"; args[1] = ""; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("::", args), "x::")); sl@0: args[0] = "x"; args[1] = "::"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("::", args), "x::")); sl@0: /* This following is weird, but keeps the definition simple */ sl@0: args[0] = "x"; args[1] = ":::"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("::", args), "x:::::")); sl@0: args[0] = "x"; args[1] = "::::"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("::", args), "x::::")); sl@0: args[0] = "x"; args[1] = "y"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("::", args), "x::y")); sl@0: args[0] = "::x"; args[1] = "y"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("::", args), "::x::y")); sl@0: args[0] = "x"; args[1] = "y::"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("::", args), "x::y::")); sl@0: args[0] = "::x::"; args[1] = "::y::"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("::", args), "::x::y::")); sl@0: args[0] = "::x:::"; args[1] = ":::y::"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("::", args), "::x::::y::")); sl@0: args[0] = "::x::::"; args[1] = "::::y::"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("::", args), "::x::y::")); sl@0: args[0] = "x"; args[1] = ""; args[2] = "y"; args[3] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("::", args), "x::y")); sl@0: args[0] = "x"; args[1] = "::"; args[2] = "y"; args[3] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("::", args), "x::y")); sl@0: args[0] = "x"; args[1] = "::::"; args[2] = "y"; args[3] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("::", args), "x::y")); sl@0: args[0] = "x"; args[1] = "y"; args[2] = "z"; args[3] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("::", args), "x::y::z")); sl@0: args[0] = "::x::"; args[1] = "::y::"; args[2] = "::z::"; args[3] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("::", args), "::x::y::z::")); sl@0: args[0] = ":::x:::"; args[1] = ":::y:::"; args[2] = ":::z:::"; args[3] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("::", args), ":::x::::y::::z:::")); sl@0: args[0] = "::::x::::"; args[1] = "::::y::::"; args[2] = "::::z::::"; args[3] = NULL; sl@0: TEST (NULL, str_check (g_build_pathv ("::", args), "::::x::y::z::::")); sl@0: sl@0: #define S G_DIR_SEPARATOR_S sl@0: sl@0: TEST (NULL, str_check (g_build_filename (NULL), "")); sl@0: TEST (NULL, str_check (g_build_filename (S, NULL), S)); sl@0: TEST (NULL, str_check (g_build_filename (S"x", NULL), S"x")); sl@0: TEST (NULL, str_check (g_build_filename ("x"S, NULL), "x"S)); sl@0: TEST (NULL, str_check (g_build_filename ("", "x", NULL), "x")); sl@0: TEST (NULL, str_check (g_build_filename ("", S"x", NULL), S"x")); sl@0: TEST (NULL, str_check (g_build_filename (S, "x", NULL), S"x")); sl@0: TEST (NULL, str_check (g_build_filename (S S, "x", NULL), S S"x")); sl@0: TEST (NULL, str_check (g_build_filename ("x", "", NULL), "x")); sl@0: TEST (NULL, str_check (g_build_filename ("x"S, "", NULL), "x"S)); sl@0: TEST (NULL, str_check (g_build_filename ("x", S, NULL), "x"S)); sl@0: TEST (NULL, str_check (g_build_filename ("x", S S, NULL), "x"S S)); sl@0: TEST (NULL, str_check (g_build_filename ("x", "y", NULL), "x"S"y")); sl@0: TEST (NULL, str_check (g_build_filename (S"x", "y", NULL), S"x"S"y")); sl@0: TEST (NULL, str_check (g_build_filename ("x", "y"S, NULL), "x"S"y"S)); sl@0: TEST (NULL, str_check (g_build_filename (S"x"S, S"y"S, NULL), S"x"S"y"S)); sl@0: TEST (NULL, str_check (g_build_filename (S"x"S S, S S"y"S, NULL), S"x"S"y"S)); sl@0: TEST (NULL, str_check (g_build_filename ("x", "", "y", NULL), "x"S"y")); sl@0: TEST (NULL, str_check (g_build_filename ("x", S, "y", NULL), "x"S"y")); sl@0: TEST (NULL, str_check (g_build_filename ("x", S S, "y", NULL), "x"S"y")); sl@0: TEST (NULL, str_check (g_build_filename ("x", "y", "z", NULL), "x"S"y"S"z")); sl@0: 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: 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: sl@0: args[0] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), "")); sl@0: args[0] = S; args[1] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), S)); sl@0: args[0] = S"x"; args[1] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), S"x")); sl@0: args[0] = "x"S; args[1] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), "x"S)); sl@0: args[0] = ""; args[1] = "x"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), "x")); sl@0: args[0] = ""; args[1] = S"x"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), S"x")); sl@0: args[0] = S; args[1] = "x"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), S"x")); sl@0: args[0] = S S; args[1] = "x"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), S S"x")); sl@0: args[0] = "x"; args[1] = ""; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), "x")); sl@0: args[0] = "x"S; args[1] = ""; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), "x"S)); sl@0: args[0] = "x"; args[1] = S; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), "x"S)); sl@0: args[0] = "x"; args[1] = S S; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), "x"S S)); sl@0: args[0] = "x"; args[1] = "y"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), "x"S"y")); sl@0: args[0] = S"x"; args[1] = "y"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), S"x"S"y")); sl@0: args[0] = "x"; args[1] = "y"S; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"S)); sl@0: args[0] = S"x"S; args[1] = S"y"S; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), S"x"S"y"S)); sl@0: args[0] = S"x"S S; args[1] = S S"y"S; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), S"x"S"y"S)); sl@0: args[0] = "x"; args[1] = ""; args[2] = "y"; args[3] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), "x"S"y")); sl@0: args[0] = "x"; args[1] = S; args[2] = "y"; args[3] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), "x"S"y")); sl@0: args[0] = "x"; args[1] = S S; args[2] = "y"; args[3] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), "x"S"y")); sl@0: args[0] = "x"; args[1] = "y"; args[2] = "z"; args[3] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"S"z")); sl@0: args[0] = S"x"S; args[1] = S"y"S; args[2] = S"z"S; args[3] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), S"x"S"y"S"z"S)); sl@0: 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: TEST (NULL, str_check (g_build_filenamev (args), S S"x"S"y"S"z"S S)); sl@0: sl@0: #ifdef G_OS_WIN32 sl@0: sl@0: /* Test also using the slash as file name separator */ sl@0: #define U "/" sl@0: TEST (NULL, str_check (g_build_filename (NULL), "")); sl@0: TEST (NULL, str_check (g_build_filename (U, NULL), U)); sl@0: TEST (NULL, str_check (g_build_filename (U"x", NULL), U"x")); sl@0: TEST (NULL, str_check (g_build_filename ("x"U, NULL), "x"U)); sl@0: TEST (NULL, str_check (g_build_filename ("", U"x", NULL), U"x")); sl@0: TEST (NULL, str_check (g_build_filename ("", U"x", NULL), U"x")); sl@0: TEST (NULL, str_check (g_build_filename (U, "x", NULL), U"x")); sl@0: TEST (NULL, str_check (g_build_filename (U U, "x", NULL), U U"x")); sl@0: TEST (NULL, str_check (g_build_filename (U S, "x", NULL), U S"x")); sl@0: TEST (NULL, str_check (g_build_filename ("x"U, "", NULL), "x"U)); sl@0: TEST (NULL, str_check (g_build_filename ("x"S"y", "z"U"a", NULL), "x"S"y"S"z"U"a")); sl@0: TEST (NULL, str_check (g_build_filename ("x", U, NULL), "x"U)); sl@0: TEST (NULL, str_check (g_build_filename ("x", U U, NULL), "x"U U)); sl@0: TEST (NULL, str_check (g_build_filename ("x", S U, NULL), "x"S U)); sl@0: TEST (NULL, str_check (g_build_filename (U"x", "y", NULL), U"x"U"y")); sl@0: TEST (NULL, str_check (g_build_filename ("x", "y"U, NULL), "x"U"y"U)); sl@0: TEST (NULL, str_check (g_build_filename (U"x"U, U"y"U, NULL), U"x"U"y"U)); sl@0: TEST (NULL, str_check (g_build_filename (U"x"U U, U U"y"U, NULL), U"x"U"y"U)); sl@0: TEST (NULL, str_check (g_build_filename ("x", U, "y", NULL), "x"U"y")); sl@0: TEST (NULL, str_check (g_build_filename ("x", U U, "y", NULL), "x"U"y")); sl@0: TEST (NULL, str_check (g_build_filename ("x", U S, "y", NULL), "x"S"y")); sl@0: TEST (NULL, str_check (g_build_filename ("x", S U, "y", NULL), "x"U"y")); sl@0: TEST (NULL, str_check (g_build_filename ("x", U "y", "z", NULL), "x"U"y"U"z")); sl@0: TEST (NULL, str_check (g_build_filename ("x", S "y", "z", NULL), "x"S"y"S"z")); sl@0: 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: 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: 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: sl@0: args[0] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), "")); sl@0: args[0] = U; args[1] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), U)); sl@0: args[0] = U"x"; args[1] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), U"x")); sl@0: args[0] = "x"U; args[1] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), "x"U)); sl@0: args[0] = ""; args[1] = U"x"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), U"x")); sl@0: args[0] = ""; args[1] = U"x"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), U"x")); sl@0: args[0] = U; args[1] = "x"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), U"x")); sl@0: args[0] = U U; args[1] = "x"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), U U"x")); sl@0: args[0] = U S; args[1] = "x"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), U S"x")); sl@0: args[0] = "x"U; args[1] = ""; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), "x"U)); sl@0: args[0] = "x"S"y"; args[1] = "z"U"a"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"S"z"U"a")); sl@0: args[0] = "x"; args[1] = U; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), "x"U)); sl@0: args[0] = "x"; args[1] = U U; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), "x"U U)); sl@0: args[0] = "x"; args[1] = S U; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), "x"S U)); sl@0: args[0] = U"x"; args[1] = "y"; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), U"x"U"y")); sl@0: args[0] = "x"; args[1] = "y"U; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), "x"U"y"U)); sl@0: args[0] = U"x"U; args[1] = U"y"U; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), U"x"U"y"U)); sl@0: args[0] = U"x"U U; args[1] = U U"y"U; args[2] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), U"x"U"y"U)); sl@0: args[0] = "x"; args[1] = U; args[2] = "y", args[3] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), "x"U"y")); sl@0: args[0] = "x"; args[1] = U U; args[2] = "y", args[3] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), "x"U"y")); sl@0: args[0] = "x"; args[1] = U S; args[2] = "y", args[3] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), "x"S"y")); sl@0: args[0] = "x"; args[1] = S U; args[2] = "y", args[3] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), "x"U"y")); sl@0: args[0] = "x"; args[1] = U "y"; args[2] = "z", args[3] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), "x"U"y"U"z")); sl@0: args[0] = "x"; args[1] = S "y"; args[2] = "z", args[3] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"S"z")); sl@0: args[0] = "x"; args[1] = S "y"; args[2] = "z", args[3] = U; sl@0: args[4] = "a"; args[5] = "b"; args[6] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), "x"S"y"S"z"U"a"U"b")); sl@0: args[0] = U"x"U; args[1] = U"y"U; args[2] = U"z"U, args[3] = NULL; sl@0: TEST (NULL, str_check (g_build_filenamev (args), U"x"U"y"U"z"U)); sl@0: 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: TEST (NULL, str_check (g_build_filenamev (args), U U"x"U"y"U"z"U U)); sl@0: #endif /* G_OS_WIN32 */ sl@0: sl@0: #undef S sl@0: sl@0: { sl@0: gchar buf[5]; sl@0: sl@0: TEST (NULL, 3 == g_snprintf (buf, 0, "%s", "abc")); sl@0: TEST (NULL, 3 == g_snprintf (NULL,0, "%s", "abc")); sl@0: TEST (NULL, 3 == g_snprintf (buf, 5, "%s", "abc")); sl@0: TEST (NULL, 4 == g_snprintf (buf, 5, "%s", "abcd")); sl@0: TEST (NULL, 9 == g_snprintf (buf, 5, "%s", "abcdefghi")); sl@0: } sl@0: sl@0: TEST (NULL, g_strv_length (g_strsplit ("1,2,3,4", ",", -1)) == 4); sl@0: sl@0: sl@0: #ifdef SYMBIAN sl@0: testResultXml("strfunc-test"); sl@0: #endif /* EMULATOR */ sl@0: return any_failed; sl@0: }