cw4_marking/cw4_test.sh
changeset 1039 86d59b074abe
parent 980 4f422766763f
equal deleted inserted replaced
1038:34d2cfb7761a 1039:86d59b074abe
    33   rm -rf /Users/cu/.ammonite/cache/3.*/* 2> /dev/null ;  
    33   rm -rf /Users/cu/.ammonite/cache/3.*/* 2> /dev/null ;  
    34   (ulimit -t 30; JAVA_OPTS="-Xmx1g -XX:MaxJavaStackTraceDepth=10" amm -s "$1" 1>> $out 2>> $out)
    34   (ulimit -t 30; JAVA_OPTS="-Xmx1g -XX:MaxJavaStackTraceDepth=10" amm -s "$1" 1>> $out 2>> $out)
    35 }
    35 }
    36 
    36 
    37 function scala_fail {
    37 function scala_fail {
       
    38   rm -rf /Users/cu/.ammonite/cache/3.*/* 2> /dev/null ;   
    38   (ulimit -t 30; JAVA_OPTS="-Xmx1g -XX:MaxJavaStackTraceDepth=10" amm -s "$1" 1>> $out 2>> $out)
    39   (ulimit -t 30; JAVA_OPTS="-Xmx1g -XX:MaxJavaStackTraceDepth=10" amm -s "$1" 1>> $out 2>> $out)
    39 }
    40 }
       
    41 
       
    42 # remove @main
       
    43 gsed -i -e "s|@main||g" cw04.sc
    40 
    44 
    41 
    45 
    42 ### compilation test
    46 ### compilation test
    43 
    47 
    44 echo -e "0) cw04.sc compiles?" | tee -a $out
    48 echo -e "0) cw04.sc compiles?" | tee -a $out
    67         tstsA=$(( 0 ))
    71         tstsA=$(( 0 ))
    68     else
    72     else
    69         echo -e "  --> FAIL\n" | tee -a $out
    73         echo -e "  --> FAIL\n" | tee -a $out
    70         tstsA=$(( 1 ))
    74         tstsA=$(( 1 ))
    71     fi
    75     fi
       
    76 else
       
    77     tstsA=$(( 1 ))
    72 fi
    78 fi
    73 
    79 
    74 echo >> $out
    80 echo >> $out
    75 
    81 
    76 if [ $tstsA -eq 0 ]
    82 if [ $tstsA -eq 0 ]
    85         echo -e "  --> The jasmin assembler generated the following error message:\n" | tee -a $out
    91         echo -e "  --> The jasmin assembler generated the following error message:\n" | tee -a $out
    86         cat outj >> $out
    92         cat outj >> $out
    87     else
    93     else
    88 	echo -e "   --> success (+ 5.0 Marks)\n" | tee -a $out
    94 	echo -e "   --> success (+ 5.0 Marks)\n" | tee -a $out
    89         marks=$(( marks + 5.0 ))
    95         marks=$(( marks + 5.0 ))
    90     fi
    96     fi   
    91 fi
    97 fi
    92 
    98 
    93 ### for test
    99 ### for test
    94 echo >> $out
   100 echo >> $out
    95 #echo -e "\n\n\n" >> $out
   101 #echo -e "\n\n\n" >> $out
   109         echo -e "  --> FAIL\n" | tee -a $out
   115         echo -e "  --> FAIL\n" | tee -a $out
   110         cat c$out >> $out
   116         cat c$out >> $out
   111 	tail -25 $out | pr -to10
   117 	tail -25 $out | pr -to10
   112         tstsB=$(( 1 ))
   118         tstsB=$(( 1 ))
   113     fi
   119     fi
       
   120 else    
       
   121     tstsB=$(( 1 ))
   114 fi
   122 fi
   115 
   123 
   116 echo >> $out
   124 echo >> $out
   117 
   125 
   118 if [ $tstsB -eq 0 ]
   126 if [ $tstsB -eq 0 ]
   141 	marks=$(( marks + 5.0 ))
   149 	marks=$(( marks + 5.0 ))
   142     else
   150     else
   143         echo -e "  --> FAIL\n" | tee -a $out
   151         echo -e "  --> FAIL\n" | tee -a $out
   144 	tail -25 $out | pr -to10
   152 	tail -25 $out | pr -to10
   145         cat c$out >> $out
   153         cat c$out >> $out
   146     fi
   154     fi   
   147 fi
   155 fi
   148 
   156 
   149 ##############################
   157 ##############################
   150 
   158 
   151 ### break test
   159 ### break test
   167         echo -e "  --> FAIL\n" | tee -a $out
   175         echo -e "  --> FAIL\n" | tee -a $out
   168         cat c$out >> $out
   176         cat c$out >> $out
   169 	tail -25 $out | pr -to10
   177 	tail -25 $out | pr -to10
   170         tstsC=$(( 1 ))
   178         tstsC=$(( 1 ))
   171     fi
   179     fi
       
   180 else
       
   181     tstsC=$(( 1 ))
   172 fi
   182 fi
   173 
   183 
   174 echo >> $out
   184 echo >> $out
   175 
   185 
   176 if [ $tstsC -eq 0 ]
   186 if [ $tstsC -eq 0 ]