forked from boostorg/intrusive
1)Fixed gcc release mode warnings.
2)Replaced throw with BOOST_RETHROW when BOOST_TRY is used. 3)Fixed issues with singly linked lists [SVN r42974]
This commit is contained in:
@@ -31,6 +31,8 @@ struct test_list
|
||||
static void test_all(std::vector<value_type>& values);
|
||||
static void test_front_back(std::vector<value_type>& values);
|
||||
static void test_sort(std::vector<value_type>& values);
|
||||
static void test_merge(std::vector<value_type>& values);
|
||||
static void test_remove_unique(std::vector<value_type>& values);
|
||||
static void test_insert(std::vector<value_type>& values);
|
||||
static void test_shift(std::vector<value_type>& values);
|
||||
static void test_swap(std::vector<value_type>& values);
|
||||
@@ -58,6 +60,8 @@ void test_list<ValueTraits>::test_all(std::vector<typename ValueTraits::value_ty
|
||||
|
||||
test_front_back(values);
|
||||
test_sort(values);
|
||||
test_merge(values);
|
||||
test_remove_unique(values);
|
||||
test_insert(values);
|
||||
test_shift(values);
|
||||
test_swap(values);
|
||||
@@ -126,6 +130,60 @@ void test_list<ValueTraits>
|
||||
{ int init_values [] = { 5, 3, 1, 4, 2 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testlist.begin() ); }
|
||||
}
|
||||
|
||||
//test: merge due to error in merge implementation:
|
||||
template<class ValueTraits>
|
||||
void test_list<ValueTraits>
|
||||
::test_remove_unique (std::vector<typename ValueTraits::value_type>& values)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef list
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, size_type<std::size_t>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
> list_type;
|
||||
{
|
||||
list_type list(values.begin(), values.end());
|
||||
list.remove_if(is_even());
|
||||
int init_values [] = { 1, 3, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, list.begin() );
|
||||
}
|
||||
{
|
||||
std::vector<typename ValueTraits::value_type> values2(values);
|
||||
list_type list(values.begin(), values.end());
|
||||
list.insert(list.end(), values2.begin(), values2.end());
|
||||
list.sort();
|
||||
int init_values [] = { 1, 1, 2, 2, 3, 3, 4, 4, 5, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, list.begin() );
|
||||
list.unique();
|
||||
int init_values2 [] = { 1, 2, 3, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values2, list.begin() );
|
||||
}
|
||||
}
|
||||
|
||||
//test: merge due to error in merge implementation:
|
||||
template<class ValueTraits>
|
||||
void test_list<ValueTraits>
|
||||
::test_merge (std::vector<typename ValueTraits::value_type>& values)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef list
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, size_type<std::size_t>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
> list_type;
|
||||
list_type testlist1, testlist2;
|
||||
testlist1.push_front (values[0]);
|
||||
testlist2.push_front (values[4]);
|
||||
testlist2.push_front (values[3]);
|
||||
testlist2.push_front (values[2]);
|
||||
testlist1.merge (testlist2);
|
||||
|
||||
int init_values [] = { 1, 3, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testlist1.begin() );
|
||||
}
|
||||
|
||||
//test: assign, insert, const_iterator, const_reverse_iterator, erase, s_iterator_to:
|
||||
template<class ValueTraits>
|
||||
|
||||
Reference in New Issue
Block a user