aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/helpers.h
blob: f8affe779c160fce8fa8f79ed0fd9f9af0ace3ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef DUCC_TESTS_HELPERS_H
#define DUCC_TESTS_HELPERS_H

void exit(int);
struct FILE;
typedef struct FILE FILE;
int fprintf(FILE*, const char*, ...);
extern FILE* stderr;

#define ASSERT(a, file, line) \
    do { \
        if (!(a)) { \
            fprintf(stderr, "%s:%d: assert failed", file, line); \
            exit(1); \
        } \
    } while (0)

#define ASSERT_EQ(a, b) ASSERT((a) == (b), __FILE__, __LINE__)

#endif