| 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 | |
| 6 | // See http://www.boost.org/libs/test for the library home page. |
| 7 | // |
| 8 | //! @file |
| 9 | //! An observer for monitoring the success/failure of the other observers |
| 10 | // *************************************************************************** |
| 11 | |
| 12 | #ifndef BOOST_TEST_FRAMEWORK_INIT_OBSERVER_IPP_021105GER |
| 13 | #define BOOST_TEST_FRAMEWORK_INIT_OBSERVER_IPP_021105GER |
| 14 | |
| 15 | // Boost.Test |
| 16 | #include <boost/test/test_framework_init_observer.hpp> |
| 17 | #include <boost/test/framework.hpp> |
| 18 | #include <boost/test/detail/suppress_warnings.hpp> |
| 19 | |
| 20 | //____________________________________________________________________________// |
| 21 | |
| 22 | namespace boost { |
| 23 | namespace unit_test { |
| 24 | |
| 25 | |
| 26 | //____________________________________________________________________________// |
| 27 | |
| 28 | // ************************************************************************** // |
| 29 | // ************** framework_init_observer_t ************** // |
| 30 | // ************************************************************************** // |
| 31 | |
| 32 | void |
| 33 | framework_init_observer_t::clear() |
| 34 | { |
| 35 | m_has_failure = false; |
| 36 | } |
| 37 | |
| 38 | //____________________________________________________________________________// |
| 39 | |
| 40 | void |
| 41 | framework_init_observer_t::test_start( counter_t, test_unit_id ) |
| 42 | { |
| 43 | clear(); |
| 44 | } |
| 45 | |
| 46 | //____________________________________________________________________________// |
| 47 | |
| 48 | void |
| 49 | framework_init_observer_t::assertion_result( unit_test::assertion_result ar ) |
| 50 | { |
| 51 | switch( ar ) { |
| 52 | case AR_FAILED: m_has_failure = true; break; |
| 53 | default: |
| 54 | break; |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | //____________________________________________________________________________// |
| 59 | |
| 60 | void |
| 61 | framework_init_observer_t::exception_caught( execution_exception const& ) |
| 62 | { |
| 63 | m_has_failure = true; |
| 64 | } |
| 65 | |
| 66 | void |
| 67 | framework_init_observer_t::test_aborted() |
| 68 | { |
| 69 | m_has_failure = true; |
| 70 | } |
| 71 | |
| 72 | |
| 73 | //____________________________________________________________________________// |
| 74 | |
| 75 | bool |
| 76 | framework_init_observer_t::has_failed() const |
| 77 | { |
| 78 | return m_has_failure; |
| 79 | } |
| 80 | |
| 81 | //____________________________________________________________________________// |
| 82 | |
| 83 | } // namespace unit_test |
| 84 | } // namespace boost |
| 85 | |
| 86 | #include <boost/test/detail/enable_warnings.hpp> |
| 87 | |
| 88 | #endif // BOOST_TEST_FRAMEWORK_INIT_OBSERVER_IPP_021105GER |
| 89 |
