Back to index

glibc  2.9
tst_wcspbrk.c
Go to the documentation of this file.
00001 /*
00002   WCSPBRK: wchar_t *wcspbrk (const wchar_t *ws1, const wchar_t *ws2);
00003 */
00004 
00005 #define TST_FUNCTION wcspbrk
00006 
00007 #include "tsp_common.c"
00008 #include "dat_wcspbrk.c"
00009 
00010 int
00011 tst_wcspbrk (FILE * fp, int debug_flg)
00012 {
00013   TST_DECL_VARS (wchar_t *);
00014   wchar_t *ws1, *ws2;
00015   int err;
00016   wchar_t wc_ex;
00017 
00018   TST_DO_TEST (wcspbrk)
00019   {
00020     TST_HEAD_LOCALE (wcspbrk, S_WCSPBRK);
00021     TST_DO_REC (wcspbrk)
00022     {
00023       TST_GET_ERRET (wcspbrk);
00024       ws1 = TST_INPUT (wcspbrk).ws1;
00025       ws2 = TST_INPUT (wcspbrk).ws2;
00026 
00027       ret = wcspbrk (ws1, ws2);
00028 
00029       if (debug_flg)
00030        {
00031          fprintf (stdout, "wcspbrk() [ %s : %d ] ret = %s\n", locale,
00032                  rec + 1, (ret == NULL) ? "null" : "not null");
00033          if (ret)
00034            fprintf (stderr,
00035                    "                     ret[0] = 0x%lx : 0x%lx = ws2[0]\n",
00036                    (unsigned long int) ret[0], (unsigned long int) ws2[0]);
00037        }
00038 
00039       TST_IF_RETURN (S_WCSPBRK)
00040       {
00041        if (ws2[0] == 0)
00042          {
00043            if (ret == ws1)
00044              {
00045               Result (C_SUCCESS, S_WCSPBRK, CASE_3, MS_PASSED);
00046              }
00047            else
00048              {
00049               err_count++;
00050               Result (C_FAILURE, S_WCSPBRK, CASE_3,
00051                      "return address is not same address as ws1");
00052              }
00053 
00054            continue;
00055          }
00056 
00057        wc_ex = TST_EXPECT (wcspbrk).wc;
00058 
00059        if (debug_flg)
00060          fprintf (stdout,
00061                  "                     *ret = 0x%lx <-> 0x%lx = wc_ex\n",
00062                  (unsigned long int) *ret, (unsigned long int) wc_ex);
00063 
00064        if (*ret != wc_ex)
00065          {
00066            err++;
00067            err_count++;
00068            Result (C_FAILURE, S_WCSPBRK, CASE_4, "the pointed wc is "
00069                   "different from an expected wc");
00070          }
00071        else
00072          {
00073            Result (C_SUCCESS, S_WCSPBRK, CASE_4, MS_PASSED);
00074          }
00075       }
00076     }
00077   }
00078 
00079   return err_count;
00080 }