testing3/knight2_test.sh
changeset 295 3f34da7a3094
parent 266 ca48ac1d3c3e
equal deleted inserted replaced
294:7a945c3b86c7 295:3f34da7a3094
     6 
     6 
     7 out=${1:-output}
     7 out=${1:-output}
     8 
     8 
     9 echo "" > $out
     9 echo "" > $out
    10 
    10 
    11 echo -e "Below is the feedback for your submission of CW 8, Advanced Part 2." >> $out
    11 echo -e "Below is the feedback for your submission of CW 8, Core Part." >> $out
    12 echo -e "" >> $out
    12 echo -e "" >> $out
    13 
    13 
    14 
    14 
    15 
    15 
    16 # compilation tests
    16 # compilation tests
    19   (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala "$1" 2>> $out 1>> $out) 
    19   (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala "$1" 2>> $out 1>> $out) 
    20 }
    20 }
    21 
    21 
    22 # functional tests
    22 # functional tests
    23 
    23 
    24 
    24 function scala_assert_slow {
    25 function scala_assert {
    25   (ulimit -t 120; JAVA_OPTS="-Xmx1g" scala -i "$1" "-- $2" 2> /dev/null 1> /dev/null)
    26   (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" "$2" -e "" 2> /dev/null 1> /dev/null)
       
    27 }
    26 }
    28 
    27 
       
    28 function scala_assert_thirty {
       
    29   (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" 2> /dev/null 1> /dev/null)
       
    30 }
       
    31 
       
    32 function scala_assert_quick {
       
    33   (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2"  2> /dev/null 1> /dev/null)
       
    34 }
    29 
    35 
    30 
    36 
    31 # purity test
    37 # purity test
    32 
    38 
    33 function scala_vars {
    39 function scala_vars {
    34    (egrep '\bvar\b|\breturn\b|\.par|ListBuffer|mutable|new Array' "$1" 2> /dev/null 1> /dev/null)
    40    (egrep '\bvar\b|\breturn\b|\.par|ListBuffer|mutable|new Array' "$1" 2> /dev/null 1> /dev/null)
    35 }
    41 }
       
    42 
       
    43 
       
    44 
       
    45 
       
    46 
       
    47 
    36 
    48 
    37 
    49 
    38 # knights2: purity test
    50 # knights2: purity test
    39 #
    51 #
    40 echo -e "knight2.scala does not contain vars, returns, Arrays, ListBuffers etc?" >> $out
    52 echo -e "knight2.scala does not contain vars, returns, Arrays, ListBuffers etc?" >> $out