main_testing1/drumb_test.sh
author Christian Urban <christian.urban@kcl.ac.uk>
Thu, 02 Nov 2023 13:53:37 +0000
changeset 474 b528d1d3d3c3
parent 459 d59404a41d5f
permissions -rwxr-xr-x
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
#!/bin/bash
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
     2
set -euo pipefail
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
420
4edc1a308652 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 376
diff changeset
     4
scalafile=${1:-drumb.scala}
4edc1a308652 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 376
diff changeset
     5
out=${2:-output}
4edc1a308652 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 376
diff changeset
     6
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
     8
echo -e "" > $out
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    10
echo -e "Below is the feedback for your submission for drumb.scala" >> $out
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    11
echo -e "" >> $out
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
# compilation tests
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
function scala_compile {
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    16
  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -Xprint:parser "$1" 2> c$out 1> c$out)
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
}
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
# functional tests
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
function scala_assert {
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
    22
  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" -e "" 2> /dev/null 1> /dev/null)
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
}
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
# purity test
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
function scala_vars {
459
d59404a41d5f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 420
diff changeset
    27
   (sed 's/immutable/ok/g' c$out > cb$out;
d59404a41d5f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 420
diff changeset
    28
    egrep '\bvar\b|\breturn\b|\.par\.|\.par |ListBuffer|AtomicInteger|mutable|util.control|new Array' cb$out 2> /dev/null 1> /dev/null)
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
}
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    32
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    33
# compilation test
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    34
echo -e "drumb.scala runs?" >> $out
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    35
420
4edc1a308652 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 376
diff changeset
    36
if (scala_compile $scalafile)
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    37
then
352
97bcf8efe4e0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 347
diff changeset
    38
    echo -e "  --> passed" >> $out
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    39
    tsts=$(( 0 ))
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    40
else
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    41
    echo -e "  --> SCALA DID NOT RUN drumb.scala" >> $out
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    42
    tsts=$(( 1 )) 
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    43
fi
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    44
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    45
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    46
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
# var, .par return, ListBuffer test
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
#
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    50
if [ $tsts -eq 0 ]
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
then
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    52
    echo -e "drumb.scala does not contain vars, returns etc?" >> $out
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
420
4edc1a308652 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 376
diff changeset
    54
    if (scala_vars $scalafile)
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    55
    then
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    56
	echo -e "  --> FAIL (make triple-sure your program conforms to the required format)" >> $out
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    57
	tsts=$(( 1 ))
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    58
    else
352
97bcf8efe4e0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 347
diff changeset
    59
	echo -e "  --> passed" >> $out
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    60
	tsts=$(( 0 )) 
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    61
    fi
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    62
fi    
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
199
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    65
### get january data
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
199
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    67
if [ $tsts -eq 0 ]
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    68
then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    69
  echo -e "  get_january_data(\"GOOG\", 1980) == List()" >> $out
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    70
  echo -e "  get_january_data(\"GOOG\", 2010).head == \"2010-01-04,312.204773\"" >> $out
199
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    71
420
4edc1a308652 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 376
diff changeset
    72
  if (scala_assert $scalafile "drumb_test1.scala")
199
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    73
  then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    74
    echo -e "  --> success" >> $out
199
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    75
  else
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    76
    echo -e "  --> ONE OF THE TESTS FAILED\n" >> $out
199
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    77
  fi
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    78
fi
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    79
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    80
### get first price
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    81
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    82
if [ $tsts -eq 0 ]
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    83
then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    84
  echo -e "  get_first_price(\"GOOG\", 1980) == None" >> $out
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    85
  echo -e "  get_first_price(\"GOOG\", 2010) == Some(312.204773)" >> $out  
199
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    86
420
4edc1a308652 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 376
diff changeset
    87
  if (scala_assert $scalafile "drumb_test2.scala")
199
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    88
  then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    89
    echo -e "  --> success" >> $out
199
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    90
  else
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    91
    echo -e "  --> ONE OF THE TESTS FAILED\n" >> $out
199
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    92
  fi
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    93
fi
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    94
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    95
### get prices tests
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    96
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    97
if [ $tsts -eq 0 ]
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    98
then
314
21b52310bd8b updated
Christian Urban <urbanc@in.tum.de>
parents: 304
diff changeset
    99
  echo "  get_prices(List(\"GOOG\", \"AAPL\"), 2010 to 2012) ==" >> $out
21b52310bd8b updated
Christian Urban <urbanc@in.tum.de>
parents: 304
diff changeset
   100
  echo "       List(List(Some(312.204773), Some(26.782711))," >> $out
21b52310bd8b updated
Christian Urban <urbanc@in.tum.de>
parents: 304
diff changeset
   101
  echo "            List(Some(301.0466),   Some(41.244694))," >> $out
21b52310bd8b updated
Christian Urban <urbanc@in.tum.de>
parents: 304
diff changeset
   102
  echo "            List(Some(331.462585), Some(51.464207)))" >> $out
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
420
4edc1a308652 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 376
diff changeset
   104
  if (scala_assert $scalafile "drumb_test3.scala")
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   105
  then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   106
    echo -e "  --> success" >> $out
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   107
  else
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   108
    echo -e "  --> ONE OF THE TESTS FAILED\n" >> $out
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   109
  fi
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   110
fi
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   111
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   112
### get_delta_test
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   113
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   114
if [ $tsts -eq 0 ]
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   115
then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   116
  echo -e "  get_delta(None, None) == None" >> $out
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   117
  echo -e "  get_delta(Some(50.0), None) == None" >> $out
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   118
  echo -e "  get_delta(None, Some(100.0)) == None" >> $out
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   119
  echo -e "  get_delta(Some(50.0), Some(100.0)) == Some(1.0)" >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   120
420
4edc1a308652 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 376
diff changeset
   121
  if (scala_assert $scalafile "drumb_test4.scala")
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   122
  then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   123
      echo -e "  --> success" >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   124
  else
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   125
      echo -e "  --> ONE OF THE TESTS FAILED\n" >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   126
  fi
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   127
fi
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   128
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   129
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   130
### get_deltas_test
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   131
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   132
if [ $tsts -eq 0 ]
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   133
then
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   134
  echo -e "  get_deltas(get_prices(List(\"GOOG\", \"AAPL\"), 2010 to 2012)) == " >> $out
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   135
  echo -e "    List(List(Some(-0.03573991804411003), Some(0.539974575389325)), " >> $out
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   136
  echo -e "         List(Some(0.10103414222249969), Some(0.24777764141006836)))" >> $out
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   137
  echo -e "" >> $out
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   138
  echo -e "  get_deltas(get_prices(List(\"BIDU\"), 2004 to 2008)) == " >> $out
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   139
  echo -e "    List(List(None), List(None),                          " >> $out
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 281
diff changeset
   140
  echo -e "         List(Some(0.9277165354330709)), List(Some(2.119679764725104))) " >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   141
  
420
4edc1a308652 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 376
diff changeset
   142
  if (scala_assert $scalafile "drumb_test5.scala") 
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   143
  then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   144
     echo -e "  --> success" >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   145
  else
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   146
     echo -e "  --> ONE OF THE TESTS FAILED\n" >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   147
  fi
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   148
fi
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   149
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   150
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   151
### yield_tests
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   152
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   153
if [ $tsts -eq 0 ]
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   154
then
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   155
  echo -e "  val ds = get_deltas(get_prices(List(\"GOOG\", \"AAPL\"), 2010 to 2012))" >> $out
320
cdfb2ce30a3d updated
Christian Urban <urbanc@in.tum.de>
parents: 314
diff changeset
   156
  echo -e "  yearly_yield(ds, 100, 0) == 125" >> $out
cdfb2ce30a3d updated
Christian Urban <urbanc@in.tum.de>
parents: 314
diff changeset
   157
  echo -e "  yearly_yield(ds, 100, 1) == 117" >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   158
  
420
4edc1a308652 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 376
diff changeset
   159
  if (scala_assert $scalafile "drumb_test6.scala") 
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   160
  then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   161
      echo -e "  --> success" >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   162
  else
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   163
      echo -e "  --> ONE OF THE TESTS FAILED\n" >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   164
  fi
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   165
fi
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   166
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   167
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   168
### investment_test
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   169
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   170
if [ $tsts -eq 0 ]
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   171
then
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   172
  echo -e "  All results need to be in the range of -/+ 1% of the given values."   >> $out
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   173
  echo -e "   investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2000, 100) == 100"   >> $out
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   174
  echo -e "   investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2001, 100) == 27 "   >> $out
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   175
  echo -e "   investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2002, 100) == 42 "   >> $out
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   176
  echo -e "   investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2003, 100) == 27 "   >> $out
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   177
  echo -e "   investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2004, 100) == 38 "   >> $out
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   178
  echo -e "   investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2005, 100) == 113"   >> $out
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   179
  echo -e "   investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2006, 100) == 254"   >> $out
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   180
  echo -e "   investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2007, 100) == 349"   >> $out
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   181
  echo -e "   investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 1990 to 2017, 100) == 11504"   >> $out
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   182
  
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   183
  
420
4edc1a308652 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 376
diff changeset
   184
  if (scala_assert $scalafile "drumb_test7.scala") 
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   185
  then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   186
    echo -e "  --> success" >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   187
  else
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   188
    echo -e "  --> ONE OF THE TESTS FAILED\n" >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   189
  fi
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   190
fi
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   191