main_marking1/drumb_test.sh
author Christian Urban <christian.urban@kcl.ac.uk>
Fri, 22 Jan 2021 10:37:55 +0000
changeset 388 ed63dca8068a
child 424 daf561a83ba6
permissions -rwxr-xr-x
update
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
388
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     1
#!/bin/bash
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     2
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     3
# to make the script fail safely
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     4
set -euo pipefail
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     5
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     6
out=${1:-output}
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     7
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     8
echo "" > $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     9
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    10
echo -e `date` >> $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    11
echo -e "" >> $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    12
echo -e "Below is the feedback and provisional marks for your submission" >> $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    13
echo -e "of the Main Part 1 (Scala).  Please note all marks are provisional until" >> $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    14
echo -e "ratified by the assessment board -- this is not an official" >> $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    15
echo -e "results transcript." >> $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    16
echo -e "" >> $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    17
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    18
# marks for CW6 main part 
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    19
marks=$(( 0 ))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    20
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    21
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    22
echo -e "" >> $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    23
echo -e "Below is the feedback for your submission drumb.scala" >> $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    24
echo -e "" >> $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    25
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    26
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    27
# compilation tests
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    28
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    29
function scala_compile {
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    30
  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -Xprint:parser "$1" 2> c$out 1> c$out)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    31
}
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    32
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    33
# functional tests
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    34
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    35
function scala_assert {
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    36
  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" -e "" 2> /dev/null 1> /dev/null)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    37
}
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    38
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    39
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    40
# purity test
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    41
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    42
function scala_vars {
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    43
   (egrep '\bvar\b|\breturn\b|\.par\.|\.par |ListBuffer|AtomicInteger|mutable|util.control|new Array' c$out 2> /dev/null 1> /dev/null)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    44
}
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    45
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    46
# compilation test
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    47
echo -e "drumb.scala runs?" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    48
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    49
if (scala_compile drumb.scala)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    50
then
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    51
    echo -e "  --> success" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    52
    tsts=$(( 0 ))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    53
else
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    54
    echo -e "  --> SCALA DID NOT RUN drumb.scala\n" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    55
    tsts=$(( 1 )) 
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    56
fi
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    57
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    58
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    59
# var, .par return, ListBuffer test
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    60
#
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    61
if  [ $tsts -eq 0 ]
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    62
then  
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    63
    echo -e "drumb.scala does not contain VARS, RETURNS etc?" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    64
    
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    65
    if (scala_vars drumb.scala)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    66
    then
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    67
	echo -e "  --> TEST FAILED\n" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    68
	tsts=$(( 1 ))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    69
    else
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    70
	echo -e "  --> success" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    71
	tsts=$(( 0 )) 
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    72
    fi
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    73
else
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    74
  tsts=$(( 1 ))  
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    75
fi     
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    76
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    77
echo >> $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    78
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    79
sleep 15
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    80
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    81
### get january tests
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    82
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    83
if [ $tsts -eq 0 ]
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    84
then
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    85
  echo -e "  get_january_data(\"GOOG\", 1980) == List()" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    86
  echo -e "  get_january_data(\"GOOG\", 2010).head == \"2010-01-04,312.204773\"" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    87
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    88
  if (scala_assert "drumb.scala" "drumb_test1.scala")
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    89
  then
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    90
      echo -e "  --> success" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    91
      marks=$(( marks + 1 ))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    92
  else
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    93
      echo -e "  --> TEST FAILED\n" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    94
  fi
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    95
fi
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    96
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    97
### get first price tests
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    98
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    99
if [ $tsts -eq 0 ]
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   100
then
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   101
  echo -e "  get_first_price(\"GOOG\", 1980) == None" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   102
  echo -e "  get_first_price(\"GOOG\", 2010) == Some(312.204773)" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   103
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   104
  if (scala_assert "drumb.scala" "drumb_test2.scala")
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   105
  then
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   106
      echo -e "  --> success" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   107
      marks=$(( marks + 1 ))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   108
  else
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   109
      echo -e "  --> TEST FAILED\n" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   110
  fi
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   111
fi
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   112
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   113
### get prices tests
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   114
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   115
if [ $tsts -eq 0 ]
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   116
then
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   117
  echo -e "  get_prices(List(\"BIDU\"), 2004 to 2008) ==" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   118
  echo -e "       List(List(None), List(None), List(Some(6.35)), " | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   119
  echo -e "            List(Some(12.241)), List(Some(38.188)))" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   120
  echo -e " " | tee -a $out  
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   121
  echo -e "  get_prices(List(\"GOOG\", \"AAPL\"), 2010 to 2012) ==" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   122
  echo -e "       List(List(Some(312.204773), Some(26.782711))," | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   123
  echo -e "            List(Some(301.0466),   Some(41.244694))," | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   124
  echo -e "            List(Some(331.462585), Some(51.464207)))" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   125
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   126
  if (scala_assert "drumb.scala" "drumb_test3.scala")
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   127
  then
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   128
      echo -e "  --> success" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   129
      marks=$(( marks + 1 ))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   130
  else
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   131
      echo -e "  --> TEST FAILED\n" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   132
  fi
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   133
fi
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   134
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   135
### get_delta test
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   136
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   137
if [ $tsts -eq 0 ]
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   138
then
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   139
  echo -e "  get_delta(None, None) == None" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   140
  echo -e "  get_delta(Some(50.0), None) == None" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   141
  echo -e "  get_delta(None, Some(100.0)) == None" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   142
  echo -e "  get_delta(Some(50.0), Some(100.0)) == Some(1.0)" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   143
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   144
  if (scala_assert "drumb.scala" "drumb_test4.scala")
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   145
  then
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   146
      echo -e "  --> success" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   147
      marks=$(( marks + 1 ))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   148
  else
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   149
      echo -e "  --> TEST FAILED\n" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   150
  fi
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   151
fi
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   152
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   153
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   154
### get_deltas_test
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   155
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   156
if [ $tsts -eq 0 ]
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   157
then
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   158
  echo -e "  get_deltas(get_prices(List(\"GOOG\", \"AAPL\"), 2010 to 2012)) == " | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   159
  echo -e "    List(List(Some(-0.03573991804411003), Some(0.539974575389325)), " | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   160
  echo -e "         List(Some(0.10103414222249969), Some(0.24777764141006836)))" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   161
  echo -e "" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   162
  echo -e "  get_deltas(get_prices(List(\"BIDU\"), 2004 to 2008)) == " | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   163
  echo -e "    List(List(None), List(None),                          " | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   164
  echo -e "         List(Some(0.9277165354330709)), List(Some(2.119679764725104)))" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   165
  
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   166
  if (scala_assert "drumb.scala" "drumb_test5.scala") 
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   167
  then
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   168
     echo -e "  --> success" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   169
     marks=$(( marks + 1 ))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   170
  else
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   171
     echo -e "  --> TEST FAILED\n" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   172
  fi
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   173
fi
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   174
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   175
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   176
### yield_tests
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   177
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   178
if [ $tsts -eq 0 ]
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   179
then
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   180
  echo -e "  val ds = get_deltas(get_prices(List(\"GOOG\", \"AAPL\"), 2010 to 2012))" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   181
  echo -e "  yearly_yield(ds, 100, 0) == 125" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   182
  echo -e "  yearly_yield(ds, 100, 1) == 117" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   183
  
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   184
  if (scala_assert "drumb.scala" "drumb_test6.scala") 
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   185
  then
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   186
      echo -e "  --> success" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   187
      marks=$(( marks + 1 ))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   188
  else
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   189
      echo -e "  --> TEST FAILED\n" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   190
  fi
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   191
fi
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   192
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   193
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   194
### investment_test
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   195
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   196
if [ $tsts -eq 0 ]
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   197
then
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   198
  echo -e "  All results need to be in the range of -/+ 1% of the given values."   | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   199
  echo -e "   investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2000, 100) == 100"   | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   200
  echo -e "   investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2001, 100) == 27 "   | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   201
  echo -e "   investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2002, 100) == 42 "   | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   202
  echo -e "   investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2003, 100) == 27 "   | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   203
  echo -e "   investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2004, 100) == 38 "   | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   204
  echo -e "   investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2005, 100) == 113"   | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   205
  echo -e "   investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2006, 100) == 254"   | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   206
  echo -e "   investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2007, 100) == 349"   | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   207
  echo -e "   investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 1990 to 2017, 100) == 11504"   | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   208
  
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   209
  
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   210
  if (scala_assert "drumb.scala" "drumb_test7.scala") 
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   211
  then
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   212
    echo -e "  --> success" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   213
    marks=$(( marks + 1 ))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   214
  else
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   215
    echo -e "  --> TEST FAILED\n" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   216
  fi
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   217
fi
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   218
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   219
## final marks
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   220
echo -e "" >> $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   221
echo -e "Overall mark for Main Part 1 (Scala)" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   222
echo -e "$marks" | tee -a $out
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   223
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   224
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
   225
sleep 10