aboutsummaryrefslogtreecommitdiff
path: root/testing.h
blob: 3fc5df553263f74f8267f005e540e43532bba02e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

#include <stdio.h>

#define t_assert(fact)                                                         \
    if (!(fact)) {                                                             \
        fprintf(stderr, "Assertion failed: %s at %s:%d in %s()\n", #fact,      \
                __FILE__, __LINE__, __func__);                                 \
        return 1;                                                              \
    }

#define t_assert_equal(a, b)                                                   \
    if (!(a == b)) {                                                           \
        fprintf(stderr,                                                        \
                "Assertion failed: %d (%s) != %d (%s) at %s:%d in %s()\n", a,  \
                #a, b, #b, __FILE__, __LINE__, __func__);                      \
        return 1;                                                              \
    }