org.specs.ScalaCheck

trait ScalaCheck

trait ScalaCheck

 extends ScalaCheckMatchers with ScalaCheckVerifications


This trait can be mixed with a specification to allow the use of ScalaCheck in a specification


Source: Scalacheck.scala(14)

 Fields

addExpectation abstract def addExpectation Example ExpectationsListener
defaultParameters implicit def defaultParameters
default parameters [details]
Uses ScalaCheck default values and doesn't print anything to the console
Parameters ScalaCheckMatchers
defaultValues def defaultValues
Default values for ScalaCheck parameters
Map[Symbol, Int] ScalaCheckParameters
maxDiscarded val maxDiscarded
Values which can be used as Symbol aliases to specify ScalaCheck parameters
The naming is a bit different, in order to keep short names for frequent use cases
  • minTestsOk == minSuccessfulTests
  • maxDiscarded == maxDiscardedTests
  • minSize and maxSize keep their name
Symbol ScalaCheckParameters
maxSize val maxSize
Values which can be used as Symbol aliases to specify ScalaCheck parameters
The naming is a bit different, in order to keep short names for frequent use cases
  • minTestsOk == minSuccessfulTests
  • maxDiscarded == maxDiscardedTests
  • minSize and maxSize keep their name
Symbol ScalaCheckParameters
minSize val minSize
Values which can be used as Symbol aliases to specify ScalaCheck parameters
The naming is a bit different, in order to keep short names for frequent use cases
  • minTestsOk == minSuccessfulTests
  • maxDiscarded == maxDiscardedTests
  • minSize and maxSize keep their name
Symbol ScalaCheckParameters
minTestsOk val minTestsOk
Values which can be used as Symbol aliases to specify ScalaCheck parameters
The naming is a bit different, in order to keep short names for frequent use cases
  • minTestsOk == minSuccessfulTests
  • maxDiscarded == maxDiscardedTests
  • minSize and maxSize keep their name
Symbol ScalaCheckParameters
shouldCountExpectations def shouldCountExpectations Boolean ScalaCheckParameters
successValueToProp implicit val successValueToProp
This implicit value is useful to transform the SuccessValue returned by matchers to properties [details]
More specifically, this allows to write expectations as properties: (1 + 1) must_== 2 will return a SuccessValue if it is not throwing a FailureException. That success value will can then be considered as a property in an example: { (1 + 1) must_== 2 } must pass
see
- Expectable
(SuccessValue) => Prop ScalaCheckMatchers

 Methods

!= final def !=(arg0 : Any) Boolean Any
!= final def !=(arg0 : Object) Boolean AnyRef
== final def ==(arg0 : Object) Boolean AnyRef
== final def ==(arg0 : Any) Boolean Any
afterNShrinks protected[matcher] def afterNShrinks(args : List[Arg]) String ScalaCheckMatchers
afterNTries protected[matcher] def afterNTries(n : Int) String ScalaCheckMatchers
anyToAnyWithParameters implicit def anyToAnyWithParameters[T](f : T)
Transforms a function to an object supporting ScalaCheck parameters [details]
Any object can use this implicit definition. A stricter definition would declare one implicit conversion per function arity from 1 to 6
AnyWithParameters[T] ScalaCheckVerifications
anyToExpectationCounter implicit def anyToExpectationCounter[T](a : => T)
Adds an isExpectation method to any block of code (mock expectation, scalacheck property) to better count the number of expectations
ExpectationCounter[T] ExpectationsListener
asInstanceOf final def asInstanceOf[T0] T0 Any
checkFunction def checkFunction[T](g : Gen[T])(f : (T) => Boolean)(p : Parameters) (Boolean, String, String) ScalaCheckMatchers
checkProp def checkProp(params : Params, prop : Prop, printResult : (Int, Int) => Unit) Result ScalaCheckFunctions
checkProperty def checkProperty(prop : Prop)(p : Parameters)
checks if the property is true for each generated value, and with the specified generation parameters p [details]
p is transformed into a scalacheck parameters and indicates if the generation should be verbose or not
(Boolean, String, String) ScalaCheckMatchers
checkScalaCheckProperty def checkScalaCheckProperty(prop : Prop)(params : Params, verbose : Boolean)
checks if the property is true for each generated value, and with the specified scalacheck parameters [details]
If verbose is true, then print the results on the console
(Boolean, String, String) ScalaCheckMatchers
clone protected def clone Object AnyRef
counterExample protected[matcher] def counterExample(args : List[Arg]) String ScalaCheckMatchers
dontExpectProperties def dontExpectProperties
declare that no expectation should be added each time a property is evaluated
ScalaCheckParameters ScalaCheckParameters
eq final def eq(arg0 : Object) Boolean AnyRef
equals def equals(arg0 : Any) Boolean AnyRef
expectProperties def expectProperties
declare that an expectation should be added each time a property is evaluated (default)
ScalaCheckParameters ScalaCheckParameters
finalize protected def finalize Unit AnyRef
flush override def flush
flushes the content if necessary
Unit ConsoleOutput
forAllProp def forAllProp[A, P](g : Gen[A])(f : (A) => Prop) Prop ScalaCheckFunctions
getClass final def getClass Class[Object] AnyRef
hashCode def hashCode Int AnyRef
isExpectation def isExpectation[T](a : => T)
Declares a block of code to count as an expectation
T ExpectationsListener
isInstanceOf final def isInstanceOf[T0] Boolean Any
ne final def ne(arg0 : Object) Boolean AnyRef
noCounterExample protected[matcher] def noCounterExample(n : Int) String ScalaCheckMatchers
notify final def notify Unit AnyRef
notifyAll final def notifyAll Unit AnyRef
pass def pass[T, S](f : (T) => Boolean)(implicit params : Parameters)
Matches ok if the function T => Boolean returns true for any generated value
Usage: generated_values must pass(function)
Matcher[Gen[T]] ScalaCheckMatchers
pass def pass(implicit params : Parameters)
Matches ok if the property is proved for any generated value
Usage: property must pass
Matcher[Prop] ScalaCheckMatchers
pass def pass[T](g : Gen[T])(implicit params : Parameters)
Matches ok if the function T => Boolean returns true for any generated value
Usage: function must pass(generated_values)
[details]
param
params - are the given by the implicit default parameters of ScalaCheck
Matcher[(T) => Boolean] ScalaCheckMatchers
pass def pass[T](prop : Prop)(implicit params : Parameters)
Matches ok if the property is proved for any generated value
Usage: generated_values must pass(property)
Matcher[Gen[T]] ScalaCheckMatchers
printStackTrace def printStackTrace(t : Throwable)
prints stacktraces
Unit Output
printf def printf(format : String, args : Any*)
prints several objects according to a format string (see Console [details]
printf)
Unit ConsoleOutput
println def println(m : Any)
prints an object with a newline
Unit ConsoleOutput
setParams def setParams(p : Seq[(Symbol, Int)])
This function transform the varargs parameters into a Map with default values if some expected values are not provided by the user
Map[Symbol, Int] ScalaCheckParameters
successValueToBoolean implicit def successValueToBoolean(s : SuccessValue)
transforms a SuccessValue to a boolean
Boolean SuccessValues
successValueToString def successValueToString(s : SuccessValue)
by default a SuccessValue is "silent"
String SuccessValues
synchronized final def synchronized[T0](arg0 : T0) T0 AnyRef
toString def toString String AnyRef
toVerifies implicit def toVerifies(e : String)
This implicit uses a string describing a function to check with ScalaCheck with the "verifies" function
VerifiableExpectation ScalaCheckVerifications
wait final def wait Unit AnyRef
wait final def wait(arg0 : Long) Unit AnyRef
wait final def wait(arg0 : Long, arg1 : Int) Unit AnyRef
Copyright (c) 2007-2009. All Rights Reserved.