diff -r 7b0ce9fb1169 -r 407c08a0eae9 test/error_test.cc --- a/test/error_test.cc Wed Apr 09 17:19:40 2008 +0100 +++ b/test/error_test.cc Fri Apr 11 16:20:54 2008 +0200 @@ -39,165 +39,21 @@ LEMON_ASSERT(true, "This is a fault message"); } -void no_assertion_exception_disable() { - LEMON_ASSERT(true, Exception()); -} - void assertion_text_disable() { LEMON_ASSERT(false, "This is a fault message"); } -void assertion_exception_disable() { - LEMON_ASSERT(false, Exception()); -} - void fixme_disable() { LEMON_FIXME("fixme_disable() is fixme!"); } void check_assertion_disable() { no_assertion_text_disable(); - no_assertion_exception_disable(); - assertion_exception_disable(); assertion_text_disable(); fixme_disable(); } #undef LEMON_DISABLE_ASSERTS - -#define LEMON_ASSERT_ERROR -#include - -void no_assertion_text_error() { - LEMON_ASSERT(true, "This is a fault message"); -} - -void no_assertion_exception_error() { - LEMON_ASSERT(true, Exception()); -} - -void assertion_text_error() { - LEMON_ASSERT(false, "This is a fault message"); -} - -void assertion_exception_error() { - LEMON_ASSERT(false, Exception()); -} - -void fixme_error() { - LEMON_FIXME("fixme_error() is fixme!"); -} - -void check_assertion_error() { - no_assertion_text_error(); - no_assertion_exception_error(); - try { - assertion_exception_error(); - check(false, "Assertion error"); - } catch (const AssertionFailedError& e) { - } - - try { - assertion_text_error(); - check(false, "Assertion error"); - } catch (const AssertionFailedError& e) { - } - - try { - fixme_error(); - check(false, "Assertion error"); - } catch (const AssertionFailedError& e) { - } -} -#undef LEMON_ASSERT_ERROR - -#define LEMON_ASSERT_EXCEPTION -#include - -void no_assertion_text_exception() { - LEMON_ASSERT(true, "This is a fault message"); -} - -void no_assertion_exception_exception() { - LEMON_ASSERT(true, Exception()); -} - -void assertion_text_exception() { - LEMON_ASSERT(false, "This is a fault message"); -} - -void assertion_exception_exception() { - LEMON_ASSERT(false, Exception()); -} - -void fixme_exception() { - LEMON_FIXME("fixme_exception() is fixme!"); -} - -void check_assertion_exception() { - no_assertion_text_exception(); - no_assertion_exception_exception(); - try { - assertion_exception_exception(); - check(false, "Assertion error"); - } catch (const Exception& e) { - } - - try { - assertion_text_exception(); - check(false, "Assertion error"); - } catch (const AssertionFailedError& e) { - } - - try { - assertion_text_exception(); - check(false, "Assertion error"); - } catch (const AssertionFailedError& e) { - } - - try { - fixme_exception(); - check(false, "Assertion error"); - } catch (const AssertionFailedError& e) { - } -} -#undef LEMON_ASSERT_EXCEPTION - -#define LEMON_ASSERT_LOG - -#include - -void no_assertion_text_log() { - LEMON_ASSERT(true, "This is a fault message"); -} - -void no_assertion_exception_log() { - LEMON_ASSERT(true, Exception()); -} - -void assertion_text_log() { - LEMON_ASSERT(false, "This is a fault message"); -} - -void assertion_exception_log() { - LEMON_ASSERT(false, Exception()); -} - -void fixme_log() { - LEMON_FIXME("fixme_log() is fixme!"); -} - -void check_assertion_log() { - no_assertion_text_log(); - no_assertion_exception_log(); - std::cerr << "The next 3 failure messages are expected: " << std::endl; - assertion_exception_log(); - assertion_text_log(); - fixme_log(); - std::cerr << "End of expected error messages" << std::endl; -} -#undef LEMON_ASSERT_LOG - #define LEMON_ASSERT_CUSTOM static int cnt = 0; @@ -206,17 +62,6 @@ ++cnt; } -void my_assert_handler(const char*, int, const char*, - const std::exception&, const char*) { - ++cnt; -} - -void my_assert_handler(const char*, int, const char*, - const std::string&, const char*) { - ++cnt; -} - - #define LEMON_CUSTOM_ASSERT_HANDLER my_assert_handler #include @@ -224,29 +69,19 @@ LEMON_ASSERT(true, "This is a fault message"); } -void no_assertion_exception_custom() { - LEMON_ASSERT(true, Exception()); -} - void assertion_text_custom() { LEMON_ASSERT(false, "This is a fault message"); } -void assertion_exception_custom() { - LEMON_ASSERT(false, Exception()); -} - void fixme_custom() { LEMON_FIXME("fixme_custom() is fixme!"); } void check_assertion_custom() { no_assertion_text_custom(); - no_assertion_exception_custom(); - assertion_exception_custom(); assertion_text_custom(); fixme_custom(); - check(cnt == 3, "The custom assert handler does not work"); + check(cnt == 2, "The custom assert handler does not work"); } #undef LEMON_ASSERT_CUSTOM @@ -254,9 +89,6 @@ int main() { check_assertion_disable(); - check_assertion_error(); - check_assertion_exception(); - check_assertion_log(); check_assertion_custom(); return 0;