[ CCUnit project page ] [ CCUnit home page ]
マクロ定義 | 関数

ASSERT マクロ

テスト関数で表明 (ASSERT) を行うためのマクロです。 [詳細]

マクロ定義

#define CCUNIT_ASSERT(COND)   ccunit_assert (__FILE__, __LINE__, COND, #COND)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_COND(TYP, CONDITION, EXPECT, ACTUAL)
 Asserts that a condition is true.

関数

void ccunit_assert (const char *file, unsigned int line, bool condition, const char *condstr)
 Asserts that a condition is true.

Assert Macros

The assert test macros.



#define CCUNIT_ASSERT_TEST(TYP, EXPECT, OP, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_TEST_INT(EXPECT, OP, ACTUAL)   CCUNIT_ASSERT_TEST (int, EXPECT, OP, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_TEST_UINT(EXPECT, OP, ACTUAL)   CCUNIT_ASSERT_TEST (u_int, EXPECT, OP, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_TEST_LONG(EXPECT, OP, ACTUAL)   CCUNIT_ASSERT_TEST (long, EXPECT, OP, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_TEST_ULONG(EXPECT, OP, ACTUAL)   CCUNIT_ASSERT_TEST (u_long, EXPECT, OP, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_TEST_SHORT(EXPECT, OP, ACTUAL)   CCUNIT_ASSERT_TEST (short, EXPECT, OP, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_TEST_USHORT(EXPECT, OP, ACTUAL)   CCUNIT_ASSERT_TEST (u_short, EXPECT, OP, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_TEST_DOUBLE(EXPECT, OP, ACTUAL)   CCUNIT_ASSERT_TEST (double, EXPECT, OP, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_TEST_FLOAT(EXPECT, OP, ACTUAL)   CCUNIT_ASSERT_TEST (float, EXPECT, OP, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_TEST_PTR(EXPECT, OP, ACTUAL)   CCUNIT_ASSERT_TEST (_ccunit_ptr_t, EXPECT, OP, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_TEST_STR(EXPECT, OP, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_TEST_NSTR(EXPECT, OP, ACTUAL, N)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_TEST_CASE_STR(EXPECT, OP, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_TEST_CASE_NSTR(EXPECT, OP, ACTUAL, N)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_TEST_OBJ(EXPECT, OP, ACTUAL, TOSTR)
 Asserts that a condition is true.

Assert Condition Macros

The assert condition macros.



#define CCUNIT_ASSERT_NULL(ACTUAL)   CCUNIT_ASSERT_TEST_PTR(NULL, ==, ACTUAL)
 Asserts that a pointer is NULL.
#define CCUNIT_ASSERT_NOT_NULL(ACTUAL)   CCUNIT_ASSERT_TEST_PTR(NULL, !=, ACTUAL)
 Asserts that a pointer is not NULL.
#define CCUNIT_ASSERT_EQ_INT(EXPECT, ACTUAL)   CCUNIT_ASSERT_TEST_INT (EXPECT, ==, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_NE_INT(EXPECT, ACTUAL)   CCUNIT_ASSERT_TEST_INT (EXPECT, !=, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_LT_INT(EXPECT, ACTUAL)   CCUNIT_ASSERT_TEST_INT (EXPECT, <, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_LE_INT(EXPECT, ACTUAL)   CCUNIT_ASSERT_TEST_INT (EXPECT, <=, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_GT_INT(EXPECT, ACTUAL)   CCUNIT_ASSERT_TEST_INT (EXPECT, >, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_GE_INT(EXPECT, ACTUAL)   CCUNIT_ASSERT_TEST_INT (EXPECT, >=, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_EQ_UINT(EXPECT, ACTUAL)   CCUNIT_ASSERT_TEST_UINT (EXPECT, ==, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_NE_UINT(EXPECT, ACTUAL)   CCUNIT_ASSERT_TEST_UINT (EXPECT, !=, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_LT_UINT(EXPECT, ACTUAL)   CCUNIT_ASSERT_TEST_UINT (EXPECT, <, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_LE_UINT(EXPECT, ACTUAL)   CCUNIT_ASSERT_TEST_UINT (EXPECT, <=, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_GT_UINT(EXPECT, ACTUAL)   CCUNIT_ASSERT_TEST_UINT (EXPECT, >, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_GE_UINT(EXPECT, ACTUAL)   CCUNIT_ASSERT_TEST_UINT (EXPECT, >=, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_EQ_STR(EXPECT, ACTUAL)   CCUNIT_ASSERT_TEST_STR (EXPECT, ==, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_NE_STR(EXPECT, ACTUAL)   CCUNIT_ASSERT_TEST_STR (EXPECT, !=, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_LT_STR(EXPECT, ACTUAL)   CCUNIT_ASSERT_TEST_STR (EXPECT, <, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_LE_STR(EXPECT, ACTUAL)   CCUNIT_ASSERT_TEST_STR (EXPECT, <=, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_GT_STR(EXPECT, ACTUAL)   CCUNIT_ASSERT_TEST_STR (EXPECT, >, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_GE_STR(EXPECT, ACTUAL)   CCUNIT_ASSERT_TEST_STR (EXPECT, >=, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_EQ_PTR(EXPECT, ACTUAL)   CCUNIT_ASSERT_TEST_PTR (EXPECT, ==, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_NE_PTR(EXPECT, ACTUAL)   CCUNIT_ASSERT_TEST_PTR (EXPECT, !=, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_LT_PTR(EXPECT, ACTUAL)   CCUNIT_ASSERT_TEST_PTR (EXPECT, <, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_LE_PTR(EXPECT, ACTUAL)   CCUNIT_ASSERT_TEST_PTR (EXPECT, <=, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_GT_PTR(EXPECT, ACTUAL)   CCUNIT_ASSERT_TEST_PTR (EXPECT, >, ACTUAL)
 Asserts that a condition is true.
#define CCUNIT_ASSERT_GE_PTR(EXPECT, ACTUAL)   CCUNIT_ASSERT_TEST_PTR (EXPECT, >=, ACTUAL)
 Asserts that a condition is true.

説明

テスト関数で表明 (ASSERT) を行うためのマクロです。


マクロ定義

#define CCUNIT_ASSERT (   COND  )     ccunit_assert (__FILE__, __LINE__, COND, #COND)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
COND assert condition.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_COND (   TYP,
  CONDITION,
  EXPECT,
  ACTUAL 
)
値:
do {                                                                    \
    const TYP ex = (EXPECT);                                            \
    const TYP ac = (ACTUAL);                                            \
    ccunit_assert_test_ ## TYP (__FILE__, __LINE__, (CONDITION),        \
                                (#CONDITION), ex, ac);                  \
  } while (0)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
TYP type of expect/actual value.
CONDITION test condition.
EXPECT expect value.
ACTUAL actual value.
例外:
_ccunit_runTest_env If condition is false.
覚え書き:
This macro has the possibility that a side effect happens in the argument EXPECT and ACTUAL.
#define CCUNIT_ASSERT_EQ_INT (   EXPECT,
  ACTUAL 
)    CCUNIT_ASSERT_TEST_INT (EXPECT, ==, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
ACTUAL actual value.
EXPECT expect value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_EQ_PTR (   EXPECT,
  ACTUAL 
)    CCUNIT_ASSERT_TEST_PTR (EXPECT, ==, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
ACTUAL actual value.
EXPECT expect value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_EQ_STR (   EXPECT,
  ACTUAL 
)    CCUNIT_ASSERT_TEST_STR (EXPECT, ==, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
ACTUAL actual value.
EXPECT expect value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_EQ_UINT (   EXPECT,
  ACTUAL 
)    CCUNIT_ASSERT_TEST_UINT (EXPECT, ==, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
ACTUAL actual value.
EXPECT expect value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_GE_INT (   EXPECT,
  ACTUAL 
)    CCUNIT_ASSERT_TEST_INT (EXPECT, >=, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
ACTUAL actual value.
EXPECT expect value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_GE_PTR (   EXPECT,
  ACTUAL 
)    CCUNIT_ASSERT_TEST_PTR (EXPECT, >=, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
ACTUAL actual value.
EXPECT expect value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_GE_STR (   EXPECT,
  ACTUAL 
)    CCUNIT_ASSERT_TEST_STR (EXPECT, >=, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
ACTUAL actual value.
EXPECT expect value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_GE_UINT (   EXPECT,
  ACTUAL 
)    CCUNIT_ASSERT_TEST_UINT (EXPECT, >=, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
ACTUAL actual value.
EXPECT expect value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_GT_INT (   EXPECT,
  ACTUAL 
)    CCUNIT_ASSERT_TEST_INT (EXPECT, >, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
ACTUAL actual value.
EXPECT expect value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_GT_PTR (   EXPECT,
  ACTUAL 
)    CCUNIT_ASSERT_TEST_PTR (EXPECT, >, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
ACTUAL actual value.
EXPECT expect value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_GT_STR (   EXPECT,
  ACTUAL 
)    CCUNIT_ASSERT_TEST_STR (EXPECT, >, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
ACTUAL actual value.
EXPECT expect value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_GT_UINT (   EXPECT,
  ACTUAL 
)    CCUNIT_ASSERT_TEST_UINT (EXPECT, >, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
ACTUAL actual value.
EXPECT expect value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_LE_INT (   EXPECT,
  ACTUAL 
)    CCUNIT_ASSERT_TEST_INT (EXPECT, <=, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
ACTUAL actual value.
EXPECT expect value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_LE_PTR (   EXPECT,
  ACTUAL 
)    CCUNIT_ASSERT_TEST_PTR (EXPECT, <=, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
ACTUAL actual value.
EXPECT expect value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_LE_STR (   EXPECT,
  ACTUAL 
)    CCUNIT_ASSERT_TEST_STR (EXPECT, <=, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
ACTUAL actual value.
EXPECT expect value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_LE_UINT (   EXPECT,
  ACTUAL 
)    CCUNIT_ASSERT_TEST_UINT (EXPECT, <=, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
ACTUAL actual value.
EXPECT expect value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_LT_INT (   EXPECT,
  ACTUAL 
)    CCUNIT_ASSERT_TEST_INT (EXPECT, <, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
ACTUAL actual value.
EXPECT expect value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_LT_PTR (   EXPECT,
  ACTUAL 
)    CCUNIT_ASSERT_TEST_PTR (EXPECT, <, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
ACTUAL actual value.
EXPECT expect value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_LT_STR (   EXPECT,
  ACTUAL 
)    CCUNIT_ASSERT_TEST_STR (EXPECT, <, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
ACTUAL actual value.
EXPECT expect value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_LT_UINT (   EXPECT,
  ACTUAL 
)    CCUNIT_ASSERT_TEST_UINT (EXPECT, <, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
ACTUAL actual value.
EXPECT expect value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_NE_INT (   EXPECT,
  ACTUAL 
)    CCUNIT_ASSERT_TEST_INT (EXPECT, !=, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
ACTUAL actual value.
EXPECT expect value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_NE_PTR (   EXPECT,
  ACTUAL 
)    CCUNIT_ASSERT_TEST_PTR (EXPECT, !=, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
ACTUAL actual value.
EXPECT expect value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_NE_STR (   EXPECT,
  ACTUAL 
)    CCUNIT_ASSERT_TEST_STR (EXPECT, !=, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
ACTUAL actual value.
EXPECT expect value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_NE_UINT (   EXPECT,
  ACTUAL 
)    CCUNIT_ASSERT_TEST_UINT (EXPECT, !=, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
ACTUAL actual value.
EXPECT expect value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_NOT_NULL (   ACTUAL  )     CCUNIT_ASSERT_TEST_PTR(NULL, !=, ACTUAL)

Asserts that a pointer is not NULL.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
ACTUAL actual value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_NULL (   ACTUAL  )     CCUNIT_ASSERT_TEST_PTR(NULL, ==, ACTUAL)

Asserts that a pointer is NULL.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
ACTUAL actual pointer value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_TEST (   TYP,
  EXPECT,
  OP,
  ACTUAL 
)
値:
do {                                                                    \
    const TYP ex = (EXPECT);                                            \
    const TYP ac = (ACTUAL);                                            \
    ccunit_assert_test_ ## TYP (__FILE__, __LINE__, (ex OP ac),         \
                                (#EXPECT " " #OP " " #ACTUAL),          \
                                ex, ac);                                \
  } while (0)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
TYP type of expect/actual value.
EXPECT expect value.
OP test operator.
ACTUAL actual value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_TEST_CASE_NSTR (   EXPECT,
  OP,
  ACTUAL,
  N 
)
値:
do {                                                                    \
    const _ccunit_str_t ex = (EXPECT);                                  \
    const _ccunit_str_t ac = (ACTUAL);                                  \
    const size_t n = (N);                                               \
    ccunit_assert_test__ccunit_str_t (__FILE__, __LINE__,               \
                                      strncasecmp(ex, ac, n) OP 0,      \
                                      "strncasecmp (" #EXPECT ", " #ACTUAL \
                                      ", " #N ") " #OP " 0",            \
                                      ex, ac);                          \
  } while (0)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
EXPECT expect value.
OP test operator.
ACTUAL actual value.
N length to compare.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_TEST_CASE_STR (   EXPECT,
  OP,
  ACTUAL 
)
値:
do {                                                                    \
    const _ccunit_str_t ex = (EXPECT);                                  \
    const _ccunit_str_t ac = (ACTUAL);                                  \
    const size_t n = (N);                                               \
    ccunit_assert_test__ccunit_str_t (__FILE__, __LINE__,               \
                                      strcasecmp(ex, ac) OP 0,          \
                                      "strcasecmp (" #EXPECT ", " #ACTUAL \
                                      ") " #OP " 0",                    \
                                      ex, ac);                          \
  } while (0)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
EXPECT expect value.
OP test operator.
ACTUAL actual value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_TEST_DOUBLE (   EXPECT,
  OP,
  ACTUAL 
)    CCUNIT_ASSERT_TEST (double, EXPECT, OP, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
EXPECT expect value.
OP test operator.
ACTUAL actual value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_TEST_FLOAT (   EXPECT,
  OP,
  ACTUAL 
)    CCUNIT_ASSERT_TEST (float, EXPECT, OP, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
EXPECT expect value.
OP test operator.
ACTUAL actual value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_TEST_INT (   EXPECT,
  OP,
  ACTUAL 
)    CCUNIT_ASSERT_TEST (int, EXPECT, OP, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
EXPECT expect value.
OP test operator.
ACTUAL actual value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_TEST_LONG (   EXPECT,
  OP,
  ACTUAL 
)    CCUNIT_ASSERT_TEST (long, EXPECT, OP, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
EXPECT expect value.
OP test operator.
ACTUAL actual value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_TEST_NSTR (   EXPECT,
  OP,
  ACTUAL,
  N 
)
値:
do {                                                                    \
    const _ccunit_str_t ex = (EXPECT);                                  \
    const _ccunit_str_t ac = (ACTUAL);                                  \
    const size_t n = (N);                                               \
    ccunit_assert_test__ccunit_str_t (__FILE__, __LINE__,               \
                                      strncmp(ex, ac, n) OP 0,          \
                                      "strncmp (" #EXPECT ", " #ACTUAL  \
                                      ", " #N ") " #OP " 0",            \
                                      ex, ac);                          \
  } while (0)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
EXPECT expect value.
OP test operator.
ACTUAL actual value.
N length to compare.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_TEST_OBJ (   EXPECT,
  OP,
  ACTUAL,
  TOSTR 
)
値:
do {                                                                    \
    const _ccunit_obj_t ex = (EXPECT);                                  \
    const _ccunit_obj_t ac = (ACTUAL);                                  \
    const char* condstr = #OP " (" #EXPECT ", " #ACTUAL ")";            \
    ccunit_assert_test__ccunit_obj_t (__FILE__, __LINE__,               \
                                      OP(ex, ac), condstr, ex, ac,      \
                                      (ccunit_toString_t)TOSTR);        \
  } while (0)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
EXPECT expect value.
OP test operator.
ACTUAL actual value.
TOSTR pointer to function of converting to string.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_TEST_PTR (   EXPECT,
  OP,
  ACTUAL 
)    CCUNIT_ASSERT_TEST (_ccunit_ptr_t, EXPECT, OP, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
EXPECT expect value.
OP test operator.
ACTUAL actual value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_TEST_SHORT (   EXPECT,
  OP,
  ACTUAL 
)    CCUNIT_ASSERT_TEST (short, EXPECT, OP, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
EXPECT expect value.
OP test operator.
ACTUAL actual value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_TEST_STR (   EXPECT,
  OP,
  ACTUAL 
)
値:
do {                                                                    \
    const _ccunit_str_t ex = (EXPECT);                                  \
    const _ccunit_str_t ac = (ACTUAL);                                  \
    const char* condstr = "strcmp (" #EXPECT ", " #ACTUAL ") " #OP " 0"; \
    ccunit_assert_test__ccunit_str_t (__FILE__, __LINE__,               \
                                      strcmp(ex, ac) OP 0, condstr, ex, ac); \
  } while (0)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
EXPECT expect value.
OP test operator.
ACTUAL actual value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_TEST_UINT (   EXPECT,
  OP,
  ACTUAL 
)    CCUNIT_ASSERT_TEST (u_int, EXPECT, OP, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
EXPECT expect value.
OP test operator.
ACTUAL actual value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_TEST_ULONG (   EXPECT,
  OP,
  ACTUAL 
)    CCUNIT_ASSERT_TEST (u_long, EXPECT, OP, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
EXPECT expect value.
OP test operator.
ACTUAL actual value.
例外:
_ccunit_runTest_env If condition is false.
#define CCUNIT_ASSERT_TEST_USHORT (   EXPECT,
  OP,
  ACTUAL 
)    CCUNIT_ASSERT_TEST (u_short, EXPECT, OP, ACTUAL)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
EXPECT expect value.
OP test operator.
ACTUAL actual value.
例外:
_ccunit_runTest_env If condition is false.

関数

void ccunit_assert ( const char *  file,
unsigned int  line,
bool  condition,
const char *  condstr 
)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

引数:
file file name.
line line number.
condition assert condition.
condstr assert condition as string.
例外:
_ccunit_runTest_env If condition is false.
SourceForge.jp hosts this site. Send comments to: CCUnit Developer