Skip to content
This repository has been archived by the owner on Jun 22, 2019. It is now read-only.

Commit

Permalink
Add part-3 testcase runner
Browse files Browse the repository at this point in the history
  • Loading branch information
mreza-kiani committed May 11, 2019
1 parent a1b637a commit 2d93c76
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions Part-3/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# ./test.sh <main.cpp path> <executable file name>

# defining colors
RED="\033[0;31m"
GREEN="\033[0;32m"
CYAN="\033[0;36m"
NC='\033[0m' # No Color

make clean

counter=0
for i in {1..6}
do
cp testcases/$i/main.cpp $1/
make
./$2 2>&1 | diff testcases/$i/$i.txt -
if ! ./$2 2>&1 | diff -rq -B -Z testcases/$i/$i.txt -; then
echo -e "${RED}$i - Failed!${NC}"
else
echo -e "${GREEN}$i - Passed!${NC}"
counter=$(( counter + 1 ));
fi
done

echo -e "\n########\t${GREEN}$counter test cases passed!${NC}\t########"

0 comments on commit 2d93c76

Please sign in to comment.