Taking 1 step in a deep context is working!

This commit is contained in:
Tom Alexander 2020-04-11 21:20:45 -04:00
parent d89d3d9f3c
commit f62d50df95
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -151,7 +151,19 @@ mod tests {
.iter() .iter()
.cloned() .cloned()
.collect(); .collect();
let deep_context: HashMap<&str, HashMap<&str, &str>> = [
("cat", [("food", "meat")].iter().cloned().collect()),
("dog", [("food", "meat")].iter().cloned().collect()),
("tiger", [("food", "people")].iter().cloned().collect()),
]
.iter()
.cloned()
.collect();
assert_eq!(do_the_walk(&context, "cat"), &"kitty"); assert_eq!(do_the_walk(&context, "cat"), &"kitty");
assert_eq!(do_the_walk(&number_context, "tiger"), &3); assert_eq!(do_the_walk(&number_context, "tiger"), &3);
assert_eq!(
do_the_walk(&deep_context, "tiger"),
&[("food", "people")].iter().cloned().collect()
);
} }
} }