-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
executable file
·57 lines (50 loc) · 1.19 KB
/
test.sh
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
#! /usr/bin/bash
exec="./read_file_test"
print_return_value() {
if [ $1 -eq 0 ]; then
echo -e "\033[1;32m[$1]\033[1;0m" # Green for success
else
echo -e "\033[1;31m[$1]\033[1;0m" # Red for failure
fi
echo
}
test_case() {
test_case=$1
echo -e "test case >>> " $test_case
$exec $test_case
print_return_value $?
}
rm -f $exec
if gcc src/load_file/load_scene_from_file.c lib/libft/lib/libft.a
-o $exec \
-g -Wall -Wextra \
src/scene/*.c \
src/minirt.c \
src/minirt_init.c \
-lm -D TEST=1; then
echo -e "$exec compile complete"
echo without arguments ">>>"
$exec
print_return_value $?
test_case "1"
test_case "1 2"
test_case "."
test_case ".."
test_case "..."
test_case "...."
test_case "....."
test_case "......"
test_case "......."
test_case demo/camera.rt
test_case demo/cylinder.rt
test_case demo/multiple_A.rt
test_case demo/multiple_C.rt
test_case demo/multiple_l_point_light.rt
test_case demo/no_lights.rt
test_case demo/plane.rt
test_case demo/point_light.rt
test_case demo/scene1.rt
test_case demo/sphere.rt
else
echo "$exec compile failed"
fi