diff --git a/src/main.rs b/src/main.rs index b483166..5229f42 100644 --- a/src/main.rs +++ b/src/main.rs @@ -294,4 +294,27 @@ mod tests { w.create(); assert!(w.empty_position(Position { x: 0, y: 0 })); } + + #[test] + fn test_valid_position() { + let p: Position = Position { x: 1, y: 1 }; + let w: World = World { + x: 5, + y: 5, + map: Vec::new(), + }; + assert!(p.is_valid(w).is_ok()); + } + + #[test] + #[should_panic] + fn test_invalid_position() { + let p: Position = Position { x: -1, y: 1 }; + let w: World = World { + x: 5, + y: 5, + map: Vec::new(), + }; + assert!(p.is_valid(w).is_ok()); + } }