2.9
[glibc/nacl-glibc.git] / localedata / tests-mbwc / tst_strcoll.c
blob4c5a84f697a7fda0877f84038f6f15cba50a7954
1 /*
2 STRCOLL: int strcoll (const char *s1, const char *s2)
3 */
5 #define TST_FUNCTION strcoll
7 #include "tsp_common.c"
8 #include "dat_strcoll.c"
10 int
11 tst_strcoll (FILE * fp, int debug_flg)
13 TST_DECL_VARS (int);
14 const char *s1, *s2;
16 TST_DO_TEST (strcoll)
18 TST_HEAD_LOCALE (strcoll, S_STRCOLL);
19 TST_DO_REC (strcoll)
21 TST_GET_ERRET (strcoll);
22 s1 = TST_INPUT (strcoll).s1;
23 s2 = TST_INPUT (strcoll).s2;
25 TST_CLEAR_ERRNO;
26 ret = strcoll (s1, s2);
27 TST_SAVE_ERRNO;
29 if (debug_flg)
31 fprintf (stdout, "strcoll() [ %s : %d ] ret = %d\n", locale,
32 rec + 1, ret);
33 fprintf (stdout, " errno = %d\n",
34 errno_save);
35 fprintf (stdout, " LC_COLLATE = %s\n",
36 (setlocale (LC_COLLATE, NULL)) ? setlocale (LC_COLLATE,
37 NULL) : "");
40 TST_IF_RETURN (S_STRCOLL)
42 if (ret_exp == +1)
44 if (ret > 0)
46 Result (C_SUCCESS, S_STRCOLL, CASE_3, MS_PASSED);
48 else
50 err_count++;
51 Result (C_FAILURE, S_STRCOLL, CASE_3,
52 "the return value should be greater than 0,"
53 " but is not ...");
56 else if (ret_exp == -1)
58 if (ret < 0)
60 Result (C_SUCCESS, S_STRCOLL, CASE_3, MS_PASSED);
62 else
64 err_count++;
65 Result (C_FAILURE, S_STRCOLL, CASE_3,
66 "the return value should less than 0, but not ...");
69 else if (ret_exp != 0)
71 if (debug_flg)
73 fprintf (stderr, "*** Warning *** : tst_strcoll : "
74 "(check the test data); should set ret_flg=1"
75 " to check a return value");
78 warn_count++;
79 Result (C_INVALID, S_WCSCHR, CASE_3, "(check the test data); "
80 "should set ret_flg=1 to check a return value");
86 return err_count;