|
49 | 49 | if [ -t 1 ]; then echo -e "${BOLDBLUE}Test ${infile:8} ${ENDCOLOR}"
|
50 | 50 | echo -e "${BOLDBLUE}---------- ${ENDCOLOR}"
|
51 | 51 | else echo -e "Test $infile\n---------- "; fi
|
52 |
| - dif="$(diff "${infile%.*}.out" <(./a.out < "$infile"))" |
53 |
| - if [ -n "$dif" ]; then |
54 |
| - if [ -t 1 ]; then echo -e "${RED}Test failed.${ENDCOLOR}\nDifference : ${RED}$dif${ENDCOLOR}\n" |
55 |
| - else echo -e "FAILED.\nDifference : $dif\n"; fi |
| 52 | + outfile="${infile%.*}.out" |
| 53 | + if [ ! -f "$outfile" ]; then |
| 54 | + echo -e "Test file $outfile not found!\n" |
| 55 | + continue |
56 | 56 | else
|
57 |
| - if [ -t 1 ]; then echo -e "${GREEN}PASSED!${ENDCOLOR}\n" |
58 |
| - else echo -e "PASSED!\n"; fi |
59 |
| - PASSED=$((PASSED + 1)) |
| 57 | + dif="$(diff "${infile%.*}.out" <(./a.out < "$infile"))" |
| 58 | + if [ -n "$dif" ]; then |
| 59 | + if [ -t 1 ]; then echo -e "${RED}Test failed.${ENDCOLOR} |
| 60 | + \nDifference : ${RED}$dif${ENDCOLOR}\n" |
| 61 | + else echo -e "FAILED.\nDifference : $dif\n"; fi |
| 62 | + else |
| 63 | + if [ -t 1 ]; then echo -e "${GREEN}PASSED!${ENDCOLOR}\n" |
| 64 | + else echo -e "PASSED!\n"; fi |
| 65 | + PASSED=$((PASSED + 1)) |
| 66 | + fi |
60 | 67 | fi
|
61 | 68 | done
|
62 | 69 |
|
63 | 70 | if [ $PASSED -eq $len ]; then
|
64 | 71 | if [ -t 1 ]; then echo -e "${GREEN}You have passed all tests! \(ᵔᵕᵔ)/${ENDCOLOR}"
|
65 | 72 | else echo "All tests passed!"; fi
|
66 | 73 | elif [ $PASSED -eq $(($len-1)) ]; then
|
67 |
| - if [ -t 1 ]; then echo -e "${MAGENTA}You have passed $PASSED out of $len tests. Almost there...! (◎_◎)${ENDCOLOR}" |
| 74 | + if [ -t 1 ]; then echo -e "${MAGENTA}You have passed $PASSED out of $len tests." |
| 75 | + echo -e "Almost there...! (◎_◎)${ENDCOLOR}" |
68 | 76 | else echo -e "Passed $PASSED out of $len tests."; fi
|
69 | 77 | else
|
70 |
| - if [ -t 1 ]; then echo -e "${MAGENTA}You have passed $PASSED out of $len tests. (._.)${ENDCOLOR}" |
| 78 | + if [ -t 1 ]; then echo -e "${MAGENTA}You have passed $PASSED out of $len tests. |
| 79 | + (._.)${ENDCOLOR}" |
71 | 80 | else echo "Passed $PASSED out of $len tests."; fi
|
72 | 81 | fi
|
73 | 82 | echo
|
|
0 commit comments