-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEBAssert.h
30 lines (25 loc) · 3.56 KB
/
EBAssert.h
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
#import <Foundation/Foundation.h>
#import <EBFoundation/EBUtilities.h>
#define EBAssertOrRecover(condition, recoveryAction) \
({ \
if (!(condition)) \
{ \
EBAssertHandle(__FILE__, (uintmax_t)__LINE__, __PRETTY_FUNCTION__, EBStringify(condition), nil, NO); \
recoveryAction; \
} \
})
#define EBAssertOrBailWithNote(condition, note, ...) \
({ \
if (!(condition)) \
EBAssertHandle(__FILE__, (uintmax_t)__LINE__, __PRETTY_FUNCTION__, EBStringify(condition), [[NSString stringWithFormat: (note), ##__VA_ARGS__] UTF8String], YES); \
})
#define EBAssertOrBail(condition) \
({ \
if (!(condition)) \
EBAssertHandle(__FILE__, (uintmax_t)__LINE__, __PRETTY_FUNCTION__, EBStringify(condition), nil, YES); \
})
#define EBAssertLog(note, ...) \
({ \
EBAssertHandle(__FILE__, (uintmax_t)__LINE__, __PRETTY_FUNCTION__, nil, [[NSString stringWithFormat: (note), ##__VA_ARGS__] UTF8String], NO); \
})
void EBAssertHandle(const char *file, uintmax_t line, const char *function, const char *assertion, const char *note, BOOL raiseException);