#!/bin/csh

if ( ! -f hailstoned ) then
  echo "hailstone.cpp has not been compiled."
  exit 1
endif

limit cputime 2
foreach n (1 2 3 4 5 7 8 16 27 30 31 35 97 99 129 150)
  echo "---------------------------------------"
  echo "n = ${n}"
  echo
  echo ${n} | ./hailstoned
  set s = $status
  if ($s == 152) then
    echo "Time limit exceeded"
  else if ($s == 139) then
    echo "Segmentation fault"
  else if ($s != 0) then
    echo "Fault" $s
  endif
end
