#!/bin/sh

## This is how I created the initial output files
## for i in * ; do echo $i; ( cat $i | cdd_both_reps_gmp --all > ../output/$i ) ; done


TEST_OUTPUT=`mktemp /tmp/test_actual_output.XXXXXXXXXX`
echo "Using $TEST_OUTPUT as a temporary file."

run_test() {
    echo "Testing $1"
    cat input/$1 | $SAGE_LOCAL/bin/cdd_both_reps_gmp --all > $TEST_OUTPUT
    # Now, compare the two outputs and error out if there is a discrepancy:
    diff -n output/$1 $TEST_OUTPUT || ( \
    	  echo "cdd_both_reps not working as expected"; \
          exit 1 )
}


cd tests
INPUT=`ls input/`

for filename in $INPUT; do run_test $filename; done

rm $TEST_OUTPUT
