diff --git a/src/main.rs b/src/main.rs index fb7b826..465bd1a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,7 +12,7 @@ struct World { impl World { /// Create a new map full of dots. - fn create_map(&mut self) { + fn create(&mut self) { self.map = vec!['.'; (self.x * self.y) as usize]; } /// Set robot on the map. @@ -74,19 +74,19 @@ impl Robot { } } /// Apply North orientation to the robot. - fn turn_north(&mut self) { + fn set_north(&mut self) { self.o = Orientation::N } /// Apply South orientation to the robot. - fn turn_south(&mut self) { + fn set_south(&mut self) { self.o = Orientation::S } /// Apply East orientation to the robot. - fn turn_east(&mut self) { + fn set_east(&mut self) { self.o = Orientation::E } /// Apply West orientation to the robot. - fn turn_west(&mut self) { + fn set_west(&mut self) { self.o = Orientation::W } } @@ -183,13 +183,13 @@ mod tests { } #[test] - fn test_create_map() { + fn test_create() { let mut w: World = World { x: 5, y: 5, map: Vec::new(), }; - w.create_map(); + w.create(); assert_eq!(w.map, vec!['.'; 25]); } @@ -206,7 +206,7 @@ mod tests { y: 2, map: Vec::new(), }; - w.create_map(); + w.create(); w.set_robot(r); assert_eq!(w.map, vec!['↑', '.', '.', '.']); } @@ -218,7 +218,7 @@ mod tests { y: 2, map: Vec::new(), }; - w.create_map(); + w.create(); assert!(w.empty_position(Position { x: 0, y: 0 })); } }