From 00405e0df5399c1abf94f5883c4d4a30c807e18b Mon Sep 17 00:00:00 2001 From: EliasCubz Date: Tue, 27 Oct 2020 13:32:00 +0100 Subject: [PATCH] remove instruction related code --- src/main.rs | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/src/main.rs b/src/main.rs index 84f6e87..89a53a0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -135,13 +135,6 @@ enum Orientation { W, } -/// Enum to store all possible instructions. -enum Instruction { - L, - R, - F, -} - /// Parse char and return corresponding orientation. fn parse_orientation(c: char) -> Result { match c { @@ -153,15 +146,6 @@ fn parse_orientation(c: char) -> Result { } } -/// Parse char and return corresponding instruction. -fn parse_instruction(c: char) -> Result { - match c { - 'L' => Ok(Instruction::L), - 'R' => Ok(Instruction::R), - 'F' => Ok(Instruction::F), - _ => Err("Invalid character, does not match any instructions"), - } -} /// Retrieve the content of a file and return it as a string. fn open_file(filename: &str) -> io::Result { @@ -204,14 +188,6 @@ mod tests { assert!(parse_orientation('Z').is_err()); } - #[test] - fn test_parse_instruction() { - assert!(parse_instruction('L').is_ok()); - assert!(parse_instruction('R').is_ok()); - assert!(parse_instruction('F').is_ok()); - assert!(parse_instruction('Z').is_err()); - } - #[test] fn test_open_file() { assert!(open_file("two_robots.txt").is_ok()); @@ -289,10 +265,6 @@ mod tests { w.create(); r.move_forward(&mut w); assert_eq!(0, r.p.y); - r.move_right(&mut w); - assert_eq!(2, r.p.x); - r.move_left(&mut w); - assert_eq!(1, r.p.x); } #[test]