Fixes #63 ("nop splice removes element")

This commit is contained in:
Ion Gaztañaga
2021-06-19 19:39:40 +02:00
parent 8f7c32dd63
commit cbc81b9417
4 changed files with 73 additions and 2 deletions
+36 -1
View File
@@ -273,7 +273,7 @@ template < class ListType, typename ValueContainer >
void test_list< ListType, ValueContainer >
::test_swap(ValueContainer& values)
{
{
{ //splice between two lists
list_type testlist1 (values.begin(), values.begin() + 2);
list_type testlist2;
testlist2.insert (testlist2.end(), values.begin() + 2, values.begin() + 5);
@@ -308,6 +308,41 @@ void test_list< ListType, ValueContainer >
BOOST_TEST (testlist1.size() == 1);
BOOST_TEST (&testlist1.front() == &values[3]);
}
{ //splice in the same list
list_type testlist1 (values.begin(), values.begin() + 5);
{ int init_values [] = { 1, 2, 3, 4, 5 };
TEST_INTRUSIVE_SEQUENCE( init_values, testlist1.begin() ); }
//nop 1
testlist1.splice (testlist1.begin(), testlist1, testlist1.begin(), ++testlist1.begin());
{ int init_values [] = { 1, 2, 3, 4, 5 };
TEST_INTRUSIVE_SEQUENCE( init_values, testlist1.begin() ); }
//nop 2
testlist1.splice (++testlist1.begin(), testlist1, testlist1.begin(), ++testlist1.begin());
{ int init_values [] = { 1, 2, 3, 4, 5 };
TEST_INTRUSIVE_SEQUENCE( init_values, testlist1.begin() ); }
//nop 3
testlist1.splice (testlist1.begin(), testlist1, ++testlist1.begin(), ++testlist1.begin());
{ int init_values [] = { 1, 2, 3, 4, 5 };
TEST_INTRUSIVE_SEQUENCE( init_values, testlist1.begin() ); }
testlist1.splice (testlist1.begin(), testlist1, ++testlist1.begin(), ++++testlist1.begin());
{ int init_values [] = { 2, 1, 3, 4, 5 };
TEST_INTRUSIVE_SEQUENCE( init_values, testlist1.begin() ); }
testlist1.splice (testlist1.begin(), testlist1, ++testlist1.begin(), ++++++testlist1.begin());
{ int init_values [] = { 1, 3, 2, 4, 5 };
TEST_INTRUSIVE_SEQUENCE( init_values, testlist1.begin() ); }
testlist1.splice (++++++++testlist1.begin(), testlist1, testlist1.begin(), ++++testlist1.begin());
{ int init_values [] = { 2, 4, 1, 3, 5 };
TEST_INTRUSIVE_SEQUENCE( init_values, testlist1.begin() ); }
}
{
list_type testlist1 (values.begin(), values.begin() + 2);
list_type testlist2 (values.begin() + 3, values.begin() + 5);