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

Defines | Functions

# Assert Macros

There are the macros for assertions by test functions. More...

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

## Detailed Description

There are the macros for assertions by test functions.

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

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

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