CCUnit: Assert

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

モジュール | マクロ定義 | 型定義 | 関数 | 変数

# Assert
[モジュール階層]

A set of assert functions and macros. [詳細]

Assertのコラボレーション図

## モジュール
| Convert value to string

| Make value to string.
## マクロ定義
#define | CCUNIT_HAVE_U_CHAR
#define | CCUNIT_HAVE_U_INT
#define | CCUNIT_HAVE_U_SHORT
#define | CCUNIT_HAVE_U_LONG
#define | DCL_CCUNIT_ASSERT_TEST_TYPE(TYP)
## 型定義
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
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)
## 変数
jmp_buf | _ccunit_runTest_env
| run tests exception environment.
CCUnitTestFailure * | _ccunit_testFailure
| run tests exception.
## Assert test type
  end of CCUnitValueToString Assert test function. 引数:
  | 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)

## 説明

A set of assert functions and macros.

Messages are only displayed when an assert fails.

## マクロ定義

#define CCUNIT_HAVE_U_CHAR

#define CCUNIT_HAVE_U_INT

#define CCUNIT_HAVE_U_LONG

#define CCUNIT_HAVE_U_SHORT

#define DCL_CCUNIT_ASSERT_TEST_TYPE | ( |  | TYP | ) |

値:

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

#define DEF_CCUNIT_ASSERT_TEST_TYPE | ( |  | TYP | ) |

値:

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

## 関数

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

参照先 _ccunit_runTest_env, ccunit_newTestFailure(), と safe_free.

関数の呼び出しグラフ:

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

## 変数

jmp_buf _ccunit_runTest_env

run tests exception environment.

参照元 ccunit_assert_test__ccunit_obj_t(), run(), と runTest().

CCUnitTestFailure* _ccunit_testFailure

run tests exception.

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