-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest.h
More file actions
26 lines (22 loc) · 874 Bytes
/
test.h
File metadata and controls
26 lines (22 loc) · 874 Bytes
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
#ifndef TEST_H
#define TEST_H
#include <stdio.h>
static int ntests;
static int nfailed;
#define ok(expr,msg) \
do { \
ntests++; \
if (expr) \
printf("ok %d - %s\n",ntests,msg); \
else { \
printf("not ok %d - %s\n",ntests,msg); \
nfailed++; \
} \
} while(0);
#define finish() \
do { \
if (nfailed != 0) \
printf("Failed %d/%d tests\n", \
nfailed,ntests); \
} while(0);
#endif