summaryrefslogtreecommitdiff
path: root/test/test.sh
blob: 0d8b84d5968b6e798788014e347f305eb745ff83 (plain) (blame)
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
#!/bin/bash

if [ "$1" != "--no-color" ]; then
	RED='\033[0;31m'
	GREEN='\033[0;32m'
	RESET='\033[0m'
else
	RED=
	GREEN=
	RESET=
fi

for f in database/*.in;
do
	output=$(diff "${f/in/out}" <(../src/runchess < "$f"))
	testname=$(head -1 $f | cut -d \" -f 2)
	if [ "$output" = "" ]
	then
		echo -e "${GREEN}Test: \"$testname\" passed${RESET}"
	else
		echo -e "${RED}Test: \"$testname\" failed${RESET}"
		diff --suppress-common-lines -y -W 50 "${f/in/out}" <(../src/runchess < "$f")
	fi
	echo "##################################################"
done