]> git.saurik.com Git - apple/xnu.git/blob - tools/tests/perf_index/fail.h
xnu-3248.60.10.tar.gz
[apple/xnu.git] / tools / tests / perf_index / fail.h
1 #ifndef __FAIL_H_
2 #define __FAIL_H_
3
4 #define TOSTRING_HELPER(x) #x
5 #define TOSTRING(x) TOSTRING_HELPER(x)
6
7 #define PERFINDEX_FAILURE -1
8 #define PERFINDEX_SUCCESS 0
9
10 extern char* error_str;
11
12 #define FAIL(message) do {\
13 error_str = message " at " __FILE__ ": " TOSTRING(__LINE__);\
14 return PERFINDEX_FAILURE;\
15 } while(0)
16
17 #define VERIFY(condition, fail_message) do {\
18 if(!(condition)) FAIL(fail_message);\
19 } while(0)
20
21 #endif