Back to index

glibc  2.9
tst_towctrans.c
Go to the documentation of this file.
00001 /*
00002   TOWCTRANS: wint_t towctrans (wint_t wc, wctrans_t desc);
00003 */
00004 
00005 #define TST_FUNCTION towctrans
00006 
00007 #include "tsp_common.c"
00008 #include "dat_towctrans.c"
00009 
00010 
00011 int
00012 tst_towctrans (FILE *fp, int debug_flg)
00013 {
00014   TST_DECL_VARS (wint_t);
00015   wint_t wc;
00016   const char *ts;
00017 #if SHOJI_IS_RIGHT
00018   int dummy=0;
00019 #endif
00020   wctrans_t wto;
00021 
00022   TST_DO_TEST (towctrans)
00023     {
00024       TST_HEAD_LOCALE (towctrans, S_TOWCTRANS);
00025       TST_DO_REC (towctrans)
00026        {
00027          TST_GET_ERRET (towctrans);
00028          wc = TST_INPUT (towctrans).wc;
00029          ts = TST_INPUT (towctrans).ts;
00030 
00031 #if SHOJI_IS_RIGHT
00032          if ((wto = wctrans (ts)) == (wctrans_t) 0)
00033            {
00034 #if 0
00035              result (fp, C_IGNORED, S_TOWCTRANS, locale, rec+1, seq_num+1, 3,
00036                     "Skip this data because the wctrans object is not invalid.");
00037              warn_count++;
00038              continue;
00039 #else
00040              wto = &dummy;  /* not good ... */
00041 #endif
00042              if (debug_flg)
00043               {
00044                 fprintf (stdout, "towctrans() ------ wctrans() returnd 0.\n");
00045               }
00046            }
00047 #else
00048          wto = wctrans (ts);
00049 #endif
00050 
00051          TST_CLEAR_ERRNO;
00052          ret = towctrans (wc, wto);
00053          TST_SAVE_ERRNO;
00054 
00055          if (debug_flg)
00056            {
00057              fprintf (stdout, "towctrans() [ %s : %d ] ret = 0x%x\n",
00058                      locale, rec+1, ret);
00059              fprintf (stdout, "                 errno = %d\n",
00060                      errno_save);
00061            }
00062 
00063          TST_IF_RETURN (S_TOWCTRANS)
00064            {
00065              if (ret != 0)
00066               {
00067                 result (fp, C_SUCCESS, S_TOWCTRANS, locale, rec+1,
00068                        seq_num+1, 3, MS_PASSED);
00069               }
00070              else
00071               {
00072                 err_count++;
00073                 result (fp, C_FAILURE, S_TOWCTRANS, locale, rec+1,
00074                        seq_num+1, 3,
00075                        "the function returned 0, but should be non-zero");
00076               }
00077            }
00078        }
00079     }
00080 
00081   return err_count;
00082 }