mirror of
https://github.com/Noratrieb/datastructures.git
synced 2026-01-15 09:55:02 +01:00
packed linked list
This commit is contained in:
parent
96b2396af2
commit
bdc9a79368
3 changed files with 189 additions and 0 deletions
28
src/packed_linked_list/test.rs
Normal file
28
src/packed_linked_list/test.rs
Normal 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!()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue