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

Function stack

tests/test_common.rs:31–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

29
30#[test]
31fn stack() {
32 let v: Vec<&str> = TOBE.split(' ').collect();
33 let mut stack = Stack::default();
34 let mut r = Vec::new();
35 for s in v {
36 match s {
37 "-" => {
38 if let Some(s) = stack.pop() {
39 r.push(s);
40 }
41 }
42 _ => stack.push(s),
43 }
44 }
45
46 assert_eq!("to be not that or be", r.join(" "));
47 assert_eq!(2, stack.len());
48}
49
50#[test]
51fn min_pq() {

Callers

nothing calls this directly

Calls 2

pushMethod · 0.80
popMethod · 0.45

Tested by

no test coverage detected