1 #undef G_DISABLE_ASSERT
10 int main (int argc, char **argv)
15 char *srcdir = getenv ("srcdir");
20 char *current_locale = setlocale (LC_CTYPE, NULL);
25 filename = g_strconcat (srcdir, G_DIR_SEPARATOR_S, "casemap.txt", NULL);
27 infile = fopen (filename, "r");
30 fprintf (stderr, "Failed to open %s\n", filename );
34 while (fgets (buffer, sizeof(buffer), infile))
39 strings = g_strsplit (buffer, "\t", -1);
46 if (strcmp (locale, current_locale) != 0)
48 setlocale (LC_CTYPE, locale);
49 current_locale = setlocale (LC_CTYPE, NULL);
51 if (strncmp (current_locale, locale, 2) != 0)
53 fprintf (stderr, "Cannot set locale to %s, skipping\n", locale);
60 convert = g_utf8_strup (test, -1);
61 if (strcmp (convert, strings[4]) != 0)
63 fprintf (stderr, "Failure: toupper(%s) == %s, should have been %s\n",
64 test, convert, strings[4]);
69 convert = g_utf8_strdown (test, -1);
70 if (strcmp (convert, strings[2]) != 0)
72 fprintf (stderr, "Failure: tolower(%s) == %s, should have been %s\n",
73 test, convert, strings[2]);
85 filename = g_strconcat (srcdir, G_DIR_SEPARATOR_S, "casefold.txt", NULL);
87 infile = fopen (filename, "r");
90 fprintf (stderr, "Failed to open %s\n", filename );
94 while (fgets (buffer, sizeof(buffer), infile))
99 buffer[strlen(buffer) - 1] = '\0';
100 strings = g_strsplit (buffer, "\t", -1);
104 convert = g_utf8_casefold (test, -1);
105 if (strcmp (convert, strings[1]) != 0)
107 fprintf (stderr, "Failure: casefold(%s) == '%s', should have been '%s'\n",
108 test, convert, strings[1]);
113 g_strfreev (strings);