Skip to content

Commit

Permalink
Added test for the drain method of the LinkedListQueue
Browse files Browse the repository at this point in the history
  • Loading branch information
Ismael144 authored Oct 10, 2024
1 parent 1d0d356 commit 27af242
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/data_structures/queue_using_singly_linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,4 +430,19 @@ mod tests {
// Whether to see whether an option of variant Some is returned
assert!(queue.delete(1).is_some());
}

#[test]
fn test_queue_drain() {
let mut queue = LinkedListQueue::default();

// Enqueue some elements
queue.enqueue(1);
queue.enqueue(2);
queue.enqueue(3);

// Then drain the queue
queue.drain();

assert_eq!(queue.len(), 0);
}
}

0 comments on commit 27af242

Please sign in to comment.