testing1/drumb_test.sh
author Christian Urban <urbanc@in.tum.de>
Fri, 22 Nov 2019 17:01:55 +0000
changeset 324 2969ee4a6cee
parent 320 cdfb2ce30a3d
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
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
out=${1:-output}
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
     6
echo -e "" > $out
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 "Below is the feedback for your submission for drumb.scala" >> $out
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
     9
echo -e "" >> $out
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
# compilation tests
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
function scala_compile {
266
ca48ac1d3c3e updated to 2.13
Christian Urban <urbanc@in.tum.de>
parents: 261
diff changeset
    14
  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala "$1" 2>> $out 1>> $out) 
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
}
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
# functional tests
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
function scala_assert {
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
    20
  (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
    21
}
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
# purity test
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
function scala_vars {
248
1616d06a0893 updared
Christian Urban <urbanc@in.tum.de>
parents: 206
diff changeset
    26
   (egrep '\bvar\b|\breturn\b|\.par|ListBuffer|mutable|new Array' "$1" 2> /dev/null 1> /dev/null)
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
}
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
# var, .par return, ListBuffer test
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
#
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    32
echo -e "drumb.scala does not contain vars, returns etc?" >> $out
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
if (scala_vars drumb.scala)
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    36
  echo -e "  --> FAIL (make triple-sure your program conforms to the required format)" >> $out
199
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    37
  tsts0=$(( 0 ))
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
else
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    39
  echo -e "  --> success" >> $out
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
  tsts0=$(( 0 )) 
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
fi
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
# compilation test
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
if  [ $tsts0 -eq 0 ]
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
then 
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    47
  echo -e "drumb.scala runs?" >> $out
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
169
b37052895281 updated
Christian Urban <urbanc@in.tum.de>
parents: 160
diff changeset
    49
  if (scala_compile drumb.scala)
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
  then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    51
    echo -e "  --> success" >> $out
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
    tsts=$(( 0 ))
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
  else
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    54
    echo -e "  --> SCALA DID NOT RUN drumb.scala" >> $out
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
    tsts=$(( 1 )) 
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
  fi
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
else
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
  tsts=$(( 1 ))     
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
fi
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
199
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    61
### get january data
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
199
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    63
if [ $tsts -eq 0 ]
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    64
then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    65
  echo -e "  get_january_data(\"GOOG\", 1980) == List()" >> $out
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    66
  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
    67
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    68
  if (scala_assert "drumb.scala" "drumb_test1.scala")
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    69
  then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    70
    echo -e "  --> success" >> $out
199
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    71
  else
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    72
    echo -e "  --> ONE OF THE TESTS FAILED\n" >> $out
199
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    73
  fi
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    74
fi
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    75
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    76
### get first price
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    77
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    78
if [ $tsts -eq 0 ]
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    79
then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    80
  echo -e "  get_first_price(\"GOOG\", 1980) == None" >> $out
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    81
  echo -e "  get_first_price(\"GOOG\", 2010) == Some(312.204773)" >> $out  
199
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    82
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    83
  if (scala_assert "drumb.scala" "drumb_test2.scala")
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    84
  then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    85
    echo -e "  --> success" >> $out
199
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    86
  else
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
    87
    echo -e "  --> ONE OF THE TESTS FAILED\n" >> $out
199
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    88
  fi
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
    89
fi
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    90
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    91
### get prices tests
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    92
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    93
if [ $tsts -eq 0 ]
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    94
then
314
21b52310bd8b updated
Christian Urban <urbanc@in.tum.de>
parents: 304
diff changeset
    95
  echo "  get_prices(List(\"GOOG\", \"AAPL\"), 2010 to 2012) ==" >> $out
21b52310bd8b updated
Christian Urban <urbanc@in.tum.de>
parents: 304
diff changeset
    96
  echo "       List(List(Some(312.204773), Some(26.782711))," >> $out
21b52310bd8b updated
Christian Urban <urbanc@in.tum.de>
parents: 304
diff changeset
    97
  echo "            List(Some(301.0466),   Some(41.244694))," >> $out
21b52310bd8b updated
Christian Urban <urbanc@in.tum.de>
parents: 304
diff changeset
    98
  echo "            List(Some(331.462585), Some(51.464207)))" >> $out
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    99
199
54befaf23648 updated
Christian Urban <urbanc@in.tum.de>
parents: 169
diff changeset
   100
  if (scala_assert "drumb.scala" "drumb_test3.scala")
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   101
  then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   102
    echo -e "  --> success" >> $out
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
  else
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   104
    echo -e "  --> ONE OF THE TESTS FAILED\n" >> $out
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   105
  fi
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   106
fi
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   107
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   108
### get_delta_test
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   109
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   110
if [ $tsts -eq 0 ]
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   111
then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   112
  echo -e "  get_delta(None, None) == None" >> $out
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   113
  echo -e "  get_delta(Some(50.0), None) == None" >> $out
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   114
  echo -e "  get_delta(None, Some(100.0)) == None" >> $out
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   115
  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
   116
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   117
  if (scala_assert "drumb.scala" "drumb_test4.scala")
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   118
  then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   119
      echo -e "  --> success" >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   120
  else
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   121
      echo -e "  --> ONE OF THE TESTS FAILED\n" >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   122
  fi
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   123
fi
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   124
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   125
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   126
### get_deltas_test
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   127
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   128
if [ $tsts -eq 0 ]
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   129
then
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   130
  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
   131
  echo -e "    List(List(Some(-0.03573991804411003), Some(0.539974575389325)), " >> $out
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   132
  echo -e "         List(Some(0.10103414222249969), Some(0.24777764141006836)))" >> $out
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   133
  echo -e "" >> $out
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   134
  echo -e "  get_deltas(get_prices(List(\"BIDU\"), 2004 to 2008)) == " >> $out
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   135
  echo -e "    List(List(None), List(None),                          " >> $out
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 281
diff changeset
   136
  echo -e "         List(Some(0.9277165354330709)), List(Some(2.119679764725104))) " >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   137
  
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   138
  if (scala_assert "drumb.scala" "drumb_test5.scala") 
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   139
  then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   140
     echo -e "  --> success" >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   141
  else
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   142
     echo -e "  --> ONE OF THE TESTS FAILED\n" >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   143
  fi
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   144
fi
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   145
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   146
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   147
### yield_tests
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   148
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   149
if [ $tsts -eq 0 ]
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   150
then
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   151
  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
   152
  echo -e "  yearly_yield(ds, 100, 0) == 125" >> $out
cdfb2ce30a3d updated
Christian Urban <urbanc@in.tum.de>
parents: 314
diff changeset
   153
  echo -e "  yearly_yield(ds, 100, 1) == 117" >> $out
281
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 (scala_assert "drumb.scala" "drumb_test6.scala") 
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   156
  then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   157
      echo -e "  --> success" >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   158
  else
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   159
      echo -e "  --> ONE OF THE TESTS FAILED\n" >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   160
  fi
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   161
fi
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   162
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   163
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   164
### investment_test
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   165
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   166
if [ $tsts -eq 0 ]
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   167
then
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   168
  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
   169
  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
   170
  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
   171
  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
   172
  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
   173
  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
   174
  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
   175
  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
   176
  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
   177
  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
   178
  
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   179
  
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   180
  if (scala_assert "drumb.scala" "drumb_test7.scala") 
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   181
  then
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   182
    echo -e "  --> success" >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   183
  else
304
4a9d1153ccc5 updated
Christian Urban <urbanc@in.tum.de>
parents: 284
diff changeset
   184
    echo -e "  --> ONE OF THE TESTS FAILED\n" >> $out
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   185
  fi
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 266
diff changeset
   186
fi
130
7f3f01dfe738 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   187