90{
91 size_t src1len = strlen(test_string);
92 size_t src2len = -1;
93 size_t dst1len = strlen(expected);
94 size_t dst2len = strlen(expected) + 1;
95 char *src1 =
malloc(src1len);
96 char *dst1 =
malloc(dst1len);
97 char *src2 = strdup(test_string);
98 char *dst2 =
malloc(dst2len);
99 size_t needed;
100
101 memcpy(src1, test_string, src1len);
102
103
104 memset(dst1, 0x7F, dst1len);
106 if (needed != strlen(expected))
107 {
108 printf(
"case_test: convert_case test1 FAILURE: needed %zu\n", needed);
110 }
111 if (memcmp(dst1, expected, dst1len) != 0)
112 {
113 printf(
"case_test: convert_case test1 FAILURE: test: '%s' result: '%.*s' expected: '%s'\n",
114 test_string, (int) dst1len, dst1, expected);
116 }
117
118
119 memset(dst2, 0x7F, dst2len);
121 if (needed != strlen(expected))
122 {
123 printf(
"case_test: convert_case test2 FAILURE: needed %zu\n", needed);
125 }
126 if (strcmp(dst2, expected) != 0)
127 {
128 printf(
"case_test: convert_case test2 FAILURE: test: '%s' result: '%s' expected: '%s'\n",
129 test_string, dst2, expected);
131 }
132
133
134 memset(dst1, 0x7F, dst1len);
136 if (needed != strlen(expected))
137 {
138 printf(
"case_test: convert_case test3 FAILURE: needed %zu\n", needed);
140 }
141 if (memcmp(dst1, expected, dst1len) != 0)
142 {
143 printf(
"case_test: convert_case test3 FAILURE: test: '%s' result: '%.*s' expected: '%s'\n",
144 test_string, (int) dst1len, dst1, expected);
146 }
147
148
149 memset(dst2, 0x7F, dst2len);
151 if (needed != strlen(expected))
152 {
153 printf(
"case_test: convert_case test4 FAILURE: needed %zu\n", needed);
155 }
156 if (strcmp(dst2, expected) != 0)
157 {
158 printf(
"case_test: convert_case test4 FAILURE: test: '%s' result: '%s' expected: '%s'\n",
159 test_string, dst2, expected);
161 }
162
167}
size_t unicode_strlower(char *dst, size_t dstsize, const char *src, ssize_t srclen)