mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-21 04:33:10 +08:00
List fix remove() and update testing
This commit is contained in:
@@ -68,7 +68,7 @@ public:
|
||||
return List<T>::remove(removeNode);
|
||||
}
|
||||
|
||||
size_t size() const
|
||||
size_t size()
|
||||
{
|
||||
LockGuard lg{_mutex};
|
||||
return List<T>::size();
|
||||
|
||||
@@ -70,7 +70,13 @@ public:
|
||||
{
|
||||
// base case
|
||||
if (removeNode == _head) {
|
||||
_head = nullptr;
|
||||
if (_head->getSibling() != nullptr) {
|
||||
_head = _head->getSibling();
|
||||
|
||||
} else {
|
||||
_head = nullptr;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -141,6 +141,8 @@ bool ListTest::test_remove()
|
||||
for (auto t : list1) {
|
||||
ut_assert_true(t->i != remove_i);
|
||||
}
|
||||
|
||||
ut_assert_true(list1.size() == 100 - remove_i - 1);
|
||||
}
|
||||
|
||||
// list should now be empty
|
||||
|
||||
Reference in New Issue
Block a user