51 then |
51 then |
52 echo "docdiff.scala runs?" >> $out |
52 echo "docdiff.scala runs?" >> $out |
53 |
53 |
54 if (scala_compile docdiff.scala) |
54 if (scala_compile docdiff.scala) |
55 then |
55 then |
56 echo " --> success" >> $out |
56 echo -e " --> success" >> $out |
57 tsts=$(( 0 )) |
57 tsts=$(( 0 )) |
58 else |
58 else |
59 echo " --> scala did not run docdiff.scala" >> $out |
59 echo -e " --> SCALA DID NOT RUN docdiff.scala" >> $out |
60 tsts=$(( 1 )) |
60 tsts=$(( 1 )) |
61 fi |
61 fi |
62 else |
62 else |
63 tsts=$(( 1 )) |
63 tsts=$(( 1 )) |
64 fi |
64 fi |
65 |
65 |
66 ### docdiff clean tests |
66 ### docdiff clean tests |
67 |
67 |
68 if [ $tsts -eq 0 ] |
68 if [ $tsts -eq 0 ] |
69 then |
69 then |
70 echo "docdiff.scala tests:" >> $out |
70 echo -e "docdiff.scala tests:" >> $out |
71 echo " clean(\"ab a abc\") == List(\"ab\", \"a\", \"abc\")" >> $out |
71 echo -e " clean(\"ab a abc\") == List(\"ab\", \"a\", \"abc\")" >> $out |
72 echo " clean(\"ab*a abc1\") == List(\"ab\", \"a\", \"abc1\")" >> $out |
72 echo -e " clean(\"ab*a abc1\") == List(\"ab\", \"a\", \"abc1\")" >> $out |
73 |
73 |
74 if (scala_assert "docdiff.scala" "docdiff_test1.scala") |
74 if (scala_assert "docdiff.scala" "docdiff_test1.scala") |
75 then |
75 then |
76 echo " --> success" >> $out |
76 echo -e " --> success\n" >> $out |
77 else |
77 else |
78 echo " --> one of the tests failed" >> $out |
78 echo -e " --> ONE OF THE TESTS FAILED\n" >> $out |
79 fi |
79 fi |
80 fi |
80 fi |
81 |
81 |
82 ### docdiff occurrences tests |
82 ### docdiff occurrences tests |
83 |
83 |
84 if [ $tsts -eq 0 ] |
84 if [ $tsts -eq 0 ] |
85 then |
85 then |
86 echo " occurrences(List(\"a\", \"b\", \"b\", \"c\", \"d\")) == " >> $out |
86 echo -e " occurrences(List(\"a\", \"b\", \"b\", \"c\", \"d\")) == " >> $out |
87 echo " Map(\"a\" -> 1, \"b\" -> 2, \"c\" -> 1, \"d\" -> 1)" >> $out |
87 echo -e " Map(\"a\" -> 1, \"b\" -> 2, \"c\" -> 1, \"d\" -> 1)" >> $out |
88 echo " " >> $out |
88 echo -e " " >> $out |
89 echo " occurrences(List(\"d\", \"b\", \"d\", \"b\", \"d\")) == " >> $out |
89 echo -e " occurrences(List(\"d\", \"b\", \"d\", \"b\", \"d\")) == " >> $out |
90 echo " Map(\"d\" -> 3, \"b\" -> 2)" >> $out |
90 echo -e " Map(\"d\" -> 3, \"b\" -> 2)" >> $out |
91 |
91 |
92 if (scala_assert "docdiff.scala" "docdiff_test2.scala") |
92 if (scala_assert "docdiff.scala" "docdiff_test2.scala") |
93 then |
93 then |
94 echo " --> success" >> $out |
94 echo -e " --> success\n" >> $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 ### docdiff prod tests |
100 ### docdiff prod tests |
101 |
101 |
102 if [ $tsts -eq 0 ] |
102 if [ $tsts -eq 0 ] |
103 then |
103 then |
104 echo " val l1 = List(\"a\", \"b\", \"b\", \"c\", \"d\")" >> $out |
104 echo -e " val l1 = List(\"a\", \"b\", \"b\", \"c\", \"d\")" >> $out |
105 echo " val l2 = List(\"d\", \"b\", \"d\", \"b\", \"d\")" >> $out |
105 echo -e " val l2 = List(\"d\", \"b\", \"d\", \"b\", \"d\")" >> $out |
106 echo " " >> $out |
106 echo -e " " >> $out |
107 echo " prod(l1, l2) == 7 " >> $out |
107 echo -e " prod(l1, l2) == 7 " >> $out |
108 echo " prod(l1, l1) == 7 " >> $out |
108 echo -e " prod(l1, l1) == 7 " >> $out |
109 echo " prod(l2, l2) == 13 " >> $out |
109 echo -e " prod(l2, l2) == 13 " >> $out |
110 |
110 |
111 if (scala_assert "docdiff.scala" "docdiff_test3.scala") |
111 if (scala_assert "docdiff.scala" "docdiff_test3.scala") |
112 then |
112 then |
113 echo " --> success" >> $out |
113 echo -e " --> success\n" >> $out |
114 else |
114 else |
115 echo " --> one of the tests failed" >> $out |
115 echo -e " --> ONE OF THE TESTS FAILED\n" >> $out |
116 fi |
116 fi |
117 fi |
117 fi |
118 |
118 |
119 ### docdiff overlap tests |
119 ### docdiff overlap tests |
120 |
120 |
121 if [ $tsts -eq 0 ] |
121 if [ $tsts -eq 0 ] |
122 then |
122 then |
123 echo " val l1 = List(\"a\", \"b\", \"b\", \"c\", \"d\")" >> $out |
123 echo -e " val l1 = List(\"a\", \"b\", \"b\", \"c\", \"d\")" >> $out |
124 echo " val l2 = List(\"d\", \"b\", \"d\", \"b\", \"d\")" >> $out |
124 echo -e " val l2 = List(\"d\", \"b\", \"d\", \"b\", \"d\")" >> $out |
125 echo " " >> $out |
125 echo -e " " >> $out |
126 echo " overlap(l1, l2) == 0.5384615384615384 " >> $out |
126 echo -e " overlap(l1, l2) == 0.5384615384615384 " >> $out |
127 echo " overlap(l1, l1) == 1.0 " >> $out |
127 echo -e " overlap(l1, l1) == 1.0 " >> $out |
128 echo " overlap(l2, l2) == 1.0 " >> $out |
128 echo -e " overlap(l2, l2) == 1.0 " >> $out |
129 |
129 |
130 if (scala_assert "docdiff.scala" "docdiff_test4.scala") |
130 if (scala_assert "docdiff.scala" "docdiff_test4.scala") |
131 then |
131 then |
132 echo " --> success" >> $out |
132 echo -e " --> success\n" >> $out |
133 else |
133 else |
134 echo " --> one of the tests failed" >> $out |
134 echo -e " --> ONE OF THE TESTS FAILED\n" >> $out |
135 fi |
135 fi |
136 fi |
136 fi |