forked from kotet/atcoder-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
executable file
·40 lines (34 loc) · 873 Bytes
/
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
BUILD="g++ -std=gnu++1y -O2 -Wall -Wextra -I/opt/boost/gcc/include -L/opt/boost/gcc/lib -o ./app ./Main.cpp"
DEBUG="g++ -std=gnu++1y -g3 -Wall -Wextra -I/opt/boost/gcc/include -L/opt/boost/gcc/lib -o ./app ./Main.cpp"
echo "Building..."
if [ "$1" = "debug" ]; then
echo $DEBUG
$DEBUG
else
echo $BUILD
$BUILD
fi
if [ ! $? = 0 ]; then
echo "Build failed."
exit
fi
echo "Removing old output..."
mkdir -p output
rm output/*
for file in $(ls input); do
echo -n "Testing $file..."
timeout 5 ./app <input/$file >output/$file 2>&1
if [[ -f answer/$file ]]; then
if diff -q output/$file answer/$file >/dev/null; then
echo "passed."
else
echo "failed."
fi
else
echo "done. (answer file not found)"
fi
done
for file in $(ls output); do
bat output/$file
done
rm -f app app.o