Back to index

glibc  2.9
dat_mbstowcs.c
Go to the documentation of this file.
00001 /*
00002  *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
00003  *
00004  *      FILE: dat_mbstowcs.c
00005  *
00006  *      MBSTOWCS:  size_t  mbstowcs (wchar_t *ws, char *s, size_t n);
00007  */
00008 
00009 #include <limits.h>
00010 
00011 TST_MBSTOWCS tst_mbstowcs_loc [] = {
00012   {
00013     { Tmbstowcs, TST_LOC_de },
00014     {
00015       { /*----------------- #01 -----------------*/
00016        {
00017          {
00018            { 1,  1, "ABC",            4                  },
00019            { 1,  1, "ABC",            3                  },
00020            { 1,  1, "ABC",            2                  },
00021          }
00022        },
00023        {
00024          {
00025            { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 }      },
00026            { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 }      },
00027            { 0,1,2, { 0x0041,0x0042,0x0043,0x0000 }      },
00028          }
00029        }
00030       },
00031       { /*----------------- #02 -----------------*/
00032        {
00033          {
00034            { 1,  1, "ABC",            4                  },
00035            { 1,  1, "",               1                  },
00036            { 0,  1, "ABC",            4                  },
00037          }
00038        },
00039        {
00040          {
00041            { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 }      },
00042            { 0,1,0, { 0x0000 }                           },
00043            { 0,1,3, { 0x0000 }                           },
00044          }
00045        }
00046       },
00047       { .is_last = 1 }
00048     }
00049   },
00050   {
00051     { Tmbstowcs, TST_LOC_enUS },
00052     {
00053       { /*----------------- #01 -----------------*/
00054        {
00055          {
00056            { 1,  1, "ABC",            4                  },
00057            { 1,  1, "ABC",            3                  },
00058            { 1,  1, "ABC",            2                  },
00059          }
00060        },
00061        {
00062          {
00063            { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 }      },
00064            { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 }      },
00065            { 0,1,2, { 0x0041,0x0042,0x0043,0x0000 }      },
00066          }
00067        }
00068       },
00069       { /*----------------- #02 -----------------*/
00070        {
00071          {
00072            { 1,  1, "ABC",            4                  },
00073            { 1,  1, "",               1                  },
00074            { 0,  1, "ABC",            4                  },
00075          }
00076        },
00077        {
00078          {
00079            { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 }      },
00080            { 0,1,0, { 0x0000 }                           },
00081            { 0,1,3, { 0x0000 }                           },
00082          }
00083        }
00084       },
00085       { .is_last = 1 }
00086     }
00087   },
00088   {
00089     { Tmbstowcs, TST_LOC_eucJP },
00090     {
00091       { /*----------------- #01 -----------------*/
00092        {
00093          {
00094            { 1,  1, "\244\242\244\244\244\246ABC",      7 },
00095            { 1,  1, "\244\242\244\244\244\246ABC",      6 },
00096            { 1,  1, "\244\242\244\244\244\246ABC",      4 },
00097          }
00098        },
00099        {
00100          {
00101            { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }},
00102            { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }},
00103            { 0,1,4, { 0x3042,0x3044,0x3046,0x0041,0x0000 }             },
00104          }
00105        }
00106       },
00107       { /*----------------- #02 -----------------*/
00108        {
00109          {
00110 #ifdef SHOJI_IS_RIGHT
00111            /* XXX I really don't understand the first and third line.
00112               the result of the first line is the same as the first
00113               in the last test (i.e., returns 6).  Also, the third
00114               test will simply convert everything.  */
00115            { 1,  1, "\244\242\244\244\244\246ABC",      7 },
00116            { 1,  1, "",                                 1 },
00117            { 0,  1, "\244\242\244\244\244\246ABC",      7 },
00118 #else
00119            { 1,  1, "\244\242\244\244\244\246ABC",      4 },
00120            { 1,  1, "",                                 1 },
00121            { 0,  1, "\244\242\244\244\244\246ABC",      0 },
00122 #endif
00123          }
00124        },
00125        {
00126          {
00127            { 0,1,4, { 0x3042,0x3044,0x3046,0x0041,0x0000 }             },
00128            { 0,1,0, { 0x0000 }                                  },
00129            { 0,1,6, { 0x0000 }                                  },
00130          }
00131        }
00132       },
00133       { .is_last = 1 }
00134     }
00135   },
00136   {
00137     { Tmbstowcs, TST_LOC_end }
00138   }
00139 };