1#ifndef NAGIOS_T_UTILS_H_INCLUDED
2#define NAGIOS_T_UTILS_H_INCLUDED
10# define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
16#define CLR_RESET "\033[m"
17#define CLR_BOLD "\033[1m"
18#define CLR_RED "\033[31m"
19#define CLR_GREEN "\033[32m"
20#define CLR_BROWN "\033[33m"
21#define CLR_YELLOW "\033[33m\033[1m"
22#define CLR_BLUE "\033[34m"
23#define CLR_MAGENTA "\033[35m"
24#define CLR_CYAN "\033[36m"
25#define CLR_BG_RED "\033[41m"
26#define CLR_BRIGHT_RED "\033[31m\033[1m"
27#define CLR_BRIGHT_GREEN "\033[32m\033[1m"
28#define CLR_BRIGHT_BLUE "\033[34m\033[1m"
29#define CLR_BRIGHT_MAGENTA "\033[35m\033[1m"
30#define CLR_BRIGHT_CYAN "\033[36m\033[1m"
32extern const char *red, *green, *yellow, *cyan, *reset;
33extern unsigned int passed, failed, t_verbose;
37 fprintf(stderr, "ALIVE @ %s:%s:%d\n", __FILE__, __func__, __LINE__); \
40#define t_assert(expr) \
42extern void t_set_colors(
int force);
43extern void t_start(
const char *fmt, ...)
44 __attribute__((__format__(__printf__, 1, 2)));
45extern
void t_pass(const
char *fmt, ...)
46 __attribute__((__format__(__printf__, 1, 2)));
47extern
void t_fail(const
char *fmt, ...)
48 __attribute__((__format__(__printf__, 1, 2)));
49extern
void t_diag(const
char *fmt, ...)
50 __attribute__((__format__(__printf__, 1, 2)));
51extern
int t_ok(
int success, const
char *fmt, ...)
52 __attribute__((__format__(__printf__, 2, 3)));
56 crash("No further testing is possible: " #expr " @%s:%d", __FILE__, __LINE__)
57extern int ok_int(
int a,
int b,
const char *name);
58extern int ok_uint(
unsigned int a,
unsigned int b,
const char *name);
59extern int ok_str(
const char *a,
const char *b,
const char *name);
60extern int t_end(
void);
61extern void t_reset(
void);
62extern void crash(
const char *fmt, ...)
63 __attribute__((__format__(__printf__, 1, 2), __noreturn__));