(root)/
glibc-2.38/
localedata/
tests-mbwc/
dat_towctrans.c
       1  /*
       2   *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
       3   *
       4   *	 FILE:	dat_towctrans.c
       5   *
       6   *	 TOWCTRANS:  wint_t towctrans (wint_t wc, wctrans_t charclass);
       7   */
       8  
       9  #include <errno.h>
      10  #include <stdlib.h>
      11  #include <wctype.h>
      12  #include "tst_types.h"
      13  #include "tgn_locdef.h"
      14  
      15  /*
      16   *  NOTE:
      17   *    Set ret_flg = 1, when a return value is expected to be 0 (FALSE).
      18   *    Set ret_flg = 0, when a return value is expected to be non-zero (TRUE).
      19   *
      20   *    Since the functions return *non*-zero value for TRUE, can't
      21   *    compare an actual return value with an expected return value.
      22   *    Set the ret_flg=0 for TRUE cases and the tst_isw*() will check
      23   *    the non-zero value.
      24   *
      25   *  { { WEOF }, { 0,0,1,0 } },
      26   *		      | |
      27   *		      | ret_val: an expected return value
      28   *		      ret_flg: if 1, compare an actual return value with the
      29   *			       ret_val; if 0, the test program checks
      30   *			       the actual return value.
      31   *
      32   *    CAUTION: if a charclass is invalid, the test function gives
      33   *    towctrans() an invalid wctrans object instead of a return value
      34   *    from wctrans() which is supposed to be 0.
      35   */
      36  
      37  TST_TOWCTRANS tst_towctrans_loc [] = {
      38    {
      39      { Ttowctrans, TST_LOC_C },
      40      {
      41        {	 { 0x0010, "xxxxxxx" }, { 0,     1,0x0010 }  },
      42        {	 { 0x007F, "tolower" }, { 0,	   1,0x007F }  },
      43        {	 { 0x0061, "toupper" }, { 0,	   1,0x0041 }  },
      44        {	 { 0x0041, "tolower" }, { 0,	   1,0x0061 }  },
      45        { .is_last = 1 }
      46      }
      47    },
      48    {
      49      { Ttowctrans, TST_LOC_de },
      50      {
      51        {	 { 0x0010, "tojkata" }, { 0,     1,0x0010 }  },
      52        {	 { 0x0080, "tolower" }, { 0,	   1,0x0080 }  },
      53        {	 { 0x00EC, "toupper" }, { 0,	   1,0x00CC }  },
      54        {	 { 0x00CC, "tolower" }, { 0,	   1,0x00EC }  },
      55        { .is_last = 1 }
      56      }
      57    },
      58    {
      59      { Ttowctrans, TST_LOC_enUS },
      60      {
      61        {	 { 0x0010, "xxxxxxx" }, { 0,     1,0x0010 }  },
      62        {	 { 0x007F, "tolower" }, { 0,	   1,0x007F }  },
      63        {	 { 0x0061, "toupper" }, { 0,	   1,0x0041 }  },
      64        {	 { 0x0041, "tolower" }, { 0,	   1,0x0061 }  },
      65        { .is_last = 1 }
      66      }
      67    },
      68    {
      69      { Ttowctrans, TST_LOC_eucJP },
      70      {
      71        {	 { 0xFF21, "tolower" }, { 0,	   1,0xFF41 }  },
      72        {	 { 0xFF41, "toupper" }, { 0,	   1,0xFF21 }  },
      73        {	 { 0x30A1, "tojhira" }, { 0,	   1,0x3041 }  },
      74        {	 { 0x3041, "tojkata" }, { 0,	   1,0x30A1 }  },
      75        { .is_last = 1 }
      76      }
      77    },
      78    {
      79      { Ttowctrans, TST_LOC_end }
      80    }
      81  };