marking/mark02
changeset 85 fd3f8581ce85
parent 84 8b132f8de8c7
child 86 f8a781322499
equal deleted inserted replaced
84:8b132f8de8c7 85:fd3f8581ce85
    17 
    17 
    18 
    18 
    19 # compilation tests
    19 # compilation tests
    20 
    20 
    21 function scala_compile {
    21 function scala_compile {
    22   (scala -nc "$1" 2> /dev/null 1> /dev/null) 
    22   (scala "$1" 2> /dev/null 1> /dev/null) 
    23 }
    23 }
    24 
    24 
    25 
    25 
    26 # functional tests
    26 # functional tests
    27 
    27 
    37 echo "knight1.scala contains any vars, returns etc?" | tee -a $out
    37 echo "knight1.scala contains any vars, returns etc?" | tee -a $out
    38 
    38 
    39 if (scala_vars knight1.scala)
    39 if (scala_vars knight1.scala)
    40 then
    40 then
    41   echo "  --> fail" | tee -a $out
    41   echo "  --> fail" | tee -a $out
    42   tsts0=$(( 0 ))
    42   tsts0=$(( 1 ))
    43 else
    43 else
    44   echo "  --> success" | tee -a $out
    44   echo "  --> success" | tee -a $out
    45   tsts0=$(( 1 )) 
    45   tsts0=$(( 0 )) 
    46 fi
    46 fi
    47 
    47 
    48 
    48 
    49 # compilation test
    49 # compilation test
    50 #if  [ $tsts0 -eq 0 ]
    50 if  [ $tsts0 -eq 0 ]
    51 #then    
    51 then    
    52 #  echo "knight1.scala runs?" | tee -a $out
    52   echo "knight1.scala runs?" | tee -a $out
    53 #
       
    54 #  if (scala_compile knight1.scala)
       
    55 #  then
       
    56 #    echo "  --> success" | tee -a $out
       
    57 #    tsts1=$(( 0 ))
       
    58 #  else
       
    59 #    echo "  --> scala did not run knight1.scala" | tee -a $out
       
    60 #    tsts1=$(( 1 )) 
       
    61 #  fi
       
    62 #fi
       
    63 
    53 
    64 ### knight1 test
    54   if (scala_compile knight1.scala.bak)
       
    55   then
       
    56     echo "  --> success" | tee -a $out
       
    57     tsts1=$(( 0 ))
       
    58   else
       
    59     echo "  --> scala did not run knight1.scala" | tee -a $out
       
    60     tsts1=$(( 1 )) 
       
    61   fi
       
    62 fi
    65 
    63 
    66 #if [ $tsts1 -eq 0 ]
    64 ### knight1a test
    67 #then
    65 
    68 #  echo "  get_prices(List(\"BIDU\"), 2004 to 2008) =" | tee -a $out
    66 if [ $tsts1 -eq 0 ]
    69 #  echo "  List(List(None), List(None), List(Some(6.35))," | tee -a $out
    67 then
    70 #  echo "       List(Some(12.241)), List(Some(38.188)))" | tee -a $out
    68   echo " legal_moves(8, Nil, (2,2)) = (3,4), (4,3), (4,1), (3,0), (1,0), (0,1), (0,3), (1,4)" | tee -a $out
    71 #
    69   echo " legal_moves(8, Nil, (7,7)) = (6,5), (5,6)" | tee -a $out
    72 #  if (scala_assert "drumb.scala" "../drumb_test1.scala")
    70   echo " legal_moves(8, (4,1), (1,0), (2,2)) = (3,4), (4,3), (3,0), (0,1), (0,3), (1,4)" | tee -a $out
    73 #  then
    71   echo " legal_moves(8, (6,6), (7,7)) = (6,5), (5,6)" | tee -a $out
    74 #    echo "  --> success" | tee -a $out
    72   echo " legal_moves(1, Nil, (0,0)) = Nil" | tee -a $out
    75 #    marks=$(( marks + 1 ))
    73   echo " legal_moves(2, Nil, (0,0)) = Nil" | tee -a $out
    76 #  else
    74   echo " legal_moves(3, Nil, (0,0)) = (1,2), (2,1)" | tee -a $out
    77 #    echo "  --> test failed" | tee -a $out
    75   
    78 #  fi
    76   if (scala_assert "knight1.scala" "../../../marking/knight1_test.scala")
    79 #fi
    77   then
       
    78     echo "  --> success" | tee -a $out
       
    79     marks=$(( marks + 1 ))
       
    80   else
       
    81     echo "  --> test failed" | tee -a $out
       
    82   fi
       
    83 fi
    80 
    84 
    81 ### knight2 test
    85 ### knight2 test
    82 
    86 
    83 #if [ $tsts -eq 0 ]
    87 #if [ $tsts -eq 0 ]
    84 #then
    88 #then
    85 #  echo "  get_deltas(get_prices(List(\"IBM\", \"BIDU\"), 2004 to 2008)) = " | tee -a $out
    89 #  echo "  legal_moves(8, Nil, (2,2) = (3,4), (4,3), (4,1), (3,0), (1,0), (0,1), (0,3), (1,4)" | tee -a $out
    86 #  echo "  List(List(Some(0.07596697626574789), None), " | tee -a $out
    90 #  echo "  List(List(Some(0.07596697626574789), None), " | tee -a $out
    87 #  echo "       List(Some(-0.152620823795232), None)," | tee -a $out
    91 #  echo "       List(Some(-0.152620823795232), None)," | tee -a $out
    88 #  echo "       List(Some(0.20126676681483952), Some(0.9277165354330709))," | tee -a $out
    92 #  echo "       List(Some(0.20126676681483952), Some(0.9277165354330709))," | tee -a $out
    89 #  echo "       List(Some(0.09141762603007778), Some(2.119679764725104)))" | tee -a $out
    93 #  echo "       List(Some(0.09141762603007778), Some(2.119679764725104)))" | tee -a $out
    90 #  
    94 #