Skip to content

Commit d08a104

Browse files
committed
test remove consecutive
1 parent 8bd25e1 commit d08a104

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

test/test_outbox/test_outbox.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,24 @@ void test_outbox_removeCurrent() {
159159
// Valgrind should not detect a leak here
160160
}
161161

162+
void test_outbox_remove_consecutive() {
163+
Outbox<uint32_t> outbox;
164+
165+
for (uint32_t i = 1; i <= 5; i++) {
166+
outbox.emplace(i);
167+
}
168+
TEST_ASSERT_EQUAL_UINT32(5, outbox.size());
169+
170+
Outbox<uint32_t>::Iterator it = outbox.front();
171+
++it; // 2
172+
++it; // 3
173+
174+
outbox.remove(it); // removes 3
175+
outbox.remove(it); // removes 4
176+
177+
TEST_ASSERT_EQUAL_UINT32(3, outbox.size());
178+
}
179+
162180
int main() {
163181
UNITY_BEGIN();
164182
RUN_TEST(test_outbox_create);
@@ -167,5 +185,6 @@ int main() {
167185
RUN_TEST(test_outbox_remove1);
168186
RUN_TEST(test_outbox_remove2);
169187
RUN_TEST(test_outbox_removeCurrent);
188+
RUN_TEST(test_outbox_remove_consecutive);
170189
return UNITY_END();
171190
}

0 commit comments

Comments
 (0)