Merge branch 'pull-request/#1149-Fix-bug-in-the-void-etl--unlink(first,-last)-for-bidirectional-links' into development

This commit is contained in:
John Wellbelove 2025-07-14 09:53:40 +01:00
commit 481e29896a
3 changed files with 9 additions and 5 deletions

View File

@ -882,7 +882,6 @@ namespace etl
if (first.etl_previous != ETL_NULLPTR)
{
first.etl_previous->etl_next = last.etl_next;
last.clear();
}
first.etl_previous = ETL_NULLPTR;

View File

@ -1225,15 +1225,14 @@ namespace
etl::link<BLink1>(data1, data0);
etl::link<BLink1>(data0, nullptr);
// According to the documentation, `data1`/`data2` remain linked to each other.
etl::unlink<BLink0>(data1, data2);
data1.BLink0::clear();
data2.BLink0::clear();
CHECK(data0.BLink0::etl_previous == nullptr);
CHECK(data0.BLink0::etl_next == &data3);
CHECK(data1.BLink0::etl_previous == nullptr);
CHECK(data1.BLink0::etl_next == nullptr);
CHECK(data2.BLink0::etl_previous == nullptr);
CHECK(data1.BLink0::etl_next == &data2);
CHECK(data2.BLink0::etl_previous == &data1);
CHECK(data2.BLink0::etl_next == nullptr);
CHECK(data3.BLink0::etl_previous == &data0);
CHECK(data3.BLink0::etl_next == nullptr);

View File

@ -1420,6 +1420,12 @@ namespace
CHECK(are_equal);
CHECK_EQUAL(data0.size(), compare0.size());
// Double check that after splicing `etl_previous` is also correct - `.reverse()` easy way to do so.
data0.reverse();
compare0.reverse();
are_equal = std::equal(data0.begin(), data0.end(), compare0.begin());
CHECK(are_equal);
}
//*************************************************************************