summaryrefslogtreecommitdiff
path: root/ext/dsent/libutil/Assert.h
diff options
context:
space:
mode:
Diffstat (limited to 'ext/dsent/libutil/Assert.h')
-rw-r--r--ext/dsent/libutil/Assert.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/ext/dsent/libutil/Assert.h b/ext/dsent/libutil/Assert.h
new file mode 100644
index 000000000..0fdd364b2
--- /dev/null
+++ b/ext/dsent/libutil/Assert.h
@@ -0,0 +1,22 @@
+#ifndef __ASSERT_H__
+#define __ASSERT_H__
+
+#include "String.h"
+#include "Exception.h"
+
+#ifdef NDEBUG
+#define ASSERT(test_value_,exception_msg_)
+#else
+#define ASSERT(test_value_,msg_) \
+ do \
+ { \
+ if(!(test_value_)) \
+ { \
+ const LibUtil::String& exception_msg = LibUtil::String::format("\nAt %s:%d\n", __FILE__, __LINE__) + (String)(msg_); \
+ throw LibUtil::Exception(exception_msg); \
+ } \
+ } while(0);
+#endif
+
+#endif // __ASSERT_H__
+