Back to index

glibc  2.9
tst_wcstod.c
Go to the documentation of this file.
00001 /*
00002   WCSTOD: double wcstod (wchar_t *np, const wchar_t **endp);
00003 */
00004 
00005 #define TST_FUNCTION wcstod
00006 
00007 #include "tsp_common.c"
00008 #include "dat_wcstod.c"
00009 
00010 int
00011 tst_wcstod (FILE * fp, int debug_flg)
00012 {
00013   TST_DECL_VARS (double);
00014   wchar_t *np, *endp, fwc;
00015   double val;
00016 
00017   TST_DO_TEST (wcstod)
00018   {
00019     TST_HEAD_LOCALE (wcstod, S_WCSTOD);
00020     TST_DO_REC (wcstod)
00021     {
00022       TST_GET_ERRET (wcstod);
00023       np = TST_INPUT (wcstod).np;
00024 
00025       TST_CLEAR_ERRNO;
00026       ret = wcstod (np, &endp);
00027       TST_SAVE_ERRNO;
00028 
00029       if (debug_flg)
00030        {
00031          fprintf (stdout, "wcstod() [ %s : %d ] ret  = %f\n", locale,
00032                  rec + 1, ret);
00033          fprintf (stdout, "                 *endp = 0x%lx\n",
00034                  (unsigned long int) *endp);
00035        }
00036 
00037       TST_IF_RETURN (S_WCSTOD)
00038       {
00039        if (ret != 0)
00040          {
00041            val = ret - TST_EXPECT (wcstod).val;
00042            if (TST_ABS (val) < TST_DBL_EPS)
00043              {
00044               Result (C_SUCCESS, S_WCSTOD, CASE_3, MS_PASSED);
00045              }
00046            else
00047              {
00048               err_count++;
00049               Result (C_FAILURE, S_WCSTOD, CASE_3, "return value is wrong");
00050              }
00051          }
00052       }
00053 
00054       fwc = TST_EXPECT (wcstod).fwc;
00055 
00056       if (fwc == *endp)
00057        {
00058          Result (C_SUCCESS, S_WCSTOD, CASE_4, MS_PASSED);
00059        }
00060       else
00061        {
00062          err_count++;
00063          Result (C_FAILURE, S_WCSTOD, CASE_4, "a final wc is wrong.");
00064        }
00065     }
00066   }
00067 
00068   return err_count;
00069 }