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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user