-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_script.sh
More file actions
executable file
·77 lines (60 loc) · 1.8 KB
/
test_script.sh
File metadata and controls
executable file
·77 lines (60 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
PROGRAM="./cub3D"
TEST_MAPS_DIR="maps"
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
YELLOW=$(tput setaf 3)
BLA=$(tput setaf 4)
NC=$(tput sgr0)
invalid_counter=0
valid_counter=0
valid_map_counter=0
invalid_map_counter=0
echo -e "\n${YELLOW}Checking invalid maps:${NC}\n"
for map_file in $TEST_MAPS_DIR/invalid_*.cub; do
echo -e "\nTesting invalid map: $map_file\n"
output=$($PROGRAM "$map_file" 2>&1)
exit_status=$?
if [ $exit_status -eq 1 ]; then
echo -e "${RED}$output"
echo -e "${GREEN}Map is invalid.${NC}\n"
((invalid_counter ++))
else
echo -e "${RED}Map is valid.${NC}\n"
fi
((invalid_map_counter++))
echo -e "---------------------"
done
Check correct maps
echo -e "${BLA}Checking correct maps:${NC}\n"
for map_file in $TEST_MAPS_DIR/correct_*.cub; do
echo -e "\nTesting valid map: $map_file\n"
output=$($PROGRAM "$map_file" 2>&1)
exit_status=$?
if [ $exit_status -eq 0 ]; then
echo -e "${GREEN}Map is valid.${NC}\n"
((valid_counter ++))
else
echo -e "$output"
echo -e "${RED}Map is not valid.${NC}\n"
fi
((valid_map_counter++))
echo -e "---------------------"
done
echo -e "\n${BLA}Invalid Maps $invalid_counter / $invalid_map_counter\n"
echo -e "Valid Maps $valid_counter / $valid_map_counter\n"
# echo -e "\n${YELLOW}Checking invalid maps:${NC}\n"
# for map_file in $TEST_MAPS_DIR/maps/*.cub; do
# echo -e "\nTesting invalid map: $map_file\n"
# output=$($PROGRAM "$map_file" 2>&1)
# exit_status=$?
# if [ $exit_status -eq 1 ]; then
# echo -e "${RED}$output"
# echo -e "${GREEN}Map is invalid.${NC}\n"
# ((invalid_counter ++))
# else
# echo -e "${RED}Map is valid.${NC}\n"
# fi
# ((invalid_map_counter++))
# echo -e "---------------------"
# done