Back to index

glibc  2.9
dat_towctrans.c
Go to the documentation of this file.
00001 /*
00002  *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
00003  *
00004  *      FILE: dat_towctrans.c
00005  *
00006  *      TOWCTRANS:  wint_t towctrans (wint_t wc, wctrans_t charclass);
00007  */
00008 
00009 #include <errno.h>
00010 #include <stdlib.h>
00011 #include <wctype.h>
00012 #include "tst_types.h"
00013 #include "tgn_locdef.h"
00014 
00015 /*
00016  *  NOTE:
00017  *    Set ret_flg = 1, when a return value is expected to be 0 (FALSE).
00018  *    Set ret_flg = 0, when a return value is expected to be non-zero (TRUE).
00019  *
00020  *    Since the functions return *non*-zero value for TRUE, can't
00021  *    compare an actual return value with an expected return value.
00022  *    Set the ret_flg=0 for TRUE cases and the tst_isw*() will check
00023  *    the non-zero value.
00024  *
00025  *  { { WEOF }, { 0,0,1,0 } },
00026  *                  | |
00027  *                  | ret_val: an expected return value
00028  *                  ret_flg: if 1, compare an actual return value with the
00029  *                          ret_val; if 0, the test program checks
00030  *                          the actual return value.
00031  *
00032  *    CAUTION: if a charclass is invalid, the test function gives
00033  *    towctrans() an invalid wctrans object instead of a return value
00034  *    from wctrans() which is supposed to be 0.
00035  */
00036 
00037 TST_TOWCTRANS tst_towctrans_loc [] = {
00038   {
00039     { Ttowctrans, TST_LOC_C },
00040     {
00041 #ifdef SHOJI_IS_RIGHT
00042       {        { 0x0010, "xxxxxxx" }, { EINVAL,1,0x0010 }  },
00043 #else                         
00044       {        { 0x0010, "xxxxxxx" }, { 0,     1,0x0010 }  },
00045 #endif                        
00046       {        { 0x007F, "tolower" }, { 0,          1,0x007F }  },
00047       {        { 0x0061, "toupper" }, { 0,          1,0x0041 }  },
00048       {        { 0x0041, "tolower" }, { 0,          1,0x0061 }  },
00049       { .is_last = 1 }
00050     }
00051   },
00052   {
00053     { Ttowctrans, TST_LOC_de },
00054     {
00055 #ifdef SHOJI_IS_RIGHT
00056       {        { 0x0010, "tojkata" }, { EINVAL,1,0x0010 }  },
00057 #else                         
00058       {        { 0x0010, "tojkata" }, { 0,     1,0x0010 }  },
00059 #endif                        
00060       {        { 0x0080, "tolower" }, { 0,          1,0x0080 }  },
00061       {        { 0x00EC, "toupper" }, { 0,          1,0x00CC }  },
00062       {        { 0x00CC, "tolower" }, { 0,          1,0x00EC }  },
00063       { .is_last = 1 }               
00064     }                         
00065   },                          
00066   {                           
00067     { Ttowctrans, TST_LOC_enUS }, 
00068     {                         
00069 #ifdef SHOJI_IS_RIGHT                
00070       {        { 0x0010, "xxxxxxx" }, { EINVAL,1,0x0010 }  },
00071 #else                         
00072       {        { 0x0010, "xxxxxxx" }, { 0,     1,0x0010 }  },
00073 #endif                        
00074       {        { 0x007F, "tolower" }, { 0,          1,0x007F }  },
00075       {        { 0x0061, "toupper" }, { 0,          1,0x0041 }  },
00076       {        { 0x0041, "tolower" }, { 0,          1,0x0061 }  },
00077       { .is_last = 1 }               
00078     }                         
00079   },                          
00080   {                           
00081     { Ttowctrans, TST_LOC_eucJP },
00082     {                         
00083       {        { 0xFF21, "tolower" }, { 0,          1,0xFF41 }  },
00084       {        { 0xFF41, "toupper" }, { 0,          1,0xFF21 }  },
00085       {        { 0x30A1, "tojhira" }, { 0,          1,0x3041 }  },
00086       {        { 0x3041, "tojkata" }, { 0,          1,0x30A1 }  },
00087       { .is_last = 1 }
00088     }
00089   },
00090   {
00091     { Ttowctrans, TST_LOC_end }
00092   }
00093 };