e03f0c0d78
Add test for alloc and add asert statement
22 lines
417 B
C
22 lines
417 B
C
#pragma once
|
|
#include "stack.h"
|
|
|
|
#define assert(p) do { \
|
|
if (!(p)) { \
|
|
printf("BUG at %s:%d assert(%s)\n", \
|
|
__FILE__, __LINE__, #p); \
|
|
printStackTrace(5); \
|
|
while(1){} \
|
|
} \
|
|
} while (0)
|
|
|
|
#define assertmsg(p, ...) do { \
|
|
if (!(p)) { \
|
|
printf("BUG at %s:%d assert(%s)\n", \
|
|
__FILE__, __LINE__, #p); \
|
|
printf(__VA_ARGS__); \
|
|
printStackTrace(5); \
|
|
while(1){} \
|
|
} \
|
|
} while (0)
|