cu/test.h: Utilities for Testing
[Utilities]

Defines

#define cu_test_bugf(...)   cuP_test_bugf(__FILE__, __LINE__, __VA_ARGS__)
#define cu_test_vbugf(...)   cuP_test_vbugf(__FILE__, __LINE__, __VA_ARGS__)
#define cu_test_assert(EXPR)
#define cuP_test_str(expr)   cuP_test_strp(expr)
#define cuP_test_strp(expr)   #expr
#define cu_test_assert_binary(OP, type, PRI, LHS, RHS)
#define cu_test_op_eq(x, y)   ((x) == (y))
#define cu_test_op_lt(x, y)   ((x) < (y))
#define cu_test_op_leq(x, y)   ((x) <= (y))
#define cu_test_op_gt(x, y)   ((x) > (y))
#define cu_test_op_geq(x, y)   ((x) >= (y))
#define cu_test_assert_int_eq(LHS, RHS)   cu_test_assert_binary(cu_test_op_eq, int, "d", LHS, RHS)
#define cu_test_assert_int_lt(LHS, RHS)   cu_test_assert_binary(cu_test_op_lt, int, "d", LHS, RHS)
#define cu_test_assert_int_leq(LHS, RHS)   cu_test_assert_binary(cu_test_op_leq, int, "d", LHS, RHS)
#define cu_test_assert_int_gt(LHS, RHS)   cu_test_assert_binary(cu_test_op_gt, int, "d", LHS, RHS)
#define cu_test_assert_int_geq(LHS, RHS)   cu_test_assert_binary(cu_test_op_geq, int, "d", LHS, RHS)
#define cu_test_assert_ptr_eq(LHS, RHS)   cu_test_assert_binary(cu_test_op_eq, void *, "p", LHS, RHS)
#define cu_test_assert_size_eq(LHS, RHS)   cu_test_assert_binary(cu_test_op_eq, size_t, "zd", LHS, RHS)
#define cu_test_assert_word_eq(LHS, RHS)   cu_test_assert_binary(cu_test_op_eq, cu_word_t, CU_PRIxWORD, LHS, RHS)

Enumerations

enum  cu_test_bugaction_t { cu_test_bugaction_cont, cu_test_bugaction_abort, cu_test_bugaction_exit }

Functions

void cu_test_on_bug (cu_test_bugaction_t action, unsigned long max_bug_cnt)
int cu_test_bug_count (void)
void cuP_test_vbugf (char const *file, int line, char const *msg, va_list)
void cuP_test_bugf (char const *file, int line, char const *msg,...)

Define Documentation

#define cu_test_assert ( EXPR   ) 
Value:
do {                                                            \
        if (!(EXPR))                                                    \
            cu_test_bugf("Assertion '%s' failed.", #EXPR);              \
    } while (0)
#define cu_test_assert_binary ( OP,
type,
PRI,
LHS,
RHS   ) 
Value:
do {                                                            \
        type lhs = (LHS);                                               \
        type rhs = (RHS);                                               \
        if (!(OP(lhs, rhs)))                                            \
            cu_test_bugf("Assertion '%s' failed. LHS = %"PRI", RHS = %"PRI"", \
                         cuP_test_str(OP(LHS, RHS)), lhs, rhs);         \
    } while (0)
Generated 2009-11-23 for culibs-0.25 using Doxygen. Maintained by Petter Urkedal.