FEAT: Add ArrayVec.capacity_left
This commit is contained in:
@@ -27,6 +27,20 @@ fn test_simple() {
|
||||
assert_eq!(sum_len, 8);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_capacity_left() {
|
||||
let mut vec: ArrayVec<[usize; 4]> = ArrayVec::new();
|
||||
assert_eq!(vec.capacity_left(), 4);
|
||||
vec.push(1);
|
||||
assert_eq!(vec.capacity_left(), 3);
|
||||
vec.push(2);
|
||||
assert_eq!(vec.capacity_left(), 2);
|
||||
vec.push(3);
|
||||
assert_eq!(vec.capacity_left(), 1);
|
||||
vec.push(4);
|
||||
assert_eq!(vec.capacity_left(), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_u16_index() {
|
||||
const N: usize = 4096;
|
||||
|
||||
Reference in New Issue
Block a user