List fix remove() and update testing

This commit is contained in:
Daniel Agar
2019-06-11 22:07:40 -04:00
parent 1623de8bd0
commit aee8f13289
3 changed files with 10 additions and 2 deletions
+1 -1
View File
@@ -68,7 +68,7 @@ public:
return List<T>::remove(removeNode);
}
size_t size() const
size_t size()
{
LockGuard lg{_mutex};
return List<T>::size();
+7 -1
View File
@@ -70,7 +70,13 @@ public:
{
// base case
if (removeNode == _head) {
_head = nullptr;
if (_head->getSibling() != nullptr) {
_head = _head->getSibling();
} else {
_head = nullptr;
}
return true;
}
+2
View File
@@ -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