summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-02-04 12:26:42 +0000
committerPaul Phillips <paulp@improving.org>2010-02-04 12:26:42 +0000
commit9ee1f2f3b8ed91897bb298592f8a600ff5e4622d (patch)
treea2959e3eeaecb558d13a279404d35fb174df7ee7 /test
parent93277ea0201f139e829cfd7248142a0c5898d9ce (diff)
downloadscala-9ee1f2f3b8ed91897bb298592f8a600ff5e4622d.tar.gz
scala-9ee1f2f3b8ed91897bb298592f8a600ff5e4622d.tar.bz2
scala-9ee1f2f3b8ed91897bb298592f8a600ff5e4622d.zip
Unique's seeming victory is overruled by commit...
Unique's seeming victory is overruled by committee. It is "distinct", not "unique", wherein lies the nub. No review.
Diffstat (limited to 'test')
-rw-r--r--test/files/run/Course-2002-13.scala4
-rw-r--r--test/files/run/colltest1.scala4
-rw-r--r--test/files/run/hashCodeBoxesRunTime.scala2
-rw-r--r--test/files/run/hashCodeDistribution.scala2
-rw-r--r--test/files/scalacheck/list.scala4
5 files changed, 8 insertions, 8 deletions
diff --git a/test/files/run/Course-2002-13.scala b/test/files/run/Course-2002-13.scala
index fa5390e534..c016d41a90 100644
--- a/test/files/run/Course-2002-13.scala
+++ b/test/files/run/Course-2002-13.scala
@@ -66,7 +66,7 @@ object Terms {
override def toString() =
a + (if (ts.isEmpty) "" else ts.mkString("(", ",", ")"));
def map(s: Subst): Term = Con(a, ts map (t => t map s));
- def tyvars = (ts flatMap (t => t.tyvars)).unique;
+ def tyvars = (ts flatMap (t => t.tyvars)).distinct;
}
private var count = 0;
@@ -113,7 +113,7 @@ object Programs {
case class Clause(lhs: Term, rhs: List[Term]) {
def tyvars =
- (lhs.tyvars ::: (rhs flatMap (t => t.tyvars))).unique;
+ (lhs.tyvars ::: (rhs flatMap (t => t.tyvars))).distinct;
def newInstance = {
var s: Subst = List();
for (val a <- tyvars) { s = Binding(a, newVar(a)) :: s }
diff --git a/test/files/run/colltest1.scala b/test/files/run/colltest1.scala
index b07e6b0e59..47b273f8ee 100644
--- a/test/files/run/colltest1.scala
+++ b/test/files/run/colltest1.scala
@@ -80,7 +80,7 @@ object Test extends Application {
val tenPlus = ten map (_ + 1)
assert((ten zip tenPlus) forall { case (x, y) => x + 1 == y })
val dble = ten flatMap (x => List(x, x))
- assert(dble.unique == ten)
+ assert(dble.distinct == ten)
assert(ten.length == 10)
assert(ten(0) == 1 && ten(9) == 10)
assert((ten lengthCompare 10) == 0 && (ten lengthCompare 1) > 0 && (ten lengthCompare 11) < 0)
@@ -122,7 +122,7 @@ object Test extends Application {
assert((ten diff (ten filter (_ % 2 == 0))) == (ten filterNot (_ % 2 == 0)))
assert((ten intersect ten) == ten)
assert((ten intersect List(5)) == List(5))
- assert((ten ++ ten).unique == ten)
+ assert((ten ++ ten).distinct == ten)
assert(ten.patch(3, List(4, 5, 6, 7), 4) == ten)
assert(ten.patch(0, List(1, 2, 3), 9) == List(1, 2, 3, 10))
assert(empty.padTo(10, 7) == Array.fill(10)(7).toSeq)
diff --git a/test/files/run/hashCodeBoxesRunTime.scala b/test/files/run/hashCodeBoxesRunTime.scala
index 9ead89beb4..ba1a30f5fb 100644
--- a/test/files/run/hashCodeBoxesRunTime.scala
+++ b/test/files/run/hashCodeBoxesRunTime.scala
@@ -5,7 +5,7 @@ object Test
import java.{ lang => jl }
import scala.runtime.BoxesRunTime.{ hashFromNumber, hashFromObject }
- def allSame[T](xs: List[T]) = assert(xs.unique.size == 1, "failed: " + xs)
+ def allSame[T](xs: List[T]) = assert(xs.distinct.size == 1, "failed: " + xs)
def mkNumbers(x: Int): List[Number] =
List(x.toByte, x.toShort, x, x.toLong, x.toFloat, x.toDouble)
diff --git a/test/files/run/hashCodeDistribution.scala b/test/files/run/hashCodeDistribution.scala
index 64cae398f1..5be9d1db6d 100644
--- a/test/files/run/hashCodeDistribution.scala
+++ b/test/files/run/hashCodeDistribution.scala
@@ -8,7 +8,7 @@ object Test {
val hashCodes =
for (x <- 0 until COUNT; y <- 0 until COUNT) yield C(x,y).hashCode
- val uniques = hashCodes.unique
+ val uniques = hashCodes.distinct
val collisionRate = (totalCodes - uniques.size) * 1000 / totalCodes
assert(collisionRate < 5, "Collision rate too high: %d / 1000".format(collisionRate))
diff --git a/test/files/scalacheck/list.scala b/test/files/scalacheck/list.scala
index f08b0d0394..1caf35e872 100644
--- a/test/files/scalacheck/list.scala
+++ b/test/files/scalacheck/list.scala
@@ -7,14 +7,14 @@ object Test extends Properties("List") {
property("concat size") = forAll { (l1: List[Int], l2: List[Int]) => (l1.size + l2.size) == (l1 ::: l2).size }
property("reverse") = forAll { (l1: List[Int]) => l1.reverse.reverse == l1 }
- property("toSet") = forAll { (l1: List[Int]) => sorted(l1.toSet.toList) sameElements sorted(l1).unique }
+ property("toSet") = forAll { (l1: List[Int]) => sorted(l1.toSet.toList) sameElements sorted(l1).distinct }
property("flatten") = forAll { (xxs: List[List[Int]]) => xxs.flatten.length == (xxs map (_.length) sum) }
property("startsWith/take") = forAll { (xs: List[Int], count: Int) => xs startsWith (xs take count) }
property("endsWith/takeRight") = forAll { (xs: List[Int], count: Int) => xs endsWith (xs takeRight count) }
property("fill") = forAll(choose(1, 100)) { count =>
forAll { (x: Int) =>
val xs = List.fill(count)(x)
- (xs.length == count) && (xs.unique == List(x))
+ (xs.length == count) && (xs.distinct == List(x))
}
}
}