Skip to content

Commit

Permalink
Added test
Browse files Browse the repository at this point in the history
  • Loading branch information
L0uisc authored and mbrubeck committed Jun 15, 2023
1 parent 9806b2d commit c64344a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -989,3 +989,14 @@ fn test_size() {
use core::mem::size_of;
assert_eq!(24, size_of::<SmallVec<[u8; 8]>>());
}

// #[cfg(feature("drain_filter"))]
#[test]
fn drain_filter() {
let mut a: SmallVec<[u8; 2]> = SmallVec::from_slice(&[1u8, 2, 3, 4, 5, 6, 7, 8]);

let b: SmallVec<[u8; 2]> = a.drain_filter(|x| *x % 3 == 0).collect();

assert_eq!(a, SmallVec::<[u8; 2]>::from_slice(&[1u8, 2, 4, 5, 7, 8]));
assert_eq!(b, SmallVec::<[u8; 2]>::from_slice(&[3u8, 6]));
}

0 comments on commit c64344a

Please sign in to comment.