test_framework_init_observer.ipp 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. // (c) Copyright Raffi Enficiaud 2017.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. // See http://www.boost.org/libs/test for the library home page.
  6. //
  7. //! @file
  8. //! An observer for monitoring the success/failure of the other observers
  9. // ***************************************************************************
  10. #ifndef BOOST_TEST_FRAMEWORK_INIT_OBSERVER_IPP_021105GER
  11. #define BOOST_TEST_FRAMEWORK_INIT_OBSERVER_IPP_021105GER
  12. // Boost.Test
  13. #include <boost/test/test_framework_init_observer.hpp>
  14. #include <boost/test/framework.hpp>
  15. #include <boost/test/detail/suppress_warnings.hpp>
  16. //____________________________________________________________________________//
  17. namespace boost {
  18. namespace unit_test {
  19. //____________________________________________________________________________//
  20. // ************************************************************************** //
  21. // ************** framework_init_observer_t ************** //
  22. // ************************************************************************** //
  23. void
  24. framework_init_observer_t::clear()
  25. {
  26. m_has_failure = false;
  27. }
  28. //____________________________________________________________________________//
  29. void
  30. framework_init_observer_t::test_start( counter_t, test_unit_id )
  31. {
  32. clear();
  33. }
  34. //____________________________________________________________________________//
  35. void
  36. framework_init_observer_t::assertion_result( unit_test::assertion_result ar )
  37. {
  38. switch( ar ) {
  39. case AR_FAILED: m_has_failure = true; break;
  40. default:
  41. break;
  42. }
  43. }
  44. //____________________________________________________________________________//
  45. void
  46. framework_init_observer_t::exception_caught( execution_exception const& )
  47. {
  48. m_has_failure = true;
  49. }
  50. void
  51. framework_init_observer_t::test_aborted()
  52. {
  53. m_has_failure = true;
  54. }
  55. //____________________________________________________________________________//
  56. bool
  57. framework_init_observer_t::has_failed() const
  58. {
  59. return m_has_failure;
  60. }
  61. //____________________________________________________________________________//
  62. } // namespace unit_test
  63. } // namespace boost
  64. #include <boost/test/detail/enable_warnings.hpp>
  65. #endif // BOOST_TEST_FRAMEWORK_INIT_OBSERVER_IPP_021105GER