7 int main (int argc, char **argv)
12 char *srcdir = getenv ("srcdir");
17 char *current_locale = setlocale (LC_CTYPE, NULL);
22 filename = g_strconcat (srcdir, G_DIR_SEPARATOR_S, "casemap.txt", NULL);
24 infile = fopen (filename, "r");
27 fprintf (stderr, "Failed to open %s\n", filename );
31 while (fgets (buffer, sizeof(buffer), infile))
36 strings = g_strsplit (buffer, "\t", -1);
43 if (strcmp (locale, current_locale) != 0)
45 setlocale (LC_CTYPE, locale);
46 current_locale = setlocale (LC_CTYPE, NULL);
48 if (strncmp (current_locale, locale, 2) != 0)
50 fprintf (stderr, "Cannot set locale to %s, skipping\n", locale);
57 convert = g_utf8_strup (test, -1);
58 if (strcmp (convert, strings[4]) != 0)
60 fprintf (stderr, "Failure: toupper(%s) == %s, should have been %s\n",
61 test, convert, strings[4]);
66 convert = g_utf8_strdown (test, -1);
67 if (strcmp (convert, strings[2]) != 0)
69 fprintf (stderr, "Failure: tolower(%s) == %s, should have been %s\n",
70 test, convert, strings[2]);
82 filename = g_strconcat (srcdir, G_DIR_SEPARATOR_S, "casefold.txt", NULL);
84 infile = fopen (filename, "r");
87 fprintf (stderr, "Failed to open %s\n", filename );
91 while (fgets (buffer, sizeof(buffer), infile))
96 buffer[strlen(buffer) - 1] = '\0';
97 strings = g_strsplit (buffer, "\t", -1);
101 convert = g_utf8_casefold (test, -1);
102 if (strcmp (convert, strings[1]) != 0)
104 fprintf (stderr, "Failure: casefold(%s) == '%s', should have been '%s'\n",
105 test, convert, strings[1]);
110 g_strfreev (strings);