#!/bin/bash
#
# Compare program for precision check
#
dprint() { echo "$1" 1>&2; }
rprint() { echo "$1"; }

#
# Get Expected results and new Results
#
if [ ! -f $1 ]; then
   dprint "File is not found ($1)"
   exit 1;
fi

EXPECT=`cat $1`
dprint "Expect        : $EXPECT"

if [ ! -f $2 ]; then
   dprint "File is not found ($2)"
   exit 1;
fi

RESULT=`cat $2`
dprint "Result        : $RESULT"

#
# Evaluate results
#
if [ "$EXPECT" == "$RESULT" ]; then
    FRESULT=1
else
    FRESULT=0
fi

#
# Show detail log
#
dprint "Test Result   : $FRESULT"

#
# Show results
#
[ $FRESULT -eq 1 ] && rprint "OK" || rprint "NG"

#
# End
#
