Back to index

tor  0.2.3.19-rc
Defines
tinytest_macros.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define TT_STMT_BEGIN   do {
#define TT_STMT_END   } while (0)
#define TT_EXIT_TEST_FUNCTION   TT_STMT_BEGIN goto end; TT_STMT_END
#define TT_DECLARE(prefix, args)
#define TT_GRIPE(args)   TT_DECLARE("FAIL", args)
#define TT_BLATHER(args)
#define TT_DIE(args)
#define TT_FAIL(args)
#define tt_abort_printf(msg)   TT_DIE(msg)
#define tt_abort_perror(op)   TT_DIE(("%s: %s [%d]",(op),strerror(errno), errno))
#define tt_abort_msg(msg)   TT_DIE(("%s", msg))
#define tt_abort()   TT_DIE(("%s", "(Failed.)"))
#define tt_failprint_f(msg)   TT_FAIL(msg)
#define tt_fail_perror(op)   TT_FAIL(("%s: %s [%d]",(op),strerror(errno), errno))
#define tt_fail_msg(msg)   TT_FAIL(("%s", msg))
#define tt_fail()   TT_FAIL(("%s", "(Failed.)"))
#define tt_skip()
#define tt_want_(b, msg, fail)
#define tt_want_msg(b, msg)   tt_want_(b, msg, );
#define tt_assert_msg(b, msg)   tt_want_(b, msg, TT_EXIT_TEST_FUNCTION);
#define tt_want(b)   tt_want_msg( (b), "want("#b")")
#define tt_assert(b)   tt_assert_msg((b), "assert("#b")")
#define tt_assert_test_fmt_type(a, b, str_test, type, test, printf_type, printf_fmt, setup_block, cleanup_block, die_on_fail)
#define tt_assert_test_type(a, b, str_test, type, test, fmt, die_on_fail)
#define tt_assert_op_type(a, op, b, type, fmt)
#define tt_int_op(a, op, b)
#define tt_uint_op(a, op, b)
#define tt_ptr_op(a, op, b)
#define tt_str_op(a, op, b)
#define tt_want_int_op(a, op, b)   tt_assert_test_type(a,b,#a" "#op" "#b,long,(val1_ op val2_),"%ld",(void)0)
#define tt_want_uint_op(a, op, b)
#define tt_want_ptr_op(a, op, b)
#define tt_want_str_op(a, op, b)

Define Documentation

#define tt_abort ( )    TT_DIE(("%s", "(Failed.)"))

Definition at line 74 of file tinytest_macros.h.

#define tt_abort_msg (   msg)    TT_DIE(("%s", msg))

Definition at line 73 of file tinytest_macros.h.

#define tt_abort_perror (   op)    TT_DIE(("%s: %s [%d]",(op),strerror(errno), errno))

Definition at line 72 of file tinytest_macros.h.

#define tt_abort_printf (   msg)    TT_DIE(msg)

Definition at line 71 of file tinytest_macros.h.

#define tt_assert (   b)    tt_assert_msg((b), "assert("#b")")

Definition at line 111 of file tinytest_macros.h.

#define tt_assert_msg (   b,
  msg 
)    tt_want_(b, msg, TT_EXIT_TEST_FUNCTION);

Definition at line 105 of file tinytest_macros.h.

#define tt_assert_op_type (   a,
  op,
  b,
  type,
  fmt 
)
Value:
tt_assert_test_type(a,b,#a" "#op" "#b,type,(val1_ op val2_),fmt, \
           TT_EXIT_TEST_FUNCTION)

Definition at line 149 of file tinytest_macros.h.

#define tt_assert_test_fmt_type (   a,
  b,
  str_test,
  type,
  test,
  printf_type,
  printf_fmt,
  setup_block,
  cleanup_block,
  die_on_fail 
)
Value:
TT_STMT_BEGIN                                           \
       type val1_ = (type)(a);                                        \
       type val2_ = (type)(b);                                        \
       int tt_status_ = (test);                                \
       if (!tt_status_ || tinytest_get_verbosity_()>1)  {             \
              printf_type print_;                              \
              printf_type print1_;                             \
              printf_type print2_;                             \
              type value_ = val1_;                             \
              setup_block;                                     \
              print1_ = print_;                                \
              value_ = val2_;                                         \
              setup_block;                                     \
              print2_ = print_;                                \
              TT_DECLARE(tt_status_?"      OK":"FAIL",                \
                        ("assert(%s): "printf_fmt" vs "printf_fmt,    \
                         str_test, print1_, print2_));         \
              print_ = print1_;                                \
              cleanup_block;                                          \
              print_ = print2_;                                \
              cleanup_block;                                          \
              if (!tt_status_) {                               \
                     tinytest_set_test_failed_();                     \
                     die_on_fail ;                             \
              }                                                \
       }                                                       \
       TT_STMT_END

Definition at line 113 of file tinytest_macros.h.

#define tt_assert_test_type (   a,
  b,
  str_test,
  type,
  test,
  fmt,
  die_on_fail 
)
Value:
tt_assert_test_fmt_type(a,b,str_test,type,test,type,fmt,       \
           {print_=value_;},{},die_on_fail)

Definition at line 143 of file tinytest_macros.h.

#define TT_BLATHER (   args)
Value:
TT_STMT_BEGIN                                           \
       if (tinytest_get_verbosity_()>1) TT_DECLARE("  OK", args);     \
       TT_STMT_END

Definition at line 52 of file tinytest_macros.h.

#define TT_DECLARE (   prefix,
  args 
)
Value:
TT_STMT_BEGIN                                    \
       printf("\n  %s %s:%d: ",prefix,__FILE__,__LINE__);      \
       printf args ;                                    \
       TT_STMT_END

Definition at line 41 of file tinytest_macros.h.

#define TT_DIE (   args)
Value:
TT_STMT_BEGIN						\
	tinytest_set_test_failed_();                           \
       TT_GRIPE(args);                                         \
       TT_EXIT_TEST_FUNCTION;                                  \
       TT_STMT_END

Definition at line 57 of file tinytest_macros.h.

Definition at line 36 of file tinytest_macros.h.

#define TT_FAIL (   args)
Value:
TT_STMT_BEGIN						\
	tinytest_set_test_failed_();                           \
       TT_GRIPE(args);                                         \
       TT_STMT_END

Definition at line 64 of file tinytest_macros.h.

#define tt_fail ( )    TT_FAIL(("%s", "(Failed.)"))

Definition at line 80 of file tinytest_macros.h.

#define tt_fail_msg (   msg)    TT_FAIL(("%s", msg))

Definition at line 79 of file tinytest_macros.h.

#define tt_fail_perror (   op)    TT_FAIL(("%s: %s [%d]",(op),strerror(errno), errno))

Definition at line 78 of file tinytest_macros.h.

#define tt_failprint_f (   msg)    TT_FAIL(msg)

Definition at line 77 of file tinytest_macros.h.

#define TT_GRIPE (   args)    TT_DECLARE("FAIL", args)

Definition at line 49 of file tinytest_macros.h.

#define tt_int_op (   a,
  op,
 
)
Value:
tt_assert_test_type(a,b,#a" "#op" "#b,long,(val1_ op val2_), \
           "%ld",TT_EXIT_TEST_FUNCTION)

Definition at line 153 of file tinytest_macros.h.

#define tt_ptr_op (   a,
  op,
 
)
Value:
tt_assert_test_type(a,b,#a" "#op" "#b,void*,                   \
           (val1_ op val2_),"%p",TT_EXIT_TEST_FUNCTION)

Definition at line 161 of file tinytest_macros.h.

#define tt_skip ( )
Value:
TT_STMT_BEGIN						\
	tinytest_set_test_skipped_();                          \
       TT_EXIT_TEST_FUNCTION;                                  \
       TT_STMT_END

Definition at line 83 of file tinytest_macros.h.

#define TT_STMT_BEGIN   do {

Definition at line 30 of file tinytest_macros.h.

#define TT_STMT_END   } while (0)

Definition at line 31 of file tinytest_macros.h.

#define tt_str_op (   a,
  op,
 
)
Value:
tt_assert_test_type(a,b,#a" "#op" "#b,const char *,            \
           (strcmp(val1_,val2_) op 0),"<%s>",TT_EXIT_TEST_FUNCTION)

Definition at line 165 of file tinytest_macros.h.

#define tt_uint_op (   a,
  op,
 
)
Value:
tt_assert_test_type(a,b,#a" "#op" "#b,unsigned long,           \
           (val1_ op val2_),"%lu",TT_EXIT_TEST_FUNCTION)

Definition at line 157 of file tinytest_macros.h.

#define tt_want (   b)    tt_want_msg( (b), "want("#b")")

Definition at line 109 of file tinytest_macros.h.

#define tt_want_ (   b,
  msg,
  fail 
)
Value:
TT_STMT_BEGIN                             \
       if (!(b)) {                               \
              tinytest_set_test_failed_();              \
              TT_GRIPE(("%s",msg));                     \
              fail;                              \
       } else {                                  \
              TT_BLATHER(("%s",msg));                   \
       }                                         \
       TT_STMT_END

Definition at line 89 of file tinytest_macros.h.

#define tt_want_int_op (   a,
  op,
 
)    tt_assert_test_type(a,b,#a" "#op" "#b,long,(val1_ op val2_),"%ld",(void)0)

Definition at line 169 of file tinytest_macros.h.

#define tt_want_msg (   b,
  msg 
)    tt_want_(b, msg, );

Definition at line 101 of file tinytest_macros.h.

#define tt_want_ptr_op (   a,
  op,
 
)
Value:
tt_assert_test_type(a,b,#a" "#op" "#b,void*,                   \
           (val1_ op val2_),"%p",(void)0)

Definition at line 176 of file tinytest_macros.h.

#define tt_want_str_op (   a,
  op,
 
)
Value:
tt_assert_test_type(a,b,#a" "#op" "#b,const char *,            \
           (strcmp(val1_,val2_) op 0),"<%s>",(void)0)

Definition at line 180 of file tinytest_macros.h.

#define tt_want_uint_op (   a,
  op,
 
)
Value:
tt_assert_test_type(a,b,#a" "#op" "#b,unsigned long,           \
           (val1_ op val2_),"%lu",(void)0)

Definition at line 172 of file tinytest_macros.h.