aboutsummaryrefslogtreecommitdiffstats
path: root/meowpp/debug
diff options
context:
space:
mode:
authorcathook <b01902109@csie.ntu.edu.tw>2014-10-21 17:51:03 +0800
committercathook <b01902109@csie.ntu.edu.tw>2014-10-21 17:51:03 +0800
commitf7770eea2208dba6f3171adcb268f446263275cb (patch)
tree6723c6bb73610e74aebc41317eda423a5dbd617d /meowpp/debug
parentbf5c9f2ae5c436aa7f59b28bb5e94b0362bfa358 (diff)
downloadmeow-f7770eea2208dba6f3171adcb268f446263275cb.tar
meow-f7770eea2208dba6f3171adcb268f446263275cb.tar.gz
meow-f7770eea2208dba6f3171adcb268f446263275cb.tar.bz2
meow-f7770eea2208dba6f3171adcb268f446263275cb.tar.lz
meow-f7770eea2208dba6f3171adcb268f446263275cb.tar.xz
meow-f7770eea2208dba6f3171adcb268f446263275cb.tar.zst
meow-f7770eea2208dba6f3171adcb268f446263275cb.zip
big change
Diffstat (limited to 'meowpp/debug')
-rw-r--r--meowpp/debug/assert.debug_test.cpp21
-rw-r--r--meowpp/debug/assert.h76
-rw-r--r--meowpp/debug/assert.nodebug_test.cpp22
3 files changed, 0 insertions, 119 deletions
diff --git a/meowpp/debug/assert.debug_test.cpp b/meowpp/debug/assert.debug_test.cpp
deleted file mode 100644
index 7514c4c..0000000
--- a/meowpp/debug/assert.debug_test.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <cstdio>
-
-#define MEOWPP_DEBUG_ASSERT_TESTING
-
-namespace test {
-
-void abort() {
- printf("Do abort()\n");
-}
-
-}
-
-#include <meowpp/debug/assert.h>
-
-using namespace meow;
-
-int main() {
- Assert(1 == 1, "hi");
- Assert(1 == 0, "no!!!%s %d", "bla", 13);
- return 0;
-}
diff --git a/meowpp/debug/assert.h b/meowpp/debug/assert.h
deleted file mode 100644
index 0143e86..0000000
--- a/meowpp/debug/assert.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*!
- * @file assert.h
- * @brief Contains assert macro for meowpp's debugging tools.
- *
- * You can use
- * @code{.cpp}
- * #define MEOWPP_NODEBUG
- * @endcode
- * to remove all the debugging code.
- *
- * @author cathook
- */
-
-#ifndef __MEOWPP_ASSERT_H__
-#define __MEOWPP_ASSERT_H__
-
-#include <cstdio>
-#include <cstdlib>
-
-
-namespace meow {
-
-
-/*!
- * @def Assert
- * @brief A macro for assert whether a expression is failed or not.
- * @param expr The expression to be tested.
- * @param ... Error information to be printed to stderr when the expr is failed.
- *
- * When expression is failed, it will call `fprintf(stderr, ...)` to print out
- * the message follows by calling `abort()` to halt the program.
- *
- * @note You can use
- * @code{.cpp}
- * #define MEOWPP_TESTING
- * @endcode
- * to tell this macro calls `test::abort()` instead of normal `abort()`
- * function.
- */
-
-
-#ifndef MEOWPP_NODEBUG
-
-#define MEOWPP_STRINGIFY(x) #x
-#define MEOWPP_TOSTRING(x) MEOWPP_STRINGIFY(x)
-
-#ifndef MEOWPP_DEBUG_ASSERT_TESTING
-
-#define Assert(expr,...) \
- while (((expr) || \
- (fprintf(stderr, "Assertion error at " \
- __FILE__ ":" MEOWPP_TOSTRING(__LINE__) \
- " >>> " __VA_ARGS__), \
- abort(), false) + fprintf(stderr, "\n")) && false)
-
-#else // MEOWPP_DEBUG_ASSERT_TESTING
-
-#define Assert(expr,...) \
- while (((expr) || \
- (fprintf(stderr, "Assertion error at " \
- __FILE__ ":" MEOWPP_TOSTRING(__LINE__) \
- " >>> " __VA_ARGS__), \
- test::abort(), false) + fprintf(stderr, "\n")) && false)
-
-#endif // MEOWPP_DEBUG_ASSERT_TESTING
-
-#else // MEOWPP_NODEBUG
-
-#define Assert(expr,...) \
- while (false)
-
-#endif // MEOWPP_NODEBUG
-
-} // meow
-
-#endif // __MEOWPP_ASSERT_H__
diff --git a/meowpp/debug/assert.nodebug_test.cpp b/meowpp/debug/assert.nodebug_test.cpp
deleted file mode 100644
index 588b874..0000000
--- a/meowpp/debug/assert.nodebug_test.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <cstdio>
-
-#define MEOWPP_NODEBUG
-
-#define MEOWPP_TESTING
-
-namespace test {
-
-void abort() {
- printf("Do abort()\n");
-}
-
-}
-#include <meowpp/debug/assert.h>
-
-using namespace meow;
-
-int main() {
- Assert(1 == 1, "hi");
- Assert(1 == 0, "no!!!%s %d", "bla", 13);
- return 0;
-}