#!/bin/sh

program=${1:-test_parse}
out_file=${program}.out

if [ $program = test_parse_cpp ]; then
   if g++ --version | head -1 | fgrep 3.4 > /dev/null; then
      out_file=test_parse_cpp.out_3_4
   else
      out_file=${program}.out
   fi
fi


cd ../obj
./$program > t

id=$$
sed -e 's/0x[0-9a-f]*/0xffff/g' t > /tmp/t.id
sed -e 's/0x[0-9a-f]*/0xffff/g' ../tests/$out_file > /tmp/t2.id

echo "Diff for $program"
diff /tmp/t2.id /tmp/t.id

rm /tmp/t.id /tmp/t2.id
