diff options
author | Paul Phillips <paulp@improving.org> | 2010-09-28 00:51:25 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-09-28 00:51:25 +0000 |
commit | 9c0e58c48da4cdbae7c96ef45fc15cd7aff4301f (patch) | |
tree | 857d48a844aa0479863f79c2a991984ac6a0104f /test/pending | |
parent | a56c33b6a470939a1396015972f09e19dc493245 (diff) | |
download | scala-9c0e58c48da4cdbae7c96ef45fc15cd7aff4301f.tar.gz scala-9c0e58c48da4cdbae7c96ef45fc15cd7aff4301f.tar.bz2 scala-9c0e58c48da4cdbae7c96ef45fc15cd7aff4301f.zip |
Cleaning up the contents of test.
including "CheckEither", written against scalacheck 1.2 in the year 471
AD. Removed all the duplicates I could find, mostly between pending
and files. Renamed a bunch of tests so they wouldn't look like likely
duplicates next time around. Nominated somebody else to do this once in
a while.
No review.
Diffstat (limited to 'test/pending')
29 files changed, 0 insertions, 880 deletions
diff --git a/test/pending/neg/t1477.scala b/test/pending/neg/t1477.scala deleted file mode 100644 index 0cc0cd5f7a..0000000000 --- a/test/pending/neg/t1477.scala +++ /dev/null @@ -1,25 +0,0 @@ -object Test extends Application { - trait A - trait B extends A - - trait C { - type U - trait D { type T >: B <: A } - type V <: D - val y: V#T = new B { } - } - - trait Middle extends C { - type V <: (D with U) - } - - class D extends Middle { - trait E - trait F { type T = E } - type U = F - def frob(arg : E) : E = arg - frob(y) - } - - new D -} diff --git a/test/pending/pos/bug2018.scala b/test/pending/pos/bug2018.scala deleted file mode 100644 index f1753f4d7a..0000000000 --- a/test/pending/pos/bug2018.scala +++ /dev/null @@ -1,15 +0,0 @@ -class A { - val b = new B - - def getChildren = List(new A).elements - - class B { - private def check = true - - private def getAncestor(p: A): A = { - val c = (p.getChildren.find(_.b.check)) match {case Some(d) => d case None => p} - - if (c == p) p else c.b.getAncestor(c) - } - } -} diff --git a/test/pending/pos/bug3420.flags b/test/pending/pos/bug3420.flags deleted file mode 100644 index ea03113c66..0000000000 --- a/test/pending/pos/bug3420.flags +++ /dev/null @@ -1 +0,0 @@ --optimise -Xfatal-warnings
\ No newline at end of file diff --git a/test/pending/pos/bug3420.scala b/test/pending/pos/bug3420.scala deleted file mode 100644 index 0fc56ed67b..0000000000 --- a/test/pending/pos/bug3420.scala +++ /dev/null @@ -1,5 +0,0 @@ -class C { - val cv = Map[Int, Int](1 -> 2) - lazy val cl = Map[Int, Int](1 -> 2) - def cd = Map[Int, Int](1 -> 2) -} diff --git a/test/pending/pos/bug563.scala b/test/pending/pos/bug563.scala deleted file mode 100644 index d559226bdb..0000000000 --- a/test/pending/pos/bug563.scala +++ /dev/null @@ -1,7 +0,0 @@ -object Test { - def map[A,R](a : List[A], f : A => R) : List[R] = a.map(f); - - def split(sn : Iterable[List[Cell[int]]]) : unit = - for (val n <- sn) - map(n,ptr => new Cell(ptr.elem)); -} diff --git a/test/pending/pos/foo.scala b/test/pending/pos/foo.scala deleted file mode 100644 index 8b45addbd5..0000000000 --- a/test/pending/pos/foo.scala +++ /dev/null @@ -1,3 +0,0 @@ -object foo { - var x: String -} diff --git a/test/pending/pos/t0716.scala b/test/pending/pos/t0716.scala deleted file mode 100644 index 98ba9bb2aa..0000000000 --- a/test/pending/pos/t0716.scala +++ /dev/null @@ -1,24 +0,0 @@ -trait Functor[F[_]] { - def fmap[A,B](fun: A=>B, arg:F[A]): F[B] -} -object Functor{ - implicit val ListFunctor = new Functor[List] { - def fmap[A, B](f: A => B, arg: List[A]):List[B] = arg map f - } - - final class OOFunctor[F[_],A](arg:F[A])(implicit ftr: Functor[F]) { - def fmap[B](fun: A=>B):F[B] = ftr.fmap(fun,arg) - } - - //breaks if uncommented - implicit def lifttoOO[F[_],A](arg:F[A])(implicit ftr: Functor[F]) = new OOFunctor[F,A](arg)(ftr) - - //works if uncommented - //implicit def liftListtoOO[A](arg:List[A]):OOFunctor[List,A] = new OOFunctor[List,A](arg) -} - -object GeneralLiftingDemo extends Application { - import Functor._ - val l = List(1,2,3) - println("OO : " + l.fmap( 1+) ) -} diff --git a/test/pending/pos/t2162.scala b/test/pending/pos/t2162.scala deleted file mode 100644 index b21404726b..0000000000 --- a/test/pending/pos/t2162.scala +++ /dev/null @@ -1,20 +0,0 @@ -// crash verified; no solution yet -class Foo(x: Int) -class Bar extends Foo(1) - -trait A { - def foo[T <: Foo] -} -class B extends A { - def foo[Bar] { println("B.foo[Bar]") } -} -object test { - val x = new B - val y = new A { - def foo[Bar] { println("A.foo[Bar]") } - } - def main(args: Array[String]) { - x.foo // ok - y.foo // java.lang.AssertionError: assertion failed (Erasure.scala:441 in r18338)) - } -} diff --git a/test/pending/pos/t2179.scala b/test/pending/pos/t2179.scala deleted file mode 100644 index fd37d8f760..0000000000 --- a/test/pending/pos/t2179.scala +++ /dev/null @@ -1,6 +0,0 @@ -on trunk r18368, this delightful little poison pill: - -(Nil:List[List[Double]]).reduceLeft((_: Any, _: Any) => Nil.indices.map(_ => 0d)) - -sends the compiler into an apparently infinite loop. a sample thread dump shows: - diff --git a/test/pending/pos/t2635.scala b/test/pending/pos/t2635.scala deleted file mode 100644 index 378631b23d..0000000000 --- a/test/pending/pos/t2635.scala +++ /dev/null @@ -1,16 +0,0 @@ -abstract class Base - -object Test -{ - def run(c: Class[_ <: Base]): Unit = { - } - - def main(args: Array[String]): Unit = - { - val sc: Option[Class[_ <: Base]] = Some(classOf[Base]) - sc match { - case Some((c: Class[_ <: Base])) => run(c) - case None => - } - } -}
\ No newline at end of file diff --git a/test/pending/pos/t2641.scala b/test/pending/pos/t2641.scala deleted file mode 100644 index fec825c4f9..0000000000 --- a/test/pending/pos/t2641.scala +++ /dev/null @@ -1,16 +0,0 @@ -import scala.collection._ -import scala.collection.generic._ - -abstract class ManagedSeqStrict[+A] - extends Traversable[A] - with GenericTraversableTemplate[A, ManagedSeqStrict] - -trait ManagedSeq[+A, +Coll] - extends ManagedSeqStrict[A] - with TraversableView[A, ManagedSeqStrict[A]] - with TraversableViewLike[A, ManagedSeqStrict[A], ManagedSeq[A/*ERROR: too few type args*/]] -{ self => - trait Transformed[+B] extends ManagedSeq[B, Coll] with super.Transformed[B] - - trait Sliced extends Transformed[A] with super.Sliced -}
\ No newline at end of file diff --git a/test/pending/pos/t3636.scala b/test/pending/pos/t3636.scala deleted file mode 100644 index 24d18c653d..0000000000 --- a/test/pending/pos/t3636.scala +++ /dev/null @@ -1,49 +0,0 @@ -class CTxnLocal[ T ] { - def set( x: T )( implicit t: Txn ) {} - def get( implicit t: Txn ) : T = null.asInstanceOf[ T ] - def initialValue( t: Txn ) : T = null.asInstanceOf[ T ] -} - -trait Txn - -trait ProcTxn { - def ccstm: Txn -} - -trait TxnLocal[ @specialized T ] { - def apply()( implicit tx: ProcTxn ) : T - def set( v: T )( implicit tx: ProcTxn ) : Unit - def swap( v: T )( implicit tx: ProcTxn ) : T - def transform( f: T => T )( implicit tx: ProcTxn ) : Unit -} - -object TxnLocal { - def apply[ @specialized T ] : TxnLocal[ T ] = new Impl( new CTxnLocal[ T ]) - def apply[ @specialized T ]( initValue: => T ) : TxnLocal[ T ] = new Impl( new CTxnLocal[ T ] { - override def initialValue( tx: Txn ): T = initValue - }) - - private class Impl[ T ]( c: CTxnLocal[ T ]) extends TxnLocal[ T ] { - def apply()( implicit tx: ProcTxn ) : T = c.get( tx.ccstm ) - def set( v: T )( implicit tx: ProcTxn ) : Unit = c.set( v )( tx.ccstm ) - def swap( v: T )( implicit tx: ProcTxn ) : T = { - // currently not implemented in CTxnLocal - val oldV = apply - set( v ) - oldV - } - def transform( f: T => T )( implicit tx: ProcTxn ) { - set( f( apply )) - } - } -} - - -object Transition { - private val currentRef = TxnLocal[ Transition ]( Instant ) - def current( implicit tx: ProcTxn ) : Transition = currentRef() -} - -sealed abstract class Transition -case object Instant extends Transition - diff --git a/test/pending/run/bug1006.scala b/test/pending/run/bug1006.scala deleted file mode 100644 index 0a82373fb6..0000000000 --- a/test/pending/run/bug1006.scala +++ /dev/null @@ -1,13 +0,0 @@ -object foo { - def main(args: Array[String]) { - abstract class A[T] { - def myVal: T - } - - class B[T](value: T) extends A[T] { - def myVal = value - } - - Console.println(new B[int](23).myVal) - } -} diff --git a/test/pending/run/bug2087.scala b/test/pending/run/bug2087.scala deleted file mode 100644 index b3f96fa415..0000000000 --- a/test/pending/run/bug2087.scala +++ /dev/null @@ -1,8 +0,0 @@ -object Test { - def main(args: Array[String]): Unit = { - val s: Short = 0xFA99.toShort - val c: Char = 0xFA99.toChar - - assert((s == c) == (c == s)) - } -}
\ No newline at end of file diff --git a/test/pending/run/bug2365/Test.scala b/test/pending/run/bug2365/Test.scala deleted file mode 100644 index 92b58f4a25..0000000000 --- a/test/pending/run/bug2365/Test.scala +++ /dev/null @@ -1,35 +0,0 @@ -import scala.tools.nsc.io._ -import java.net.URL - -object A { def apply(d: { def apply(): Int}) = d.apply() } -object A2 { def apply(d: { def apply(): Int}) = d.apply() } -object A3 { def apply(d: { def apply(): Int}) = d.apply() } -object A4 { def apply(d: { def apply(): Int}) = d.apply() } - -class B extends Function0[Int] { - def apply() = 3 -} - -object Test -{ - type StructF0 = { def apply(): Int } - def main(args: Array[String]) { - for(i <- 0 until 150) - println(i + " " + test(A.apply) + " " + test(A2.apply) + " " + test(A3.apply) + " " + test(A3.apply)) - } - - def test(withF0: StructF0 => Int): Int = { - // Some large jar - val ivyJar = File("/local/lib/java/ivy.jar").toURL - // load a class in a separate loader that will be passed to A - val loader = new java.net.URLClassLoader(Array(File(".").toURL, ivyJar)) - // load a real class to fill perm gen space - Class.forName("org.apache.ivy.Ivy", true, loader).newInstance - // create a class from another class loader with an apply: Int method - val b = Class.forName("B", true, loader).newInstance - - // pass instance to a, which will call apply using structural type reflection. - // This should hold on to the class for B, which means bLoader will not get collected - withF0(b.asInstanceOf[StructF0]) - } -} diff --git a/test/pending/run/bug2365/bug2365.javaopts b/test/pending/run/bug2365/bug2365.javaopts deleted file mode 100644 index 357e033c1c..0000000000 --- a/test/pending/run/bug2365/bug2365.javaopts +++ /dev/null @@ -1 +0,0 @@ --XX:MaxPermSize=25M diff --git a/test/pending/run/bug3150.scala b/test/pending/run/bug3150.scala deleted file mode 100644 index 034703b5f7..0000000000 --- a/test/pending/run/bug3150.scala +++ /dev/null @@ -1,10 +0,0 @@ -object Test { - case object Bob { override def equals(other: Any) = true } - def f(x: Any) = x match { case Bob => Bob } - - def main(args: Array[String]): Unit = { - assert(f(Bob) eq Bob) - assert(f(0) eq Bob) - assert(f(Nil) eq Bob) - } -} diff --git a/test/pending/run/castsingleton.scala b/test/pending/run/castsingleton.scala deleted file mode 100644 index 171b380dc9..0000000000 --- a/test/pending/run/castsingleton.scala +++ /dev/null @@ -1,10 +0,0 @@ -object Test extends Application { - case class L(); - object N extends L(); - - def empty(xs : L) : Unit = xs match { - case x@N => println(x); println(x); - } - - empty(L()) -} diff --git a/test/pending/run/t0807.scala b/test/pending/run/t0807.scala deleted file mode 100644 index e69aa1c71c..0000000000 --- a/test/pending/run/t0807.scala +++ /dev/null @@ -1,5 +0,0 @@ -trait A -trait B extends A { val x = println("early") } -object Test extends Application { - new B {} -} diff --git a/test/pending/run/t1939.scala b/test/pending/run/t1939.scala deleted file mode 100644 index 44ab1769d2..0000000000 --- a/test/pending/run/t1939.scala +++ /dev/null @@ -1,41 +0,0 @@ -// works in trunk -class Module {} - -abstract class T { - type moduleType <: Module - def module: moduleType -} - -final class T1(val module: Module) extends T { - type moduleType = Module -} - -final class T2(_module: Module) extends T { - type moduleType = Module - - def module = _module -} - -object Main extends Application { - - type mType = Module - - type tType = T { type moduleType <: mType } - // type tType = T { type moduleType <: Module } // runs successfully - // type tType = T // runs successfully - - def f(ts: List[tType]): Unit = { - - for (t <- ts; m = t.module) {} - ts.map(_.module).foreach { _ => () } - // ts.map(t => (t : T).module).foreach { _ => () } // runs successfully - } - - f(new T1(new Module) :: new T2(new Module) :: Nil) -} - -/* - * java.lang.AbstractMethodError - at scala.List.foreach(List.scala:849) - at Main$.f -*/ diff --git a/test/pending/scalacheck/CheckEither.scala b/test/pending/scalacheck/CheckEither.scala deleted file mode 100644 index a6c728451b..0000000000 --- a/test/pending/scalacheck/CheckEither.scala +++ /dev/null @@ -1,253 +0,0 @@ - -// To run these tests: -// 1) wget http://scalacheck.googlecode.com/files/ScalaCheck-1.2.jar -// 2) scalac -classpath ScalaCheck-1.2.jar Either.scala -// 3) scala -classpath .:ScalaCheck-1.2.jar scala.CheckEither -// 4) observe passing tests - -import org.scalacheck.Arbitrary -import org.scalacheck.Arbitrary.{arbitrary, arbThrowable} -import org.scalacheck.Gen.oneOf -import org.scalacheck.{Prop, StdRand} -import org.scalacheck.Prop._ -import org.scalacheck.ConsoleReporter.{testReport, propReport} -import org.scalacheck.Test.{Params, check} -import org.scalacheck.ConsoleReporter.testStatsEx -import Function.tupled - -object CheckEither { - implicit def arbitraryEither[X, Y](implicit xa: Arbitrary[X], ya: Arbitrary[Y]): Arbitrary[Either[X, Y]] = - Arbitrary[Either[X, Y]](oneOf(arbitrary[X].map(Left(_)), arbitrary[Y].map(Right(_)))) - - val prop_either1 = property((n: Int) => Left(n).either(x => x, b => error("fail")) == n) - - val prop_either2 = property((n: Int) => Right(n).either(a => error("fail"), x => x) == n) - - val prop_swap = property((e: Either[Int, Int]) => e match { - case Left(a) => e.swap.right.value == a - case Right(b) => e.swap.left.value == b - }) - - val prop_isLeftRight = property((e: Either[Int, Int]) => e.isLeft != e.isRight) - - object CheckLeftProjection { - val prop_valueE = property((n: Int, s: String) => Left(n).left.valueE(s) == n) - - val prop_value = property((n: Int) => Left(n).left.value == n) - - val prop_on = property((e: Either[Int, Int]) => e.left.on((_: Int) + 1) == (e match { - case Left(a) => a - case Right(b) => b + 1 - })) - - val prop_getOrElse = property((e: Either[Int, Int], or: Int) => e.left.getOrElse(or) == (e match { - case Left(a) => a - case Right(_) => or - })) - - val prop_forall = property((e: Either[Int, Int]) => - e.left.forall(_ % 2 == 0) == (e.isRight || e.left.value % 2 == 0)) - - val prop_exists = property((e: Either[Int, Int]) => - e.left.exists(_ % 2 == 0) == (e.isLeft && e.left.value % 2 == 0)) - - val prop_flatMapLeftIdentity = property((e: Either[Int, Int], n: Int, s: String) => { - def f(x: Int) = if(x % 2 == 0) Left(s) else Right(s) - Left(n).left.flatMap(f(_)) == f(n)}) - - val prop_flatMapRightIdentity = property((e: Either[Int, Int]) => e.left.flatMap(Left(_)) == e) - - val prop_flatMapComposition = property((e: Either[Int, Int]) => { - def f(x: Int) = if(x % 2 == 0) Left(x) else Right(x) - def g(x: Int) = if(x % 7 == 0) Right(x) else Left(x) - e.left.flatMap(f(_)).left.flatMap(g(_)) == e.left.flatMap(f(_).left.flatMap(g(_)))}) - - val prop_mapIdentity = property((e: Either[Int, Int]) => e.left.map(x => x) == e) - - val prop_mapComposition = property((e: Either[String, Int]) => { - def f(s: String) = s.toLowerCase - def g(s: String) = s.reverse - e.left.map(x => f(g(x))) == e.left.map(x => g(x)).left.map(f(_))}) - - val prop_filter = property((e: Either[Int, Int], x: Int) => e.left.filter(_ % 2 == 0) == - (if(e.isRight || e.left.value % 2 != 0) None else Some(e))) - - val prop_ap = property((e1: Either[Int, Int], e2: Either[Int, Int]) => { - val ee2 = e2.left map (n => (x: Int) => x + n) - e1.left.ap(ee2) == (ee2 match { - case Left(f) => e1 match { - case Left(a) => Left(f(a)) - case Right(b) => Right(b) - } - case Right(b) => Right(b) - }) - }) - - val prop_seq = property((e: Either[Int, Int]) => e.left.seq == (e match { - case Left(a) => Seq.singleton(a) - case Right(_) => Seq.empty - })) - - val prop_option = property((e: Either[Int, Int]) => e.left.option == (e match { - case Left(a) => Some(a) - case Right(_) => None - })) - } - - object CheckRightProjection { - val prop_valueE = property((n: Int, s: String) => Right(n).right.valueE(s) == n) - - val prop_value = property((n: Int) => Right(n).right.value == n) - - val prop_on = property((e: Either[Int, Int]) => e.right.on((_: Int) + 1) == (e match { - case Left(a) => a + 1 - case Right(b) => b - })) - - val prop_getOrElse = property((e: Either[Int, Int], or: Int) => e.right.getOrElse(or) == (e match { - case Left(_) => or - case Right(b) => b - })) - - val prop_forall = property((e: Either[Int, Int]) => - e.right.forall(_ % 2 == 0) == (e.isLeft || e.right.value % 2 == 0)) - - val prop_exists = property((e: Either[Int, Int]) => - e.right.exists(_ % 2 == 0) == (e.isRight && e.right.value % 2 == 0)) - - val prop_flatMapLeftIdentity = property((e: Either[Int, Int], n: Int, s: String) => { - def f(x: Int) = if(x % 2 == 0) Left(s) else Right(s) - Right(n).right.flatMap(f(_)) == f(n)}) - - val prop_flatMapRightIdentity = property((e: Either[Int, Int]) => e.right.flatMap(Right(_)) == e) - - val prop_flatMapComposition = property((e: Either[Int, Int]) => { - def f(x: Int) = if(x % 2 == 0) Left(x) else Right(x) - def g(x: Int) = if(x % 7 == 0) Right(x) else Left(x) - e.right.flatMap(f(_)).right.flatMap(g(_)) == e.right.flatMap(f(_).right.flatMap(g(_)))}) - - val prop_mapIdentity = property((e: Either[Int, Int]) => e.right.map(x => x) == e) - - val prop_mapComposition = property((e: Either[Int, String]) => { - def f(s: String) = s.toLowerCase - def g(s: String) = s.reverse - e.right.map(x => f(g(x))) == e.right.map(x => g(x)).right.map(f(_))}) - - val prop_filter = property((e: Either[Int, Int], x: Int) => e.right.filter(_ % 2 == 0) == - (if(e.isLeft || e.right.value % 2 != 0) None else Some(e))) - - val prop_ap = property((e1: Either[Int, Int], e2: Either[Int, Int]) => { - val ee2 = e2.right map (n => (x: Int) => x + n) - e1.right.ap(ee2) == (ee2 match { - case Left(a) => Left(a) - case Right(f) => e1 match { - case Left(a) => Left(a) - case Right(b) => Right(f(b)) - } - }) - }) - - val prop_seq = property((e: Either[Int, Int]) => e.right.seq == (e match { - case Left(_) => Seq.empty - case Right(b) => Seq.singleton(b) - })) - - val prop_option = property((e: Either[Int, Int]) => e.right.option == (e match { - case Left(_) => None - case Right(b) => Some(b) - })) - } - - val prop_Either_left = property((n: Int) => Either.left(n).left.value == n) - - val prop_Either_right = property((n: Int) => Either.right(n).right.value == n) - - val prop_Either_joinLeft = property((e: Either[Either[Int, Int], Int]) => e match { - case Left(ee) => Either.joinLeft(e) == ee - case Right(n) => Either.joinLeft(e) == Right(n) - }) - - val prop_Either_joinRight = property((e: Either[Int, Either[Int, Int]]) => e match { - case Left(n) => Either.joinRight(e) == Left(n) - case Right(ee) => Either.joinRight(e) == ee - }) - - val prop_Either_lefts = property((es: List[Either[Int, Int]]) => - Either.lefts(es) == es.filter(_.isLeft).map(_.left.value)) - - val prop_Either_rights = property((es: List[Either[Int, Int]]) => - Either.rights(es) == es.filter(_.isRight).map(_.right.value)) - - val prop_Either_leftRights = property((es: List[Either[Int, Int]]) => - Either.rights(es) == es.filter(_.isRight).map(_.right.value)) - - val prop_Either_throws = property((n: Int) => - Either.throws(n) == Right(n) && Either.throws(error("error")).isLeft) - - val prop_Either_throwIt = property((e: Either[Throwable, Int]) => - try { - Either.throwIt(e) == e.right.value - } catch { - case (t) => e.isLeft && e.left.value == t - }) - - val prop_Either_reduce = property((e: Either[Int, Int]) => - Either.reduce(e) == (e match { - case Left(a) => a - case Right(a) => a - })) - - val prop_Either_iif = property((c: Boolean, a: Int, b: Int) => - Either.iif(c, a, b) == (if(c) Right(b) else Left(a))) - - val tests = List( - ("prop_either1", prop_either1), - ("prop_either2", prop_either2), - ("prop_swap", prop_swap), - ("prop_isLeftRight", prop_isLeftRight), - ("Left.prop_valueE", CheckLeftProjection.prop_valueE), - ("Left.prop_value", CheckLeftProjection.prop_value), - ("Left.prop_getOrElse", CheckLeftProjection.prop_getOrElse), - ("Left.prop_forall", CheckLeftProjection.prop_forall), - ("Left.prop_exists", CheckLeftProjection.prop_exists), - ("Left.prop_flatMapLeftIdentity", CheckLeftProjection.prop_flatMapLeftIdentity), - ("Left.prop_flatMapRightIdentity", CheckLeftProjection.prop_flatMapRightIdentity), - ("Left.prop_flatMapComposition", CheckLeftProjection.prop_flatMapComposition), - ("Left.prop_mapIdentity", CheckLeftProjection.prop_mapIdentity), - ("Left.prop_mapComposition", CheckLeftProjection.prop_mapComposition), - ("Left.prop_filter", CheckLeftProjection.prop_filter), - ("Left.prop_ap", CheckLeftProjection.prop_ap), - ("Left.prop_seq", CheckLeftProjection.prop_seq), - ("Left.prop_option", CheckLeftProjection.prop_option), - ("Right.prop_valueE", CheckRightProjection.prop_valueE), - ("Right.prop_value", CheckRightProjection.prop_value), - ("Right.prop_getOrElse", CheckRightProjection.prop_getOrElse), - ("Right.prop_forall", CheckRightProjection.prop_forall), - ("Right.prop_exists", CheckRightProjection.prop_exists), - ("Right.prop_flatMapLeftIdentity", CheckRightProjection.prop_flatMapLeftIdentity), - ("Right.prop_flatMapRightIdentity", CheckRightProjection.prop_flatMapRightIdentity), - ("Right.prop_flatMapComposition", CheckRightProjection.prop_flatMapComposition), - ("Right.prop_mapIdentity", CheckRightProjection.prop_mapIdentity), - ("Right.prop_mapComposition", CheckRightProjection.prop_mapComposition), - ("Right.prop_filter", CheckRightProjection.prop_filter), - ("Right.prop_ap", CheckRightProjection.prop_ap), - ("Right.prop_seq", CheckRightProjection.prop_seq), - ("Right.prop_option", CheckRightProjection.prop_option), - ("prop_Either_left", prop_Either_left), - ("prop_Either_right", prop_Either_right), - ("prop_Either_joinLeft", prop_Either_joinLeft), - ("prop_Either_joinRight", prop_Either_joinRight), - ("prop_Either_lefts", prop_Either_lefts), - ("prop_Either_rights", prop_Either_rights), - ("prop_Either_leftRights", prop_Either_leftRights), - ("prop_Either_throws", prop_Either_throws), - ("prop_Either_throwIt", prop_Either_throwIt), - ("prop_Either_reduce", prop_Either_reduce), - ("prop_Either_iif", prop_Either_iif) - ) - - def main(args: Array[String]) = - tests foreach (tupled((name, prop) => - testStatsEx(name, testReport(check(Params(500, 0, 0, 500, StdRand), prop, propReport))))) -} - diff --git a/test/pending/scalacheck/array.scala b/test/pending/scalacheck/array.scala deleted file mode 100644 index 03c0217180..0000000000 --- a/test/pending/scalacheck/array.scala +++ /dev/null @@ -1,37 +0,0 @@ -import org.scalacheck._ -import Prop._ -import Gen._ -import Arbitrary._ -import util._ -import Buildable._ -import scala.collection.mutable.ArraySeq - -object Test extends Properties("Array") { - /** At this moment the authentic scalacheck Array Builder/Arb bits are commented out. - */ - implicit def arbArray[T](implicit a: Arbitrary[T], m: Manifest[T]): Arbitrary[Array[T]] = - Arbitrary(containerOf[List,T](arbitrary[T]) map (_.toArray)) - - val arrGen: Gen[Array[_]] = oneOf( - arbitrary[Array[Int]], - arbitrary[Array[Array[Int]]], - arbitrary[Array[List[String]]], - arbitrary[Array[String]], - arbitrary[Array[Boolean]], - arbitrary[Array[AnyVal]] - ) - - // inspired by #1857 and #2352 - property("eq/ne") = forAll(arrGen, arrGen) { (c1, c2) => - (c1 eq c2) || (c1 ne c2) - } - - // inspired by #2299 - def smallInt = choose(1, 10) - property("ofDim") = forAll(smallInt, smallInt, smallInt) { (i1, i2, i3) => - val arr = Array.ofDim[String](i1, i2, i3) - val flattened = arr flatMap (x => x) flatMap (x => x) - flattened.length == i1 * i2 * i3 - } -} - diff --git a/test/pending/scalacheck/eqeq.scala b/test/pending/scalacheck/eqeq.scala deleted file mode 100644 index 60fe63c207..0000000000 --- a/test/pending/scalacheck/eqeq.scala +++ /dev/null @@ -1,37 +0,0 @@ -import org.scalacheck._ -import Prop._ -import Gen._ - -object Test extends Properties("==") { - def equalObjectsEqualHashcodes(x: Any, y: Any) = (x != y) || (x == y && x.## == y.##) - - // ticket #2087 - property("short/char") = forAll { (x: Short) => { - val ch: Char = x.toChar - (x == ch) == (ch == x) - } - } - - property("symmetry") = forAll { (x: AnyVal, y: AnyVal) => (x == y) == (y == x) } - property("transitivity") = forAll { (x: AnyVal, y: AnyVal, z: AnyVal) => x != y || y != z || x == z } - - property("##") = forAll { - (x: Short) => { - val anyvals = List(x.toByte, x.toChar, x, x.toInt, x.toLong, x.toFloat, x.toDouble, BigInt(x), BigDecimal(x)) - val shortAndLarger = anyvals drop 2 - - val result = ( - ((anyvals, anyvals).zipped forall equalObjectsEqualHashcodes) && - ((shortAndLarger, shortAndLarger).zipped forall (_ == _)) && - ((shortAndLarger, shortAndLarger).zipped forall ((x, y) => (x: Any) == (y: Any))) - ) - result - } - } - property("## 2") = forAll { - (dv: Double) => { - val fv = dv.toFloat - (fv != dv) || (fv.## == dv.##) - } - } -} diff --git a/test/pending/scalacheck/list.scala b/test/pending/scalacheck/list.scala deleted file mode 100644 index 1caf35e872..0000000000 --- a/test/pending/scalacheck/list.scala +++ /dev/null @@ -1,21 +0,0 @@ -import org.scalacheck._ -import Prop._ -import Gen._ - -object Test extends Properties("List") { - def sorted(xs: List[Int]) = xs sortWith (_ < _) - - 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).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.distinct == List(x)) - } - } -} - diff --git a/test/pending/scalacheck/range.scala b/test/pending/scalacheck/range.scala deleted file mode 100644 index faa1f5d479..0000000000 --- a/test/pending/scalacheck/range.scala +++ /dev/null @@ -1,205 +0,0 @@ -import org.scalacheck._ -import Prop._ -import Gen._ -import Arbitrary._ - -class Counter(r: Range) { - var cnt = 0L - var last: Option[Int] = None - val str = "Range["+r.start+", "+r.end+", "+r.step+(if (r.isInclusive) "]" else ")") - def apply(x: Int) = { - cnt += 1L - if (cnt % 500000000L == 0L) { - println("Working: %s %d %d" format (str, cnt, x)) - } - if (cnt > (Int.MaxValue.toLong + 1) * 2) - error("Count exceeds maximum possible for an Int Range") - if ((r.step > 0 && last.exists(_ > x)) || (r.step < 0 && last.exists(_ < x))) - error("Range wrapped: %d %s" format (x, last.toString)) - last = Some(x) - } -} - -abstract class RangeTest(kind: String) extends Properties("Range "+kind) { - def myGen: Gen[Range] - - val genRange = for { - start <- arbitrary[Int] - end <- arbitrary[Int] - step <- Gen.choose(1, (start - end).abs + 1) - } yield if (start < end) Range(start, end, step) else Range(start, end, -step) - - val genReasonableSizeRange = for { - start <- choose(-Int.MinValue, Int.MaxValue) - end <- choose(-Int.MinValue, Int.MaxValue) - step <- choose(-Int.MaxValue, Int.MaxValue) - } yield Range(start, end, if (step == 0) 100 else step) - - val genSmallRange = for { - start <- choose(-100, 100) - end <- choose(-100, 100) - step <- choose(1, 1) - } yield if (start < end) Range(start, end, step) else Range(start, end, -step) - - val genRangeByOne = for { - start <- arbitrary[Int] - end <- arbitrary[Int] - if (end.toLong - start.toLong).abs <= 10000000L - } yield if (start < end) Range(start, end) else Range(end, start) - - def str(r: Range) = "Range["+r.start+", "+r.end+", "+r.step+(if (r.isInclusive) "]" else ")") - - def expectedSize(r: Range): Long = if (r.isInclusive) { - (r.end.toLong - r.start.toLong < 0, r.step < 0) match { - case (true, true) | (false, false) => (r.end.toLong - r.start.toLong).abs / r.step.abs.toLong + 1L - case _ => if (r.start == r.end) 1L else 0L - } - } else { - (r.end.toLong - r.start.toLong < 0, r.step < 0) match { - case (true, true) | (false, false) => ( - (r.end.toLong - r.start.toLong).abs / r.step.abs.toLong - + (if ((r.end.toLong - r.start.toLong).abs % r.step.abs.toLong > 0L) 1L else 0L) - ) - case _ => 0L - } - } - - def within(r: Range, x: Int) = if (r.step > 0) - r.start <= x && (if (r.isInclusive) x <= r.end else x < r.end) - else - r.start >= x && (if (r.isInclusive) x >= r.end else x > r.end) - - def multiple(r: Range, x: Int) = (x.toLong - r.start) % r.step == 0 - - property("foreach.step") = forAll(myGen) { r => - var allValid = true - val cnt = new Counter(r) -// println("--------------------") -// println(r) - r foreach { x => cnt(x) -// println(x + ", " + (x - r.start) + ", " + (x.toLong - r.start) + ", " + ((x.toLong - r.start) % r.step)) - allValid &&= multiple(r, x) - } - allValid :| str(r) - } - - property("foreach.inside.range") = forAll(myGen) { r => - var allValid = true - var last: Option[Int] = None - val cnt = new Counter(r) - r foreach { x => cnt(x) - allValid &&= within(r, x) - } - allValid :| str(r) - } - - property("foreach.visited.size") = forAll(myGen) { r => - var visited = 0L - val cnt = new Counter(r) - r foreach { x => cnt(x) - visited += 1L - } -// println("----------") -// println(str(r)) -// println("size: " + r.size) -// println("expected: " + expectedSize(r)) -// println("visited: " + visited) - (visited == expectedSize(r)) :| str(r) - } - - property("length") = forAll(myGen suchThat (r => expectedSize(r).toInt == expectedSize(r))) { r => - (r.length == expectedSize(r)) :| str(r) - } - - property("isEmpty") = forAll(myGen suchThat (r => expectedSize(r).toInt == expectedSize(r))) { r => - (r.isEmpty == (expectedSize(r) == 0L)) :| str(r) - } - - property("contains") = forAll(myGen, arbInt.arbitrary) { (r, x) => -// println("----------------") -// println(str(r)) -// println(x) -// println("within: " + within(r, x)) -// println("multiple: " + multiple(r, x)) -// println("contains: " + r.contains(x)) - ((within(r, x) && multiple(r, x)) == r.contains(x)) :| str(r)+": "+x - } - - property("take") = forAll(myGen suchThat (r => expectedSize(r).toInt == expectedSize(r)), arbInt.arbitrary) { (r, x) => - val t = r take x - (t.size == (0 max x min r.size) && t.start == r.start && t.step == r.step) :| str(r)+" / "+str(t)+": "+x - } - - property("takeWhile") = forAll(myGen suchThat (r => expectedSize(r).toInt == expectedSize(r)), arbInt.arbitrary) { (r, x) => - val t = (if (r.step > 0) r takeWhile (_ <= x) else r takeWhile(_ >= x)) - if (r.size == 0) { - (t.size == 0) :| str(r)+" / "+str(t)+": "+x - } else { - val t2 = (if (r.step > 0) Range(r.start, x min r.last, r.step).inclusive else Range(r.start, x max r.last, r.step).inclusive) - (t.start == r.start && t.size == t2.size && t.step == r.step) :| str(r)+" / "+str(t)+" / "+str(t2)+": "+x - } - } - - property("reverse.toSet.equal") = forAll(myGen) { r => - val reversed = r.reverse - val aresame = r.toSet == reversed.toSet - if (!aresame) { - println(str(r)) - println(r) - println(reversed) - println(r.toSet) - println(reversed.toSet) - } - aresame - } -} - -object NormalRangeTest extends RangeTest("normal") { - override def myGen = genReasonableSizeRange - def genOne = for { - start <- arbitrary[Int] - end <- arbitrary[Int] - if (start.toLong - end.toLong).abs < Int.MaxValue.toLong - } yield Range(start, end, if (start < end) 1 else - 1) - property("by 1.size + 1 == inclusive.size") = forAll(genOne) { r => - (r.size + 1 == r.inclusive.size) :| str(r) - } -} - -object InclusiveRangeTest extends RangeTest("inclusive") { - override def myGen = for (r <- genReasonableSizeRange) yield r.inclusive -} - -object ByOneRangeTest extends RangeTest("byOne") { - override def myGen = genSmallRange -} - -object InclusiveByOneRangeTest extends RangeTest("inclusiveByOne") { - override def myGen = for (r <- genSmallRange) yield r.inclusive -} - -object SmallValuesRange extends RangeTest("smallValues") { - override def myGen = genSmallRange -} - -object Test extends Properties("Range") { - include(NormalRangeTest) - include(InclusiveRangeTest) - include(ByOneRangeTest) - include(InclusiveByOneRangeTest) -} - -/* Mini-benchmark -def testRange(i: Int, j: Int, k: Int) = { - var count = 0 - for { - vi <- 0 to i - vj <- 0 to j - vk <- 0 to k - } { count += 1 } -} - -testRange(10, 1000, 10000) -testRange(10000, 1000, 10) -*/ - diff --git a/test/pending/scalacheck/scan.scala b/test/pending/scalacheck/scan.scala deleted file mode 100644 index e9b25ce3df..0000000000 --- a/test/pending/scalacheck/scan.scala +++ /dev/null @@ -1,17 +0,0 @@ -import org.scalacheck._ -import Prop._ -import Gen._ - - -object Test extends Properties("TraversableLike.scanLeft") { - property("scanLeft") = forAll { (xs: List[Int], z: Int) => { - val sums = xs.scanLeft(z)(_ + _) - (xs.size == 0) || sums.zip(sums.tail).map(x => x._2 - x._1) == xs - }} -} - - - - - - diff --git a/test/pending/run/bug2365/run b/test/pending/script/bug2365.sh index f3c44ad086..f3c44ad086 100755 --- a/test/pending/run/bug2365/run +++ b/test/pending/script/bug2365.sh diff --git a/test/pending/script/errors.check b/test/pending/script/error-messages.check index 1aee1fb44a..1aee1fb44a 100644 --- a/test/pending/script/errors.check +++ b/test/pending/script/error-messages.check diff --git a/test/pending/script/errors.scala b/test/pending/script/error-messages.scala index 2e2025b203..2e2025b203 100644 --- a/test/pending/script/errors.scala +++ b/test/pending/script/error-messages.scala |