Back to index

glibc  2.9
Defines | Functions
tst_funcs.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define C_SUCCESS   'S' /* test case test passed */
#define C_FAILURE   'F' /* test case failed */
#define C_IGNORED   'I' /* test case/result ignored (not tested) */
#define C_INVALID   'D' /* test data may be wrong */
#define C_LOCALES   'L' /* can't set locale (skip) */
#define Result(C, S, E, M)   result (fp, (C), (S), locale, rec+1, seq_num+1, (E), (M))
#define CASE_0   0
#define CASE_1   1
#define CASE_2   2
#define CASE_3   3
#define CASE_4   4
#define CASE_5   5
#define CASE_6   6
#define CASE_7   7
#define CASE_8   8
#define CASE_9   9
#define MS_PASSED   "PASSED"
#define MS_SPACE   " "
#define MS_FAILED   " "
#define MS_NOTEST   "NOTEST"
#define MS_ABORTU   "ABEND0"
#define MS_ABORT   "ABEND1"
#define MK_PASSED   0x00
#define MK_SPACE   0x01
#define MK_NOTEST   0x02
#define MK_ABORTU   0x04
#define MK_ABORT   0x08
#define TST_ABS(x)   (((x) > 0) ? (x) : -(x))
#define TMD_ERRET(_type_)
#define TMD_RECHEAD(_FUNC_)
#define TST_FTYP(func)   tst_##func##_loc
#define TST_HEAD(func)   tst_##func##_loc[ loc ].hd
#define TST_INPUT(func)   tst_##func##_loc[ loc ].rec[ rec ].input
#define TST_EXPECT(func)   tst_##func##_loc[ loc ].rec[ rec ].expect
#define TST_INPUT_SEQ(func)   tst_##func##_loc[ loc ].rec[ rec ].input.seq[ seq_num ]
#define TST_EXPECT_SEQ(func)   tst_##func##_loc[ loc ].rec[ rec ].expect.seq[ seq_num ]
#define TST_IS_LAST(func)   tst_##func##_loc[ loc ].rec[ rec ].is_last
#define TST_DECL_VARS(_type_)
#define TST_DO_TEST(o_func)   for (loc = 0; strcmp (TST_HEAD (o_func).locale, TST_LOC_end); ++loc)
#define TST_HEAD_LOCALE(ofunc, s_func)
#define TST_DO_REC(ofunc)   for (rec=0; !TST_IS_LAST (ofunc); ++rec)
#define TST_DO_SEQ(_count_)   for (seq_num=0; seq_num < _count_; seq_num++)
#define TST_GET_ERRET(_ofunc_)
#define TST_GET_ERRET_SEQ(_ofunc_)
#define TST_CLEAR_ERRNO   errno = 0
#define TST_SAVE_ERRNO   errno_save = errno
#define TST_IF_RETURN(_s_func_)
#define TEX_ERRET_REC(_type_)
#define TEX_ERRET_REC_SEQ(_type_, _count_)
#define TST_ISW_STRUCT(_FUNC_, _func_)
#define TST_FUNC_ISW(_FUNC_, _func_)
#define TST_TOW_STRUCT(_FUNC_, _func_)
#define TST_FUNC_TOW(_FUNC_, _func_)

Functions

int result (FILE *fp, char res, const char *func, const char *loc, int rec_no, int seq_num, int case_no, const char *msg)

Define Documentation

#define C_FAILURE   'F' /* test case failed */

Definition at line 14 of file tst_funcs.h.

#define C_IGNORED   'I' /* test case/result ignored (not tested) */

Definition at line 15 of file tst_funcs.h.

#define C_INVALID   'D' /* test data may be wrong */

Definition at line 16 of file tst_funcs.h.

#define C_LOCALES   'L' /* can't set locale (skip) */

Definition at line 17 of file tst_funcs.h.

#define C_SUCCESS   'S' /* test case test passed */

Definition at line 13 of file tst_funcs.h.

#define CASE_0   0

Definition at line 26 of file tst_funcs.h.

#define CASE_1   1

Definition at line 27 of file tst_funcs.h.

#define CASE_2   2

Definition at line 28 of file tst_funcs.h.

#define CASE_3   3

Definition at line 29 of file tst_funcs.h.

#define CASE_4   4

Definition at line 30 of file tst_funcs.h.

#define CASE_5   5

Definition at line 31 of file tst_funcs.h.

#define CASE_6   6

Definition at line 32 of file tst_funcs.h.

#define CASE_7   7

Definition at line 33 of file tst_funcs.h.

#define CASE_8   8

Definition at line 34 of file tst_funcs.h.

#define CASE_9   9

Definition at line 35 of file tst_funcs.h.

#define MK_ABORT   0x08

Definition at line 48 of file tst_funcs.h.

#define MK_ABORTU   0x04

Definition at line 47 of file tst_funcs.h.

#define MK_NOTEST   0x02

Definition at line 46 of file tst_funcs.h.

#define MK_PASSED   0x00

Definition at line 44 of file tst_funcs.h.

#define MK_SPACE   0x01

Definition at line 45 of file tst_funcs.h.

#define MS_ABORT   "ABEND1"

Definition at line 42 of file tst_funcs.h.

#define MS_ABORTU   "ABEND0"

Definition at line 41 of file tst_funcs.h.

#define MS_FAILED   " "

Definition at line 39 of file tst_funcs.h.

#define MS_NOTEST   "NOTEST"

Definition at line 40 of file tst_funcs.h.

#define MS_PASSED   "PASSED"

Definition at line 37 of file tst_funcs.h.

#define MS_SPACE   " "

Definition at line 38 of file tst_funcs.h.

#define Result (   C,
  S,
  E,
  M 
)    result (fp, (C), (S), locale, rec+1, seq_num+1, (E), (M))

Definition at line 23 of file tst_funcs.h.

#define TEX_ERRET_REC (   _type_)
Value:
struct {                           \
           TMD_ERRET (_type_);                   \
       }

Definition at line 165 of file tst_funcs.h.

#define TEX_ERRET_REC_SEQ (   _type_,
  _count_ 
)
Value:
struct {                           \
           struct {                       \
              TMD_ERRET (_type_);         \
           } seq[ _count_ ];                     \
       }

Definition at line 170 of file tst_funcs.h.

#define TMD_ERRET (   _type_)
Value:
int      err_val; \
                         int         ret_flg; \
                         _type_ ret_val

Definition at line 56 of file tst_funcs.h.

#define TMD_RECHEAD (   _FUNC_)
Value:
\
                           typedef struct {                            \
                              TIN_##_FUNC_##_REC  input;               \
                              TEX_##_FUNC_##_REC  expect;              \
                              int is_last;                             \
                           }         TST_##_FUNC_##_REC;                      \
                           typedef struct {                            \
				  TST_HEAD             hd;             \
                              TST_##_FUNC_##_REC  rec[ MAX_LOC_TEST ]; \
                           }         TST_##_FUNC_

Definition at line 60 of file tst_funcs.h.

#define TST_ABS (   x)    (((x) > 0) ? (x) : -(x))

Definition at line 54 of file tst_funcs.h.

#define TST_CLEAR_ERRNO   errno = 0

Definition at line 126 of file tst_funcs.h.

#define TST_DECL_VARS (   _type_)
Value:
int   loc, rec, err_count = 0;                   \
       int   warn_count __attribute__ ((unused));       \
       int   func_id, seq_num = 0;               \
       const char *locale;                       \
       int   err_exp, ret_flg;                          \
       int errno_save = 0;                       \
       _type_ ret_exp;                                  \
       _type_ ret

Definition at line 84 of file tst_funcs.h.

#define TST_DO_REC (   ofunc)    for (rec=0; !TST_IS_LAST (ofunc); ++rec)

Definition at line 110 of file tst_funcs.h.

#define TST_DO_SEQ (   _count_)    for (seq_num=0; seq_num < _count_; seq_num++)

Definition at line 113 of file tst_funcs.h.

#define TST_DO_TEST (   o_func)    for (loc = 0; strcmp (TST_HEAD (o_func).locale, TST_LOC_end); ++loc)

Definition at line 94 of file tst_funcs.h.

#define TST_EXPECT (   func)    tst_##func##_loc[ loc ].rec[ rec ].expect

Definition at line 75 of file tst_funcs.h.

#define TST_EXPECT_SEQ (   func)    tst_##func##_loc[ loc ].rec[ rec ].expect.seq[ seq_num ]

Definition at line 78 of file tst_funcs.h.

#define TST_FTYP (   func)    tst_##func##_loc

Definition at line 72 of file tst_funcs.h.

#define TST_FUNC_ISW (   _FUNC_,
  _func_ 
)

Definition at line 190 of file tst_funcs.h.

#define TST_FUNC_TOW (   _FUNC_,
  _func_ 
)
Value:
int                                                            \
tst_tow##_func_ (FILE *fp, int debug_flg)                      \
{                                                              \
  TST_DECL_VARS (wint_t);                                      \
  wint_t wc;                                                   \
  TST_DO_TEST (tow##_func_)                                    \
    {                                                          \
      TST_HEAD_LOCALE (tow##_func_, S_TOW##_FUNC_);                   \
      TST_DO_REC (tow##_func_)                                        \
       {                                                       \
         TST_GET_ERRET (tow##_func_);                                 \
         wc = TST_INPUT (tow##_func_).wc;                      \
         ret = tow##_func_ (wc);                               \
         if (debug_flg)                                        \
           {                                                   \
             fprintf (stdout, "tow*() [ %s : %d ] ret = 0x%x\n",      \
                     locale, rec+1, ret);                      \
           }                                                   \
									\
	  TST_IF_RETURN (S_TOW##_FUNC_) { };                          \
       }                                                       \
    }                                                          \
                                                               \
  return err_count;                                            \
}

Definition at line 244 of file tst_funcs.h.

#define TST_GET_ERRET (   _ofunc_)
Value:
err_exp = TST_EXPECT (_ofunc_).err_val; \
       ret_flg = TST_EXPECT (_ofunc_).ret_flg; \
       ret_exp = TST_EXPECT (_ofunc_).ret_val

Definition at line 116 of file tst_funcs.h.

#define TST_GET_ERRET_SEQ (   _ofunc_)
Value:
err_exp = TST_EXPECT_SEQ (_ofunc_).err_val; \
       ret_flg = TST_EXPECT_SEQ (_ofunc_).ret_flg; \
       ret_exp = TST_EXPECT_SEQ (_ofunc_).ret_val

Definition at line 121 of file tst_funcs.h.

#define TST_HEAD (   func)    tst_##func##_loc[ loc ].hd

Definition at line 73 of file tst_funcs.h.

#define TST_HEAD_LOCALE (   ofunc,
  s_func 
)
Value:
func_id = TST_HEAD (ofunc).func_id;                                         \
  locale  = TST_HEAD (ofunc).locale;                                        \
  if (setlocale (LC_ALL, locale) == NULL)                            \
    {                                                                \
      fprintf (stderr, "Warning : can't set locale: %s\nskipping ...\n",      \
              locale);                                                      \
      result (fp, C_LOCALES, s_func, locale, 0, 0, 0, "can't set locale");    \
      ++err_count;                                                   \
      continue;                                                             \
    }

Definition at line 98 of file tst_funcs.h.

#define TST_IF_RETURN (   _s_func_)
Value:
if (err_exp != 0)                                                    \
    {                                                                \
      if (errno_save == err_exp)                                     \
       {                                                             \
         result (fp, C_SUCCESS, _s_func_, locale, rec+1, seq_num+1, 1,             \
                MS_PASSED);                                          \
       }                                                             \
      else                                                           \
       {                                                             \
         err_count++;                                                       \
         result (fp, C_FAILURE, _s_func_, locale, rec+1, seq_num+1, 1,             \
                "the value of errno is different from an expected value");  \
       }                                                             \
    }                                                                \
                                                                     \
  if (ret_flg == 1)                                                  \
    {                                                                \
      if (ret == ret_exp)                                            \
       {                                                             \
         result (fp, C_SUCCESS, _s_func_, locale, rec+1, seq_num+1, 2,             \
                MS_PASSED);                                          \
       }                                                             \
      else                                                           \
       {                                                             \
         err_count++;                                                       \
         result (fp, C_FAILURE, _s_func_, locale, rec+1, seq_num+1, 2,             \
                "the return value is different from an expected value");    \
       }                                                             \
    }                                                                \
  else

Definition at line 133 of file tst_funcs.h.

#define TST_INPUT (   func)    tst_##func##_loc[ loc ].rec[ rec ].input

Definition at line 74 of file tst_funcs.h.

#define TST_INPUT_SEQ (   func)    tst_##func##_loc[ loc ].rec[ rec ].input.seq[ seq_num ]

Definition at line 76 of file tst_funcs.h.

#define TST_IS_LAST (   func)    tst_##func##_loc[ loc ].rec[ rec ].is_last

Definition at line 80 of file tst_funcs.h.

#define TST_ISW_STRUCT (   _FUNC_,
  _func_ 
)
Value:
typedef                                          \
       struct {                                  \
	    wint_t   wc;                         \
       } TIN_ISW##_FUNC_##_REC;                  \
	typedef						\
	TEX_ERRET_REC (int)   TEX_ISW##_FUNC_##_REC;    \
       TMD_RECHEAD (ISW##_FUNC_)

Definition at line 181 of file tst_funcs.h.

#define TST_SAVE_ERRNO   errno_save = errno

Definition at line 129 of file tst_funcs.h.

#define TST_TOW_STRUCT (   _FUNC_,
  _func_ 
)
Value:
typedef                                          \
       struct {                                  \
	    wint_t   wc;                         \
       } TIN_TOW##_FUNC_##_REC;                  \
	typedef						\
	TEX_ERRET_REC (wint_t)     TEX_TOW##_FUNC_##_REC;      \
       TMD_RECHEAD (TOW##_FUNC_)

Definition at line 235 of file tst_funcs.h.


Function Documentation

int result ( FILE fp,
char  res,
const char *  func,
const char *  loc,
int  rec_no,
int  seq_num,
int  case_no,
const char *  msg 
)

Definition at line 43 of file tsp_common.c.

{
  if (fp == NULL
      || strlen (func) + strlen (loc) + strlen (msg) + 32 > MAX_RESULT_REC)
    {
      fprintf (stderr,
              "Warning: result(): can't write the result: %s:%s:%d:%d:%s\n",
              func, loc, rec_no, case_no, msg);
      return 0;
    }

  sprintf (result_rec, "%s:%s:%d:%d:%d:%c:%s\n", func, loc, rec_no, seq_no,
          case_no, res, msg);

  if (fputs (result_rec, fp) == EOF)
    {
      return 0;
    }

  return 1;
}

Here is the call graph for this function: