#!/bin/sh
#
# This is a simple test script that tests a few lp-solve
# features to make sure I haven't broken them before a release.
#
# installed as: /usr/lib/debian-test/tests/lp-solve/test-1
#
# NOTE: debian-test-0.0.2 has a bug which prevents tests in
# subdirectories of /usr/lib/debian-test/tests/ from being run.
# The bug, with a patch, has been reported.

if test -n "${DEBIANTEST_LIB}" ; then
  # make sure lp-solve is installed
  test -e /usr/bin/lp_solve || exit 0
  
  . ${DEBIANTEST_LIB}/functions.sh
  Debian=1
else
  echo "Please install debian-test before running this script"
  exit 1
fi

TESTDIR=/usr/lib/debian-test/tests/lp-solve
TMP=/tmp/lp-solve-test.$$

doit(){
# echo "getting data from $TESTDIR/$1.lp"
# echo "writing results into $TMP"
# echo "comparing $TMP and $TESTDIR/$1.out"
    lp_solve -p -s <$TESTDIR/$1.lp >$TMP && diff $TESTDIR/$1.out $TMP
}

runtest "ex1.lp" doit ex1
runtest "ex2.lp" doit ex2
runtest "ex3.lp" doit ex3
runtest "ex6.lp" doit ex6
