]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/test/impl/test_framework_init_observer.ipp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / test / impl / test_framework_init_observer.ipp
CommitLineData
b32b8144
FG
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
22namespace boost {
23namespace unit_test {
24
25
26//____________________________________________________________________________//
27
28// ************************************************************************** //
29// ************** framework_init_observer_t ************** //
30// ************************************************************************** //
31
32namespace {
33
34struct test_init_observer_check {
35 bool has_failure;
36
37 void clear()
38 {
39 has_failure = false;
40 }
41};
42
43
44test_init_observer_check& s_tioc_impl() { static test_init_observer_check the_inst; return the_inst; }
45
46} // local namespace
47
48void
49framework_init_observer_t::clear()
50{
51 if(!framework::test_in_progress())
52 s_tioc_impl().clear();
53}
54
55//____________________________________________________________________________//
56
57void
58framework_init_observer_t::test_start( counter_t )
59{
60 clear();
61}
62
63//____________________________________________________________________________//
64
65void
66framework_init_observer_t::assertion_result( unit_test::assertion_result ar )
67{
68 test_init_observer_check& tr = s_tioc_impl();
69 switch( ar ) {
70 case AR_TRIGGERED: break;
71 case AR_PASSED: break;
72 case AR_FAILED: tr.has_failure = true; break;
73 default:
74 break;
75 }
76}
77
78//____________________________________________________________________________//
79
80void
81framework_init_observer_t::exception_caught( execution_exception const& )
82{
83 test_init_observer_check& tr = s_tioc_impl();
84 tr.has_failure = true;
85}
86
87void
88framework_init_observer_t::test_aborted()
89{
90 s_tioc_impl().has_failure = true;
91}
92
93
94//____________________________________________________________________________//
95
96bool
97framework_init_observer_t::has_failed() const
98{
99 return s_tioc_impl().has_failure;
100}
101
102//____________________________________________________________________________//
103
104} // namespace unit_test
105} // namespace boost
106
107#include <boost/test/detail/enable_warnings.hpp>
108
109#endif // BOOST_TEST_FRAMEWORK_INIT_OBSERVER_IPP_021105GER