Back to index

glibc  2.9
dat_strxfrm.c
Go to the documentation of this file.
00001 /*
00002  *  TEST SUITE FOR MB/WC FUNCTIONS IN CLIBRARY
00003  *
00004  *      FILE: dat_strxfrm.c
00005  *
00006  *      STRXFRM:  size_t strxfrm (char *s1, const char s2, size_t n);
00007  */
00008 
00009 
00010 /*
00011  *  NOTE:
00012  *
00013  *  Return value and errno value are checked only for 2nd string:
00014  *  org2[]; n1 and n2 don't mean bytes to be translated.
00015  *  It means a buffer size including a null character.
00016  *  Results of this test depens on results of strcoll().
00017  *  If you got errors, check both test results.
00018  *
00019  *  The buffer size should be enough to contain a string including a
00020  *  null char.       Returns the number of bytes of the string (NOT
00021  *  including a null char).
00022  */
00023 
00024 
00025 
00026 TST_STRXFRM tst_strxfrm_loc [] = {
00027   {
00028     { Tstrxfrm, TST_LOC_de },
00029     {
00030       { /*inp*/ { "\xf6\xc4\xe4\xfc", "\xf6\xc4\xe4\xfc", 17, 17 },  /* #01 */
00031        /*exp*/ { 0,0,0,                      },
00032       },
00033       { /*inp*/ { "aA", "Aa",          10, 10 },  /* #02 */
00034        /*exp*/ { 0,0,0 ,                     },
00035       },
00036       { /*inp*/ { "Aa", "aA",          10, 10 },  /* #03 */
00037        /*exp*/ { 0,0,0,                      },
00038       },
00039       { /*inp*/ { "abc", "",           13, 13 },  /* #04 */
00040        /*exp*/ { 0,0,0,                      },
00041       },
00042       { /*inp*/ { "a", "B",             7,        7 },  /* #05 */
00043        /*exp*/ { 0,0,0,                      },
00044       },
00045       { /*inp*/ { "B", "a",             7,        7 },  /* #06 */
00046        /*exp*/ { 0,0,0,                      },
00047       },
00048       {
00049        /* hiragana == latin1 */
00050        /*inp*/ { "abc", "\244\241\244\242",  13,  9 },   /* #07 */
00051        /*exp*/ { 0,0,0,                   },
00052       },
00053       { .is_last = 1 }
00054     }
00055   },
00056   {
00057     { Tstrxfrm, TST_LOC_enUS },
00058     {
00059       { /*inp*/ { "abcd", "abcd",      17, 17 },  /* #01 */
00060        /*exp*/ { 0,0,0,                      },
00061       },
00062       { /*inp*/ { "aA", "Aa",          10, 10 },  /* #02 */
00063        /*exp*/ { 0,0,0 ,                     },
00064       },
00065       { /*inp*/ { "Aa", "aA",          10, 10 },  /* #03 */
00066        /*exp*/ { 0,0,0,                      },
00067       },
00068       { /*inp*/ { "abc", "",           13, 13 },  /* #04 */
00069        /*exp*/ { 0,0,0,                      },
00070       },
00071       { /*inp*/ { "a", "B",             7,        7 },  /* #05 */
00072        /*exp*/ { 0,0,0,                      },
00073       },
00074       { /*inp*/ { "B", "a",             7,        7 },  /* #06 */
00075        /*exp*/ { 0,0,0,                      },
00076       },
00077 #ifdef NO_WAIVER
00078       {
00079        /* <WAIVER> */
00080        /*inp*/ { "abc", "\244\241\244\242",  13,  9 },   /* #07 */
00081        /*exp*/ { EINVAL,0,0,                     },
00082       },
00083 #endif
00084       { .is_last = 1 }
00085     }
00086   },
00087   {
00088     { Tstrxfrm, TST_LOC_eucJP },    /* ??? */
00089     {
00090       {
00091        /* #01 */
00092        /*inp*/ { "\244\242\244\241",  "\244\241\244\242",   5,  5 },
00093        /*exp*/ { 0,0,0,                   },
00094       },
00095       {
00096        /* #02 */
00097        /*inp*/ { "\244\241\244\242",  "\244\242\244\241",   5,  5 },
00098        /*exp*/ { 0,0,0,                   },
00099       },
00100       {
00101        /* #03 */
00102        /*inp*/ { "\244\242\216\261",  "\216\261\244\242",   5,  5 },
00103        /*exp*/ { 0,0,0,                   },
00104       },
00105 #ifdef NO_WAIVER
00106       {
00107        /*inp*/ { "AAA", "\216\217",        5,  5 },  /* #04 */ /* <WAIVER> */
00108        /*exp*/ { EINVAL,0,0,                     },
00109       },
00110 #endif
00111       { .is_last = 1 }
00112     }
00113   },
00114   {
00115     { Tstrxfrm, TST_LOC_end }
00116   }
00117 };