All pastes #184732 Raw Edit

Untitled

public text v1 · immutable
#184732 ·published 2006-09-28 06:17 UTC
rendered paste body
#!/bin/csh
# simple test program to ensure everyone should get some marks in final testing
   set mark = 0
   echo "Subject:  COMP225 Assignment 2 Preview" >! results
   echo "======================================" >> results
   echo " There are 4 tests  worth 6 marks  (4 saves and 2 treedraws) ">> results
   g++ *.cc -o testit >& errors
   set stat = $status
   if ( $stat != 0 ) then
         echo "Did not compile" >> results
         cat errors >> results
         exit 
   endif
   echo "Testing saved output file " >> results
   foreach i (1 2 3 4 )
       echo "====== Test $i  contains ========" >> results
       cat "test$i" >> results
       echo "====== Input file $i  contains ========" >> results
       cat "in$i" >> results
       echo "+++++++++++++++++++++++++++++++++++++++++" >> results
       (limit cputime 1; limit filesize 2k ;./testit< test$i  )
       set stat = $status
       if ($stat != 0) then
             echo "** Program killed **" >> results
       else
            ## test output files
             diff -wb out$i sampleout$i  >& /dev/null
             set stat = $status
             if ($stat == 0) then
                echo "** Passed test $i  for saved file ">> results
                @ mark++
             else
                echo " Did not pass test $i for saved file" >> results
             endif
             ## save tree.txt 
             cp tree.txt tree$i  >& /dev/null
       endif
   end
   echo "Testing drawing trees " >> results
   foreach i (3 4)
       diff tree$i sampletree$i
       set stat = $status
       if ($stat == 0) then
            echo "** Passed test $i  for tree drawing ">> results
            @ mark++
       else
            echo " Did not pass test $i for tree drawing " >> results
       endif
   end
   echo " ************************************" >> results
   echo " Mark  is $mark out of 6 " >> results
   if ($mark == 6) then
      echo " EXCELLENT (so far)" >> results
   endif
   echo " ************************************" >> results
   rm -rf  testit* > /dev/null
exit