test_framework_init_observer.hpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. /// @brief Defines an observer that monitors the init of the unit test framework
  9. // ***************************************************************************
  10. #ifndef BOOST_TEST_FRAMEWORK_INIT_OBSERVER_HPP_071894GER
  11. #define BOOST_TEST_FRAMEWORK_INIT_OBSERVER_HPP_071894GER
  12. // Boost.Test
  13. #include <boost/test/tree/observer.hpp>
  14. #include <boost/test/detail/global_typedef.hpp>
  15. #include <boost/test/detail/fwd_decl.hpp>
  16. #include <boost/test/utils/trivial_singleton.hpp>
  17. #include <boost/test/detail/suppress_warnings.hpp>
  18. //____________________________________________________________________________//
  19. namespace boost {
  20. namespace unit_test {
  21. // ************************************************************************** //
  22. /// @brief Monitors the init of the framework
  23. ///
  24. /// This class collects the state of the init/termination of the unit test framework.
  25. ///
  26. /// @see boost::unit_test::test_observer
  27. class BOOST_TEST_DECL framework_init_observer_t : public test_observer, public singleton<framework_init_observer_t> {
  28. public:
  29. virtual void test_start( counter_t );
  30. virtual void assertion_result( unit_test::assertion_result );
  31. virtual void exception_caught( execution_exception const& );
  32. virtual void test_aborted();
  33. virtual int priority() { return 0; }
  34. void clear();
  35. /// Indicates if a failure has been recorded so far
  36. bool has_failed( ) const;
  37. private:
  38. BOOST_TEST_SINGLETON_CONS( framework_init_observer_t )
  39. };
  40. BOOST_TEST_SINGLETON_INST( framework_init_observer )
  41. } // namespace unit_test
  42. } // namespace boost
  43. #include <boost/test/detail/enable_warnings.hpp>
  44. #endif // BOOST_TEST_FRAMEWORK_INIT_OBSERVER_HPP_071894GER