[ CCUnit project page ] |  | [ CCUnit home page ]

Defines | Functions

# Making assertions

## Defines
#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.
## Functions
void | ccunit_assert (const char *file, unsigned int line, bool condition, const char *condstr)
| Asserts that a condition is true.
## Declare assert test types
#define | DCL_CCUNIT_ASSERT_TEST_TYPE(TYP)
| Asserts that a condition is true.
| DCL_CCUNIT_ASSERT_TEST_TYPE (char)
| DCL_CCUNIT_ASSERT_TEST_TYPE (u_char)
| DCL_CCUNIT_ASSERT_TEST_TYPE (int)
| DCL_CCUNIT_ASSERT_TEST_TYPE (u_int)
| DCL_CCUNIT_ASSERT_TEST_TYPE (short)
| DCL_CCUNIT_ASSERT_TEST_TYPE (u_short)
| DCL_CCUNIT_ASSERT_TEST_TYPE (long)
| DCL_CCUNIT_ASSERT_TEST_TYPE (u_long)
| DCL_CCUNIT_ASSERT_TEST_TYPE (float)
| DCL_CCUNIT_ASSERT_TEST_TYPE (double)
| DCL_CCUNIT_ASSERT_TEST_TYPE (_ccunit_str_t)
| DCL_CCUNIT_ASSERT_TEST_TYPE (_ccunit_ptr_t)
void | ccunit_assert_test__ccunit_obj_t (const char *file, unsigned int line, bool cond, const char *condstr, _ccunit_obj_t expect, _ccunit_obj_t acutal, ccunit_toString_t)
typedef char *(* | ccunit_toString_t )(_ccunit_obj_t)
## 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.

## Define Documentation

#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.

Parameters:

  | COND | assert condition.

Exceptions:

  | _ccunit_runTest_env | If condition is false.

#define CCUNIT_ASSERT_COND | ( |  | TYP,
|  |  | CONDITION,
|  |  | EXPECT,
|  |  | ACTUAL |
| ) |  |  |

Value:

    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.

Parameters:

  | TYP | type of expect/actual value.
  | CONDITION | test condition.
  | EXPECT | expect value.
  | ACTUAL | actual value.

Exceptions:

  | _ccunit_runTest_env | If condition is false.

Note:
  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.

Parameters:

  | ACTUAL | actual value.
  | EXPECT | expect value.

Exceptions:

  | _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.

Parameters:

  | ACTUAL | actual value.
  | EXPECT | expect value.

Exceptions:

  | _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.

Parameters:

  | ACTUAL | actual value.
  | EXPECT | expect value.

Exceptions:

  | _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.

Parameters:

  | ACTUAL | actual value.
  | EXPECT | expect value.

Exceptions:

  | _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.

Parameters:

  | ACTUAL | actual value.
  | EXPECT | expect value.

Exceptions:

  | _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.

Parameters:

  | ACTUAL | actual value.
  | EXPECT | expect value.

Exceptions:

  | _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.

Parameters:

  | ACTUAL | actual value.
  | EXPECT | expect value.

Exceptions:

  | _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.

Parameters:

  | ACTUAL | actual value.
  | EXPECT | expect value.

Exceptions:

  | _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.

Parameters:

  | ACTUAL | actual value.
  | EXPECT | expect value.

Exceptions:

  | _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.

Parameters:

  | ACTUAL | actual value.
  | EXPECT | expect value.

Exceptions:

  | _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.

Parameters:

  | ACTUAL | actual value.
  | EXPECT | expect value.

Exceptions:

  | _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.

Parameters:

  | ACTUAL | actual value.
  | EXPECT | expect value.

Exceptions:

  | _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.

Parameters:

  | ACTUAL | actual value.
  | EXPECT | expect value.

Exceptions:

  | _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.

Parameters:

  | ACTUAL | actual value.
  | EXPECT | expect value.

Exceptions:

  | _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.

Parameters:

  | ACTUAL | actual value.
  | EXPECT | expect value.

Exceptions:

  | _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.

Parameters:

  | ACTUAL | actual value.
  | EXPECT | expect value.

Exceptions:

  | _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.

Parameters:

  | ACTUAL | actual value.
  | EXPECT | expect value.

Exceptions:

  | _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.

Parameters:

  | ACTUAL | actual value.
  | EXPECT | expect value.

Exceptions:

  | _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.

Parameters:

  | ACTUAL | actual value.
  | EXPECT | expect value.

Exceptions:

  | _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.

Parameters:

  | ACTUAL | actual value.
  | EXPECT | expect value.

Exceptions:

  | _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.

Parameters:

  | ACTUAL | actual value.
  | EXPECT | expect value.

Exceptions:

  | _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.

Parameters:

  | ACTUAL | actual value.
  | EXPECT | expect value.

Exceptions:

  | _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.

Parameters:

  | ACTUAL | actual value.
  | EXPECT | expect value.

Exceptions:

  | _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.

Parameters:

  | ACTUAL | actual value.
  | EXPECT | expect value.

Exceptions:

  | _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.

Parameters:

  | ACTUAL | actual value.

Exceptions:

  | _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.

Parameters:

  | ACTUAL | actual pointer value.

Exceptions:

  | _ccunit_runTest_env | If condition is false.

#define CCUNIT_ASSERT_TEST | ( |  | TYP,
|  |  | EXPECT,
|  |  | OP,
|  |  | ACTUAL |
| ) |  |  |

Value:

    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.

Parameters:

  | TYP | type of expect/actual value.
  | EXPECT | expect value.
  | OP | test operator.
  | ACTUAL | actual value.

Exceptions:

  | _ccunit_runTest_env | If condition is false.

#define CCUNIT_ASSERT_TEST_CASE_NSTR | ( |  | EXPECT,
|  |  | OP,
|  |  | ACTUAL,
|  |  | N |
| ) |  |  |

Value:

    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.

Parameters:

  | EXPECT | expect value.
  | OP | test operator.
  | ACTUAL | actual value.
  | N | length to compare.

Exceptions:

  | _ccunit_runTest_env | If condition is false.

#define CCUNIT_ASSERT_TEST_CASE_STR | ( |  | EXPECT,
|  |  | OP,
|  |  | ACTUAL |
| ) |  |  |

Value:

    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.

Parameters:

  | EXPECT | expect value.
  | OP | test operator.
  | ACTUAL | actual value.

Exceptions:

  | _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.

Parameters:

  | EXPECT | expect value.
  | OP | test operator.
  | ACTUAL | actual value.

Exceptions:

  | _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.

Parameters:

  | EXPECT | expect value.
  | OP | test operator.
  | ACTUAL | actual value.

Exceptions:

  | _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.

Parameters:

  | EXPECT | expect value.
  | OP | test operator.
  | ACTUAL | actual value.

Exceptions:

  | _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.

Parameters:

  | EXPECT | expect value.
  | OP | test operator.
  | ACTUAL | actual value.

Exceptions:

  | _ccunit_runTest_env | If condition is false.

#define CCUNIT_ASSERT_TEST_NSTR | ( |  | EXPECT,
|  |  | OP,
|  |  | ACTUAL,
|  |  | N |
| ) |  |  |

Value:

    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.

Parameters:

  | EXPECT | expect value.
  | OP | test operator.
  | ACTUAL | actual value.
  | N | length to compare.

Exceptions:

  | _ccunit_runTest_env | If condition is false.

#define CCUNIT_ASSERT_TEST_OBJ | ( |  | EXPECT,
|  |  | OP,
|  |  | ACTUAL,
|  |  | TOSTR |
| ) |  |  |

Value:

    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.

Parameters:

  | EXPECT | expect value.
  | OP | test operator.
  | ACTUAL | actual value.
  | TOSTR | pointer to function of converting to string.

Exceptions:

  | _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.

Parameters:

  | EXPECT | expect value.
  | OP | test operator.
  | ACTUAL | actual value.

Exceptions:

  | _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.

Parameters:

  | EXPECT | expect value.
  | OP | test operator.
  | ACTUAL | actual value.

Exceptions:

  | _ccunit_runTest_env | If condition is false.

#define CCUNIT_ASSERT_TEST_STR | ( |  | EXPECT,
|  |  | OP,
|  |  | ACTUAL |
| ) |  |  |

Value:

    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.

Parameters:

  | EXPECT | expect value.
  | OP | test operator.
  | ACTUAL | actual value.

Exceptions:

  | _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.

Parameters:

  | EXPECT | expect value.
  | OP | test operator.
  | ACTUAL | actual value.

Exceptions:

  | _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.

Parameters:

  | EXPECT | expect value.
  | OP | test operator.
  | ACTUAL | actual value.

Exceptions:

  | _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.

Parameters:

  | EXPECT | expect value.
  | OP | test operator.
  | ACTUAL | actual value.

Exceptions:

  | _ccunit_runTest_env | If condition is false.

#define DCL_CCUNIT_ASSERT_TEST_TYPE | ( |  | TYP | ) |

Value:

    extern void ccunit_assert_test_ ## TYP (const char* file, unsigned int line, \
                                              bool cond, const char* condstr, \
                                              TYP expect, TYP acutal)

Asserts that a condition is true.

If it isn't it longjmp with _ccunit_runTest_env.

Parameters:

  | TYP | test value type

Exceptions:

  | _ccunit_runTest_env | If condition is false.

## Typedef Documentation

typedef char*(* ccunit_toString_t)(_ccunit_obj_t)

## Function Documentation

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.

Parameters:

  | file | file name.
  | line | line number.
  | condition | assert condition.
  | condstr | assert condition as string.

Exceptions:

  | _ccunit_runTest_env | If condition is false.

void ccunit_assert_test__ccunit_obj_t | ( | const char * | file,
|  | unsigned int | line,
|  | bool | cond,
|  | const char * | condstr,
|  | _ccunit_obj_t | expect,
|  | _ccunit_obj_t | acutal,
|  | ccunit_toString_t |  |
| ) |  |  |

DCL_CCUNIT_ASSERT_TEST_TYPE | ( | _ccunit_ptr_t |  | ) |

DCL_CCUNIT_ASSERT_TEST_TYPE | ( | _ccunit_str_t |  | ) |

DCL_CCUNIT_ASSERT_TEST_TYPE | ( | double |  | ) |

DCL_CCUNIT_ASSERT_TEST_TYPE | ( | float |  | ) |

DCL_CCUNIT_ASSERT_TEST_TYPE | ( | u_long |  | ) |

DCL_CCUNIT_ASSERT_TEST_TYPE | ( | long |  | ) |

DCL_CCUNIT_ASSERT_TEST_TYPE | ( | u_char |  | ) |

DCL_CCUNIT_ASSERT_TEST_TYPE | ( | short |  | ) |

DCL_CCUNIT_ASSERT_TEST_TYPE | ( | u_int |  | ) |

DCL_CCUNIT_ASSERT_TEST_TYPE | ( | int |  | ) |

DCL_CCUNIT_ASSERT_TEST_TYPE | ( | u_short |  | ) |

DCL_CCUNIT_ASSERT_TEST_TYPE | ( | char |  | ) |

| hosts this site. |  | Send comments to: CCUnit Developer |