marking2/danube_test.sh
changeset 331 e3878cdd38bc
parent 284 9a04eb6a2291
child 332 703c7e42bf46
equal deleted inserted replaced
330:c3d3461a5e77 331:e3878cdd38bc
     5 
     5 
     6 
     6 
     7 out=${1:-output}
     7 out=${1:-output}
     8 
     8 
     9 
     9 
    10 
    10 echo -e `date` >> $out
    11 echo -e  "" > $out
    11 echo -e  "" > $out
    12 
       
    13 echo -e  "Below is the feedback and provisional marks for your submission" >> $out
    12 echo -e  "Below is the feedback and provisional marks for your submission" >> $out
    14 echo -e  "for core assignment 7.  Please note all marks are provisional until" >> $out
    13 echo -e  "for core assignment 7.  Please note all marks are provisional until" >> $out
    15 echo -e  "ratified by the assessment board -- this is not an official" >> $out
    14 echo -e  "ratified by the assessment board -- this is not an official" >> $out
    16 echo -e  "results transcript." >> $out
    15 echo -e  "results transcript." >> $out
    17 echo -e  "" >> $out
    16 echo -e  "" >> $out
    18 
    17 
       
    18 # marks for core CW7
       
    19 marks=$(( 0 ))
       
    20 
       
    21 echo -e "" >> $out
    19 echo -e  "Below is the feedback for your submission danube.scala" >> $out
    22 echo -e  "Below is the feedback for your submission danube.scala" >> $out
    20 echo -e  "" >> $out
    23 echo -e  "" >> $out
    21 
    24 
    22 # marks for core CW7
    25 
    23 marks=$(( 0 ))
       
    24 
    26 
    25 
    27 
    26 # compilation tests
    28 # compilation tests
    27 
    29 
    28 function scala_compile {
    30 function scala_compile {
    36 }
    38 }
    37 
    39 
    38 # purity test
    40 # purity test
    39 
    41 
    40 function scala_vars {
    42 function scala_vars {
    41    (egrep '\bvar\b|\breturn\b|ListBuffer|mutable' "$1" 2> /dev/null 1> /dev/null)
    43    (egrep '\bvar\b|\breturn\b|\.par|ListBuffer|mutable|new Array' "$1" 2> /dev/null 1> /dev/null)
    42 }
    44 }
    43 
    45 
    44 
    46 
    45 # var, .par return, ListBuffer test
    47 # var, .par return, ListBuffer test
    46 #
    48 #
    47 echo -e  "danube.scala does not contain vars, returns etc?" | tee -a $out
    49 echo -e  "danube.scala does not contain vars, returns,  Arrays, ListBuffers etc?" | tee -a $out
    48 
    50 
    49 if (scala_vars danube.scala)
    51 if (scala_vars danube.scala)
    50 then
    52 then
    51   echo -e  "  --> test failed" | tee -a $out
    53   echo -e  "  --> TEST FAILED\n" | tee -a $out
    52   tsts0=$(( 1 ))  
    54   tsts0=$(( 1 ))  
    53 else
    55 else
    54   echo -e  "  --> success" | tee -a $out
    56   echo -e  "  --> success" | tee -a $out
    55   tsts0=$(( 0 )) 
    57   tsts0=$(( 0 )) 
    56 fi
    58 fi
    85   if (scala_assert "danube.scala" "danube_test1.scala")
    87   if (scala_assert "danube.scala" "danube_test1.scala")
    86   then
    88   then
    87       echo -e  "  --> success" | tee -a $out
    89       echo -e  "  --> success" | tee -a $out
    88       marks=$(( marks + 1 ))
    90       marks=$(( marks + 1 ))
    89   else
    91   else
    90     echo -e  "  --> ONE OF THE TESTS FAILED\n" | tee -a $out
    92       echo -e  "  --> ONE OF THE TESTS FAILED\n" | tee -a $out
    91   fi
    93   fi
    92 fi
    94 fi
    93 
    95 
    94 ### danube processing tests
    96 ### danube processing tests
    95 
    97 
   104   if (scala_assert "danube.scala" "danube_test2.scala") 
   106   if (scala_assert "danube.scala" "danube_test2.scala") 
   105   then
   107   then
   106       echo -e  "  --> success" | tee -a $out
   108       echo -e  "  --> success" | tee -a $out
   107       marks=$(( marks + 1 ))
   109       marks=$(( marks + 1 ))
   108   else
   110   else
   109     echo -e  "  --> ONE OF THE TESTS FAILED\n" | tee -a $out
   111       echo -e  "  --> ONE OF THE TESTS FAILED\n" | tee -a $out
   110   fi
   112   fi
   111 fi
   113 fi
   112 
   114 
   113 ### danube groupById test
   115 ### danube groupById test
   114 
   116 
   191 fi
   193 fi
   192 
   194 
   193 
   195 
   194 
   196 
   195 ## final marks
   197 ## final marks
       
   198 echo -e "" >> $out
   196 echo -e  "Overall mark for CW 7 Core Part" | tee -a $out
   199 echo -e  "Overall mark for CW 7 Core Part" | tee -a $out
   197 echo -e  "$marks" | tee -a $out
   200 echo -e  "$marks" | tee -a $out
   198 
   201 
   199 
   202