Object

scalachecklib

PropertiesSection

Related Doc: package scalachecklib

Permalink

object PropertiesSection extends Checkers with Matchers with Section

A property is the testable unit in ScalaCheck, and is represented by the org.scalacheck.Prop class. There are several ways to create properties in ScalaCheck, one of them is to use the org.scalacheck.Prop.forAll method like in the example below.

scala> val propConcatLists = forAll { (l1: List[Int], l2: List[Int]) =>
  l1.size + l2.size == (l1 ::: l2).size }

We can use the check method to test it:

scala> propConcatLists.check
+ OK, passed 100 tests.

OK, that seemed alright. Now, we'll define another property.

scala> val propSqrt = forAll { (n: Int) => scala.math.sqrt(n*n) == n }

And check it:

scala> propSqrt.check
! Falsified after 2 passed tests.
> ARG_0: -1
> ARG_0_ORIGINAL: -488187735

Not surprisingly, the property doesn't hold. The argument -1 falsifies it. You can also see that the argument -488187735 falsifies the property. That was the first argument ScalaCheck found, and it was then simplified to -1.

The forAll method creates universally quantified properties directly, but it is also possible to create new properties by combining other properties, or to use any of the specialised methods in the org.scalacheck.Prop object.

Linear Supertypes
Section, Matchers, Explicitly, MatcherWords, ShouldVerb, Tolerance, Assertions, TripleEquals, TripleEqualsSupport, Checkers, Configuration, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. PropertiesSection
  2. Section
  3. Matchers
  4. Explicitly
  5. MatcherWords
  6. ShouldVerb
  7. Tolerance
  8. Assertions
  9. TripleEquals
  10. TripleEqualsSupport
  11. Checkers
  12. Configuration
  13. AnyRef
  14. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. final class AWord extends AnyRef

    Permalink
    Definition Classes
    Matchers
  2. final class AnWord extends AnyRef

    Permalink
    Definition Classes
    Matchers
  3. sealed class AnyShouldWrapper[T] extends AnyRef

    Permalink
    Definition Classes
    Matchers
  4. class AssertionsHelper extends AnyRef

    Permalink
    Definition Classes
    Assertions
  5. class CheckingEqualizer[L] extends AnyRef

    Permalink
    Definition Classes
    TripleEqualsSupport
  6. class DecidedByEquality[A] extends Equality[A]

    Permalink
    Definition Classes
    Explicitly
  7. class DecidedWord extends AnyRef

    Permalink
    Definition Classes
    Explicitly
  8. class DeterminedByEquivalence[T] extends Equivalence[T]

    Permalink
    Definition Classes
    Explicitly
  9. class DeterminedWord extends AnyRef

    Permalink
    Definition Classes
    Explicitly
  10. class Equalizer[L] extends AnyRef

    Permalink
    Definition Classes
    TripleEqualsSupport
  11. final class HavePropertyMatcherGenerator extends AnyRef

    Permalink
    Definition Classes
    Matchers
  12. final class KeyWord extends AnyRef

    Permalink
    Definition Classes
    Matchers
  13. case class MaxDiscardedFactor extends PropertyCheckConfigParam with Product with Serializable

    Permalink
    Definition Classes
    Configuration
  14. case class MinSize extends PropertyCheckConfigParam with Product with Serializable

    Permalink
    Definition Classes
    Configuration
  15. case class MinSuccessful extends PropertyCheckConfigParam with Product with Serializable

    Permalink
    Definition Classes
    Configuration
  16. final class PlusOrMinusWrapper[T] extends AnyRef

    Permalink
    Definition Classes
    Tolerance
  17. sealed abstract class PropertyCheckConfigParam extends Product with Serializable

    Permalink
    Definition Classes
    Configuration
  18. case class PropertyCheckConfiguration extends PropertyCheckConfigurable with Product with Serializable

    Permalink
    Definition Classes
    Configuration
  19. final class RegexWord extends AnyRef

    Permalink
    Definition Classes
    Matchers
  20. final class RegexWrapper extends AnyRef

    Permalink
    Definition Classes
    Matchers
  21. class ResultOfBeWordForAny[T] extends AnyRef

    Permalink
    Definition Classes
    Matchers
  22. sealed class ResultOfBeWordForCollectedAny[T] extends AnyRef

    Permalink
    Definition Classes
    Matchers
  23. final class ResultOfBeWordForCollectedArray[T] extends ResultOfBeWordForCollectedAny[Array[T]]

    Permalink
    Definition Classes
    Matchers
  24. final class ResultOfCollectedAny[T] extends AnyRef

    Permalink
    Definition Classes
    Matchers
  25. final class ResultOfContainWordForCollectedAny[T] extends AnyRef

    Permalink
    Definition Classes
    Matchers
  26. final class ResultOfEndWithWordForCollectedString extends AnyRef

    Permalink
    Definition Classes
    Matchers
  27. final class ResultOfEndWithWordForString extends AnyRef

    Permalink
    Definition Classes
    Matchers
  28. final class ResultOfFullyMatchWordForCollectedString extends AnyRef

    Permalink
    Definition Classes
    Matchers
  29. final class ResultOfFullyMatchWordForString extends AnyRef

    Permalink
    Definition Classes
    Matchers
  30. final class ResultOfHaveWordForCollectedExtent[A] extends AnyRef

    Permalink
    Definition Classes
    Matchers
  31. final class ResultOfHaveWordForExtent[A] extends AnyRef

    Permalink
    Definition Classes
    Matchers
  32. final class ResultOfIncludeWordForCollectedString extends AnyRef

    Permalink
    Definition Classes
    Matchers
  33. final class ResultOfIncludeWordForString extends AnyRef

    Permalink
    Definition Classes
    Matchers
  34. final class ResultOfNotWordForCollectedAny[T] extends AnyRef

    Permalink
    Definition Classes
    Matchers
  35. final class ResultOfStartWithWordForCollectedString extends AnyRef

    Permalink
    Definition Classes
    Matchers
  36. final class ResultOfStartWithWordForString extends AnyRef

    Permalink
    Definition Classes
    Matchers
  37. case class SizeRange extends PropertyCheckConfigParam with Product with Serializable

    Permalink
    Definition Classes
    Configuration
  38. final class StringShouldWrapper extends AnyShouldWrapper[String] with org.scalatest.Matchers.StringShouldWrapperForVerb

    Permalink
    Definition Classes
    Matchers
  39. trait StringShouldWrapperForVerb extends AnyRef

    Permalink
    Definition Classes
    ShouldVerb
  40. class TheAfterWord extends AnyRef

    Permalink
    Definition Classes
    Explicitly
  41. final class TheSameInstanceAsPhrase extends AnyRef

    Permalink
    Definition Classes
    Matchers
  42. final class ValueWord extends AnyRef

    Permalink
    Definition Classes
    Matchers
  43. case class Workers extends PropertyCheckConfigParam with Product with Serializable

    Permalink
    Definition Classes
    Configuration
  44. case class MaxDiscarded extends PropertyCheckConfigParam with Product with Serializable

    Permalink
    Definition Classes
    Configuration
    Annotations
    @deprecated
    Deprecated
  45. case class MaxSize extends PropertyCheckConfigParam with Product with Serializable

    Permalink
    Definition Classes
    Configuration
    Annotations
    @deprecated
    Deprecated

    use SizeRange instead

  46. case class PropertyCheckConfig extends PropertyCheckConfigurable with Product with Serializable

    Permalink
    Definition Classes
    Configuration
    Annotations
    @deprecated
    Deprecated

    Use PropertyCheckConfiguration instead

  47. trait PropertyCheckConfigurable extends AnyRef

    Permalink
    Definition Classes
    Configuration
    Annotations
    @deprecated
    Deprecated

    Use PropertyCheckConfiguration directly instead.

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. def !==[T](right: Spread[T]): TripleEqualsInvocationOnSpread[T]

    Permalink
    Definition Classes
    TripleEqualsSupport
  3. def !==(right: Null): TripleEqualsInvocation[Null]

    Permalink
    Definition Classes
    TripleEqualsSupport
  4. def !==[T](right: T): TripleEqualsInvocation[T]

    Permalink
    Definition Classes
    TripleEqualsSupport
  5. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  6. def <[T](right: T)(implicit arg0: Ordering[T]): ResultOfLessThanComparison[T]

    Permalink
    Definition Classes
    Matchers
  7. def <=[T](right: T)(implicit arg0: Ordering[T]): ResultOfLessThanOrEqualToComparison[T]

    Permalink
    Definition Classes
    Matchers
  8. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  9. def ===[T](right: Spread[T]): TripleEqualsInvocationOnSpread[T]

    Permalink
    Definition Classes
    TripleEqualsSupport
  10. def ===(right: Null): TripleEqualsInvocation[Null]

    Permalink
    Definition Classes
    TripleEqualsSupport
  11. def ===[T](right: T): TripleEqualsInvocation[T]

    Permalink
    Definition Classes
    TripleEqualsSupport
  12. def >[T](right: T)(implicit arg0: Ordering[T]): ResultOfGreaterThanComparison[T]

    Permalink
    Definition Classes
    Matchers
  13. def >=[T](right: T)(implicit arg0: Ordering[T]): ResultOfGreaterThanOrEqualToComparison[T]

    Permalink
    Definition Classes
    Matchers
  14. implicit def PropertyCheckConfig2PropertyCheckConfiguration(p: PropertyCheckConfig): PropertyCheckConfiguration

    Permalink
    Definition Classes
    Configuration
  15. def a[T](implicit arg0: ClassTag[T]): ResultOfATypeInvocation[T]

    Permalink
    Definition Classes
    Matchers
  16. val a: AWord

    Permalink
    Definition Classes
    Matchers
  17. val after: TheAfterWord

    Permalink
    Definition Classes
    Explicitly
  18. def all(xs: String)(implicit collecting: Collecting[Char, String], prettifier: Prettifier, pos: Position): ResultOfCollectedAny[Char]

    Permalink
    Definition Classes
    Matchers
  19. def all[K, V, JMAP[k, v] <: Map[k, v]](xs: JMAP[K, V])(implicit collecting: Collecting[Entry[K, V], JMAP[K, V]], prettifier: Prettifier, pos: Position): ResultOfCollectedAny[Entry[K, V]]

    Permalink
    Definition Classes
    Matchers
  20. def all[E, C[_]](xs: C[E])(implicit collecting: Collecting[E, C[E]], prettifier: Prettifier, pos: Position): ResultOfCollectedAny[E]

    Permalink
    Definition Classes
    Matchers
  21. def allElementsOf[R](elements: GenTraversable[R]): ResultOfAllElementsOfApplication

    Permalink
    Definition Classes
    Matchers
  22. def allOf(firstEle: Any, secondEle: Any, remainingEles: Any*)(implicit pos: Position): ResultOfAllOfApplication

    Permalink
    Definition Classes
    Matchers
  23. def an[T](implicit arg0: ClassTag[T]): ResultOfAnTypeInvocation[T]

    Permalink
    Definition Classes
    Matchers
  24. val an: AnWord

    Permalink
    Definition Classes
    Matchers
  25. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  26. macro def assert(condition: Boolean, clue: Any)(implicit prettifier: Prettifier, pos: Position): Assertion

    Permalink
    Definition Classes
    Assertions
  27. macro def assert(condition: Boolean)(implicit prettifier: Prettifier, pos: Position): Assertion

    Permalink
    Definition Classes
    Assertions
  28. macro def assertCompiles(code: String)(implicit pos: Position): Assertion

    Permalink
    Definition Classes
    Assertions
  29. macro def assertDoesNotCompile(code: String)(implicit pos: Position): Assertion

    Permalink
    Definition Classes
    Assertions
  30. def assertResult(expected: Any)(actual: Any)(implicit prettifier: Prettifier, pos: Position): Assertion

    Permalink
    Definition Classes
    Assertions
  31. def assertResult(expected: Any, clue: Any)(actual: Any)(implicit prettifier: Prettifier, pos: Position): Assertion

    Permalink
    Definition Classes
    Assertions
  32. def assertThrows[T <: AnyRef](f: ⇒ Any)(implicit classTag: ClassTag[T], pos: Position): Assertion

    Permalink
    Definition Classes
    Assertions
  33. macro def assertTypeError(code: String)(implicit pos: Position): Assertion

    Permalink
    Definition Classes
    Assertions
  34. val assertionsHelper: AssertionsHelper

    Permalink
    Definition Classes
    Assertions
  35. macro def assume(condition: Boolean, clue: Any)(implicit prettifier: Prettifier, pos: Position): Assertion

    Permalink
    Definition Classes
    Assertions
  36. macro def assume(condition: Boolean)(implicit prettifier: Prettifier, pos: Position): Assertion

    Permalink
    Definition Classes
    Assertions
  37. def atLeast(num: Int, xs: String)(implicit collecting: Collecting[Char, String], prettifier: Prettifier, pos: Position): ResultOfCollectedAny[Char]

    Permalink
    Definition Classes
    Matchers
  38. def atLeast[K, V, JMAP[k, v] <: Map[k, v]](num: Int, xs: JMAP[K, V])(implicit collecting: Collecting[Entry[K, V], JMAP[K, V]], prettifier: Prettifier, pos: Position): ResultOfCollectedAny[Entry[K, V]]

    Permalink
    Definition Classes
    Matchers
  39. def atLeast[E, C[_]](num: Int, xs: C[E])(implicit collecting: Collecting[E, C[E]], prettifier: Prettifier, pos: Position): ResultOfCollectedAny[E]

    Permalink
    Definition Classes
    Matchers
  40. def atLeastOneElementOf(elements: GenTraversable[Any]): ResultOfAtLeastOneElementOfApplication

    Permalink
    Definition Classes
    Matchers
  41. def atLeastOneOf(firstEle: Any, secondEle: Any, remainingEles: Any*)(implicit pos: Position): ResultOfAtLeastOneOfApplication

    Permalink
    Definition Classes
    Matchers
  42. def atMost(num: Int, xs: String)(implicit collecting: Collecting[Char, String], prettifier: Prettifier, pos: Position): ResultOfCollectedAny[Char]

    Permalink
    Definition Classes
    Matchers
  43. def atMost[K, V, JMAP[k, v] <: Map[k, v]](num: Int, xs: JMAP[K, V])(implicit collecting: Collecting[Entry[K, V], JMAP[K, V]], prettifier: Prettifier, pos: Position): ResultOfCollectedAny[Entry[K, V]]

    Permalink
    Definition Classes
    Matchers
  44. def atMost[E, C[_]](num: Int, xs: C[E])(implicit collecting: Collecting[E, C[E]], prettifier: Prettifier, pos: Position): ResultOfCollectedAny[E]

    Permalink
    Definition Classes
    Matchers
  45. def atMostOneElementOf[R](elements: GenTraversable[R]): ResultOfAtMostOneElementOfApplication

    Permalink
    Definition Classes
    Matchers
  46. def atMostOneOf(firstEle: Any, secondEle: Any, remainingEles: Any*)(implicit pos: Position): ResultOfAtMostOneOfApplication

    Permalink
    Definition Classes
    Matchers
  47. val be: BeWord

    Permalink
    Definition Classes
    MatcherWords
  48. def between(from: Int, upTo: Int, xs: String)(implicit collecting: Collecting[Char, String], prettifier: Prettifier, pos: Position): ResultOfCollectedAny[Char]

    Permalink
    Definition Classes
    Matchers
  49. def between[K, V, JMAP[k, v] <: Map[k, v]](from: Int, upTo: Int, xs: JMAP[K, V])(implicit collecting: Collecting[Entry[K, V], JMAP[K, V]], prettifier: Prettifier, pos: Position): ResultOfCollectedAny[Entry[K, V]]

    Permalink
    Definition Classes
    Matchers
  50. def between[E, C[_]](from: Int, upTo: Int, xs: C[E])(implicit collecting: Collecting[E, C[E]], prettifier: Prettifier, pos: Position): ResultOfCollectedAny[E]

    Permalink
    Definition Classes
    Matchers
  51. def cancel(cause: Throwable)(implicit pos: Position): Nothing

    Permalink
    Definition Classes
    Assertions
  52. def cancel(message: String, cause: Throwable)(implicit pos: Position): Nothing

    Permalink
    Definition Classes
    Assertions
  53. def cancel(message: String)(implicit pos: Position): Nothing

    Permalink
    Definition Classes
    Assertions
  54. def cancel()(implicit pos: Position): Nothing

    Permalink
    Definition Classes
    Assertions
  55. def check[ASSERTION](p: Prop, configParams: PropertyCheckConfigParam*)(implicit config: PropertyCheckConfigurable, asserting: CheckerAsserting[ASSERTION], prettifier: Prettifier, pos: Position): Result

    Permalink
    Definition Classes
    Checkers
  56. def check[ASSERTION](p: Prop, prms: Parameters)(implicit asserting: CheckerAsserting[ASSERTION], prettifier: Prettifier, pos: Position): Result

    Permalink
    Definition Classes
    Checkers
  57. def check[A1, A2, A3, A4, A5, A6, P, ASSERTION](f: (A1, A2, A3, A4, A5, A6) ⇒ P, configParams: PropertyCheckConfigParam*)(implicit config: PropertyCheckConfigurable, p: (P) ⇒ Prop, a1: Arbitrary[A1], s1: Shrink[A1], pp1: (A1) ⇒ Pretty, a2: Arbitrary[A2], s2: Shrink[A2], pp2: (A2) ⇒ Pretty, a3: Arbitrary[A3], s3: Shrink[A3], pp3: (A3) ⇒ Pretty, a4: Arbitrary[A4], s4: Shrink[A4], pp4: (A4) ⇒ Pretty, a5: Arbitrary[A5], s5: Shrink[A5], pp5: (A5) ⇒ Pretty, a6: Arbitrary[A6], s6: Shrink[A6], pp6: (A6) ⇒ Pretty, asserting: CheckerAsserting[ASSERTION], prettifier: Prettifier, pos: Position): Result

    Permalink
    Definition Classes
    Checkers
  58. def check[A1, A2, A3, A4, A5, P, ASSERTION](f: (A1, A2, A3, A4, A5) ⇒ P, configParams: PropertyCheckConfigParam*)(implicit config: PropertyCheckConfigurable, p: (P) ⇒ Prop, a1: Arbitrary[A1], s1: Shrink[A1], pp1: (A1) ⇒ Pretty, a2: Arbitrary[A2], s2: Shrink[A2], pp2: (A2) ⇒ Pretty, a3: Arbitrary[A3], s3: Shrink[A3], pp3: (A3) ⇒ Pretty, a4: Arbitrary[A4], s4: Shrink[A4], pp4: (A4) ⇒ Pretty, a5: Arbitrary[A5], s5: Shrink[A5], pp5: (A5) ⇒ Pretty, asserting: CheckerAsserting[ASSERTION], prettifier: Prettifier, pos: Position): Result

    Permalink
    Definition Classes
    Checkers
  59. def check[A1, A2, A3, A4, P, ASSERTION](f: (A1, A2, A3, A4) ⇒ P, configParams: PropertyCheckConfigParam*)(implicit config: PropertyCheckConfigurable, p: (P) ⇒ Prop, a1: Arbitrary[A1], s1: Shrink[A1], pp1: (A1) ⇒ Pretty, a2: Arbitrary[A2], s2: Shrink[A2], pp2: (A2) ⇒ Pretty, a3: Arbitrary[A3], s3: Shrink[A3], pp3: (A3) ⇒ Pretty, a4: Arbitrary[A4], s4: Shrink[A4], pp4: (A4) ⇒ Pretty, asserting: CheckerAsserting[ASSERTION], prettifier: Prettifier, pos: Position): Result

    Permalink
    Definition Classes
    Checkers
  60. def check[A1, A2, A3, P, ASSERTION](f: (A1, A2, A3) ⇒ P, configParams: PropertyCheckConfigParam*)(implicit config: PropertyCheckConfigurable, p: (P) ⇒ Prop, a1: Arbitrary[A1], s1: Shrink[A1], pp1: (A1) ⇒ Pretty, a2: Arbitrary[A2], s2: Shrink[A2], pp2: (A2) ⇒ Pretty, a3: Arbitrary[A3], s3: Shrink[A3], pp3: (A3) ⇒ Pretty, asserting: CheckerAsserting[ASSERTION], prettifier: Prettifier, pos: Position): Result

    Permalink
    Definition Classes
    Checkers
  61. def check[A1, A2, P, ASSERTION](f: (A1, A2) ⇒ P, configParams: PropertyCheckConfigParam*)(implicit config: PropertyCheckConfigurable, p: (P) ⇒ Prop, a1: Arbitrary[A1], s1: Shrink[A1], pp1: (A1) ⇒ Pretty, a2: Arbitrary[A2], s2: Shrink[A2], pp2: (A2) ⇒ Pretty, asserting: CheckerAsserting[ASSERTION], prettifier: Prettifier, pos: Position): Result

    Permalink
    Definition Classes
    Checkers
  62. def check[A1, P, ASSERTION](f: (A1) ⇒ P, configParams: PropertyCheckConfigParam*)(implicit config: PropertyCheckConfigurable, p: (P) ⇒ Prop, a1: Arbitrary[A1], s1: Shrink[A1], pp1: (A1) ⇒ Pretty, asserting: CheckerAsserting[ASSERTION], prettifier: Prettifier, pos: Position): Result

    Permalink
    Definition Classes
    Checkers
  63. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  64. def combiningProperties(res0: Boolean, res1: Boolean): Assertion

    Permalink

    A third way of creating properties, is to combine existing properties into new ones.

    Combining Properties

    A third way of creating properties, is to combine existing properties into new ones.

    val p1 = forAll(...)
    val p2 = forAll(...)
    val p3 = p1 && p2
    val p4 = p1 || p2
    val p5 = p1 == p2
    val p6 = all(p1, p2) // same as p1 && p2
    val p7 = atLeastOne(p1, p2) // same as p1 || p2

    Here, p3 will hold if and only if both p1 and p2 hold, p4 will hold if either p1 or p2 holds, and p5 will hold if p1 holds exactly when p2 holds and vice versa.

  65. val compile: CompileWord

    Permalink
    Definition Classes
    MatcherWords
  66. def conditionalProperties(res0: Int): Assertion

    Permalink

    Sometimes, a specification takes the form of an implication.

    Conditional properties

    Sometimes, a specification takes the form of an implication. In ScalaCheck, you can use the implication operator ==> to filter the generated values.

    If the implication operator is given a condition that is hard or impossible to fulfill, ScalaCheck might not find enough passing test cases to state that the property holds. In the following trivial example, all cases where n is non-zero will be thrown away:

    scala> import org.scalacheck.Prop.{forAll, BooleanOperators}
    scala> val propTrivial = forAll { n: Int =>
         |  (n == 0) ==> n + 10 == 10
         | }
    
    scala> propTrivial.check
    ! Gave up after only 4 passed tests. 500 tests were discarded.

    It is possible to tell ScalaCheck to try harder when it generates test cases, but generally you should try to refactor your property specification instead of generating more test cases, if you get this scenario.

    Using implications, we realise that a property might not just pass or fail, it could also be undecided if the implication condition doesn't get fulfilled.

    In this example, ScalaCheck will only care for the cases when n is an even number.

  67. val contain: ContainWord

    Permalink
    Definition Classes
    MatcherWords
  68. def conversionCheckedConstraint[A, B](implicit equivalenceOfA: Equivalence[A], cnv: (B) ⇒ A): CanEqual[A, B]

    Permalink
    Definition Classes
    TripleEquals → TripleEqualsSupport
  69. def convertEquivalenceToAToBConstraint[A, B](equivalenceOfB: Equivalence[B])(implicit ev: <:<[A, B]): CanEqual[A, B]

    Permalink
    Definition Classes
    TripleEquals → TripleEqualsSupport
  70. def convertEquivalenceToAToBConversionConstraint[A, B](equivalenceOfB: Equivalence[B])(implicit ev: (A) ⇒ B): CanEqual[A, B]

    Permalink
    Definition Classes
    TripleEquals → TripleEqualsSupport
  71. def convertEquivalenceToBToAConstraint[A, B](equivalenceOfA: Equivalence[A])(implicit ev: <:<[B, A]): CanEqual[A, B]

    Permalink
    Definition Classes
    TripleEquals → TripleEqualsSupport
  72. def convertEquivalenceToBToAConversionConstraint[A, B](equivalenceOfA: Equivalence[A])(implicit ev: (B) ⇒ A): CanEqual[A, B]

    Permalink
    Definition Classes
    TripleEquals → TripleEqualsSupport
  73. implicit def convertNumericToPlusOrMinusWrapper[T](pivot: T)(implicit arg0: Numeric[T]): PlusOrMinusWrapper[T]

    Permalink
    Definition Classes
    Tolerance
  74. implicit def convertSymbolToHavePropertyMatcherGenerator(symbol: Symbol)(implicit prettifier: Prettifier, pos: Position): HavePropertyMatcherGenerator

    Permalink
    Definition Classes
    Matchers
  75. implicit def convertToAnyShouldWrapper[T](o: T)(implicit pos: Position, prettifier: Prettifier): AnyShouldWrapper[T]

    Permalink
    Definition Classes
    Matchers
  76. def convertToCheckingEqualizer[T](left: T): CheckingEqualizer[T]

    Permalink
    Definition Classes
    TripleEquals → TripleEqualsSupport
  77. implicit def convertToEqualizer[T](left: T): Equalizer[T]

    Permalink
    Definition Classes
    TripleEquals → TripleEqualsSupport
  78. implicit def convertToRegexWrapper(o: Regex): RegexWrapper

    Permalink
    Definition Classes
    Matchers
  79. implicit def convertToStringShouldWrapper(o: String)(implicit pos: Position, prettifier: Prettifier): StringShouldWrapper

    Permalink
    Definition Classes
    Matchers
  80. implicit def convertToStringShouldWrapperForVerb(o: String)(implicit position: Position): StringShouldWrapperForVerb

    Permalink
    Definition Classes
    ShouldVerb
  81. val decided: DecidedWord

    Permalink
    Definition Classes
    Explicitly
  82. def defaultEquality[A]: Equality[A]

    Permalink
    Definition Classes
    TripleEqualsSupport
  83. val defined: DefinedWord

    Permalink
    Definition Classes
    MatcherWords
  84. def definedAt[T](right: T): ResultOfDefinedAt[T]

    Permalink
    Definition Classes
    Matchers
  85. val determined: DeterminedWord

    Permalink
    Definition Classes
    Explicitly
  86. val empty: EmptyWord

    Permalink
    Definition Classes
    MatcherWords
  87. val endWith: EndWithWord

    Permalink
    Definition Classes
    MatcherWords
  88. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  89. def equal(o: Null): Matcher[AnyRef]

    Permalink
    Definition Classes
    Matchers
  90. def equal[T](spread: Spread[T]): Matcher[T]

    Permalink
    Definition Classes
    Matchers
  91. def equal(right: Any): MatcherFactory1[Any, Equality]

    Permalink
    Definition Classes
    MatcherWords
  92. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  93. def every(xs: String)(implicit collecting: Collecting[Char, String], prettifier: Prettifier, pos: Position): ResultOfCollectedAny[Char]

    Permalink
    Definition Classes
    Matchers
  94. def every[K, V, JMAP[k, v] <: Map[k, v]](xs: JMAP[K, V])(implicit collecting: Collecting[Entry[K, V], JMAP[K, V]], prettifier: Prettifier, pos: Position): ResultOfCollectedAny[Entry[K, V]]

    Permalink
    Definition Classes
    Matchers
  95. def every[E, C[_]](xs: C[E])(implicit collecting: Collecting[E, C[E]], prettifier: Prettifier, pos: Position): ResultOfCollectedAny[E]

    Permalink
    Definition Classes
    Matchers
  96. def exactly(num: Int, xs: String)(implicit collecting: Collecting[Char, String], prettifier: Prettifier, pos: Position): ResultOfCollectedAny[Char]

    Permalink
    Definition Classes
    Matchers
  97. def exactly[K, V, JMAP[k, v] <: Map[k, v]](num: Int, xs: JMAP[K, V])(implicit collecting: Collecting[Entry[K, V], JMAP[K, V]], prettifier: Prettifier, pos: Position): ResultOfCollectedAny[Entry[K, V]]

    Permalink
    Definition Classes
    Matchers
  98. def exactly[E, C[_]](num: Int, xs: C[E])(implicit collecting: Collecting[E, C[E]], prettifier: Prettifier, pos: Position): ResultOfCollectedAny[E]

    Permalink
    Definition Classes
    Matchers
  99. val exist: ExistWord

    Permalink
    Definition Classes
    MatcherWords
  100. def fail(cause: Throwable)(implicit pos: Position): Nothing

    Permalink
    Definition Classes
    Assertions
  101. def fail(message: String, cause: Throwable)(implicit pos: Position): Nothing

    Permalink
    Definition Classes
    Assertions
  102. def fail(message: String)(implicit pos: Position): Nothing

    Permalink
    Definition Classes
    Assertions
  103. def fail()(implicit pos: Position): Nothing

    Permalink
    Definition Classes
    Assertions
  104. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  105. val fullyMatch: FullyMatchWord

    Permalink
    Definition Classes
    MatcherWords
  106. implicit val generatorDrivenConfig: PropertyCheckConfiguration

    Permalink
    Definition Classes
    Configuration
  107. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  108. def groupingProperties(res0: Int, res1: Int, res2: Int): Assertion

    Permalink

    Often you want to specify several related properties, perhaps for all methods in a class.

    Grouping Properties

    Often you want to specify several related properties, perhaps for all methods in a class. ScalaCheck provides a simple way of doing this, through the Properties trait. Look at the following specifications that define some properties for zero.

    You can use the check method of the Properties class to check all specified properties, just like for simple Prop instances. In fact, Properties is a subtype of Prop, so you can use it just as if it was a single property.

    That single property holds if and only if all of the contained properties hold.

  109. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  110. val have: HaveWord

    Permalink
    Definition Classes
    MatcherWords
  111. def inOrder(firstEle: Any, secondEle: Any, remainingEles: Any*)(implicit pos: Position): ResultOfInOrderApplication

    Permalink
    Definition Classes
    Matchers
  112. def inOrderElementsOf[R](elements: GenTraversable[R]): ResultOfInOrderElementsOfApplication

    Permalink
    Definition Classes
    Matchers
  113. def inOrderOnly[T](firstEle: Any, secondEle: Any, remainingEles: Any*)(implicit pos: Position): ResultOfInOrderOnlyApplication

    Permalink
    Definition Classes
    Matchers
  114. val include: IncludeWord

    Permalink
    Definition Classes
    MatcherWords
  115. def intercept[T <: AnyRef](f: ⇒ Any)(implicit classTag: ClassTag[T], pos: Position): T

    Permalink
    Definition Classes
    Assertions
  116. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  117. val key: KeyWord

    Permalink
    Definition Classes
    Matchers
  118. val length: LengthWord

    Permalink
    Definition Classes
    MatcherWords
  119. def lowPriorityConversionCheckedConstraint[A, B](implicit equivalenceOfB: Equivalence[B], cnv: (A) ⇒ B): CanEqual[A, B]

    Permalink
    Definition Classes
    TripleEquals → TripleEqualsSupport
  120. def lowPriorityTypeCheckedConstraint[A, B](implicit equivalenceOfB: Equivalence[B], ev: <:<[A, B]): CanEqual[A, B]

    Permalink
    Definition Classes
    TripleEquals → TripleEqualsSupport
  121. val matchPattern: MatchPatternWord

    Permalink
    Definition Classes
    MatcherWords
  122. def maxDiscardedFactor(value: PosZDouble): MaxDiscardedFactor

    Permalink
    Definition Classes
    Configuration
  123. def message(expectedMessage: String): ResultOfMessageWordApplication

    Permalink
    Definition Classes
    Matchers
  124. def minSize(value: PosZInt): MinSize

    Permalink
    Definition Classes
    Configuration
  125. def minSuccessful(value: PosInt): MinSuccessful

    Permalink
    Definition Classes
    Configuration
  126. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  127. def no(xs: String)(implicit collecting: Collecting[Char, String], prettifier: Prettifier, pos: Position): ResultOfCollectedAny[Char]

    Permalink
    Definition Classes
    Matchers
  128. def no[K, V, JMAP[k, v] <: Map[k, v]](xs: JMAP[K, V])(implicit collecting: Collecting[Entry[K, V], JMAP[K, V]], prettifier: Prettifier, pos: Position): ResultOfCollectedAny[Entry[K, V]]

    Permalink
    Definition Classes
    Matchers
  129. def no[E, C[_]](xs: C[E])(implicit collecting: Collecting[E, C[E]], prettifier: Prettifier, pos: Position): ResultOfCollectedAny[E]

    Permalink
    Definition Classes
    Matchers
  130. def noElementsOf(elements: GenTraversable[Any]): ResultOfNoElementsOfApplication

    Permalink
    Definition Classes
    Matchers
  131. def noException(implicit pos: Position): NoExceptionWord

    Permalink
    Definition Classes
    MatcherWords
  132. def noneOf(firstEle: Any, secondEle: Any, remainingEles: Any*)(implicit pos: Position): ResultOfNoneOfApplication

    Permalink
    Definition Classes
    Matchers
  133. val not: NotWord

    Permalink
    Definition Classes
    MatcherWords
  134. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  135. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  136. def of[T](implicit ev: ClassTag[T]): ResultOfOfTypeInvocation[T]

    Permalink
    Definition Classes
    Matchers
  137. def oneElementOf(elements: GenTraversable[Any]): ResultOfOneElementOfApplication

    Permalink
    Definition Classes
    Matchers
  138. def oneOf(firstEle: Any, secondEle: Any, remainingEles: Any*)(implicit pos: Position): ResultOfOneOfApplication

    Permalink
    Definition Classes
    Matchers
  139. def only(xs: Any*)(implicit pos: Position): ResultOfOnlyApplication

    Permalink
    Definition Classes
    Matchers
  140. def pending: Assertion with PendingStatement

    Permalink
    Definition Classes
    Assertions
  141. def pendingUntilFixed(f: ⇒ Unit)(implicit pos: Position): Assertion with PendingStatement

    Permalink
    Definition Classes
    Assertions
  142. val readable: ReadableWord

    Permalink
    Definition Classes
    MatcherWords
  143. val regex: RegexWord

    Permalink
    Definition Classes
    Matchers
  144. val size: SizeWord

    Permalink
    Definition Classes
    MatcherWords
  145. def sizeRange(value: PosZInt): SizeRange

    Permalink
    Definition Classes
    Configuration
  146. val sorted: SortedWord

    Permalink
    Definition Classes
    MatcherWords
  147. val startWith: StartWithWord

    Permalink
    Definition Classes
    MatcherWords
  148. final val succeed: Assertion

    Permalink
    Definition Classes
    Assertions
  149. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  150. def the[T](implicit arg0: ClassTag[T], pos: Position): ResultOfTheTypeInvocation[T]

    Permalink
    Definition Classes
    Matchers
  151. def theSameElementsAs(xs: GenTraversable[_]): ResultOfTheSameElementsAsApplication

    Permalink
    Definition Classes
    Matchers
  152. def theSameElementsInOrderAs(xs: GenTraversable[_]): ResultOfTheSameElementsInOrderAsApplication

    Permalink
    Definition Classes
    Matchers
  153. val theSameInstanceAs: TheSameInstanceAsPhrase

    Permalink
    Definition Classes
    Matchers
  154. def thrownBy(fun: ⇒ Any): ResultOfThrownByApplication

    Permalink
    Definition Classes
    Matchers
  155. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  156. val typeCheck: TypeCheckWord

    Permalink
    Definition Classes
    MatcherWords
  157. def typeCheckedConstraint[A, B](implicit equivalenceOfA: Equivalence[A], ev: <:<[B, A]): CanEqual[A, B]

    Permalink
    Definition Classes
    TripleEquals → TripleEqualsSupport
  158. implicit def unconstrainedEquality[A, B](implicit equalityOfA: Equality[A]): CanEqual[A, B]

    Permalink
    Definition Classes
    TripleEquals → TripleEqualsSupport
  159. def universallyQuantifiedPropertiesGen(res0: Boolean): Assertion

    Permalink

    When you run check on the properties, ScalaCheck generates random instances of the function parameters and evaluates the results, reporting any failing cases.

    When you run check on the properties, ScalaCheck generates random instances of the function parameters and evaluates the results, reporting any failing cases.

    You can also give forAll a specific data generator. In the following example smallInteger defines a generator that generates integers between 0 and 100, inclusively.

    This way of using the forAll method is good to use when you want to control the data generation by specifying exactly which generator that should be used, and not rely on a default generator for the given type.

  160. def universallyQuantifiedPropertiesString(res0: Boolean): Assertion

    Permalink

    As mentioned before, org.scalacheck.Prop.forAll creates universally quantified properties.

    Universally quantified properties

    As mentioned before, org.scalacheck.Prop.forAll creates universally quantified properties. forAll takes a function as parameter, and creates a property out of it that can be tested with the check method or with Scalatest, like in these examples.

    The function passed to forAll should return Boolean or another property, and can take parameters of any types, as long as there exist implicit Arbitrary instances for the types. By default, ScalaCheck has instances for common types like Int, String, List, etc, but it is also possible to define your own Arbitrary instances.

    For example:

  161. val value: ValueWord

    Permalink
    Definition Classes
    Matchers
  162. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  163. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  164. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  165. def withClue[T](clue: Any)(fun: ⇒ T): T

    Permalink
    Definition Classes
    Assertions
  166. def workers(value: PosInt): Workers

    Permalink
    Definition Classes
    Configuration
  167. val writable: WritableWord

    Permalink
    Definition Classes
    MatcherWords

Deprecated Value Members

  1. def maxDiscarded(value: Int): MaxDiscarded

    Permalink
    Definition Classes
    Configuration
    Annotations
    @deprecated
    Deprecated

    use maxDiscardedFactor instead

  2. def maxSize(value: Int): MaxSize

    Permalink
    Definition Classes
    Configuration
    Annotations
    @deprecated
    Deprecated

    use SizeRange instead

  3. def trap[T](f: ⇒ T): Throwable

    Permalink
    Definition Classes
    Assertions
    Annotations
    @deprecated
    Deprecated

    The trap method is no longer needed for demos in the REPL, which now abreviates stack traces, and will be removed in a future version of ScalaTest

Inherited from Section

Inherited from Matchers

Inherited from Explicitly

Inherited from MatcherWords

Inherited from ShouldVerb

Inherited from Tolerance

Inherited from Assertions

Inherited from TripleEquals

Inherited from TripleEqualsSupport

Inherited from Checkers

Inherited from Configuration

Inherited from AnyRef

Inherited from Any

Ungrouped