luasandbox  1.4.0
Generic Lua sandbox for dynamic data analysis
Macros | Variables
mu_test.h File Reference

Unit test macros and global data. More...

#include <stdio.h>
Include dependency graph for mu_test.h:

Go to the source code of this file.

Macros

#define PRIuSIZE   "zu"
 
#define MU_ERR_LEN   1024
 
#define mu_assert(cond, ...)
 
#define mu_assert_rv(rv, fn)
 
#define mu_run_test(test)
 

Variables

int mu_tests_run = 0
 
char mu_err [MU_ERR_LEN] = { 0 }
 

Detailed Description

Unit test macros and global data.

Definition in file mu_test.h.

Macro Definition Documentation

#define mu_assert (   cond,
  ... 
)
Value:
do { \
if (!(cond)) { \
int cnt = snprintf(mu_err, MU_ERR_LEN, "line: %d (%s) ", __LINE__, #cond); \
if (cnt > 0 && cnt < MU_ERR_LEN) { \
cnt = snprintf(mu_err+cnt, MU_ERR_LEN-cnt, __VA_ARGS__); \
if (cnt > 0 && cnt < MU_ERR_LEN) { \
return mu_err; \
} \
} \
mu_err[MU_ERR_LEN - 1] = 0; \
return mu_err; \
} \
} while (0)
char mu_err[MU_ERR_LEN]
Definition: mu_test.h:66
#define MU_ERR_LEN
Definition: mu_test.h:26

Definition at line 28 of file mu_test.h.

#define mu_assert_rv (   rv,
  fn 
)
Value:
do { \
int result = fn; \
if (rv != result) { \
int cnt = snprintf(mu_err, MU_ERR_LEN, "line: %d %s expected: %d " \
" received: %d", __LINE__, #fn, rv, result); \
if (cnt > 0 && cnt < MU_ERR_LEN) { \
return mu_err; \
} \
mu_err[MU_ERR_LEN - 1] = 0; \
return mu_err; \
} \
} while (0)
char mu_err[MU_ERR_LEN]
Definition: mu_test.h:66
#define MU_ERR_LEN
Definition: mu_test.h:26

Definition at line 43 of file mu_test.h.

#define MU_ERR_LEN   1024

Definition at line 26 of file mu_test.h.

#define mu_run_test (   test)
Value:
do { \
char *message = test(); \
if (message) \
return message; \
} while (0)
int mu_tests_run
Definition: mu_test.h:65

Definition at line 57 of file mu_test.h.

#define PRIuSIZE   "zu"

Definition at line 23 of file mu_test.h.

Variable Documentation

char mu_err[MU_ERR_LEN] = { 0 }

Definition at line 66 of file mu_test.h.

int mu_tests_run = 0

Definition at line 65 of file mu_test.h.