#!/bin/bash

mkdir -p regression-bugs-tmp

regress () {
  if [ -f "`which banner`" ] ; then
      banner $1
  elif [ -f ./banner ] ; then
      ./banner $1
  fi  
  cp regression-bugs/$1.imp regression-bugs-tmp/$1.imp
  i77 -c regression-bugs-tmp/$1.imp 2> regression-bugs-tmp/$1.err
  #clang-format regression-bugs-tmp/$1.c | ecce - - -command "((v. .r)0v.//.e-0i/ /72m,m)0;%c" 2> /dev/null > regression-bugs-tmp/$1-pretty.c
  ./idec --i2c regression-bugs-tmp/$1 > regression-bugs-tmp/$1.idec
  diff regression-bugs-tmp/$1.err regression-bugs/$1.err
  diff regression-bugs-tmp/$1.c regression-bugs/$1.c
}

# 4 imp files in test that aren't imp77 compatible. Removed.
#regress arrays2
#regress bigreal
#regress soap80-b
#regress soaps

regress 1Darray
regress 3Darray
regress ack
regress arrayname
regress arraynames
regress arrays
regress assref
regress broken2
regress broken
regress bug001
regress cat
regress compares
regress constreal
regress cprio-failure2
regress cprio-failure
regress derefs
regress draft4
regress dscond2
regress dscond3
regress dscond4
regress dscond
regress dsided
regress exponent
regress expr2a
regress expr2
regress expr
regress extarray
regress hal7502
regress intaddr
regress intreal
regress labtest
regress leibnitz
regress linux
regress lunarlander
regress missingrecord
regress nameindex
regress nestedfns
regress nestrec2
regress nestrec
regress overload
regress ownreal
regress priobug
regress readwrite
regress reallits
regress recarrfield
regress recfieldarr
regress shiftprecbug
regress signal
regress SIM
regress soap80-a
regress strtest
regress swdecs
regress test144
regress unassreal
regress writeprint

regress bernstein
regress cordic32
regress dec10-print
regress erccprint
regress ercc-write
regress i77print
regress ioprocs
regress itos
regress mouses-print
regress nsqrt
regress print-abd
regress printfl2
regress printfl-apm
regress printfl
regress print
regress rtof
regress rtos
regress shorts
regress sqrt
regress stoi
regress stor
regress test
regress TPK-imp77
regress vax-lib
regress vaxprint
regress vax-write
regress write2
regress write-emas77
regress write
regress write-mouses

fgrep error regression-bugs-tmp/*.err
