Templates -- Meow  2.0.-1
A C++ template contains kinds of interesting classes and functions
assert.h
Go to the documentation of this file.
1 
14 #ifndef __MEOWPP_ASSERT_H__
15 #define __MEOWPP_ASSERT_H__
16 
17 #include <cstdio>
18 #include <cstdlib>
19 
20 
21 namespace meow {
22 
23 
42 #ifndef MEOWPP_NODEBUG
43 
44 #define MEOWPP_STRINGIFY(x) #x
45 #define MEOWPP_TOSTRING(x) MEOWPP_STRINGIFY(x)
46 
47 #ifndef MEOWPP_DEBUG_ASSERT_TESTING
48 
49 #define Assert(expr,...) \
50  while (((expr) || \
51  (fprintf(stderr, "Assertion error at " \
52  __FILE__ ":" MEOWPP_TOSTRING(__LINE__) \
53  " >>>" __VA_ARGS__), \
54  abort(), false)) && false)
55 
56 #else // MEOWPP_DEBUG_ASSERT_TESTING
57 
58 #define Assert(expr,...) \
59  while (((expr) || \
60  (fprintf(stderr, "Assertion error at " \
61  __FILE__ ":" MEOWPP_TOSTRING(__LINE__) \
62  " >>> " __VA_ARGS__), \
63  test::abort(), false)) && false)
64 
65 #endif // MEOWPP_DEBUG_ASSERT_TESTING
66 
67 #else // MEOWPP_NODEBUG
68 
69 #define Assert(expr,...) \
70  while (false)
71 
72 #endif // MEOWPP_NODEBUG
73 
74 } // meow
75 
76 #endif // __MEOWPP_ASSERT_H__