Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IntrusiveQueue add remove method, iterators, and update test #12246

Merged
merged 3 commits into from
Jun 13, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
tests free test containers in IntrusiveQueue and List
dagar committed Jun 12, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 28ce48702ff2d8b400cb504c255a58c2701ad072
5 changes: 5 additions & 0 deletions src/systemcmds/tests/test_IntrusiveQueue.cpp
Original file line number Diff line number Diff line change
@@ -238,12 +238,17 @@ bool IntrusiveQueueTest::test_remove()
for (int remove_i = 0; remove_i < 100; remove_i++) {

// find node with i == remove_i
testContainer *removed = nullptr;

for (auto t : q1) {
if (t->i == remove_i) {
ut_assert_true(q1.remove(t));
t = removed;
}
}

delete removed;

// iterate list again to verify removal
for (auto t : q1) {
ut_assert_true(t->i != remove_i);
5 changes: 5 additions & 0 deletions src/systemcmds/tests/test_List.cpp
Original file line number Diff line number Diff line change
@@ -131,12 +131,17 @@ bool ListTest::test_remove()
for (int remove_i = 0; remove_i < 100; remove_i++) {

// find node with i == remove_i
testContainer *removed = nullptr;

for (auto t : list1) {
if (t->i == remove_i) {
ut_assert_true(list1.remove(t));
t = removed;
}
}

delete removed;

// iterate list again to verify removal
for (auto t : list1) {
ut_assert_true(t->i != remove_i);