]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/log/test/run/attr_attribute_set_ticket11106.cpp
2 * Copyright Andrey Semashev 2007 - 2015.
3 * Distributed under the Boost Software License, Version 1.0.
4 * (See accompanying file LICENSE_1_0.txt or copy at
5 * http://www.boost.org/LICENSE_1_0.txt)
8 * \file attr_attribute_set_ticket11106.cpp
9 * \author Andrey Semashev
12 * \brief This header contains a test for the fix for https://svn.boost.org/trac/boost/ticket/11106.
15 #define BOOST_TEST_MODULE attr_attribute_set_ticket11106
20 #include <boost/test/unit_test.hpp>
21 #include <boost/log/attributes/constant.hpp>
22 #include <boost/log/attributes/attribute_set.hpp>
24 // The test checks that insertion does not invalidate existing elements in the container
25 BOOST_AUTO_TEST_CASE(ticket11106
)
27 boost::log::attribute_set set
;
32 std::ostringstream strm
;
34 boost::log::attribute_name name
= strm
.str();
36 std::pair
< boost::log::attribute_set::iterator
, bool > res
= set
.insert(name
, boost::log::attributes::make_constant(5));
39 BOOST_CHECK(res
.second
); // check that insertion succeeded
40 BOOST_CHECK(set
.find(res
.first
->first
) != set
.end()); // check that lookup works
42 // Now check that all previously inserted elements are still findable
44 for (boost::log::attribute_set::const_iterator it
= set
.begin(), end
= set
.end(); it
!= end
; ++it
, ++j
)
46 boost::log::attribute_name key
= it
->first
;
47 BOOST_CHECK(set
.find(key
) != set
.end());
49 BOOST_CHECK_EQUAL(j
, i
);