#!/bin/sh
# put the code and data in the same folder
in="in" #data's inputs file suffix
out="out" #Analogy above
cpp="a.cpp" # the CPP of yours.BTW you should comment the freopen
prog="test" #compilation's product
myoutput="myans" #program's output
g++ -O2 $cpp -o $prog #compile command
for file in ./*
do
if test -f $file
then
name=${file##*/}
suff=${name#*.}
pre=${name%%.*}
#echo $name $pre $suff
#echo $file
if test $suff = $in
then
infile=$name
outfile=$pre.$out
./$prog <$infile >$myoutput
if diff $myoutput $outfile
then
echo $infile AC
else
echo $infile WA
fi
fi
fi
done