main_testing1/drumb_test.sh
author Christian Urban <christian.urban@kcl.ac.uk>
Wed, 09 Nov 2022 20:51:29 +0000
changeset 440 f3bfc496d6ca
parent 420 4edc1a308652
child 459 d59404a41d5f
permissions -rwxr-xr-x
updated jars
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
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
function scala_vars {
376
6cc36d0ef79e updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 352
diff changeset
    28
   (egrep '\bvar\b|\breturn\b|\.par\.|\.par |ListBuffer|AtomicInteger|mutable|util.control|new Array' c$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
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    34
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    35
# compilation test
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    36
echo -e "drumb.scala runs?" >> $out
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    37
420
4edc1a308652 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 376
diff changeset
    38
if (scala_compile $scalafile)
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    39
then
352
97bcf8efe4e0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 347
diff changeset
    40
    echo -e "  --> passed" >> $out
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    41
    tsts=$(( 0 ))
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    42
else
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    43
    echo -e "  --> SCALA DID NOT RUN drumb.scala" >> $out
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    44
    tsts=$(( 1 )) 
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    45
fi
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    46
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    47
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    48
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
# var, .par return, ListBuffer test
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
#
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    52
if [ $tsts -eq 0 ]
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
then
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    54
    echo -e "drumb.scala does not contain vars, returns etc?" >> $out
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
420
4edc1a308652 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 376
diff changeset
    56
    if (scala_vars $scalafile)
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    57
    then
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    58
	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
    59
	tsts=$(( 1 ))
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    60
    else
352
97bcf8efe4e0 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 347
diff changeset
    61
	echo -e "  --> passed" >> $out
347
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    62
	tsts=$(( 0 )) 
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    63
    fi
4de31fdc0d67 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 320
diff changeset
    64
fi    
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
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
### get january data
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68
199
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    69
if [ $tsts -eq 0 ]
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    70
then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    71
  echo -e "  get_january_data(\"GOOG\", 1980) == List()" >> $out
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    72
  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
    73
420
4edc1a308652 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 376
diff changeset
    74
  if (scala_assert $scalafile "drumb_test1.scala")
199
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    75
  then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    76
    echo -e "  --> success" >> $out
199
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    77
  else
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    78
    echo -e "  --> ONE OF THE TESTS FAILED\n" >> $out
199
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    79
  fi
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    80
fi
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
### get first price
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    83
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    84
if [ $tsts -eq 0 ]
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    85
then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    86
  echo -e "  get_first_price(\"GOOG\", 1980) == None" >> $out
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    87
  echo -e "  get_first_price(\"GOOG\", 2010) == Some(312.204773)" >> $out  
199
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    88
420
4edc1a308652 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 376
diff changeset
    89
  if (scala_assert $scalafile "drumb_test2.scala")
199
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    90
  then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    91
    echo -e "  --> success" >> $out
199
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    92
  else
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    93
    echo -e "  --> ONE OF THE TESTS FAILED\n" >> $out
199
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    94
  fi
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    95
fi
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    96
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    97
### get prices tests
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    98
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    99
if [ $tsts -eq 0 ]
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   100
then
314
21b52310bd8b updated
Christian Urban <urbanc@in.tum.de>
parents: 304
diff changeset
   101
  echo "  get_prices(List(\"GOOG\", \"AAPL\"), 2010 to 2012) ==" >> $out
21b52310bd8b updated
Christian Urban <urbanc@in.tum.de>
parents: 304
diff changeset
   102
  echo "       List(List(Some(312.204773), Some(26.782711))," >> $out
21b52310bd8b updated
Christian Urban <urbanc@in.tum.de>
parents: 304
diff changeset
   103
  echo "            List(Some(301.0466),   Some(41.244694))," >> $out
21b52310bd8b updated
Christian Urban <urbanc@in.tum.de>
parents: 304
diff changeset
   104
  echo "            List(Some(331.462585), Some(51.464207)))" >> $out
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   105
420
4edc1a308652 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 376
diff changeset
   106
  if (scala_assert $scalafile "drumb_test3.scala")
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   107
  then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   108
    echo -e "  --> success" >> $out
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   109
  else
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   110
    echo -e "  --> ONE OF THE TESTS FAILED\n" >> $out
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   111
  fi
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   112
fi
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   113
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   114
### get_delta_test
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   115
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   116
if [ $tsts -eq 0 ]
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   117
then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   118
  echo -e "  get_delta(None, None) == None" >> $out
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   119
  echo -e "  get_delta(Some(50.0), None) == None" >> $out
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   120
  echo -e "  get_delta(None, Some(100.0)) == None" >> $out
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   121
  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
   122
420
4edc1a308652 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 376
diff changeset
   123
  if (scala_assert $scalafile "drumb_test4.scala")
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   124
  then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   125
      echo -e "  --> success" >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   126
  else
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   127
      echo -e "  --> ONE OF THE TESTS FAILED\n" >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   128
  fi
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   129
fi
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   130
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   131
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   132
### get_deltas_test
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   133
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   134
if [ $tsts -eq 0 ]
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   135
then
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   136
  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
   137
  echo -e "    List(List(Some(-0.03573991804411003), Some(0.539974575389325)), " >> $out
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   138
  echo -e "         List(Some(0.10103414222249969), Some(0.24777764141006836)))" >> $out
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   139
  echo -e "" >> $out
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   140
  echo -e "  get_deltas(get_prices(List(\"BIDU\"), 2004 to 2008)) == " >> $out
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   141
  echo -e "    List(List(None), List(None),                          " >> $out
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 281
diff changeset
   142
  echo -e "         List(Some(0.9277165354330709)), List(Some(2.119679764725104))) " >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   143
  
420
4edc1a308652 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 376
diff changeset
   144
  if (scala_assert $scalafile "drumb_test5.scala") 
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   145
  then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   146
     echo -e "  --> success" >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   147
  else
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   148
     echo -e "  --> ONE OF THE TESTS FAILED\n" >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   149
  fi
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   150
fi
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   151
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   152
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   153
### yield_tests
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   154
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   155
if [ $tsts -eq 0 ]
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   156
then
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   157
  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
   158
  echo -e "  yearly_yield(ds, 100, 0) == 125" >> $out
cdfb2ce30a3d updated
Christian Urban <urbanc@in.tum.de>
parents: 314
diff changeset
   159
  echo -e "  yearly_yield(ds, 100, 1) == 117" >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   160
  
420
4edc1a308652 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 376
diff changeset
   161
  if (scala_assert $scalafile "drumb_test6.scala") 
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   162
  then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   163
      echo -e "  --> success" >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   164
  else
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   165
      echo -e "  --> ONE OF THE TESTS FAILED\n" >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   166
  fi
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   167
fi
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   168
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   169
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   170
### investment_test
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   171
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   172
if [ $tsts -eq 0 ]
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   173
then
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   174
  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
   175
  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
   176
  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
   177
  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
   178
  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
   179
  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
   180
  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
   181
  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
   182
  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
   183
  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
   184
  
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   185
  
420
4edc1a308652 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 376
diff changeset
   186
  if (scala_assert $scalafile "drumb_test7.scala") 
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   187
  then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   188
    echo -e "  --> success" >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   189
  else
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   190
    echo -e "  --> ONE OF THE TESTS FAILED\n" >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   191
  fi
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   192
fi
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   193