-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathtest_common.h
34 lines (31 loc) · 1.17 KB
/
test_common.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* CC0 license applied, see LICENCE.md */
#include <stdio.h>
#include <openssl/err.h>
/* For controlled success */
#define T(e) \
if (!(e)) { \
ERR_print_errors_fp(stderr); \
OPENSSL_die(#e, __FILE__, __LINE__); \
}
/* For controlled failure */
#define TF(e) \
if ((e)) { \
ERR_print_errors_fp(stderr); \
} else { \
OPENSSL_die(#e, __FILE__, __LINE__); \
}
#define cRED "\033[1;31m"
#define cDRED "\033[0;31m"
#define cGREEN "\033[1;32m"
#define cDGREEN "\033[0;32m"
#define cBLUE "\033[1;34m"
#define cDBLUE "\033[0;34m"
#define cNORM "\033[m"
#define TEST_ASSERT(e) \
{ \
if (!(test = (e))) \
printf(cRED " Test FAILED" cNORM "\n"); \
else \
printf(cGREEN " Test passed" cNORM "\n"); \
}
void hexdump(const void *ptr, size_t len);