blob: 5d593662110f78fd5b5af10058e69b9026a4dd7a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#ifndef _ddekit_assert_h
#define _ddekit_assert_h
#include "ddekit/printf.h"
#include "ddekit/panic.h"
/** \file ddekit/assert.h */
/** Assert that an expression is true and panic if not.
* \ingroup DDEKit_util
*/
#define Assert(expr) do \
{ \
if (!(expr)) { \
ddekit_print("\033[31;1mDDE: Assertion failed: "#expr"\033[0m\n"); \
ddekit_printf(" File: %s:%d\n",__FILE__,__LINE__); \
ddekit_printf(" Function: %s()\n", __FUNCTION__); \
ddekit_panic("Assertion failed."); \
}} while (0);
#endif
#define assert Assert
|