--- a/main_testing1/drumb_test.sh Mon Jan 03 00:59:32 2022 +0000
+++ b/main_testing1/drumb_test.sh Sun Jan 09 01:06:30 2022 +0000
@@ -1,7 +1,9 @@
#!/bin/bash
set -euo pipefail
-out=${1:-output}
+scalafile=${1:-drumb.scala}
+out=${2:-output}
+
echo -e "" > $out
@@ -33,7 +35,7 @@
# compilation test
echo -e "drumb.scala runs?" >> $out
-if (scala_compile drumb.scala)
+if (scala_compile $scalafile)
then
echo -e " --> passed" >> $out
tsts=$(( 0 ))
@@ -51,7 +53,7 @@
then
echo -e "drumb.scala does not contain vars, returns etc?" >> $out
- if (scala_vars drumb.scala)
+ if (scala_vars $scalafile)
then
echo -e " --> FAIL (make triple-sure your program conforms to the required format)" >> $out
tsts=$(( 1 ))
@@ -69,7 +71,7 @@
echo -e " get_january_data(\"GOOG\", 1980) == List()" >> $out
echo -e " get_january_data(\"GOOG\", 2010).head == \"2010-01-04,312.204773\"" >> $out
- if (scala_assert "drumb.scala" "drumb_test1.scala")
+ if (scala_assert $scalafile "drumb_test1.scala")
then
echo -e " --> success" >> $out
else
@@ -84,7 +86,7 @@
echo -e " get_first_price(\"GOOG\", 1980) == None" >> $out
echo -e " get_first_price(\"GOOG\", 2010) == Some(312.204773)" >> $out
- if (scala_assert "drumb.scala" "drumb_test2.scala")
+ if (scala_assert $scalafile "drumb_test2.scala")
then
echo -e " --> success" >> $out
else
@@ -101,7 +103,7 @@
echo " List(Some(301.0466), Some(41.244694))," >> $out
echo " List(Some(331.462585), Some(51.464207)))" >> $out
- if (scala_assert "drumb.scala" "drumb_test3.scala")
+ if (scala_assert $scalafile "drumb_test3.scala")
then
echo -e " --> success" >> $out
else
@@ -118,7 +120,7 @@
echo -e " get_delta(None, Some(100.0)) == None" >> $out
echo -e " get_delta(Some(50.0), Some(100.0)) == Some(1.0)" >> $out
- if (scala_assert "drumb.scala" "drumb_test4.scala")
+ if (scala_assert $scalafile "drumb_test4.scala")
then
echo -e " --> success" >> $out
else
@@ -139,7 +141,7 @@
echo -e " List(List(None), List(None), " >> $out
echo -e " List(Some(0.9277165354330709)), List(Some(2.119679764725104))) " >> $out
- if (scala_assert "drumb.scala" "drumb_test5.scala")
+ if (scala_assert $scalafile "drumb_test5.scala")
then
echo -e " --> success" >> $out
else
@@ -156,7 +158,7 @@
echo -e " yearly_yield(ds, 100, 0) == 125" >> $out
echo -e " yearly_yield(ds, 100, 1) == 117" >> $out
- if (scala_assert "drumb.scala" "drumb_test6.scala")
+ if (scala_assert $scalafile "drumb_test6.scala")
then
echo -e " --> success" >> $out
else
@@ -181,7 +183,7 @@
echo -e " investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 1990 to 2017, 100) == 11504" >> $out
- if (scala_assert "drumb.scala" "drumb_test7.scala")
+ if (scala_assert $scalafile "drumb_test7.scala")
then
echo -e " --> success" >> $out
else