@@ -35,18 +35,35 @@ jobs:
3535 - name : Setup test maps
3636 run : |
3737 mkdir -p maps
38- # Create invalid.cub
39- echo "invalid content" > maps/invalid.cub
38+ # Invalid maps
39+ echo "invalid content" > maps/invalid_content.cub
40+ echo -e "NO texture.xpm\nSO texture.xpm\nWE texture.xpm\nEA texture.xpm\nF 255,0,0\nC 0,0,255\n\n111\n1P \n111" > maps/invalid_map_format.cub
41+ echo -e "NO missing_texture.xpm\nSO texture.xpm\nWE texture.xpm\nEA texture.xpm\nF 300,0,0\nC 0,0,300\n\n111\n1P1\n111" > maps/invalid_texture_color.cub
42+ echo -e "NO texture.xpm\nSO texture.xpm\nWE texture.xpm\nEA texture.xpm\nF 255,0,0\nC 0,0,255\n\n111\n1P1\n1 1" > maps/invalid_map_chars.cub
43+ echo -e "NO texture.xpm\nSO texture.xpm\nWE texture.xpm\nEA texture.xpm\nF 255,0,0\nC 0,0,255\n\n111\n111\n111" > maps/missing_player.cub
4044
4145 - name : Validate map handling
4246 run : |
43- echo "Testing invalid map (should fail)..."
44- if ./cub3D maps/invalid.cub 2>&1 | grep -q "Error"; then
45- echo "✓ Invalid map correctly rejected"
46- else
47- echo "✗ Invalid map not rejected" && exit 1
48- fi
47+ echo "=== Testing invalid map cases ==="
48+
49+ declare -A test_cases=(
50+ ["invalid_content.cub"]="Invalid content"
51+ ["invalid_map_format.cub"]="Map formatting"
52+ ["invalid_texture_color.cub"]="Texture/color values"
53+ ["invalid_map_chars.cub"]="Invalid map characters"
54+ ["missing_player.cub"]="Missing player position"
55+ )
56+
57+ for map in "${!test_cases[@]}"; do
58+ echo "Testing ${test_cases[$map]} (should fail)..."
59+ if ./cub3D "maps/$map" 2>&1 | grep -q "Error"; then
60+ echo "✓ Correctly rejected : ${test_cases[$map]}"
61+ else
62+ echo "✗ Failed to reject : ${test_cases[$map]}" && exit 1
63+ fi
64+ done
4965
66+ echo "All invalid map tests passed successfully"
5067 - name : Memory check
5168 run : |
5269 mkdir -p logs
0 commit comments