minor fixes
[ia32rtools.git] / tools / my_assert.h
1
2 static inline void my_assert_(int line, const char *name, long v, long expect, int is_eq)
3 {
4         int ok;
5         if (is_eq)
6                 ok = (v == expect);
7         else
8                 ok = (v != expect);
9
10         if (!ok)
11         {
12                 printf("%d: '%s' is %lx, need %s%lx\n", line, name,
13                         v, is_eq ? "" : "!", expect);
14                 exit(1);
15         }
16 }
17 #define my_assert(v, exp) \
18         my_assert_(__LINE__, #v, (long)(v), (long)(exp), 1)
19 #define my_assert_not(v, exp) \
20         my_assert_(__LINE__, #v, (long)(v), (long)(exp), 0)
21
22