changeset 102 | 085bf16963c6 |
parent 98 | 8f03f0dc3065 |
child 125 | dcaab8068baa |
101:139eb1ed2d57 | 102:085bf16963c6 |
---|---|
24 |
24 |
25 |
25 |
26 # functional tests |
26 # functional tests |
27 |
27 |
28 function scala_assert { |
28 function scala_assert { |
29 (scala -i "$1" "$2" -e "" 2> /dev/null 1> /dev/null) |
29 (scala -i "$1" "$2" -e "") # 2> /dev/null 1> /dev/null) |
30 } |
30 } |
31 |
31 |
32 |
32 |
33 # marks for CW2b |
33 # marks for CW2b |
34 marks=$(( 0 )) |
34 marks=$(( 0 )) |
63 fi |
63 fi |
64 else |
64 else |
65 tsts1=$(( 1 )) |
65 tsts1=$(( 1 )) |
66 fi |
66 fi |
67 |
67 |
68 |
|
69 if [ $tsts1 -eq 0 ] |
68 if [ $tsts1 -eq 0 ] |
70 then |
69 then |
71 echo " ordered_moves(8, List((3,4), (3,2)), (1,3)) == (0,1), (0,5), (2,1), (2,5)" | tee -a $out |
70 echo " ordered_moves(8, List((3,4), (3,2)), (1, 3)) == List((0,1), (0,5), (2,1), (2,5))" | tee -a $out |
72 echo " ordered_moves(8, List((4,0)), (0,0)) == (2,1), (1,2)" | tee -a $out |
71 echo " ordered_moves(8, List((4,0)), (0,0)) == List((2,1), (1,2))" | tee -a $out |
73 echo " ordered_moves(8, List((0,4)), (0,0)) == (1,2), (2,1)" | tee -a $out |
72 echo " ordered_moves(8, List((0,4)), (0,0)) == List((1,2), (2,1))" | tee -a $out |
74 |
73 |
75 if (scala_assert "knight3.scala.bak" "../../../marking/knight3a_test.scala") |
74 if (scala_assert "knight3.scala.bak" "../../../marking/knight3a_test.scala") |
76 then |
75 then |
77 echo " --> success" | tee -a $out |
76 echo " --> success" | tee -a $out |
78 marks=$(( marks + 1 )) |
77 marks=$(( marks + 1 )) |
81 fi |
80 fi |
82 fi |
81 fi |
83 |
82 |
84 if [ $tsts1 -eq 0 ] |
83 if [ $tsts1 -eq 0 ] |
85 then |
84 then |
86 echo " first_closed_tour_heuristic(6, List((3, 3))) is ok?" | tee -a $out |
85 echo " first_closed_tour_heuristic(6, List((3, 3))) found and ok?" | tee -a $out |
87 |
86 |
88 if (scala_assert "knight3.scala.bak" "../../../marking/knight3b_test.scala") |
87 if (scala_assert "knight3.scala.bak" "../../../marking/knight3b_test.scala") |
88 then |
|
89 echo " --> success" | tee -a $out |
|
90 marks=$(( marks + 1 )) |
|
91 else |
|
92 echo " --> test failed" | tee -a $out |
|
93 fi |
|
94 fi |
|
95 |
|
96 if [ $tsts1 -eq 0 ] |
|
97 then |
|
98 echo " first_tour_heuristic(8, List((0,0))) found and ok?" | tee -a $out |
|
99 echo " first_tour_heuristic(50, List((0,0))) found and ok?" | tee -a $out |
|
100 |
|
101 if (scala_assert "knight3.scala.bak" "../../../marking/knight3c_test.scala") |
|
89 then |
102 then |
90 echo " --> success" | tee -a $out |
103 echo " --> success" | tee -a $out |
91 marks=$(( marks + 1 )) |
104 marks=$(( marks + 1 )) |
92 else |
105 else |
93 echo " --> test failed" | tee -a $out |
106 echo " --> test failed" | tee -a $out |