19 #include "test_strcasecmp_l.h"
46 int res = POSIX_EXIT_SUCCESS;
47 posix_locale_t loc_ctype_posix;
48 const char* string1_1 =
"x1: 10, y2: 50%, eol";
49 const char* string1_2 =
"x1: 10, y2: 50%, eol";
50 const char* string2_1 =
"XXX";
51 const char* string2_2 =
"YYY";
52 const char* string3_1 =
"Longer";
53 const char* string3_2 =
"Long";
54 const char* string4_1 =
"Long";
55 const char* string4_2 =
"Longer";
56 const char* string5_1 =
"case";
57 const char* string5_2 =
"Case";
58 const char* string6_1 =
"B\xC3\xA4ume";
59 const char* string6_2 =
"B\xC3\x84ume";
64 loc_ctype_posix = posix_newlocale(POSIX_LC_CTYPE_MASK,
"POSIX",
66 if((posix_locale_t) 0 == loc_ctype_posix)
69 res = POSIX_EXIT_FAILURE;
78 rv = posix_strcasecmp_l(string1_1, string1_2, loc_ctype_posix);
81 print_error(
"Result is not correct (should indicate match)");
82 res = POSIX_EXIT_FAILURE;
87 fprintf(stderr,
TEST_TAB "String 1: \"%s\"\n", string1_1);
88 fprintf(stderr,
TEST_TAB "String 2: \"%s\"\n", string1_2);
98 rv = posix_strcasecmp_l(string2_1, string2_2, loc_ctype_posix);
101 print_error(
"Result is not correct (should indicate no match)");
102 res = POSIX_EXIT_FAILURE;
107 fprintf(stderr,
TEST_TAB "String 1: \"%s\"\n", string2_1);
108 fprintf(stderr,
TEST_TAB "String 2: \"%s\"\n", string2_2);
118 rv = posix_strcasecmp_l(string3_1, string3_2, loc_ctype_posix);
121 print_error(
"Result is not correct (should indicate no match)");
122 res = POSIX_EXIT_FAILURE;
127 fprintf(stderr,
TEST_TAB "String 1: \"%s\"\n", string3_1);
128 fprintf(stderr,
TEST_TAB "String 2: \"%s\"\n", string3_2);
138 rv = posix_strcasecmp_l(string4_1, string4_2, loc_ctype_posix);
141 print_error(
"Result is not correct (should indicate no match)");
142 res = POSIX_EXIT_FAILURE;
147 fprintf(stderr,
TEST_TAB "String 1: \"%s\"\n", string4_1);
148 fprintf(stderr,
TEST_TAB "String 2: \"%s\"\n", string4_2);
158 rv = posix_strcasecmp_l(string5_1, string5_2, loc_ctype_posix);
161 print_error(
"Result is not correct (should indicate match)");
162 res = POSIX_EXIT_FAILURE;
167 fprintf(stderr,
TEST_TAB "String 1: \"%s\"\n", string5_1);
168 fprintf(stderr,
TEST_TAB "String 2: \"%s\"\n", string5_2);
179 rv = posix_strcasecmp_l(string6_1, string6_2, loc_ctype_posix);
182 print_error(
"Result is not correct (should indicate no match)");
183 res = POSIX_EXIT_FAILURE;
188 #if CFG_USE_POSIX_API >= 200112 || CFG_USE_XSI
189 loc = posix_setlocale(POSIX_LC_CTYPE,
"");
195 print_error(
"Setting locale for debug messages failed");
200 if(NULL == strstr(loc,
"UTF") && NULL == strstr(loc,
"utf"))
203 "Debug messages can't be printed with current locale");
208 fprintf(stderr,
TEST_TAB "String 1: \"%s\"\n", string6_1);
209 fprintf(stderr,
TEST_TAB "String 2: \"%s\"\n", string6_2);
216 posix_freelocale(loc_ctype_posix);