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

Function find_kth2tail

tests/test_linked_list.rs:48–60  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46
47#[test]
48fn find_kth2tail() {
49 let data = vec![1, 2, 3, 4, 5, 6, 7, 8, 9];
50 let ll = create_ll(&data);
51
52 let p = ll::kth2tail::find(&ll, 2);
53 assert_eq!(unsafe { p.unwrap().as_ref().element }, 8);
54
55 let p = ll::kth2tail::find(&ll, 5);
56 assert_eq!(unsafe { p.unwrap().as_ref().element }, 5);
57
58 let p = ll::kth2tail::find(&ll, 10);
59 assert_eq!(p, None);
60}
61
62#[test]
63fn drop_clear() {

Callers

nothing calls this directly

Calls 2

create_llFunction · 0.85
findFunction · 0.50

Tested by

no test coverage detected