diff --git a/src/main.rs b/src/main.rs index fed27a8..d569841 100644 --- a/src/main.rs +++ b/src/main.rs @@ -86,67 +86,67 @@ mod driver { #[cfg(test)] mod tests { - use super::{rover, driver}; - use super::rover::{Rover}; + use super::driver; + use super::rover::{Rover, Facing,Rotation}; #[test] fn move_north() { - let r = Rover(1, 1, rover::Facing::N); + let r = Rover(1, 1, Facing::N); assert_eq!(r.forward(), - Rover(1, 0, rover::Facing::N)); + Rover(1, 0, Facing::N)); - let r = Rover(1, 3, rover::Facing::N); + let r = Rover(1, 3, Facing::N); assert_eq!(r.forward(), - Rover(1, 2, rover::Facing::N)); + Rover(1, 2, Facing::N)); } #[test] fn move_south() { - let r = Rover(1, 1, rover::Facing::S); + let r = Rover(1, 1, Facing::S); assert_eq!(r.forward(), - Rover(1, 2, rover::Facing::S)); + Rover(1, 2, Facing::S)); } #[test] fn move_west() { - let r = Rover(1, 1, rover::Facing::W); + let r = Rover(1, 1, Facing::W); assert_eq!(r.forward(), - Rover(0, 1, rover::Facing::W)); + Rover(0, 1, Facing::W)); } #[test] fn move_east() { - let r = Rover(1, 1, rover::Facing::E); + let r = Rover(1, 1, Facing::E); assert_eq!(r.forward(), - Rover(2, 1, rover::Facing::E)); + Rover(2, 1, Facing::E)); } #[test] fn move_backward() { - let r = Rover(1, 1, rover::Facing::E); + let r = Rover(1, 1, Facing::E); let r2 = r.forward(); assert_eq!(r2.backward(), r); } #[test] fn spin_left() { - let r = Rover(1, 1, rover::Facing::E); - match r.rotate(rover::Rotation::Left) { - Rover(_, _, facing) => assert_eq!(facing, rover::Facing::N) + let r = Rover(1, 1, Facing::E); + match r.rotate(Rotation::Left) { + Rover(_, _, facing) => assert_eq!(facing, Facing::N) } } #[test] fn spin_right() { - let r = Rover(1, 1, rover::Facing::S); - match r.rotate(rover::Rotation::Right) { - Rover(_, _, facing) => assert_eq!(facing, rover::Facing::W) + let r = Rover(1, 1, Facing::S); + match r.rotate(Rotation::Right) { + Rover(_, _, facing) => assert_eq!(facing, Facing::W) } } #[test] fn drive() { - let r = Rover(1, 1, rover::Facing::S); + let r = Rover(1, 1, Facing::S); assert_eq!(driver::execute(&r, "ffrf"), - Rover(0, 3, rover::Facing::W)); + Rover(0, 3, Facing::W)); } }