2
0
mirror of https://github.com/boostorg/log.git synced 2026-02-17 13:52:15 +00:00

Fixed #11148. Fixed incorrect behavior of attribute_value_set::size() if a large number of attribute values are inserted into the set.

This commit is contained in:
Andrey Semashev
2015-03-28 19:04:31 +03:00
parent 54759c6890
commit f74a7df2df
4 changed files with 27 additions and 4 deletions

View File

@@ -16,6 +16,7 @@
#include <vector>
#include <string>
#include <sstream>
#include <utility>
#include <iterator>
#include <boost/config.hpp>
@@ -220,3 +221,24 @@ BOOST_AUTO_TEST_CASE(lookup)
BOOST_CHECK_EQUAL(view1.count(data::attr3()), 1UL);
BOOST_CHECK_EQUAL(view1.count(data::attr4()), 0UL);
}
// The test checks size method
BOOST_AUTO_TEST_CASE(size)
{
typedef logging::attribute_value_set attr_values;
attrs::constant< int > attr1(10);
attr_values view;
view.freeze();
unsigned int i = 0;
for (; i < 100; ++i)
{
std::ostringstream strm;
strm << "Attr" << i;
view.insert(attr_values::key_type(strm.str()), attr1.get_value());
}
BOOST_CHECK_EQUAL(view.size(), i);
}