File: test.h

package info (click to toggle)
mle 1.7.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,108 kB
  • sloc: ansic: 13,335; sh: 728; php: 228; makefile: 83
file content (27 lines) | stat: -rw-r--r-- 775 bytes parent folder | download | duplicates (2)
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
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <locale.h>
#include <inttypes.h>
#include <dlfcn.h>
#include "mle.h"
#include "mlbuf.h"

#define concat1(a, b) a ## b
#define concat2(a, b) concat1(a, b)
#define str  concat2(TEST_NAME, _str)
#define test TEST_NAME

extern char *str;
extern void test(buffer_t *buf, mark_t *cur);

// TODO run each test with buffer_set_slabbed + buffer_insert

#define ASSERT(testname, expected, observed) do { \
    if ((expected) == (observed)) { \
        printf("  \x1b[32mOK  \x1b[0m %s\n", (testname)); \
    } else { \
        printf("  \x1b[31mERR \x1b[0m %s expected=%" PRIdPTR " observed=%" PRIdPTR "\n", (testname), (intptr_t)(expected), (intptr_t)(observed)); \
        exit(EXIT_FAILURE); \
    } \
} while(0);