Object

scalachecklib

GeneratorsSection

Related Doc: package scalachecklib

Permalink

object GeneratorsSection extends Checkers with Matchers with Section

Generators are responsible for generating test data in ScalaCheck, and are represented by the org.scalacheck.Gen class. In the Gen object, there are several methods for creating new and modifying existing generators. We will show how to use some of them in this section. For a more complete reference of what is available, please see the API scaladoc.

A generator can be seen simply as a function that takes some generation parameters, and (maybe) returns a generated value. That is, the type Gen[T] may be thought of as a function of type Gen.Params => Option[T]. However, the Gen class contains additional methods to make it possible to map generators, use them in for-comprehensions and so on. Conceptually, though, you should think of generators simply as functions, and the combinators in the Gen object can be used to create or modify the behaviour of such generator functions.

Linear Supertypes
Section, Matchers, Explicitly, MatcherWords, ShouldVerb, Tolerance, Assertions, TripleEquals, TripleEqualsSupport, Checkers, Configuration, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. GeneratorsSection
  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 caseClassGenerator(res0: Boolean): Assertion

    Permalink

    On the basis of the above we can create a generator for the following case class:

    Case class Generators

    On the basis of the above we can create a generator for the following case class:

    case class Foo(intValue: Int, charValue: Char)
  56. def check[ASSERTION](p: Prop, configParams: PropertyCheckConfigParam*)(implicit config: PropertyCheckConfigurable, asserting: CheckerAsserting[ASSERTION], prettifier: Prettifier, pos: Position): Result

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

    Permalink
    Definition Classes
    Checkers
  58. 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
  59. 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
  60. 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
  61. 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
  62. 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
  63. 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
  64. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  65. val compile: CompileWord

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

    Permalink

    Conditional generators can be defined using Gen.suchThat.

    Conditional Generators

    Conditional generators can be defined using Gen.suchThat.

    Conditional generators works just like conditional properties, in the sense that if the condition is too hard, ScalaCheck might not be able to generate enough values, and it might report a property test as undecided. The smallEvenInteger definition is probably OK, since it will only throw away half of the generated numbers, but one has to be careful when using the suchThat operator.

  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. def forComprehension(res0: Boolean): Assertion

    Permalink

    Let's see how to create a new generator.

    Let's see how to create a new generator. The best way to do it is to use the generator combinators that exist in the org.scalacheck.Gen module. These can be combined using a for-comprehension. Suppose you need a generator which generates a tuple that contains two random integer values, one of them being at least twice as big as the other. The following definition does this:

  106. val fullyMatch: FullyMatchWord

    Permalink
    Definition Classes
    MatcherWords
  107. def genAPI(res0: Boolean, res1: Boolean, res2: Int): Assertion

    Permalink

    The distribution is uniform, but if you want to control it you can use the frequency combinator:

    The distribution is uniform, but if you want to control it you can use the frequency combinator:

    val vowel = Gen.frequency(
      (3, 'A'),
      (4, 'E'),
      (2, 'I'),
      (3, 'O'),
      (1, 'U')
    )

    Now, the vowel generator will generate E:s more often than U:s. Roughly, 4/14 of the values generated will be E:s, and 1/14 of them will be U:s.

    Other methods in the Gen API:

    def alphaChar: Gen[Char]
    
    def alphaStr: Gen[String]
    
    def posNum[T](implicit n: Numeric[T]): Gen[T]
    
    def listOf[T](g: Gen[T]): Gen[List[T]]
    
    def listOfN[T](n: Int, g: Gen[T]): Gen[List[T]]
  108. def genOf(res0: Seq[Char]): Assertion

    Permalink

    You can create generators that pick one value out of a selection of values.

    You can create generators that pick one value out of a selection of values. The oneOf method creates a generator that randomly picks one of its parameters each time it generates a value. Notice that plain values are implicitly converted to generators (which always generate that value) if needed.

    The following generator generates a vowel:

  109. def generatingContainers(res0: List[Int]): Assertion

    Permalink

    There is a special generator, Gen.containerOf, that generates containers such as lists and arrays.

    Generating Containers

    There is a special generator, Gen.containerOf, that generates containers such as lists and arrays. It takes another generator as argument which is responsible for generating the individual items. You can use it in the following way:

    val genIntList      = Gen.containerOf[List,Int](Gen.oneOf(1, 3, 5))
    
    val genStringStream = Gen.containerOf[Stream,String](Gen.alphaStr)
    
    val genBoolArray    = Gen.containerOf[Array,Boolean](true)

    By default, ScalaCheck supports generation of List, Stream, Set, Array, and ArrayList (from java.util). You can add support for additional containers by adding implicit Buildable instances.

    There is also Gen.nonEmptyContainerOf for generating non-empty containers, and Gen.containerOfN for generating containers of a given size.

  110. implicit val generatorDrivenConfig: PropertyCheckConfiguration

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

    Permalink
    Definition Classes
    AnyRef → Any
  112. def hashCode(): Int

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

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

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

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

    Permalink
    Definition Classes
    Matchers
  117. val include: IncludeWord

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

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

    Permalink
    Definition Classes
    Any
  120. val key: KeyWord

    Permalink
    Definition Classes
    Matchers
  121. val length: LengthWord

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

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

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

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

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

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

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

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

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

    Permalink
    Definition Classes
    Matchers
  131. 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
  132. def no[E, C[_]](xs: C[E])(implicit collecting: Collecting[E, C[E]], prettifier: Prettifier, pos: Position): ResultOfCollectedAny[E]

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

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

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

    Permalink
    Definition Classes
    Matchers
  136. val not: NotWord

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

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

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

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

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

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

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

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

    Permalink
    Definition Classes
    Assertions
  145. val readable: ReadableWord

    Permalink
    Definition Classes
    MatcherWords
  146. val regex: RegexWord

    Permalink
    Definition Classes
    Matchers
  147. val size: SizeWord

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

    Permalink
    Definition Classes
    Configuration
  149. def sizedGenerator(res0: Int, res1: Int): Assertion

    Permalink

    When ScalaCheck uses a generator to generate a value, it feeds it with some parameters.

    Sized Generators

    When ScalaCheck uses a generator to generate a value, it feeds it with some parameters. One of the parameters the generator is given is a size value, which some generators use to generate their values.

    If you want to use the size parameter in your own generator, you can use the Gen.sized method:

    def sized[T](f: Int => Gen[T])

    In this example we're creating a generator that produces two lists of numbers where 1/3 are positive and 2/3 are negative. Note: we're also returning the original size to verify the behaviour.

  150. val sorted: SortedWord

    Permalink
    Definition Classes
    MatcherWords
  151. val startWith: StartWithWord

    Permalink
    Definition Classes
    MatcherWords
  152. final val succeed: Assertion

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

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

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

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

    Permalink
    Definition Classes
    Matchers
  157. val theSameInstanceAs: TheSameInstanceAsPhrase

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

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

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

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

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

    Permalink
    Definition Classes
    TripleEquals → TripleEqualsSupport
  163. val value: ValueWord

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

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

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

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

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

    Permalink
    Definition Classes
    Configuration
  169. 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