Use correct signedness in wcsncmp
[glibc.git] / localedata / tests-mbwc / tst_wcsncmp.c
blobf93ca49e47408742cad692974c10afbc034d0d95
1 /*-------------------------------------------------------------------------------------*/
2 /* WCSNCMP: int wcsncmp( const wchar_t *ws1, const wchar_t *ws2, size_t n ) */
3 /*-------------------------------------------------------------------------------------*/
5 #define TST_FUNCTION wcsncmp
7 #include "tsp_common.c"
8 #include "dat_wcsncmp.c"
10 int
11 tst_wcsncmp (FILE * fp, int debug_flg)
13 TST_DECL_VARS (int);
14 wchar_t *ws1, *ws2;
15 size_t n;
17 TST_DO_TEST (wcsncmp)
19 TST_HEAD_LOCALE (wcsncmp, S_WCSNCMP);
20 TST_DO_REC (wcsncmp)
22 TST_GET_ERRET (wcsncmp);
23 ws1 = TST_INPUT (wcsncmp).ws1; /* external value: size WCSSIZE */
24 ws2 = TST_INPUT (wcsncmp).ws2;
25 n = TST_INPUT (wcsncmp).n;
26 ret = wcsncmp (ws1, ws2, n);
27 ret = (ret > 0 ? 1 : ret < 0 ? -1 : 0);
29 if (debug_flg)
31 fprintf (stderr, "tst_wcsncmp: ret = %d, 0x%x\n", ret, ret);
34 TST_IF_RETURN (S_WCSNCMP)
40 return err_count;