ThrowingBoostAssert.hpp 877 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef BOOST_STATECHART_TEST_THROWING_BOOST_ASSERT_HPP_INCLUDED
  2. #define BOOST_STATECHART_TEST_THROWING_BOOST_ASSERT_HPP_INCLUDED
  3. //////////////////////////////////////////////////////////////////////////////
  4. // Copyright 2005-2006 Andreas Huber Doenni
  5. // Distributed under the Boost Software License, Version 1.0. (See accompany-
  6. // ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  7. //////////////////////////////////////////////////////////////////////////////
  8. #include <string>
  9. #include <stdexcept>
  10. #define BOOST_ENABLE_ASSERT_HANDLER
  11. namespace boost
  12. {
  13. void assertion_failed(
  14. char const * expr, char const * func, char const * file, long )
  15. {
  16. throw std::logic_error(
  17. std::string( "\nAssertion failed: \"" ) + expr + "\"\n" +
  18. "File: \"" + file + "\"\n" +
  19. "Function: \"" + func + "\"\n" );
  20. }
  21. } // namespace boost
  22. #endif