equal
deleted
inserted
replaced
29 |
29 |
30 # functional tests |
30 # functional tests |
31 |
31 |
32 function scala_assert { |
32 function scala_assert { |
33 rm -rf /Users/cu/.ammonite/cache/3.*/* 2> /dev/null ; |
33 rm -rf /Users/cu/.ammonite/cache/3.*/* 2> /dev/null ; |
34 (ulimit -t 30; JAVA_OPTS="-Xmx1g -XX:MaxJavaStackTraceDepth=10" amm -s "$1" 1>> $out 2>> $out) |
34 (ulimit -t 60; JAVA_OPTS="-Xmx1g -XX:MaxJavaStackTraceDepth=10" amm -s "$1" 1>> $out 2>> $out) |
35 } |
35 } |
36 |
36 |
37 function scala_fail { |
37 function scala_fail { |
38 (ulimit -t 30; JAVA_OPTS="-Xmx1g -XX:MaxJavaStackTraceDepth=10" amm -s "$1" 1>> $out 2>> $out) |
38 rm -rf /Users/cu/.ammonite/cache/3.*/* 2> /dev/null ; |
|
39 (ulimit -t 60; JAVA_OPTS="-Xmx1g -XX:MaxJavaStackTraceDepth=10" amm -s "$1" 1>> $out 2>> $out) |
39 } |
40 } |
|
41 |
|
42 # remove @main |
|
43 gsed -i -e "s|@main||g" cw03.sc |
40 |
44 |
41 |
45 |
42 |
46 |
43 ### compilation test |
47 ### compilation test |
44 |
48 |
59 echo >> $out |
63 echo >> $out |
60 #echo -e "\n\n\n" >> $out |
64 #echo -e "\n\n\n" >> $out |
61 |
65 |
62 if [ $tsts -eq 0 ] |
66 if [ $tsts -eq 0 ] |
63 then |
67 then |
64 echo -e "1) Parsing test with example files (does it raise an exception):\n" | tee -a $out |
68 echo -e "1) Parsing test with example files (no exception is raised):\n" | tee -a $out |
65 cat cw03.sc c3_add.sc > cw033_add.sc |
69 cat cw03.sc c3_add.sc > cw033_add.sc |
|
70 START=$(date +%s) |
66 if (scala_assert "c3.sc") |
71 if (scala_assert "c3.sc") |
67 then |
72 then |
|
73 END=$(date +%s) |
|
74 DIFF=$(( $END - $START )) |
|
75 echo -e " This test ran for $DIFF seconds" | tee -a $out |
68 echo -e " --> success (+ 6.0 Marks)\n" | tee -a $out |
76 echo -e " --> success (+ 6.0 Marks)\n" | tee -a $out |
69 marks=$(( marks + 6.0 )) |
77 marks=$(( marks + 6.0 )) |
70 else |
78 else |
|
79 END=$(date +%s) |
|
80 DIFF=$(( $END - $START )) |
|
81 echo -e " This test ran for $DIFF seconds" | tee -a $out |
71 echo -e " --> FAILED\n" | tee -a $out |
82 echo -e " --> FAILED\n" | tee -a $out |
72 #cat $out | tee -a $out |
83 #cat $out | tee -a $out |
73 fi |
84 fi |
74 fi |
85 fi |
75 |
86 |
81 then |
92 then |
82 echo -e "2) Evaluation of primes.while:\n" | tee -a $out |
93 echo -e "2) Evaluation of primes.while:\n" | tee -a $out |
83 cat c4_pre.sc cw03.sc c4_add.sc > cw034_add.sc |
94 cat c4_pre.sc cw03.sc c4_add.sc > cw034_add.sc |
84 if (scala_assert "c4.sc") |
95 if (scala_assert "c4.sc") |
85 then |
96 then |
86 echo -e " --> success (+ 2.0 Marks)\n" | tee -a $out |
97 echo -e " --> success (+ 5.0 Marks)\n" | tee -a $out |
87 marks=$(( marks + 2.0 )) |
98 marks=$(( marks + 5.0 )) |
88 else |
99 else |
89 echo -e " --> FAILED\n" | tee -a $out |
100 echo -e " --> FAILED\n" | tee -a $out |
90 #cat $out | tee -a $out |
101 #cat $out | tee -a $out |
91 fi |
102 fi |
92 fi |
103 fi |
101 echo -e "\"\"\"" >> $out |
112 echo -e "\"\"\"" >> $out |
102 cat "test.while" >> $out |
113 cat "test.while" >> $out |
103 echo -e "\"\"\"\n" >> $out |
114 echo -e "\"\"\"\n" >> $out |
104 if (scala_assert "c5.sc") |
115 if (scala_assert "c5.sc") |
105 then |
116 then |
106 echo -e " --> success (+ 2.0 Marks)\n" | tee -a $out |
117 echo -e " --> success (+ 4.0 Marks)\n" | tee -a $out |
107 marks=$(( marks + 2.0 )) |
118 marks=$(( marks + 4.0 )) |
108 else |
119 else |
109 echo -e " --> FAILED\n" | tee -a $out |
120 echo -e " --> FAILED\n" | tee -a $out |
110 tail -25 $out | pr -to10 |
121 tail -25 $out | pr -to10 |
111 fi |
122 fi |
112 fi |
123 fi |