From f7770eea2208dba6f3171adcb268f446263275cb Mon Sep 17 00:00:00 2001 From: cathook Date: Tue, 21 Oct 2014 17:51:03 +0800 Subject: big change --- meowpp/debug/assert.debug_test.cpp | 21 ---------- meowpp/debug/assert.h | 76 ------------------------------------ meowpp/debug/assert.nodebug_test.cpp | 22 ----------- 3 files changed, 119 deletions(-) delete mode 100644 meowpp/debug/assert.debug_test.cpp delete mode 100644 meowpp/debug/assert.h delete mode 100644 meowpp/debug/assert.nodebug_test.cpp (limited to 'meowpp/debug') 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 - -#define MEOWPP_DEBUG_ASSERT_TESTING - -namespace test { - -void abort() { - printf("Do abort()\n"); -} - -} - -#include - -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 -#include - - -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 - -#define MEOWPP_NODEBUG - -#define MEOWPP_TESTING - -namespace test { - -void abort() { - printf("Do abort()\n"); -} - -} -#include - -using namespace meow; - -int main() { - Assert(1 == 1, "hi"); - Assert(1 == 0, "no!!!%s %d", "bla", 13); - return 0; -} -- cgit v1.2.3