packed linked list

This commit is contained in:
nora 2021-08-12 17:24:41 +02:00
parent 96b2396af2
commit bdc9a79368
3 changed files with 189 additions and 0 deletions

View file

@ -0,0 +1,28 @@
use super::*;
#[test]
fn empty_unit_list() {
PackedLinkedList::<(), 0>::new();
}
#[test]
fn push_front_single_node() {
let mut list = PackedLinkedList::<_, 16>::new();
list.push_front("hallo");
}
#[test]
fn iter_single_node() {
let mut list = PackedLinkedList::<_, 16>::new();
list.push_front("2");
list.push_front("1");
let mut iter = list.iter();
assert_eq!(iter.next(), Some(&"1"));
assert_eq!(iter.next(), Some(&"2"));
assert_eq!(iter.next(), None);
}
fn create_list<T: Clone, const COUNT: usize>(iter: &[T]) -> PackedLinkedList<T, COUNT> {
//iter.into_iter().cloned().collect()
todo!()
}