summaryrefslogtreecommitdiff
path: root/lily-test.h
blob: 01eb34a5431ee7aa2f7ac3ffff6d7b5ab94dbb5e (plain)
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
#ifndef LILY_TEST_H
#define LILY_TEST_H

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <setjmp.h>

#define STR_IMP(x) #x
#define STR(x) STR_IMP(x)
/* define SOURCE_PATH_SIZE to strip away the
   leading parts of the full compilation path */
#ifndef SOURCE_PATH_SIZE
#define LILY_LOCATION (__FILE__ ":" STR(__LINE__))
#else
#define LILY_LOCATION ((__FILE__ ":" STR(__LINE__)) + SOURCE_PATH_SIZE)
#endif

struct lily_globals_t {
   jmp_buf env;
   char *error_msg;
   const char *error_location;
};

extern struct lily_globals_t _lily_globals;
void lily_init();

void lily_assert_msg(bool statement, const char *location,
		     const char *format_string, ...);

#endif