Back to index

glibc  2.9
tst_wcscoll.c
Go to the documentation of this file.
00001 /*
00002   WCSCOLL: int wcscoll (const wchar_t *ws1, const wchar_t *ws2);
00003 */
00004 
00005 #define TST_FUNCTION wcscoll
00006 
00007 #include "tsp_common.c"
00008 #include "dat_wcscoll.c"
00009 
00010 int
00011 tst_wcscoll (FILE * fp, int debug_flg)
00012 {
00013   TST_DECL_VARS (int);
00014   wchar_t *ws1, *ws2;
00015   int cmp;
00016 
00017   TST_DO_TEST (wcscoll)
00018   {
00019     TST_HEAD_LOCALE (wcscoll, S_WCSCOLL);
00020     TST_DO_REC (wcscoll)
00021     {
00022       TST_GET_ERRET (wcscoll);
00023       ws1 = TST_INPUT (wcscoll).ws1;      /* external value: size WCSSIZE */
00024       ws2 = TST_INPUT (wcscoll).ws2;
00025 
00026       TST_CLEAR_ERRNO;
00027       ret = wcscoll (ws1, ws2);
00028       TST_SAVE_ERRNO;
00029 
00030       if (debug_flg)
00031        {
00032          fprintf (stderr, "tst_wcscoll: ret = %d\n", ret);
00033        }
00034 
00035       cmp = TST_EXPECT (wcscoll).cmp_flg;
00036       TST_IF_RETURN (S_WCSCOLL)
00037       {
00038        if (cmp != 0)
00039          {
00040            if ((cmp == 1 && ret > 0) || (cmp == -1 && ret < 0))
00041              {
00042               Result (C_SUCCESS, S_WCSCOLL, CASE_3, MS_PASSED);
00043              }
00044            else
00045              {
00046               err_count++;
00047               if (cmp == 1)
00048                 {
00049                   if (ret == 0)
00050                     Result (C_FAILURE, S_WCSCOLL, CASE_3,
00051                            "the return value should be positive"
00052                            " but it's zero.");
00053                   else
00054                     Result (C_FAILURE, S_WCSCOLL, CASE_3,
00055                            "the return value should be positive"
00056                            " but it's negative.");
00057                 }
00058               else
00059                 {
00060                   if (ret == 0)
00061                     Result (C_FAILURE, S_WCSCOLL, CASE_3,
00062                            "the return value should be negative"
00063                            " but it's zero.");
00064                   else
00065                     Result (C_FAILURE, S_WCSCOLL, CASE_3,
00066                            "the return value should be negative"
00067                            " but it's positive.");
00068                 }
00069              }
00070          }
00071       }
00072     }
00073   }
00074 
00075   return err_count;
00076 }