#! /bin/sh

# $Id: testme,v 1.2 1998/12/02 00:01:05 oliva Exp $

# Copyright 1998 Alexandre Oliva <oliva@dcc.unicamp.br>, Islene Calciolari Garcia <islene@dcc.unicamp.br>
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

# This program should be run from within the build tree of minpath.
# It assumes SPLIB has been built within this directory, and its
# programs are runnable in directory ./SPLIB/bin

text_tests="bf bfp pape two_q gor gor1"
bin_tests="bf bfp pape twoq gor gor1"

while read gen; do
  case "$gen" in ""|"#"*) continue;; esac
  echo Test set: $gen
  (eval SPLIB/bin/$gen) 2>&1 > in # err output from the generator to stdout
  for prog in $text_tests; do
    echo Solver: SPLIB/bin/$prog
    SPLIB/bin/$prog < in
  done
  ./in2bin -b < in > in.bin
  rm -f in
  mv in.bin in
  for prog in $bin_tests; do
    echo Solver: ./$prog
    ./$prog < in 2>/dev/null
    echo
  done
  rm -f in.bin
  echo
done <<EOF # the test generators follow
sprand 512 65536 251
sprand 512 65536 253
sprand 512 65536 255
sprand 2048 1048576 451
sprand 2048 1048576 453
sprand 2048 1048576 455
sprand 131072 524288 961
sprand 131072 524288 963
sprand 131072 524288 965
sprand 512 65536 251 -lm-5000 | ./in2bin -a -r
sprand 512 65536 253 -lm-5000 | ./in2bin -a -r
sprand 512 65536 255 -lm-5000 | ./in2bin -a -r
sprand 2048 1048576 451 -lm-5000 | ./in2bin -a -r
sprand 2048 1048576 453 -lm-5000 | ./in2bin -a -r
sprand 2048 1048576 455 -lm-5000 | ./in2bin -a -r
spacyc 8192 131072 561
spacyc 8192 131072 563
spacyc 8192 131072 565
spacyc 32768 524288 761
spacyc 32768 524288 763
spacyc 32768 524288 765
spacyc 131072 2097152 961
spacyc 131072 2097152 963
spacyc 131072 2097152 965
spacyc 8192 131072 561 -lm-10000
spacyc 8192 131072 563 -lm-10000
spacyc 8192 131072 565 -lm-10000
spacyc 32768 524288 761 -lm-10000
spacyc 32768 524288 763 -lm-10000
spacyc 32768 524288 765 -lm-10000
EOF

exit 0
