(root)/
glibc-2.38/
localedata/
tests-mbwc/
tst_towctrans.c
       1  /*
       2    TOWCTRANS: wint_t towctrans (wint_t wc, wctrans_t desc);
       3  */
       4  
       5  #define TST_FUNCTION towctrans
       6  
       7  #include "tsp_common.c"
       8  #include "dat_towctrans.c"
       9  
      10  
      11  int
      12  tst_towctrans (FILE *fp, int debug_flg)
      13  {
      14    TST_DECL_VARS (wint_t);
      15    wint_t wc;
      16    const char *ts;
      17    wctrans_t wto;
      18  
      19    TST_DO_TEST (towctrans)
      20      {
      21        TST_HEAD_LOCALE (towctrans, S_TOWCTRANS);
      22        TST_DO_REC (towctrans)
      23  	{
      24  	  TST_GET_ERRET (towctrans);
      25  	  wc = TST_INPUT (towctrans).wc;
      26  	  ts = TST_INPUT (towctrans).ts;
      27  
      28  	  wto = wctrans (ts);
      29  
      30  	  TST_CLEAR_ERRNO;
      31  	  ret = towctrans (wc, wto);
      32  	  TST_SAVE_ERRNO;
      33  
      34  	  if (debug_flg)
      35  	    {
      36  	      fprintf (stdout, "towctrans() [ %s : %d ] ret = 0x%x\n",
      37  		       locale, rec+1, ret);
      38  	      fprintf (stdout, "		      errno = %d\n",
      39  		       errno_save);
      40  	    }
      41  
      42  	  TST_IF_RETURN (S_TOWCTRANS)
      43  	    {
      44  	      if (ret != 0)
      45  		{
      46  		  result (fp, C_SUCCESS, S_TOWCTRANS, locale, rec+1,
      47  			  seq_num+1, 3, MS_PASSED);
      48  		}
      49  	      else
      50  		{
      51  		  err_count++;
      52  		  result (fp, C_FAILURE, S_TOWCTRANS, locale, rec+1,
      53  			  seq_num+1, 3,
      54  			  "the function returned 0, but should be non-zero");
      55  		}
      56  	    }
      57  	}
      58      }
      59  
      60    return err_count;
      61  }