Compare commits

..

No commits in common. "64b2f18d92a0192977d15947472908ccfff35b5b" and "1bae2dcb0019d579cdfe5a0c68a9e46780eea6dd" have entirely different histories.

3 changed files with 23 additions and 31 deletions

View file

@ -1,7 +1,7 @@
// TODO: Fix the compiler error on this function. // TODO: Fix the compiler error on this function.
fn picky_eater(food: &str) -> &str { fn foo_if_fizz(fizzish: &str) -> &str {
if food == "strawberry" { if fizzish == "fizz" {
"Yummy!" "foo"
} else { } else {
1 1
} }
@ -18,20 +18,18 @@ mod tests {
use super::*; use super::*;
#[test] #[test]
fn yummy_food() { fn foo_for_fizz() {
// This means that calling `picky_eater` with the argument "food" should return "Yummy!". // This means that calling `foo_if_fizz` with the argument "fizz" should return "foo".
assert_eq!(picky_eater("strawberry"), "Yummy!"); assert_eq!(foo_if_fizz("fizz"), "foo");
} }
#[test] #[test]
fn neutral_food() { fn bar_for_fuzz() {
assert_eq!(picky_eater("potato"), "I guess I can eat that."); assert_eq!(foo_if_fizz("fuzz"), "bar");
} }
#[test] #[test]
fn default_disliked_food() { fn default_to_baz() {
assert_eq!(picky_eater("broccoli"), "No thanks!"); assert_eq!(foo_if_fizz("literally anything"), "baz");
assert_eq!(picky_eater("gummy bears"), "No thanks!");
assert_eq!(picky_eater("literally anything"), "No thanks!");
} }
} }

View file

@ -4,11 +4,7 @@ struct Point {
} }
enum Message { enum Message {
Resize { width: u64, height: u64 }, // TODO: Implement the message variant types based on their usage below.
Move(Point),
Echo(String),
ChangeColor(u8, u8, u8),
Quit,
} }
struct State { struct State {

View file

@ -1,10 +1,10 @@
fn picky_eater(food: &str) -> &str { fn foo_if_fizz(fizzish: &str) -> &str {
if food == "strawberry" { if fizzish == "fizz" {
"Yummy!" "foo"
} else if food == "potato" { } else if fizzish == "fuzz" {
"I guess I can eat that." "bar"
} else { } else {
"No thanks!" "baz"
} }
} }
@ -17,19 +17,17 @@ mod tests {
use super::*; use super::*;
#[test] #[test]
fn yummy_food() { fn foo_for_fizz() {
assert_eq!(picky_eater("strawberry"), "Yummy!"); assert_eq!(foo_if_fizz("fizz"), "foo");
} }
#[test] #[test]
fn neutral_food() { fn bar_for_fuzz() {
assert_eq!(picky_eater("potato"), "I guess I can eat that."); assert_eq!(foo_if_fizz("fuzz"), "bar");
} }
#[test] #[test]
fn default_disliked_food() { fn default_to_baz() {
assert_eq!(picky_eater("broccoli"), "No thanks!"); assert_eq!(foo_if_fizz("literally anything"), "baz");
assert_eq!(picky_eater("gummy bears"), "No thanks!");
assert_eq!(picky_eater("literally anything"), "No thanks!");
} }
} }