MCPcopy Create free account
hub / github.com/QMHTMY/RustBook / basic_test

Function basic_test

code/chapter03/linked_list.rs:122–133  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

120
121fn main() {
122 fn basic_test() {
123 let mut list = List::new();
124 list.push(1); list.push(2); list.push(3);
125 assert_eq!(list.pop(), Some(3));
126 assert_eq!(list.peek(), Some(&2));
127 assert_eq!(list.peek_mut(), Some(&mut 2));
128 list.peek_mut().map(|val| {
129 *val = 4;
130 });
131 assert_eq!(list.peek(), Some(&4));
132 println!("basics test Ok!");
133 }
134
135 fn into_iter_test() {
136 let mut list = List::new();

Callers 1

mainFunction · 0.70

Calls 2

pushMethod · 0.45
peek_mutMethod · 0.45

Tested by

no test coverage detected