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

Modules | Defines | Typedefs | Variables

# Assert
[Module hierarchy]

A set of assert functions and macros. More...

Collaboration diagram for Assert:

## Modules
| Convert value to string

| Make value to string.
## Defines
#define | CCUNIT_HAVE_U_CHAR
#define | CCUNIT_HAVE_U_INT
#define | CCUNIT_HAVE_U_SHORT
#define | CCUNIT_HAVE_U_LONG
## Typedefs
typedef unsigned char | u_char
| u_char
typedef unsigned int | u_int
| u_int
typedef unsigned short | u_short
| u_short
typedef unsigned long | u_long
| u_long
typedef const char * | _ccunit_str_t
| string type
typedef const void * | _ccunit_ptr_t
| pointer type
typedef const void * | _ccunit_obj_t
| object type
## Variables
jmp_buf | _ccunit_runTest_env
| run tests exception environment.
CCUnitTestFailure * | _ccunit_testFailure
| run tests exception.
## Declare assert test types
typedef char *(* | ccunit_toString_t )(_ccunit_obj_t)
| 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)
## Assert test type
  end of CCUnitValueToString Assert test function. Parameters:
  | TYP | type of test value.
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 actual, char *(*to_string)(_ccunit_obj_t))
| DEF_CCUNIT_ASSERT_TEST_TYPE (char)
| DEF_CCUNIT_ASSERT_TEST_TYPE (u_char)
| DEF_CCUNIT_ASSERT_TEST_TYPE (int)
| DEF_CCUNIT_ASSERT_TEST_TYPE (u_int)
| DEF_CCUNIT_ASSERT_TEST_TYPE (short)
| DEF_CCUNIT_ASSERT_TEST_TYPE (u_short)
| DEF_CCUNIT_ASSERT_TEST_TYPE (long)
| DEF_CCUNIT_ASSERT_TEST_TYPE (u_long)
| DEF_CCUNIT_ASSERT_TEST_TYPE (float)
| DEF_CCUNIT_ASSERT_TEST_TYPE (double)
| DEF_CCUNIT_ASSERT_TEST_TYPE (_ccunit_str_t)
| DEF_CCUNIT_ASSERT_TEST_TYPE (_ccunit_ptr_t)
#define | DEF_CCUNIT_ASSERT_TEST_TYPE(TYP)

## Detailed Description

A set of assert functions and macros.

Messages are only displayed when an assert fails.

## Define Documentation

#define CCUNIT_HAVE_U_CHAR

#define CCUNIT_HAVE_U_INT

#define CCUNIT_HAVE_U_LONG

#define CCUNIT_HAVE_U_SHORT

#define DEF_CCUNIT_ASSERT_TEST_TYPE | ( |  | TYP | ) |

Value:

    void ccunit_assert_test_ ## TYP (const char* file,                      \
                                       unsigned int line,                   \
                                       bool cond,                           \
                                       const char* condstr,                 \
                                       TYP expect,                          \
                                       TYP actual)                          \
      {                                                                     \
        if (cond)                                                           \
          return;                                                           \
        else                                                                \
          {                                                                 \
            const char* ex = TYP ## _to_string (expect);                    \
            const char* ac = TYP ## _to_string (actual);                    \
            _ccunit_testFailure = ccunit_newTestFailure (file, line, condstr, ex, ac); \
            safe_free (ex);                                                 \
            safe_free (ac);                                                 \
            assert (_ccunit_testFailure != NULL);                           \
            longjmp (_ccunit_runTest_env, 1);                               \
          }                                                                 \
      }

## Typedef Documentation

typedef const void* _ccunit_obj_t

object type

typedef const void* _ccunit_ptr_t

pointer type

typedef const char* _ccunit_str_t

string type

typedef char*(* ccunit_toString_t)(_ccunit_obj_t)

typedef unsigned char u_char

u_char

typedef unsigned int u_int

u_int

typedef unsigned long u_long

u_long

typedef unsigned short u_short

u_short

## Function Documentation

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 | actual,
|  | char *(*)(_ccunit_obj_t) | to_string |
| ) |  |  |

References _ccunit_runTest_env, ccunit_newTestFailure(), and safe_free.

Here is the call graph for this function:

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 | ( | int |  | ) |

DCL_CCUNIT_ASSERT_TEST_TYPE | ( | u_int |  | ) |

DCL_CCUNIT_ASSERT_TEST_TYPE | ( | double |  | ) |

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 | ( | char |  | ) |

DCL_CCUNIT_ASSERT_TEST_TYPE | ( | _ccunit_ptr_t |  | ) |

DCL_CCUNIT_ASSERT_TEST_TYPE | ( | _ccunit_str_t |  | ) |

DCL_CCUNIT_ASSERT_TEST_TYPE | ( | u_char |  | ) |

DEF_CCUNIT_ASSERT_TEST_TYPE | ( | int |  | ) |

DEF_CCUNIT_ASSERT_TEST_TYPE | ( | _ccunit_ptr_t |  | ) |

DEF_CCUNIT_ASSERT_TEST_TYPE | ( | float |  | ) |

DEF_CCUNIT_ASSERT_TEST_TYPE | ( | u_int |  | ) |

DEF_CCUNIT_ASSERT_TEST_TYPE | ( | _ccunit_str_t |  | ) |

DEF_CCUNIT_ASSERT_TEST_TYPE | ( | char |  | ) |

DEF_CCUNIT_ASSERT_TEST_TYPE | ( | u_char |  | ) |

DEF_CCUNIT_ASSERT_TEST_TYPE | ( | long |  | ) |

DEF_CCUNIT_ASSERT_TEST_TYPE | ( | short |  | ) |

DEF_CCUNIT_ASSERT_TEST_TYPE | ( | double |  | ) |

DEF_CCUNIT_ASSERT_TEST_TYPE | ( | u_short |  | ) |

DEF_CCUNIT_ASSERT_TEST_TYPE | ( | u_long |  | ) |

## Variable Documentation

jmp_buf _ccunit_runTest_env

run tests exception environment.

Referenced by ccunit_assert_test__ccunit_obj_t(), run(), and runTest().

CCUnitTestFailure* _ccunit_testFailure

run tests exception.

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