89 echo " good_ratings.length == 48580 " >> $out |
89 echo " good_ratings.length == 48580 " >> $out |
90 echo " movie_names.length == 9742 " >> $out |
90 echo " movie_names.length == 9742 " >> $out |
91 |
91 |
92 if (scala_assert "danube.scala" "danube_test2.scala") |
92 if (scala_assert "danube.scala" "danube_test2.scala") |
93 then |
93 then |
94 echo " --> success" >> $out |
94 echo -e " --> success" >> $out |
95 else |
95 else |
96 echo " --> one of the tests failed" >> $out |
96 echo -e " --> ONE OF THE TESTS FAILED\n" >> $out |
97 fi |
97 fi |
98 fi |
98 fi |
99 |
99 |
|
100 ### danube groupById test |
|
101 |
|
102 if [ $tsts -eq 0 ] |
|
103 then |
|
104 echo -e " val ls1 = List((\"1\", \"a\"), (\"2\", \"a\"), (\"1\", \"c\"), (\"2\", \"a\"), (\"1\", \"c\"))" >> $out |
|
105 echo -e " val ls2 = List((\"1\", \"a\"), (\"1\", \"b\"), (\"2\", \"x\"), (\"3\", \"a\"), (\"2\", \"y\"), (\"3\", \"c\"))" >> $out |
|
106 echo -e " groupById(ls1, Map()) == Map(1 -> List(c, c, a), 2 -> List(a, a))" >> $out |
|
107 echo -e " groupById(ls2, Map()) == Map(1 -> List(b, a), 2 -> List(x, y), 3 -> List(c, a))" >> $out |
|
108 echo -e " where the order in the lists is unimportant" >> $out |
|
109 echo -e " val ls3 = (1 to 1000).map(_.toString).toList" >> $out |
|
110 echo -e " val ls4 = ls3 zip ls3.tail" >> $out |
|
111 echo -e " val ls5 = ls4 ::: ls4.reverse" >> $out |
|
112 echo -e " groupById(ls5, Map()) == Map(1 -> List(2,2), 2 -> List(3,3), ....)" >> $out |
|
113 |
|
114 if (scala_assert "danube.scala" "danube_test3.scala") |
|
115 then |
|
116 echo -e -e " --> success" >> $out |
|
117 else |
|
118 echo -e -e " --> ONE OF THE TESTS FAILED\n" >> $out |
|
119 fi |
|
120 fi |
|
121 |
|
122 ### danube favourites tests |
|
123 |
|
124 if [ $tsts -eq 0 ] |
|
125 then |
|
126 echo -e " val good_ratings = process_ratings(ratings)" >> $out |
|
127 echo -e " val ratings_map = groupById(good_ratings, Map())" >> $out |
|
128 echo -e " favourites(ratings_map, \"912\").length == 80 " >> $out |
|
129 echo -e " favourites(ratings_map, \"858\").length == 158 " >> $out |
|
130 echo -e " favourites(ratings_map, \"260\").length == 201 " >> $out |
|
131 |
|
132 if (scala_assert "danube.scala" "danube_test4.scala") |
|
133 then |
|
134 echo -e " --> success" >> $out |
|
135 else |
|
136 echo -e " --> ONE OF THE TESTS FAILED\n" >> $out |
|
137 fi |
|
138 fi |
|
139 |
|
140 ### danube suggestions tests |
|
141 |
|
142 if [ $tsts -eq 0 ] |
|
143 then |
|
144 echo -e " val good_ratings = process_ratings(ratings)" >> $out |
|
145 echo -e " val ratings_map = groupById(good_ratings, Map())" >> $out |
|
146 echo -e " suggestions(ratings_map, \"912\").length == 4110 " >> $out |
|
147 echo -e " suggestions(ratings_map, \"858\").length == 4883 " >> $out |
|
148 echo -e " suggestions(ratings_map, \"260\").length == 4970 " >> $out |
|
149 |
|
150 if (scala_assert "danube.scala" "danube_test5.scala") |
|
151 then |
|
152 echo -e " --> success" >> $out |
|
153 else |
|
154 echo -e " --> ONE OF THE TESTS FAILED\n" >> $out |
|
155 fi |
|
156 fi |
|
157 |
|
158 ### danube recommendation tests |
|
159 |
|
160 if [ $tsts -eq 0 ] |
|
161 then |
|
162 echo -e " recommendations(ratings_map, movies_map, \"1\").length == 2 " >> $out |
|
163 echo -e " recommendations(ratings_map, movies_map, \"2\").length == 2 " >> $out |
|
164 echo -e " recommendations(ratings_map, movies_map, \"3\").length == 2 " >> $out |
|
165 echo -e " recommendations(ratings_map, movies_map, \"4\").length == 0 " >> $out |
|
166 echo -e " recommendations(ratings_map, movies_map, \"5\").length == 2 " >> $out |
|
167 |
|
168 if (scala_assert "danube.scala" "danube_test6.scala") |
|
169 then |
|
170 echo -e " --> success" >> $out |
|
171 else |
|
172 echo -e " --> ONE OF THE TESTS FAILED\n" >> $out |
|
173 fi |
|
174 fi |
|
175 |