exip  Alpha 0.5.4
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Typedefs | Enumerations | Functions | Variables
check.h File Reference
#include <stddef.h>
#include <string.h>

Go to the source code of this file.

Macros

#define GCC_VERSION_AT_LEAST(major, minor)   0
 
#define CK_ATTRIBUTE_UNUSED
 
#define CK_EXPORT
 
#define CK_DLL_EXP
 
#define CHECK_MAJOR_VERSION   (0)
 
#define CHECK_MINOR_VERSION   (9)
 
#define CHECK_MICRO_VERSION   (6)
 
#define NULL   ((void*)0)
 
#define tcase_add_test(tc, tf)   tcase_add_test_raise_signal(tc,tf,0)
 
#define tcase_add_test_raise_signal(tc, tf, signal)   _tcase_add_test((tc),(tf),"" # tf "",(signal), 0, 0, 1)
 
#define tcase_add_exit_test(tc, tf, expected_exit_value)   _tcase_add_test((tc),(tf),"" # tf "",0,(expected_exit_value),0,1)
 
#define tcase_add_loop_test(tc, tf, s, e)   _tcase_add_test((tc),(tf),"" # tf "",0,0,(s),(e))
 
#define tcase_add_loop_test_raise_signal(tc, tf, signal, s, e)   _tcase_add_test((tc),(tf),"" # tf "",(signal),0,(s),(e))
 
#define tcase_add_loop_exit_test(tc, tf, expected_exit_value, s, e)   _tcase_add_test((tc),(tf),"" # tf "",0,(expected_exit_value),(s),(e))
 
#define START_TEST(__testname)
 
#define END_TEST   }
 
#define fail_unless(expr,...)
 
#define fail_if(expr,...)
 
#define fail(...)   _fail_unless(0, __FILE__, __LINE__, "Failed" , ## __VA_ARGS__, NULL)
 
#define ck_abort()   ck_abort_msg(NULL)
 
#define ck_abort_msg   fail
 
#define ck_assert(C)   ck_assert_msg(C, NULL)
 
#define ck_assert_msg   fail_unless
 
#define _ck_assert_int(X, OP, Y)
 
#define ck_assert_int_eq(X, Y)   _ck_assert_int(X, ==, Y)
 
#define ck_assert_int_ne(X, Y)   _ck_assert_int(X, !=, Y)
 
#define ck_assert_int_lt(X, Y)   _ck_assert_int(X, <, Y)
 
#define ck_assert_int_le(X, Y)   _ck_assert_int(X, <=, Y)
 
#define ck_assert_int_gt(X, Y)   _ck_assert_int(X, >, Y)
 
#define ck_assert_int_ge(X, Y)   _ck_assert_int(X, >=, Y)
 
#define _ck_assert_str(X, OP, Y)
 
#define ck_assert_str_eq(X, Y)   _ck_assert_str(X, ==, Y)
 
#define ck_assert_str_ne(X, Y)   _ck_assert_str(X, !=, Y)
 
#define ck_assert_str_lt(X, Y)   _ck_assert_str(X, <, Y)
 
#define ck_assert_str_le(X, Y)   _ck_assert_str(X, <=, Y)
 
#define ck_assert_str_gt(X, Y)   _ck_assert_str(X, >, Y)
 
#define ck_assert_str_ge(X, Y)   _ck_assert_str(X, >=, Y)
 
#define mark_point()   _mark_point(__FILE__,__LINE__)
 

Typedefs

typedef struct TCase TCase
 
typedef void(* TFun )(int)
 
typedef void(* SFun )(void)
 
typedef struct Suite Suite
 
typedef struct SRunner SRunner
 
typedef struct TestResult TestResult
 

Enumerations

enum  test_result { CK_TEST_RESULT_INVALID, CK_PASS, CK_FAILURE, CK_ERROR }
 
enum  print_output {
  CK_SILENT, CK_MINIMAL, CK_NORMAL, CK_VERBOSE,
  CK_ENV, CK_LAST
}
 
enum  ck_result_ctx { CK_CTX_INVALID, CK_CTX_SETUP, CK_CTX_TEST, CK_CTX_TEARDOWN }
 
enum  fork_status { CK_FORK_GETENV, CK_FORK, CK_NOFORK }
 

Functions

CK_DLL_EXP Suite *CK_EXPORT suite_create (const char *name)
 
int suite_tcase (Suite *s, const char *tcname)
 
CK_DLL_EXP void CK_EXPORT suite_add_tcase (Suite *s, TCase *tc)
 
CK_DLL_EXP TCase *CK_EXPORT tcase_create (const char *name)
 
CK_DLL_EXP void CK_EXPORT _tcase_add_test (TCase *tc, TFun tf, const char *fname, int _signal, int allowed_exit_value, int start, int end)
 
CK_DLL_EXP void CK_EXPORT tcase_add_unchecked_fixture (TCase *tc, SFun setup, SFun teardown)
 
CK_DLL_EXP void CK_EXPORT tcase_add_checked_fixture (TCase *tc, SFun setup, SFun teardown)
 
CK_DLL_EXP void CK_EXPORT tcase_set_timeout (TCase *tc, int timeout)
 
CK_DLL_EXP void CK_EXPORT tcase_fn_start (const char *fname, const char *file, int line)
 
CK_DLL_EXP void CK_EXPORT _fail_unless (int result, const char *file, int line, const char *expr,...)
 
CK_DLL_EXP void CK_EXPORT _mark_point (const char *file, int line)
 
CK_DLL_EXP int CK_EXPORT tr_rtype (TestResult *tr)
 
CK_DLL_EXP enum ck_result_ctx
CK_EXPORT 
tr_ctx (TestResult *tr)
 
CK_DLL_EXP const char *CK_EXPORT tr_msg (TestResult *tr)
 
CK_DLL_EXP int CK_EXPORT tr_lno (TestResult *tr)
 
CK_DLL_EXP const char *CK_EXPORT tr_lfile (TestResult *tr)
 
CK_DLL_EXP const char *CK_EXPORT tr_tcname (TestResult *tr)
 
CK_DLL_EXP SRunner *CK_EXPORT srunner_create (Suite *s)
 
CK_DLL_EXP void CK_EXPORT srunner_add_suite (SRunner *sr, Suite *s)
 
CK_DLL_EXP void CK_EXPORT srunner_free (SRunner *sr)
 
CK_DLL_EXP void CK_EXPORT srunner_run_all (SRunner *sr, enum print_output print_mode)
 
CK_DLL_EXP void CK_EXPORT srunner_run (SRunner *sr, const char *sname, const char *tcname, enum print_output print_mode)
 
CK_DLL_EXP int CK_EXPORT srunner_ntests_failed (SRunner *sr)
 
CK_DLL_EXP int CK_EXPORT srunner_ntests_run (SRunner *sr)
 
CK_DLL_EXP TestResult **CK_EXPORT srunner_failures (SRunner *sr)
 
CK_DLL_EXP TestResult **CK_EXPORT srunner_results (SRunner *sr)
 
CK_DLL_EXP void CK_EXPORT srunner_print (SRunner *sr, enum print_output print_mode)
 
CK_DLL_EXP void CK_EXPORT srunner_set_log (SRunner *sr, const char *fname)
 
CK_DLL_EXP int CK_EXPORT srunner_has_log (SRunner *sr)
 
CK_DLL_EXP const char *CK_EXPORT srunner_log_fname (SRunner *sr)
 
CK_DLL_EXP void CK_EXPORT srunner_set_xml (SRunner *sr, const char *fname)
 
CK_DLL_EXP int CK_EXPORT srunner_has_xml (SRunner *sr)
 
CK_DLL_EXP const char *CK_EXPORT srunner_xml_fname (SRunner *sr)
 
CK_DLL_EXP enum fork_status
CK_EXPORT 
srunner_fork_status (SRunner *sr)
 
CK_DLL_EXP void CK_EXPORT srunner_set_fork_status (SRunner *sr, enum fork_status fstat)
 
CK_DLL_EXP pid_t CK_EXPORT check_fork (void)
 
CK_DLL_EXP void CK_EXPORT check_waitpid_and_exit (pid_t pid)
 

Variables

CK_DLL_EXP int CK_EXPORT check_major_version
 
CK_DLL_EXP int CK_EXPORT check_minor_version
 
CK_DLL_EXP int CK_EXPORT check_micro_version
 

Macro Definition Documentation

#define _ck_assert_int (   X,
  OP,
 
)
Value:
do { \
int _ck_x = (X); \
int _ck_y = (Y); \
ck_assert_msg(_ck_x OP _ck_y, "Assertion '"#X#OP#Y"' failed: "#X"==%d, "#Y"==%d", _ck_x, _ck_y); \
} while (0)

Definition at line 262 of file check.h.

#define _ck_assert_str (   X,
  OP,
 
)
Value:
do { \
const char* _ck_x = (X); \
const char* _ck_y = (Y); \
ck_assert_msg(0 OP strcmp(_ck_y, _ck_x), \
"Assertion '"#X#OP#Y"' failed: "#X"==\"%s\", "#Y"==\"%s\"", _ck_x, _ck_y); \
} while (0)

Definition at line 277 of file check.h.

#define CHECK_MAJOR_VERSION   (0)

Definition at line 100 of file check.h.

#define CHECK_MICRO_VERSION   (6)

Definition at line 102 of file check.h.

#define CHECK_MINOR_VERSION   (9)

Definition at line 101 of file check.h.

#define ck_abort ( )    ck_abort_msg(NULL)

Definition at line 255 of file check.h.

#define ck_abort_msg   fail

Definition at line 256 of file check.h.

#define ck_assert (   C)    ck_assert_msg(C, NULL)

Definition at line 257 of file check.h.

#define ck_assert_int_eq (   X,
 
)    _ck_assert_int(X, ==, Y)

Definition at line 267 of file check.h.

#define ck_assert_int_ge (   X,
 
)    _ck_assert_int(X, >=, Y)

Definition at line 272 of file check.h.

#define ck_assert_int_gt (   X,
 
)    _ck_assert_int(X, >, Y)

Definition at line 271 of file check.h.

#define ck_assert_int_le (   X,
 
)    _ck_assert_int(X, <=, Y)

Definition at line 270 of file check.h.

#define ck_assert_int_lt (   X,
 
)    _ck_assert_int(X, <, Y)

Definition at line 269 of file check.h.

#define ck_assert_int_ne (   X,
 
)    _ck_assert_int(X, !=, Y)

Definition at line 268 of file check.h.

#define ck_assert_msg   fail_unless

Definition at line 258 of file check.h.

#define ck_assert_str_eq (   X,
 
)    _ck_assert_str(X, ==, Y)

Definition at line 283 of file check.h.

#define ck_assert_str_ge (   X,
 
)    _ck_assert_str(X, >=, Y)

Definition at line 288 of file check.h.

#define ck_assert_str_gt (   X,
 
)    _ck_assert_str(X, >, Y)

Definition at line 287 of file check.h.

#define ck_assert_str_le (   X,
 
)    _ck_assert_str(X, <=, Y)

Definition at line 286 of file check.h.

#define ck_assert_str_lt (   X,
 
)    _ck_assert_str(X, <, Y)

Definition at line 285 of file check.h.

#define ck_assert_str_ne (   X,
 
)    _ck_assert_str(X, !=, Y)

Definition at line 284 of file check.h.

#define CK_ATTRIBUTE_UNUSED

Definition at line 80 of file check.h.

#define CK_DLL_EXP

Definition at line 95 of file check.h.

#define CK_EXPORT

Definition at line 89 of file check.h.

#define END_TEST   }

Definition at line 226 of file check.h.

#define fail (   ...)    _fail_unless(0, __FILE__, __LINE__, "Failed" , ## __VA_ARGS__, NULL)

Definition at line 248 of file check.h.

#define fail_if (   expr,
  ... 
)
Value:
_fail_unless(!(expr), __FILE__, __LINE__,\
"Failure '"#expr"' occured" , ## __VA_ARGS__, NULL)

Definition at line 243 of file check.h.

#define fail_unless (   expr,
  ... 
)
Value:
_fail_unless(expr, __FILE__, __LINE__,\
"Assertion '"#expr"' failed" , ## __VA_ARGS__, NULL)

Definition at line 232 of file check.h.

#define GCC_VERSION_AT_LEAST (   major,
  minor 
)    0

Definition at line 74 of file check.h.

#define mark_point ( )    _mark_point(__FILE__,__LINE__)

Definition at line 294 of file check.h.

#define NULL   ((void*)0)

Definition at line 109 of file check.h.

#define START_TEST (   __testname)
Value:
static void __testname (int _i CK_ATTRIBUTE_UNUSED)\
{\
tcase_fn_start (""# __testname, __FILE__, __LINE__);

Definition at line 220 of file check.h.

#define tcase_add_exit_test (   tc,
  tf,
  expected_exit_value 
)    _tcase_add_test((tc),(tf),"" # tf "",0,(expected_exit_value),0,1)

Definition at line 150 of file check.h.

#define tcase_add_loop_exit_test (   tc,
  tf,
  expected_exit_value,
  s,
 
)    _tcase_add_test((tc),(tf),"" # tf "",0,(expected_exit_value),(s),(e))

Definition at line 169 of file check.h.

#define tcase_add_loop_test (   tc,
  tf,
  s,
 
)    _tcase_add_test((tc),(tf),"" # tf "",0,0,(s),(e))

Definition at line 159 of file check.h.

#define tcase_add_loop_test_raise_signal (   tc,
  tf,
  signal,
  s,
 
)    _tcase_add_test((tc),(tf),"" # tf "",(signal),0,(s),(e))

Definition at line 165 of file check.h.

#define tcase_add_test (   tc,
  tf 
)    tcase_add_test_raise_signal(tc,tf,0)

Definition at line 143 of file check.h.

#define tcase_add_test_raise_signal (   tc,
  tf,
  signal 
)    _tcase_add_test((tc),(tf),"" # tf "",(signal), 0, 0, 1)

Definition at line 146 of file check.h.

Typedef Documentation

typedef void(* SFun)(void)

Definition at line 124 of file check.h.

typedef struct SRunner SRunner

Definition at line 322 of file check.h.

typedef struct Suite Suite

Definition at line 127 of file check.h.

typedef struct TCase TCase

Definition at line 118 of file check.h.

typedef struct TestResult TestResult

Definition at line 325 of file check.h.

typedef void(* TFun)(int)

Definition at line 121 of file check.h.

Enumeration Type Documentation

Enumerator
CK_CTX_INVALID 
CK_CTX_SETUP 
CK_CTX_TEST 
CK_CTX_TEARDOWN 

Definition at line 328 of file check.h.

Enumerator
CK_FORK_GETENV 
CK_FORK 
CK_NOFORK 

Definition at line 433 of file check.h.

Enumerator
CK_SILENT 
CK_MINIMAL 
CK_NORMAL 
CK_VERBOSE 
CK_ENV 
CK_LAST 

Definition at line 309 of file check.h.

Enumerator
CK_TEST_RESULT_INVALID 
CK_PASS 
CK_FAILURE 
CK_ERROR 

Definition at line 300 of file check.h.

Function Documentation

CK_DLL_EXP void CK_EXPORT _fail_unless ( int  result,
const char *  file,
int  line,
const char *  expr,
  ... 
)
CK_DLL_EXP void CK_EXPORT _mark_point ( const char *  file,
int  line 
)
CK_DLL_EXP void CK_EXPORT _tcase_add_test ( TCase tc,
TFun  tf,
const char *  fname,
int  _signal,
int  allowed_exit_value,
int  start,
int  end 
)
CK_DLL_EXP pid_t CK_EXPORT check_fork ( void  )
CK_DLL_EXP void CK_EXPORT check_waitpid_and_exit ( pid_t  pid)
CK_DLL_EXP void CK_EXPORT srunner_add_suite ( SRunner sr,
Suite s 
)
CK_DLL_EXP SRunner* CK_EXPORT srunner_create ( Suite s)
CK_DLL_EXP TestResult** CK_EXPORT srunner_failures ( SRunner sr)
CK_DLL_EXP enum fork_status CK_EXPORT srunner_fork_status ( SRunner sr)
CK_DLL_EXP void CK_EXPORT srunner_free ( SRunner sr)
CK_DLL_EXP int CK_EXPORT srunner_has_log ( SRunner sr)
CK_DLL_EXP int CK_EXPORT srunner_has_xml ( SRunner sr)
CK_DLL_EXP const char* CK_EXPORT srunner_log_fname ( SRunner sr)
CK_DLL_EXP int CK_EXPORT srunner_ntests_failed ( SRunner sr)
CK_DLL_EXP int CK_EXPORT srunner_ntests_run ( SRunner sr)
CK_DLL_EXP void CK_EXPORT srunner_print ( SRunner sr,
enum print_output  print_mode 
)
CK_DLL_EXP TestResult** CK_EXPORT srunner_results ( SRunner sr)
CK_DLL_EXP void CK_EXPORT srunner_run ( SRunner sr,
const char *  sname,
const char *  tcname,
enum print_output  print_mode 
)
CK_DLL_EXP void CK_EXPORT srunner_run_all ( SRunner sr,
enum print_output  print_mode 
)
CK_DLL_EXP void CK_EXPORT srunner_set_fork_status ( SRunner sr,
enum fork_status  fstat 
)
CK_DLL_EXP void CK_EXPORT srunner_set_log ( SRunner sr,
const char *  fname 
)
CK_DLL_EXP void CK_EXPORT srunner_set_xml ( SRunner sr,
const char *  fname 
)
CK_DLL_EXP const char* CK_EXPORT srunner_xml_fname ( SRunner sr)
CK_DLL_EXP void CK_EXPORT suite_add_tcase ( Suite s,
TCase tc 
)
CK_DLL_EXP Suite* CK_EXPORT suite_create ( const char *  name)
int suite_tcase ( Suite s,
const char *  tcname 
)
CK_DLL_EXP void CK_EXPORT tcase_add_checked_fixture ( TCase tc,
SFun  setup,
SFun  teardown 
)
CK_DLL_EXP void CK_EXPORT tcase_add_unchecked_fixture ( TCase tc,
SFun  setup,
SFun  teardown 
)
CK_DLL_EXP TCase* CK_EXPORT tcase_create ( const char *  name)
CK_DLL_EXP void CK_EXPORT tcase_fn_start ( const char *  fname,
const char *  file,
int  line 
)
CK_DLL_EXP void CK_EXPORT tcase_set_timeout ( TCase tc,
int  timeout 
)
CK_DLL_EXP const char* CK_EXPORT tr_lfile ( TestResult tr)
CK_DLL_EXP int CK_EXPORT tr_lno ( TestResult tr)
CK_DLL_EXP const char* CK_EXPORT tr_msg ( TestResult tr)
CK_DLL_EXP int CK_EXPORT tr_rtype ( TestResult tr)
CK_DLL_EXP const char* CK_EXPORT tr_tcname ( TestResult tr)

Variable Documentation

CK_DLL_EXP int CK_EXPORT check_major_version
CK_DLL_EXP int CK_EXPORT check_micro_version
CK_DLL_EXP int CK_EXPORT check_minor_version