diff options
Diffstat (limited to 'test/files/run/lists-run.scala')
-rw-r--r-- | test/files/run/lists-run.scala | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/test/files/run/lists-run.scala b/test/files/run/lists-run.scala index 9e9e49e818..13fca22982 100644 --- a/test/files/run/lists-run.scala +++ b/test/files/run/lists-run.scala @@ -25,7 +25,7 @@ object Test_multiset { assert(List(1, 2) == (ys intersect xs), "ys_intersect_xs") assert(List(1) == (xs diff ys), "xs_diff_ys") assert(List(2, 3) == (ys diff xs), "ys_diff_xs") - assert(isSubListOf(xs -- ys, xs diff ys), "xs_subset_ys") + assert(isSubListOf(xs filterNot (ys contains), xs diff ys), "xs_subset_ys") val zs = List(0, 1, 1, 2, 2, 2) assert(List(0, 1, 1, 2, 2, 2, 1, 2, 2, 3) == (zs union ys), "zs_union_ys") @@ -34,7 +34,7 @@ object Test_multiset { assert(List(1, 2, 2) == (ys intersect zs), "ys_intersect_zs") assert(List(0, 1, 2) == (zs diff ys), "zs_diff_ys") assert(List(3) == (ys diff zs), "ys_diff_zs") - assert(isSubListOf(zs -- ys, zs diff ys), "xs_subset_ys") + assert(isSubListOf(zs filterNot (ys contains), zs diff ys), "xs_subset_ys") val ws = List(2) assert(List(2, 1, 2, 2, 3) == (ws union ys), "ws_union_ys") @@ -43,7 +43,7 @@ object Test_multiset { assert(List(2) == (ys intersect ws), "ys_intersect_ws") assert(List() == (ws diff ys), "ws_diff_ys") assert(List(1, 2, 3) == (ys diff ws), "ys_diff_ws") - assert(isSubListOf(ws -- ys, ws diff ys), "ws_subset_ys") + assert(isSubListOf(ws filterNot (ys contains), ws diff ys), "ws_subset_ys") val vs = List(3, 2, 2, 1) assert(List(1, 1, 2, 3, 2, 2, 1) == (xs union vs), "xs_union_vs") @@ -52,11 +52,11 @@ object Test_multiset { assert(List(2, 1) == (vs intersect xs), "vs_intersect_xs") assert(List(1) == (xs diff vs), "xs_diff_vs") assert(List(3, 2) == (vs diff xs), "vs_diff_xs") - assert(isSubListOf(xs -- vs, xs diff vs), "xs_subset_vs") + assert(isSubListOf(xs filterNot (vs contains), xs diff vs), "xs_subset_vs") // tests adapted from Thomas Jung assert({ - def sort(zs: List[Int]) = zs sort ( _ > _ ) + def sort(zs: List[Int]) = zs sortWith ( _ > _ ) sort(xs intersect ys) == sort(ys intersect xs) }, "be symmetric after sorting") assert({ @@ -137,12 +137,12 @@ object Test2 { val ys1 = xs1 ::: List(4) assert(List(1, 2, 3, 4) == ys1, "check_:::") - val ys2 = ys1 - 4 + val ys2 = ys1 filterNot (_ == 4) assert(xs1 == ys2, "check_-") val n2 = (xs1 ++ ys1).length val n3 = (xs1 ++ Nil).length - val n4 = (xs1 ++ ((new collection.mutable.ArrayBuffer[Int]) + 0)).length + val n4 = (xs1 ++ ((new collection.mutable.ArrayBuffer[Int]) += 0)).length assert(14 == n2 + n3 + n4, "check_++") } } |