changeset 153 | 4383809c176a |
parent 145 | d306102fd33b |
child 168 | 03530cb87cd0 |
152:114a89518aea | 153:4383809c176a |
---|---|
13 } |
13 } |
14 |
14 |
15 # compilation tests |
15 # compilation tests |
16 |
16 |
17 function scala_compile { |
17 function scala_compile { |
18 (ulimit -t 30 -m 1024000 ; scala "$1" 2>> $out 1>> $out) |
18 (ulimit -t 30 ; JAVA_OPTS="-Xmx1g" scala "$1" 2>> $out 1>> $out) |
19 } |
19 } |
20 |
20 |
21 # functional tests |
21 # functional tests |
22 |
22 |
23 function scala_assert { |
23 function scala_assert { |
24 (ulimit -t 300 -m 1024000 ; scala -i "$1" "$2" -e "" 2> /dev/null 1> /dev/null) |
24 (ulimit -t 20 ; JAVA_OPTS="-Xmx1g" scala -i "$1" "$2" -e "" 2> /dev/null 1> /dev/null) |
25 } |
25 } |
26 |
26 |
27 # purity test |
27 # purity test |
28 |
28 |
29 function scala_vars { |
29 function scala_vars { |
30 (egrep '\bvar\b|\breturn\b|\.par|ListBuffer|mutable' "$1" 2> /dev/null 1> /dev/null) |
30 (egrep '\bvar\b|\breturn\b|\.par|ListBuffer|mutable|new Array' "$1" 2> /dev/null 1> /dev/null) |
31 } |
31 } |
32 |
32 |
33 |
33 |
34 # knights3: purity test |
34 # knights3: purity test |
35 # |
35 # |
36 echo "knight3.scala does not contain vars, returns etc?" >> $out |
36 echo "knight3.scala does not contain vars, returns etc?" >> $out |
37 |
37 |
38 if (scala_vars knight3.scala) |
38 if (scala_vars knight3.scala) |
39 then |
39 then |
40 echo " --> fail" >> $out |
40 echo " --> fail: if you do not fix this, you will receive a mark of zero" >> $out |
41 tsts0=$(( 1 )) |
41 tsts0=$(( 1 )) |
42 else |
42 else |
43 echo " --> success" >> $out |
43 echo " --> success" >> $out |
44 tsts0=$(( 0 )) |
44 tsts0=$(( 0 )) |
45 fi |
45 fi |
64 |
64 |
65 # ordered move test |
65 # ordered move test |
66 |
66 |
67 if [ $tsts1 -eq 0 ] |
67 if [ $tsts1 -eq 0 ] |
68 then |
68 then |
69 echo "Takes 20 seconds or less to execute: " >> $out |
|
69 echo " ordered_moves(8, List((3,4), (3,2)), (1, 3)) == List((0,1), (0,5), (2,1), (2,5))" >> $out |
70 echo " ordered_moves(8, List((3,4), (3,2)), (1, 3)) == List((0,1), (0,5), (2,1), (2,5))" >> $out |
70 echo " ordered_moves(8, List((4,0)), (0,0)) == List((2,1), (1,2))" >> $out |
71 echo " ordered_moves(8, List((4,0)), (0,0)) == List((2,1), (1,2))" >> $out |
71 echo " ordered_moves(8, List((0,4)), (0,0)) == List((1,2), (2,1))" >> $out |
72 echo " ordered_moves(8, List((0,4)), (0,0)) == List((1,2), (2,1))" >> $out |
72 |
73 |
73 if (scala_assert "knight3.scala" "knight3a_test.scala") |
74 if (scala_assert "knight3.scala" "knight3a_test.scala") |
95 |
96 |
96 |
97 |
97 |
98 |
98 if [ $tsts1 -eq 0 ] |
99 if [ $tsts1 -eq 0 ] |
99 then |
100 then |
101 echo "Takes 20 seconds or less to execute: " >> $out |
|
100 echo " first_tour_heuristic(8, List((0,0))) found and ok?" >> $out |
102 echo " first_tour_heuristic(8, List((0,0))) found and ok?" >> $out |
101 echo " first_tour_heuristic(40, List((0,0))) found and ok?" >> $out |
103 echo " first_tour_heuristic(40, List((0,0))) found and ok?" >> $out |
102 |
104 |
103 if (scala_assert "knight3.scala" "knight3c_test.scala") |
105 if (scala_assert "knight3.scala" "knight3c_test.scala") |
104 then |
106 then |