MCPcopy Create free account
hub / github.com/douchuan/algorithm / push_front

Function push_front

tests/test_linked_list.rs:17–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15
16#[test]
17fn push_front() {
18 let mut data = vec![1, 2, 3, 4, 5];
19 let mut ll = LinkedList::default();
20 for &v in &data {
21 ll.push_front(v);
22 }
23
24 //len
25 assert_eq!(ll.len(), data.len());
26
27 //verify data
28 let ll_data: Vec<i32> = ll.into_iter().collect();
29 data.reverse();
30 assert_eq!(ll_data, data);
31}
32
33#[test]
34fn reverse() {

Callers

nothing calls this directly

Calls 3

push_frontMethod · 0.80
into_iterMethod · 0.80
reverseMethod · 0.45

Tested by

no test coverage detected