update to ScalaCheck 1.11.0

This commit is contained in:
Mark Harrah 2013-11-04 11:27:46 -05:00
parent 57f87fe6c1
commit cfe5f3cebc
2 changed files with 10 additions and 5 deletions

View File

@ -18,7 +18,7 @@ object DagSpecification extends Properties("Dag")
private def dagGen(nodeCount: Int): Gen[TestDag] =
{
val nodes = new HashSet[TestDag]
def nonterminalGen(p: Gen.Params): Gen[TestDag] =
def nonterminalGen(p: Gen.Parameters): Gen[TestDag] =
{
for(i <- 0 until nodeCount; nextDeps <- Gen.someOf(nodes).apply(p))
nodes += new TestDag(i, nextDeps)
@ -27,7 +27,7 @@ object DagSpecification extends Properties("Dag")
}
Gen.parameterized(nonterminalGen)
}
private def isSet[T](c: Seq[T]) = Set(c: _*).size == c.size
private def dependenciesPrecedeNodes(sort: List[TestDag]) =
{

View File

@ -8,7 +8,12 @@ import Process._
object ProcessSpecification extends Properties("Process I/O")
{
implicit val exitCodeArb: Arbitrary[Array[Byte]] = Arbitrary(Gen.choose(0, 10) flatMap { size => Gen.resize(size, Arbitrary.arbArray[Byte].arbitrary) })
implicit val exitCodeArb: Arbitrary[Array[Byte]] = Arbitrary(
for(size <- Gen.choose(0, 10);
l <- Gen.listOfN[Byte](size, Arbitrary.arbByte.arbitrary))
yield
l.toArray
)
/*property("Correct exit code") = forAll( (exitCode: Byte) => checkExit(exitCode))
property("#&& correct") = forAll( (exitCodes: Array[Byte]) => checkBinary(exitCodes)(_ #&& _)(_ && _))
@ -99,7 +104,7 @@ object ProcessSpecification extends Properties("Process I/O")
val process = f(a, b)
( process ! ) == 0 && sameFiles(a, b)
}
private def sameFiles(a: File, b: File) =
private def sameFiles(a: File, b: File) =
IO.readBytes(a) sameElements IO.readBytes(b)
private def withTempFiles[T](f: (File, File) => T): T =
@ -112,7 +117,7 @@ object ProcessSpecification extends Properties("Process I/O")
temporaryFile1.delete()
temporaryFile2.delete()
}
}
}
private def unsigned(b: Int): Int = ((b: Int) +256) % 256
private def unsigned(b: Byte): Int = unsigned(b: Int)
private def process(command: String) =