1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use crate::FixedVec;

impl<T, U> PartialEq<U> for FixedVec<T>
where
    U: AsRef<[T]>,
    T: PartialEq,
{
    fn eq(&self, other: &U) -> bool {
        self.data.as_slice() == other.as_ref()
    }
}

#[cfg(test)]
mod tests {
    use crate::prelude::*;
    use alloc::vec::Vec;

    #[test]
    fn eq() {
        let mut vec = FixedVec::new(42);
        for i in 0..vec.capacity() {
            vec.push(i);
        }

        let slice = &(0..vec.capacity()).collect::<Vec<_>>();
        assert_eq!(vec, slice);
    }
}