diff --git a/tests/asset.rs b/tests/asset.rs deleted file mode 100644 index f21a09b..0000000 --- a/tests/asset.rs +++ /dev/null @@ -1,14 +0,0 @@ -use pacman::asset::Asset; -use std::path::Path; -use strum::IntoEnumIterator; - -#[test] -fn test_asset_paths_valid() { - let base_path = Path::new("assets/game/"); - - for asset in Asset::iter() { - let path = base_path.join(asset.path()); - assert!(path.exists(), "Asset path does not exist: {:?}", path); - assert!(path.is_file(), "Asset path is not a file: {:?}", path); - } -} diff --git a/tests/constants.rs b/tests/constants.rs index 6d60c65..dc2ba94 100644 --- a/tests/constants.rs +++ b/tests/constants.rs @@ -2,27 +2,34 @@ use pacman::constants::*; #[test] fn test_raw_board_structure() { + // Test board dimensions match expected size assert_eq!(RAW_BOARD.len(), BOARD_CELL_SIZE.y as usize); - for row in RAW_BOARD.iter() { assert_eq!(row.len(), BOARD_CELL_SIZE.x as usize); } - // Test boundaries + // Test boundaries are properly walled assert!(RAW_BOARD[0].chars().all(|c| c == '#')); assert!(RAW_BOARD[RAW_BOARD.len() - 1].chars().all(|c| c == '#')); - - // Test tunnel row - let tunnel_row = RAW_BOARD[14]; - assert_eq!(tunnel_row.chars().next().unwrap(), 'T'); - assert_eq!(tunnel_row.chars().last().unwrap(), 'T'); } #[test] -fn test_raw_board_content() { - let power_pellet_count = RAW_BOARD.iter().flat_map(|row| row.chars()).filter(|&c| c == 'o').count(); - assert_eq!(power_pellet_count, 4); - - assert!(RAW_BOARD.iter().any(|row| row.contains('X'))); - assert!(RAW_BOARD.iter().any(|row| row.contains("=="))); +fn test_raw_board_contains_required_elements() { + // Test that essential game elements are present + assert!( + RAW_BOARD.iter().any(|row| row.contains('X')), + "Board should contain Pac-Man start position" + ); + assert!( + RAW_BOARD.iter().any(|row| row.contains("==")), + "Board should contain ghost house door" + ); + assert!( + RAW_BOARD.iter().any(|row| row.chars().any(|c| c == 'T')), + "Board should contain tunnel entrances" + ); + assert!( + RAW_BOARD.iter().any(|row| row.chars().any(|c| c == 'o')), + "Board should contain power pellets" + ); }