Packages

  • package root
    Definition Classes
    root
  • package org
    Definition Classes
    root
  • package scalatest

    ScalaTest's main traits, classes, and other members, including members supporting ScalaTest's DSL for the Scala interpreter.

    ScalaTest's main traits, classes, and other members, including members supporting ScalaTest's DSL for the Scala interpreter.

    Definition Classes
    org
  • package prop

    Scalatest support for Property-based testing.

    Scalatest support for Property-based testing.

    Introduction to Property-based Testing

    In traditional unit testing, you write tests that describe precisely what the test will do: create these objects, wire them together, call these functions, assert on the results, and so on. It is clear and deterministic, but also limited, because it only covers the exact situations you think to test. In most cases, it is not feasible to test all of the possible combinations of data that might arise in real-world use.

    Property-based testing works the other way around. You describe properties -- rules that you expect your classes to live by -- and describe how to test those properties. The test system then generates relatively large amounts of synthetic data (with an emphasis on edge cases that tend to make things break), so that you can see if the properties hold true in these situations.

    As a result, property-based testing is scientific in the purest sense: you are stating a hypothesis about how things should work (the property), and the system is trying to falsify that hypothesis. If the tests pass, that doesn't prove the property holds, but it at least gives you some confidence that you are probably correct.

    Property-based testing is deliberately a bit random: while the edge cases get tried upfront, the system also usually generates a number of random values to try out. This makes things a bit non-deterministic -- each run will be tried with somewhat different data. To make it easier to debug, and to build regression tests, the system provides tools to re-run a failed test with precisely the same data.

    Background

    TODO: Bill should insert a brief section on QuickCheck, ScalaCheck, etc, and how this system is similar and different.

    Using Property Checks

    In order to use the tools described here, you should import this package:

    import org.scalatest._
    import org.scalatest.prop._

    This library is designed to work well with the types defined in Scalactic, and some functions take types such as PosZInt as parameters. So it can also be helpful to import those with:

    import org.scalactic.anyvals._

    In order to call forAll, the function that actually performs property checks, you will need to either extend or import GeneratorDrivenPropertyChecks, like this:

    class DocExamples extends FlatSpec with Matchers with GeneratorDrivenPropertyChecks {

    There's nothing special about FlatSpec, though -- you may use any of ScalaTest's styles with property checks. GeneratorDrivenPropertyChecks extends CommonGenerators, so it also provides access to the many utilities found there.

    What Does a Property Look Like?

    Let's check a simple property of Strings -- that if you concatenate a String to itself, its length will be doubled:

    "Strings" should "have the correct length when doubled" in {
      forAll { (s: String) =>
        val s2 = s * 2
        s2.length should equal (s.length * 2)
      }
    }

    (Note that the examples here are all using the FlatSpec style, but will work the same way with any of ScalaTest's styles.)

    As the name of the tests suggests, the property we are testing is the length of a String that has been doubled.

    The test begins with forAll. This is usually the way you'll want to begin property checks, and that line can be read as, "For all Strings, the following should be true".

    The test harness will generate a number of Strings, with various contents and lengths. For each one, we compute s * 2. (* is a function on String, which appends the String to itself as many times as you specify.) And then we check that the length of the doubled String is twice the length of the original one.

    Using Specific Generators

    Let's try a more general version of this test, multiplying arbitrary Strings by arbitrary multipliers:

    "Strings" should "have the correct length when multiplied" in {
      forAll { (s: String, n: PosZInt) =>
        val s2 = s * n.value
        s2.length should equal (s.length * n.value)
      }
    }

    Again, you can read the first line of the test as "For all Strings, and all non-negative Integers, the following should be true". (PosZInt is a type defined in Scalactic, which can be any positive integer, including zero. It is appropriate to use here, since multiplying a String by a negative number doesn't make sense.)

    This intuitively makes sense, but when we try to run it, we get a JVM Out of Memory error! Why? Because the test system tries to test with the "edge cases" first, and one of the more important edge cases is Int.MaxValue. It is trying to multiply a String by that, which is far larger than the memory of even a big computer, and crashing.

    So we want to constrain our test to sane values of n, so that it doesn't crash. We can do this by using more specific Generators.

    When we write a forAll test like the above, ScalaTest has to generate the values to be tested -- the semi-random Strings, Ints and other types that you are testing. It does this by calling on an implicit Generator for the desired type. The Generator generates values to test, starting with the edge cases and then moving on to randomly-selected values.

    ScalaTest has built-in Generators for many major types, including String and PosZInt, but these Generators are generic: they will try any value, including values that can break your test, as shown above. But it also provides tools to let you be more specific.

    Here is the fixed version of the above test:

    "Strings" should "have the correct length when multiplied" in {
      forAll(strings, posZIntsBetween(0, 1000))
      { (s: String, n: PosZInt) =>
        val s2 = s * n.value
        s2.length should equal (s.length * n.value)
      }
    }

    This is using a variant of forAll, which lets you specify the Generators to use instead of just picking the implicit one. CommonGenerators.strings is the built-in Generator for Strings, the same one you were getting implicitly. (The other built-ins can be found in CommonGenerators. They are mixed into GeneratorDrivenPropertyChecks, so they are readily available.)

    But CommonGenerators.posZIntsBetween is a function that creates a Generator that selects from the given values. In this case, it will create a Generator that only creates numbers from 0 to 1000 -- small enough to not blow up our computer's memory. If you try this test, this runs correctly.

    The moral of the story is that, while using the built-in Generators is very convenient, and works most of the time, you should think about the data you are trying to test, and pick or create a more-specific Generator when the test calls for it.

    CommonGenerators contains many functions that are helpful in common cases. In particular:

    • xxsBetween (where xxs might be Int, Long, Float or most other significant numeric types) gives you a value of the desired type in the given range, as in the posZIntsBetween() example above.
    • CommonGenerators.specificValue and CommonGenerators.specificValues create Generators that produce either one specific value every time, or one of several values randomly. This is useful for enumerations and types that behave like enumerations.
    • CommonGenerators.evenly and CommonGenerators.frequency create higher-level Generators that call other Generators, either more or less equally or with a distribution you define.

    Testing Your Own Types

    Testing the built-in types isn't very interesting, though. Usually, you have your own types that you want to check the properties of. So let's build up an example piece by piece.

    Say you have this simple type:

    sealed trait Shape {
      def area: Double
    }
    case class Rectangle(width: Int, height: Int) extends Shape {
      require(width > 0)
      require(height > 0)
      def area: Double = width * height
    }

    Let's confirm a nice straightforward property that is surely true: that the area is greater than zero:

    "Rectangles" should "have a positive area" in {
       forAll { (w: PosInt, h: PosInt) =>
         val rect = Rectangle(w, h)
         rect.area should be > 0.0
       }
     }

    Note that, even though our class takes ordinary Ints as parameters (and checks the values at runtime), it is actually easier to generate the legal values using Scalactic's PosInt type.

    This should work, right? Actually, it doesn't -- if we run it a few times, we quickly hit an error!

    [info] Rectangles
    [info] - should have a positive area *** FAILED ***
    [info]   GeneratorDrivenPropertyCheckFailedException was thrown during property evaluation.
    [info]    (DocExamples.scala:42)
    [info]     Falsified after 2 successful property evaluations.
    [info]     Location: (DocExamples.scala:42)
    [info]     Occurred when passed generated values (
    [info]       None = PosInt(399455539),
    [info]       None = PosInt(703518968)
    [info]     )
    [info]     Init Seed: 1568878346200

    TODO: fix the above error to reflect the better errors we should get when we merge in the code being forward-ported from 3.0.5.

    Looking at it, we can see that the numbers being used are pretty large. What happens when we multiply them together?

    scala> 399455539 * 703518968
    res0: Int = -2046258840

    We're hitting an Int overflow problem here: the numbers are too big to multiply together and still get an Int. So we have to fix our area function:

    case class Rectangle(width: Int, height: Int) extends Shape {
      require(width > 0)
      require(height > 0)
      def area: Double = width.toLong * height.toLong
    }

    Now, when we run our property check, it consistently passes. Excellent -- we've caught a bug, because ScalaTest tried sufficiently large numbers.

    Composing Your Own Generators

    Doing things as shown above works, but having to generate the parameters and construct a Rectangle every time is a nuisance. What we really want is to create our own Generator that just hands us Rectangles, the same way we can do for PosInt. Fortunately, this is easy.

    Generators can be composed in for comprehensions. So we can create our own Generator for Rectangle like this:

    implicit val rectGenerator = for {
      w <- posInts
      h <- posInts
    }
      yield Rectangle(w, h)

    Taking that line by line:

    w <- posInts

    CommonGenerators.posInts is the built-in Generator for positive Ints. So this line puts a randomly-generated positive Int in w, and

    h <- posInts

    this line puts another one in h. Finally, this line:

    yield Rectangle(w, h)

    combines w and h to make a Rectangle.

    That's pretty much all you need in order to build any normal case class -- just build it out of the Generators for the type of each field. (And if the fields are complex data structures themselves, build Generators for them the same way, until you are just using primitives.)

    Now, our property check becomes simpler:

    "Generated Rectangles" should "have a positive area" in {
       forAll { (rect: Rectangle) =>
         rect.area should be > 0.0
       }
     }

    That's about as close to plain English as we can reasonably hope for!

    Filtering Values with whenever()

    Sometimes, not all of your generated values make sense for the property you want to check -- you know (via external information) that some of these values will never come up. In cases like this, you can create a custom Generator that only creates the values you do want, but it's often easier to just use Whenever.whenever. (Whenever is mixed into GeneratorDrivenPropertyChecks, so this is available when you need it.)

    The Whenever.whenever function can be used inside of GeneratorDrivenPropertyChecks.forAll. It says that only the filtered values should be used, and anything else should be discarded. For example, look at this property:

    "Fractions" should "get smaller when squared" in {
      forAll { (n: Float) =>
        whenever(n > 0 && n < 1) {
          (n * n) should be < n
        }
      }
    }

    We are testing a property of numbers less than 1, so we filter away everything that is not the numbers we want. This property check succeeds, because we've screened out the values that would make it fail.

    Discard Limits

    You shouldn't push Whenever.whenever too far, though. This system is all about trying random data, but if too much of the random data simply isn't usable, you can't get valid answers, and the system tracks that.

    For example, consider this apparently-reasonable test:

    "Space Chars" should "not also be letters" in {
      forAll { (c: Char) =>
        whenever (c.isSpaceChar) {
          assert(!c.isLetter)
        }
      }
    }

    Although the property is true, this test will fail with an error like this:

    [info] Lowercase Chars
    [info] - should upper-case correctly *** FAILED ***
    [info]   Gave up after 0 successful property evaluations. 49 evaluations were discarded.
    [info]   Init Seed: 1568855247784

    Because the vast majority of Chars are not spaces, nearly all of the generated values are being discarded. As a result, the system gives up after a while. In cases like this, you usually should write a custom Generator instead.

    The proportion of how many discards to permit, relative to the number of successful checks, is configuration-controllable. See GeneratorDrivenPropertyChecks for more details.

    Randomization

    The point of Generator is to create pseudo-random values for checking properties. But it turns out to be very inconvenient if those values are actually random -- that would mean that, when a property check fails occasionally, you have no good way to invoke that specific set of circumstances again for debugging. We want "randomness", but we also want it to be deterministic, and reproducible when you need it.

    To support this, all "randomness" in ScalaTest's property checking system uses the Randomizer class. You start by creating a Randomizer using an initial seed value, and call that to get your "random" value. Each call to a Randomizer function returns a new Randomizer, which you should use to fetch the next value.

    GeneratorDrivenPropertyChecks.forAll uses Randomizer under the hood: each time you run a forAll-based test, it will automatically create a new Randomizer, which by default is seeded based on the current system time. You can override this, as discussed below.

    Since Randomizer is actually deterministic (the "random" values are unobvious, but will always be the same given the same initial seed), this means that re-running a test with the same seed will produce the same values.

    If you need random data for your own Generators and property checks, you should use Randomizer in the same way; that way, your tests will also be re-runnable, when needed for debugging.

    Debugging, and Re-running a Failed Property Check

    In Testing Your Own Types above, we found to our surprise that the property check failed with this error:

    [info] Rectangles
    [info] - should have a positive area *** FAILED ***
    [info]   GeneratorDrivenPropertyCheckFailedException was thrown during property evaluation.
    [info]    (DocExamples.scala:42)
    [info]     Falsified after 2 successful property evaluations.
    [info]     Location: (DocExamples.scala:42)
    [info]     Occurred when passed generated values (
    [info]       None = PosInt(399455539),
    [info]       None = PosInt(703518968)
    [info]     )
    [info]     Init Seed: 1568878346200

    There must be a bug here -- but once we've fixed it, how can we make sure that we are re-testing exactly the same case that failed?

    This is where the pseudo-random nature of Randomizer comes in, and why it is so important to use it consistently. So long as all of our "random" data comes from that, then all we need to do is re-run with the same seed.

    That's why the Init Seed shown in the message above is crucial. We can re-use that seed -- and therefore get exactly the same "random" data -- by using the -S flag to ScalaTest.

    So you can run this command in sbt to re-run exactly the same property check:

    testOnly *DocExamples -- -z "have a positive area" -S 1568878346200

    Taking that apart:

    • testOnly *DocExamples says that we only want to run suites whose paths end with DocExamples
    • -z "have a positive area" says to only run tests whose names include that string.
    • -S 1568878346200 says to run all tests with a "random" seed of 1568878346200

    By combining these flags, you can re-run exactly the property check you need, with the right random seed to make sure you are re-creating the failed test. You should get exactly the same failure over and over until you fix the bug, and then you can confirm your fix with confidence.

    Configuration

    In general, forAll() works well out of the box. But you can tune several configuration parameters when needed. See GeneratorDrivenPropertyChecks for info on how to set configuration parameters for your test.

    Table-Driven Properties

    Sometimes, you want something in between traditional hard-coded unit tests and Generator-driven, randomized tests. Instead, you sometimes want to check your properties against a specific set of inputs.

    (This is particularly useful for regression tests, when you have found certain inputs that have caused problems in the past, and want to make sure that they get consistently re-tested.)

    ScalaTest supports these, by mixing in TableDrivenPropertyChecks. See the documentation for that class for the full details.

    Definition Classes
    scalatest
  • Chooser
  • Classification
  • CommonGenerators
  • Configuration
  • Generator
  • GeneratorDrivenPropertyChecks
  • HavingLength
  • HavingSize
  • PrettyFunction0
  • PropertyArgument
  • PropertyCheckResult
  • PropertyChecks
  • Randomizer
  • SizeParam
  • TableDrivenPropertyChecks
  • TableFor1
  • TableFor10
  • TableFor11
  • TableFor12
  • TableFor13
  • TableFor14
  • TableFor15
  • TableFor16
  • TableFor17
  • TableFor18
  • TableFor19
  • TableFor2
  • TableFor20
  • TableFor21
  • TableFor22
  • TableFor3
  • TableFor4
  • TableFor5
  • TableFor6
  • TableFor7
  • TableFor8
  • TableFor9
  • Tables
  • Whenever

object CommonGenerators extends CommonGenerators

An import-able version of CommonGenerators.

You should not usually need to import this directly, since it is mixed into GeneratorDrivenPropertyChecks and TableDrivenPropertyChecks.

Source
CommonGenerators.scala
Linear Supertypes
CommonGenerators, AnyRef, Any
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. CommonGenerators
  2. CommonGenerators
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def between[T](from: T, to: T)(implicit ord: Ordering[T], chooser: Chooser[T], gen: Generator[T]): Generator[T]

    Create a Generator that returns values in the specified range.

    Create a Generator that returns values in the specified range.

    This is the general-purpose function that underlies all of the other xxsBetween() functions in CommonGenerators. It works with any type for which there is an Ordering, a Generator, and a Chooser, making it easy to create Generators for ranges within that type.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to. (However "less than or equal" is defined for this type.)

    The "edges" -- the edge case values -- for this type will be taken from the implicit Generator. This function then filters out any that aren't within the specified range, and adds the from and to values as edges.

    The implicit Chooser is used to pick random values of the type. That should do most of the heavy lifting.

    Since this underlies the more-specific xxsBetween() functions, you may use either those or this when appropriate. For example, this:

    intsBetween(1, 100)

    and

    between(1, 100)

    are functionally identical so long as the types of the parameters are clear to the compiler. Use whichever suits your project's coding style better.

    T

    the type to choose a value from

    from

    the lower bound of the range to choose from

    to

    the upper bound of the range to choose from

    ord

    an instance of Ordering[T], which should usually be in implicit scope

    chooser

    an instance of Chooser[T], which should usually be in implicit scope

    gen

    an instance of Generator[T], which should usually be in implicit scope

    returns

    a new Generator, that produces values in the specified range

    Definition Classes
    CommonGenerators
  6. val booleans: Generator[Boolean]

    A Generator that produces Boolean values.

    A Generator that produces Boolean values.

    Definition Classes
    CommonGenerators
  7. val bytes: Generator[Byte]

    A Generator that produces Byte values.

    A Generator that produces Byte values.

    Definition Classes
    CommonGenerators
  8. def bytesBetween(from: Byte, to: Byte): Generator[Byte]

    Create a Generator that returns Bytes in the specified range.

    Create a Generator that returns Bytes in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  9. val chars: Generator[Char]

    A Generator that produces Char values.

    A Generator that produces Char values.

    Definition Classes
    CommonGenerators
  10. def charsBetween(from: Char, to: Char): Generator[Char]

    Create a Generator that returns Chars in the specified range.

    Create a Generator that returns Chars in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  11. def classify[A](count: PosInt, genOfA: Generator[A])(pf: PartialFunction[A, String]): Classification

    Generate a bunch of values from a Generator, and distribute them into buckets.

    Generate a bunch of values from a Generator, and distribute them into buckets.

    This function mainly exists for the purpose of testing your Generator, and making sure that it is actually creating data with the sort of distribution you expect. You provide the Generator, the number of values to create, and a function that "classifies" each value with a String; it returns a Classification that collates all of the results. You can then look at the Classification to see if the proportions match your expectations.

    For example, consider this simple classification of small numbers:

    val classification: Classification =
      CommonGenerators.classify(10000, CommonGenerators.intsBetween(0, 9))
      {
        case x if (x % 2) == 0 => "even"
        case _ => "odd"
      }

    As expected, the results come out evenly:

    classification: org.scalatest.prop.Classification =
    50% odd
    50% even

    The options provided in the PartialFunction do not have to be comprehensive; it is legal for some generated values to not match any of the choices. In this case, those values will not be accounted for in the resulting Classification.

    A

    the type to be generated

    count

    the number of values to generate

    genOfA

    the Generator to use

    pf

    a PartialFunction that takes the generated values, and sorts them into "buckets" by String names

    returns

    statistics on how many values wound up in each bucket

    Definition Classes
    CommonGenerators
  12. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  13. val doubles: Generator[Double]

    A Generator that produces Double values.

    A Generator that produces Double values.

    Definition Classes
    CommonGenerators
  14. def doublesBetween(from: Double, to: Double): Generator[Double]

    Create a Generator that returns Doubles in the specified range.

    Create a Generator that returns Doubles in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  15. def eithers[L, R](implicit genOfL: Generator[L], genOfR: Generator[R]): Generator[Either[L, R]]

    Given Generators for two types, L and R, this provides one for Either[L, R].

    Given Generators for two types, L and R, this provides one for Either[L, R].

    L

    the Left type for an Either

    R

    the Right type for an Either

    genOfL

    a Generator that produces type L

    genOfR

    a Generator that produces type R

    returns

    a Generator that produces Either[L, R]

    Definition Classes
    CommonGenerators
  16. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  18. def evenly[T](first: Generator[T], second: Generator[T], rest: Generator[T]*): Generator[T]

    Given a number of Generators, this creates one that invokes each of its constituents with roughly the same frequency.

    Given a number of Generators, this creates one that invokes each of its constituents with roughly the same frequency.

    Consider this example:

    val numbers: Generator[Char] = ... // generates only digits
    val letters: Generator[Char] = ... // generates only letters
    val punct: Generator[Char]   = ... // generates only punctuation
    
    val chars: Generator[Char] = evenly(numbers, letters, punct)

    The chars Generator should produce numbers, letters and punctuation, each about a third of the time.

    Keep in mind that the distribution is invoked randomly, so these are rough proportions. As you invoke the Generator more times, you should see results that are closer and closer to an equal distribution, but the random element will generally keep it inexact.

    As usual, the resulting Generator will use the Randomizer passed in to Generator.next() to choose which of the constituent Generators to invoke. So if you use the same seed to initialize your Randomizer, you should get the same results.

    Note that all of the constituent Generators must produce the same type.

    T

    the type to be produced

    first

    a Generator to choose from

    second

    another Generator to choose from

    rest

    any number of additional Generators to choose from

    returns

    a single Generator that invokes each of its constituents roughly the same number of times

    Definition Classes
    CommonGenerators
  19. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  20. val finiteDoubleValues: Generator[Double]

    A Generator that produces Double values, including zero but not including infinities or NaN.

    A Generator that produces Double values, including zero but not including infinities or NaN.

    Definition Classes
    CommonGenerators
  21. val finiteDoubles: Generator[FiniteDouble]

    A Generator that produces FiniteDouble values.

    A Generator that produces FiniteDouble values.

    Definition Classes
    CommonGenerators
  22. def finiteDoublesBetween(from: FiniteDouble, to: FiniteDouble): Generator[FiniteDouble]

    Create a Generator that returns FiniteDoubles in the specified range.

    Create a Generator that returns FiniteDoubles in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  23. val finiteFloatValues: Generator[Float]

    A Generator that produces Float values, including zero but not including infinities or NaN.

    A Generator that produces Float values, including zero but not including infinities or NaN.

    Definition Classes
    CommonGenerators
  24. val finiteFloats: Generator[FiniteFloat]

    A Generator that produces FiniteFloat values.

    A Generator that produces FiniteFloat values.

    Definition Classes
    CommonGenerators
  25. def finiteFloatsBetween(from: FiniteFloat, to: FiniteFloat): Generator[FiniteFloat]

    Create a Generator that returns FiniteFloats in the specified range.

    Create a Generator that returns FiniteFloats in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  26. lazy val first1000Primes: Generator[Int]

    A Generator of prime numbers.

    A Generator of prime numbers.

    As the name implies, this doesn't try to generate entirely arbitrary prime numbers. Instead, it takes the simpler and more efficient approach of choosing randomly from a hard-coded table of the first 1000 primes. As a result, the largest number that can be produced from this is 7919.

    returns

    a Generator that will produce smallish prime numbers

    Definition Classes
    CommonGenerators
  27. val floats: Generator[Float]

    A Generator that produces Float values.

    A Generator that produces Float values.

    Definition Classes
    CommonGenerators
  28. def floatsBetween(from: Float, to: Float): Generator[Float]

    Create a Generator that returns Floats in the specified range.

    Create a Generator that returns Floats in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  29. def frequency[T](first: (Int, Generator[T]), second: (Int, Generator[T]), rest: (Int, Generator[T])*): Generator[T]

    Given a number of Generators, and the weightings for each one, this creates a Generator that invokes each of its components according to its weighting.

    Given a number of Generators, and the weightings for each one, this creates a Generator that invokes each of its components according to its weighting.

    For example, consider this:

    val evens: Generator[Int] = ... // generates even Ints
    val odds: Generator[Int] = ... // generates odd Ints
    val zeros: Generator[Int] = specificValue(0)
    
    val mixed: Generator[Int] = frequency(
      (5, evens),
      (4, odds),
      (1, zeros)
    )

    The total weighting is (5 + 4 + 1) = 10. So the resulting Generator will produce an even number (10 / 5) = 50% the time, an odd number (10 / 4) = 40% of the time, and zero (10 / 1) = 10% of the time.

    Keep in mind that the distribution is invoked randomly, so these are rough proportions. As you invoke the Generator more times, you should see results that are closer and closer to the specified proportions, but the random element will generally keep it inexact.

    As usual, the resulting Generator will use the Randomizer passed in to Generator.next() to choose which of the constituent Generators to invoke. So if you use the same seed to initialize your Randomizer, you should get the same results.

    Note that all of the constituent Generators must produce the same type.

    T

    the type being produced by all of these Generators

    first

    a Generator and its weight

    second

    another Generator and its weight

    rest

    as many more Generator and weight pairs as you like

    returns

    a single Generator, that invokes its constituents according to their weights

    Definition Classes
    CommonGenerators
  30. def function0s[A](implicit genOfA: Generator[A]): Generator[() => A]

    Given a Generator that produces values of type A, this returns one that produces functions that return a T.

    Given a Generator that produces values of type A, this returns one that produces functions that return a T.

    The functions produced here are nullary -- they take no parameters, they just spew out values of type A.

    A

    the type to return from the generated functions

    returns

    a Generator that produces functions that return values of type A

    Definition Classes
    CommonGenerators
  31. def function10s[A, B, C, D, E, F, G, H, I, J, K](implicit genOfK: Generator[K], typeInfoA: TypeInfo[A], typeInfoB: TypeInfo[B], typeInfoC: TypeInfo[C], typeInfoD: TypeInfo[D], typeInfoE: TypeInfo[E], typeInfoF: TypeInfo[F], typeInfoG: TypeInfo[G], typeInfoH: TypeInfo[H], typeInfoI: TypeInfo[I], typeInfoJ: TypeInfo[J], typeInfoK: TypeInfo[K]): Generator[(A, B, C, D, E, F, G, H, I, J) => K]

    See function1s.

    Definition Classes
    CommonGenerators
  32. def function11s[A, B, C, D, E, F, G, H, I, J, K, L](implicit genOfL: Generator[L], typeInfoA: TypeInfo[A], typeInfoB: TypeInfo[B], typeInfoC: TypeInfo[C], typeInfoD: TypeInfo[D], typeInfoE: TypeInfo[E], typeInfoF: TypeInfo[F], typeInfoG: TypeInfo[G], typeInfoH: TypeInfo[H], typeInfoI: TypeInfo[I], typeInfoJ: TypeInfo[J], typeInfoK: TypeInfo[K], typeInfoL: TypeInfo[L]): Generator[(A, B, C, D, E, F, G, H, I, J, K) => L]

    See function1s.

    Definition Classes
    CommonGenerators
  33. def function12s[A, B, C, D, E, F, G, H, I, J, K, L, M](implicit genOfM: Generator[M], typeInfoA: TypeInfo[A], typeInfoB: TypeInfo[B], typeInfoC: TypeInfo[C], typeInfoD: TypeInfo[D], typeInfoE: TypeInfo[E], typeInfoF: TypeInfo[F], typeInfoG: TypeInfo[G], typeInfoH: TypeInfo[H], typeInfoI: TypeInfo[I], typeInfoJ: TypeInfo[J], typeInfoK: TypeInfo[K], typeInfoL: TypeInfo[L], typeInfoM: TypeInfo[M]): Generator[(A, B, C, D, E, F, G, H, I, J, K, L) => M]

    See function1s.

    Definition Classes
    CommonGenerators
  34. def function13s[A, B, C, D, E, F, G, H, I, J, K, L, M, N](implicit genOfN: Generator[N], typeInfoA: TypeInfo[A], typeInfoB: TypeInfo[B], typeInfoC: TypeInfo[C], typeInfoD: TypeInfo[D], typeInfoE: TypeInfo[E], typeInfoF: TypeInfo[F], typeInfoG: TypeInfo[G], typeInfoH: TypeInfo[H], typeInfoI: TypeInfo[I], typeInfoJ: TypeInfo[J], typeInfoK: TypeInfo[K], typeInfoL: TypeInfo[L], typeInfoM: TypeInfo[M], typeInfoN: TypeInfo[N]): Generator[(A, B, C, D, E, F, G, H, I, J, K, L, M) => N]

    See function1s.

    Definition Classes
    CommonGenerators
  35. def function14s[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O](implicit genOfO: Generator[O], typeInfoA: TypeInfo[A], typeInfoB: TypeInfo[B], typeInfoC: TypeInfo[C], typeInfoD: TypeInfo[D], typeInfoE: TypeInfo[E], typeInfoF: TypeInfo[F], typeInfoG: TypeInfo[G], typeInfoH: TypeInfo[H], typeInfoI: TypeInfo[I], typeInfoJ: TypeInfo[J], typeInfoK: TypeInfo[K], typeInfoL: TypeInfo[L], typeInfoM: TypeInfo[M], typeInfoN: TypeInfo[N], typeInfoO: TypeInfo[O]): Generator[(A, B, C, D, E, F, G, H, I, J, K, L, M, N) => O]

    See function1s.

    Definition Classes
    CommonGenerators
  36. def function15s[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P](implicit genOfP: Generator[P], typeInfoA: TypeInfo[A], typeInfoB: TypeInfo[B], typeInfoC: TypeInfo[C], typeInfoD: TypeInfo[D], typeInfoE: TypeInfo[E], typeInfoF: TypeInfo[F], typeInfoG: TypeInfo[G], typeInfoH: TypeInfo[H], typeInfoI: TypeInfo[I], typeInfoJ: TypeInfo[J], typeInfoK: TypeInfo[K], typeInfoL: TypeInfo[L], typeInfoM: TypeInfo[M], typeInfoN: TypeInfo[N], typeInfoO: TypeInfo[O], typeInfoP: TypeInfo[P]): Generator[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) => P]

    See function1s.

    Definition Classes
    CommonGenerators
  37. def function16s[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q](implicit genOfQ: Generator[Q], typeInfoA: TypeInfo[A], typeInfoB: TypeInfo[B], typeInfoC: TypeInfo[C], typeInfoD: TypeInfo[D], typeInfoE: TypeInfo[E], typeInfoF: TypeInfo[F], typeInfoG: TypeInfo[G], typeInfoH: TypeInfo[H], typeInfoI: TypeInfo[I], typeInfoJ: TypeInfo[J], typeInfoK: TypeInfo[K], typeInfoL: TypeInfo[L], typeInfoM: TypeInfo[M], typeInfoN: TypeInfo[N], typeInfoO: TypeInfo[O], typeInfoP: TypeInfo[P], typeInfoQ: TypeInfo[Q]): Generator[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P) => Q]

    See function1s.

    Definition Classes
    CommonGenerators
  38. def function17s[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R](implicit genOfR: Generator[R], typeInfoA: TypeInfo[A], typeInfoB: TypeInfo[B], typeInfoC: TypeInfo[C], typeInfoD: TypeInfo[D], typeInfoE: TypeInfo[E], typeInfoF: TypeInfo[F], typeInfoG: TypeInfo[G], typeInfoH: TypeInfo[H], typeInfoI: TypeInfo[I], typeInfoJ: TypeInfo[J], typeInfoK: TypeInfo[K], typeInfoL: TypeInfo[L], typeInfoM: TypeInfo[M], typeInfoN: TypeInfo[N], typeInfoO: TypeInfo[O], typeInfoP: TypeInfo[P], typeInfoQ: TypeInfo[Q], typeInfoR: TypeInfo[R]): Generator[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q) => R]

    See function1s.

    Definition Classes
    CommonGenerators
  39. def function18s[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S](implicit genOfS: Generator[S], typeInfoA: TypeInfo[A], typeInfoB: TypeInfo[B], typeInfoC: TypeInfo[C], typeInfoD: TypeInfo[D], typeInfoE: TypeInfo[E], typeInfoF: TypeInfo[F], typeInfoG: TypeInfo[G], typeInfoH: TypeInfo[H], typeInfoI: TypeInfo[I], typeInfoJ: TypeInfo[J], typeInfoK: TypeInfo[K], typeInfoL: TypeInfo[L], typeInfoM: TypeInfo[M], typeInfoN: TypeInfo[N], typeInfoO: TypeInfo[O], typeInfoP: TypeInfo[P], typeInfoQ: TypeInfo[Q], typeInfoR: TypeInfo[R], typeInfoS: TypeInfo[S]): Generator[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R) => S]

    See function1s.

    Definition Classes
    CommonGenerators
  40. def function19s[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T](implicit genOfT: Generator[T], typeInfoA: TypeInfo[A], typeInfoB: TypeInfo[B], typeInfoC: TypeInfo[C], typeInfoD: TypeInfo[D], typeInfoE: TypeInfo[E], typeInfoF: TypeInfo[F], typeInfoG: TypeInfo[G], typeInfoH: TypeInfo[H], typeInfoI: TypeInfo[I], typeInfoJ: TypeInfo[J], typeInfoK: TypeInfo[K], typeInfoL: TypeInfo[L], typeInfoM: TypeInfo[M], typeInfoN: TypeInfo[N], typeInfoO: TypeInfo[O], typeInfoP: TypeInfo[P], typeInfoQ: TypeInfo[Q], typeInfoR: TypeInfo[R], typeInfoS: TypeInfo[S], typeInfoT: TypeInfo[T]): Generator[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S) => T]

    See function1s.

    Definition Classes
    CommonGenerators
  41. def function1s[A, B](implicit genOfB: Generator[B], typeInfoA: TypeInfo[A], typeInfoB: TypeInfo[B]): Generator[(A) => B]

    Create a Generator of functions from type A to type B.

    Create a Generator of functions from type A to type B.

    Note that the generated functions are, necessarily, pretty random. In practice, the function you get from a function1s call (and its variations, up through function22s) takes the hashes of its input values, combines those with a randomly-chosen number, and combines them in order to choose the generated value B.

    That said, each of the generated functions is deterministic: given the same input parameters and the same randomly-chosen number, you will always get the same B result. And the toString function on the generated function will show the formula you need to use in order to recreate that, which will look something like:

    (a: Int, b: String, c: Float) =>
      org.scalatest.prop.valueOf[String](a, b, c)(131)

    The number and type of the a, b, c, etc, parameters, as well as the type parameter of valueOf, will depend on the function type you are generating, but they will always follow this pattern. valueOf is the underlying function that takes these parameters and the randomly-chosen number, and returns a value of the specified type.

    So if a property evaluation fails, the display of the generated function will tell you how to call valueOf to recreate the failure.

    The typeInfo parameters are automatically created via macros; you should generally not try to pass them manually.

    A

    the input type for the generated functions

    B

    the result type for the generated functions

    genOfB

    a Generator for the desired result type B

    typeInfoA

    automatically-created type information for type A

    typeInfoB

    automatically-created type information for type B

    returns

    a Generator that produces functions that take values of A and returns values of B

    Definition Classes
    CommonGenerators
  42. def function20s[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U](implicit genOfU: Generator[U], typeInfoA: TypeInfo[A], typeInfoB: TypeInfo[B], typeInfoC: TypeInfo[C], typeInfoD: TypeInfo[D], typeInfoE: TypeInfo[E], typeInfoF: TypeInfo[F], typeInfoG: TypeInfo[G], typeInfoH: TypeInfo[H], typeInfoI: TypeInfo[I], typeInfoJ: TypeInfo[J], typeInfoK: TypeInfo[K], typeInfoL: TypeInfo[L], typeInfoM: TypeInfo[M], typeInfoN: TypeInfo[N], typeInfoO: TypeInfo[O], typeInfoP: TypeInfo[P], typeInfoQ: TypeInfo[Q], typeInfoR: TypeInfo[R], typeInfoS: TypeInfo[S], typeInfoT: TypeInfo[T], typeInfoU: TypeInfo[U]): Generator[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T) => U]

    See function1s.

    Definition Classes
    CommonGenerators
  43. def function21s[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V](implicit genOfV: Generator[V], typeInfoA: TypeInfo[A], typeInfoB: TypeInfo[B], typeInfoC: TypeInfo[C], typeInfoD: TypeInfo[D], typeInfoE: TypeInfo[E], typeInfoF: TypeInfo[F], typeInfoG: TypeInfo[G], typeInfoH: TypeInfo[H], typeInfoI: TypeInfo[I], typeInfoJ: TypeInfo[J], typeInfoK: TypeInfo[K], typeInfoL: TypeInfo[L], typeInfoM: TypeInfo[M], typeInfoN: TypeInfo[N], typeInfoO: TypeInfo[O], typeInfoP: TypeInfo[P], typeInfoQ: TypeInfo[Q], typeInfoR: TypeInfo[R], typeInfoS: TypeInfo[S], typeInfoT: TypeInfo[T], typeInfoU: TypeInfo[U], typeInfoV: TypeInfo[V]): Generator[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U) => V]

    See function1s.

    Definition Classes
    CommonGenerators
  44. def function22s[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W](implicit genOfW: Generator[W], typeInfoA: TypeInfo[A], typeInfoB: TypeInfo[B], typeInfoC: TypeInfo[C], typeInfoD: TypeInfo[D], typeInfoE: TypeInfo[E], typeInfoF: TypeInfo[F], typeInfoG: TypeInfo[G], typeInfoH: TypeInfo[H], typeInfoI: TypeInfo[I], typeInfoJ: TypeInfo[J], typeInfoK: TypeInfo[K], typeInfoL: TypeInfo[L], typeInfoM: TypeInfo[M], typeInfoN: TypeInfo[N], typeInfoO: TypeInfo[O], typeInfoP: TypeInfo[P], typeInfoQ: TypeInfo[Q], typeInfoR: TypeInfo[R], typeInfoS: TypeInfo[S], typeInfoT: TypeInfo[T], typeInfoU: TypeInfo[U], typeInfoV: TypeInfo[V], typeInfoW: TypeInfo[W]): Generator[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V) => W]

    See function1s.

    Definition Classes
    CommonGenerators
  45. def function2s[A, B, C](implicit genOfC: Generator[C], typeInfoA: TypeInfo[A], typeInfoB: TypeInfo[B], typeInfoC: TypeInfo[C]): Generator[(A, B) => C]

    See function1s.

    Definition Classes
    CommonGenerators
  46. def function3s[A, B, C, D](implicit genOfD: Generator[D], typeInfoA: TypeInfo[A], typeInfoB: TypeInfo[B], typeInfoC: TypeInfo[C], typeInfoD: TypeInfo[D]): Generator[(A, B, C) => D]

    See function1s.

    Definition Classes
    CommonGenerators
  47. def function4s[A, B, C, D, E](implicit genOfE: Generator[E], typeInfoA: TypeInfo[A], typeInfoB: TypeInfo[B], typeInfoC: TypeInfo[C], typeInfoD: TypeInfo[D], typeInfoE: TypeInfo[E]): Generator[(A, B, C, D) => E]

    See function1s.

    Definition Classes
    CommonGenerators
  48. def function5s[A, B, C, D, E, F](implicit genOfF: Generator[F], typeInfoA: TypeInfo[A], typeInfoB: TypeInfo[B], typeInfoC: TypeInfo[C], typeInfoD: TypeInfo[D], typeInfoE: TypeInfo[E], typeInfoF: TypeInfo[F]): Generator[(A, B, C, D, E) => F]

    See function1s.

    Definition Classes
    CommonGenerators
  49. def function6s[A, B, C, D, E, F, G](implicit genOfG: Generator[G], typeInfoA: TypeInfo[A], typeInfoB: TypeInfo[B], typeInfoC: TypeInfo[C], typeInfoD: TypeInfo[D], typeInfoE: TypeInfo[E], typeInfoF: TypeInfo[F], typeInfoG: TypeInfo[G]): Generator[(A, B, C, D, E, F) => G]

    See function1s.

    Definition Classes
    CommonGenerators
  50. def function7s[A, B, C, D, E, F, G, H](implicit genOfH: Generator[H], typeInfoA: TypeInfo[A], typeInfoB: TypeInfo[B], typeInfoC: TypeInfo[C], typeInfoD: TypeInfo[D], typeInfoE: TypeInfo[E], typeInfoF: TypeInfo[F], typeInfoG: TypeInfo[G], typeInfoH: TypeInfo[H]): Generator[(A, B, C, D, E, F, G) => H]

    See function1s.

    Definition Classes
    CommonGenerators
  51. def function8s[A, B, C, D, E, F, G, H, I](implicit genOfI: Generator[I], typeInfoA: TypeInfo[A], typeInfoB: TypeInfo[B], typeInfoC: TypeInfo[C], typeInfoD: TypeInfo[D], typeInfoE: TypeInfo[E], typeInfoF: TypeInfo[F], typeInfoG: TypeInfo[G], typeInfoH: TypeInfo[H], typeInfoI: TypeInfo[I]): Generator[(A, B, C, D, E, F, G, H) => I]

    See function1s.

    Definition Classes
    CommonGenerators
  52. def function9s[A, B, C, D, E, F, G, H, I, J](implicit genOfJ: Generator[J], typeInfoA: TypeInfo[A], typeInfoB: TypeInfo[B], typeInfoC: TypeInfo[C], typeInfoD: TypeInfo[D], typeInfoE: TypeInfo[E], typeInfoF: TypeInfo[F], typeInfoG: TypeInfo[G], typeInfoH: TypeInfo[H], typeInfoI: TypeInfo[I], typeInfoJ: TypeInfo[J]): Generator[(A, B, C, D, E, F, G, H, I) => J]

    See function1s.

    Definition Classes
    CommonGenerators
  53. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  54. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  55. def instancesOf[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W](construct: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V) => W)(deconstruct: (W) => (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V))(implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H], genOfI: Generator[I], genOfJ: Generator[J], genOfK: Generator[K], genOfL: Generator[L], genOfM: Generator[M], genOfN: Generator[N], genOfO: Generator[O], genOfP: Generator[P], genOfQ: Generator[Q], genOfR: Generator[R], genOfS: Generator[S], genOfT: Generator[T], genOfU: Generator[U], genOfV: Generator[V]): Generator[W]

    See the simple [A, B] version of instancesOf() for details.

    See the simple [A, B] version of instancesOf() for details.

    Definition Classes
    CommonGenerators
  56. def instancesOf[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V](construct: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U) => V)(deconstruct: (V) => (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U))(implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H], genOfI: Generator[I], genOfJ: Generator[J], genOfK: Generator[K], genOfL: Generator[L], genOfM: Generator[M], genOfN: Generator[N], genOfO: Generator[O], genOfP: Generator[P], genOfQ: Generator[Q], genOfR: Generator[R], genOfS: Generator[S], genOfT: Generator[T], genOfU: Generator[U]): Generator[V]

    See the simple [A, B] version of instancesOf() for details.

    See the simple [A, B] version of instancesOf() for details.

    Definition Classes
    CommonGenerators
  57. def instancesOf[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U](construct: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T) => U)(deconstruct: (U) => (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T))(implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H], genOfI: Generator[I], genOfJ: Generator[J], genOfK: Generator[K], genOfL: Generator[L], genOfM: Generator[M], genOfN: Generator[N], genOfO: Generator[O], genOfP: Generator[P], genOfQ: Generator[Q], genOfR: Generator[R], genOfS: Generator[S], genOfT: Generator[T]): Generator[U]

    See the simple [A, B] version of instancesOf() for details.

    See the simple [A, B] version of instancesOf() for details.

    Definition Classes
    CommonGenerators
  58. def instancesOf[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T](construct: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S) => T)(deconstruct: (T) => (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S))(implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H], genOfI: Generator[I], genOfJ: Generator[J], genOfK: Generator[K], genOfL: Generator[L], genOfM: Generator[M], genOfN: Generator[N], genOfO: Generator[O], genOfP: Generator[P], genOfQ: Generator[Q], genOfR: Generator[R], genOfS: Generator[S]): Generator[T]

    See the simple [A, B] version of instancesOf() for details.

    See the simple [A, B] version of instancesOf() for details.

    Definition Classes
    CommonGenerators
  59. def instancesOf[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S](construct: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R) => S)(deconstruct: (S) => (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R))(implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H], genOfI: Generator[I], genOfJ: Generator[J], genOfK: Generator[K], genOfL: Generator[L], genOfM: Generator[M], genOfN: Generator[N], genOfO: Generator[O], genOfP: Generator[P], genOfQ: Generator[Q], genOfR: Generator[R]): Generator[S]

    See the simple [A, B] version of instancesOf() for details.

    See the simple [A, B] version of instancesOf() for details.

    Definition Classes
    CommonGenerators
  60. def instancesOf[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R](construct: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q) => R)(deconstruct: (R) => (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q))(implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H], genOfI: Generator[I], genOfJ: Generator[J], genOfK: Generator[K], genOfL: Generator[L], genOfM: Generator[M], genOfN: Generator[N], genOfO: Generator[O], genOfP: Generator[P], genOfQ: Generator[Q]): Generator[R]

    See the simple [A, B] version of instancesOf() for details.

    See the simple [A, B] version of instancesOf() for details.

    Definition Classes
    CommonGenerators
  61. def instancesOf[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q](construct: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P) => Q)(deconstruct: (Q) => (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P))(implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H], genOfI: Generator[I], genOfJ: Generator[J], genOfK: Generator[K], genOfL: Generator[L], genOfM: Generator[M], genOfN: Generator[N], genOfO: Generator[O], genOfP: Generator[P]): Generator[Q]

    See the simple [A, B] version of instancesOf() for details.

    See the simple [A, B] version of instancesOf() for details.

    Definition Classes
    CommonGenerators
  62. def instancesOf[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P](construct: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) => P)(deconstruct: (P) => (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O))(implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H], genOfI: Generator[I], genOfJ: Generator[J], genOfK: Generator[K], genOfL: Generator[L], genOfM: Generator[M], genOfN: Generator[N], genOfO: Generator[O]): Generator[P]

    See the simple [A, B] version of instancesOf() for details.

    See the simple [A, B] version of instancesOf() for details.

    Definition Classes
    CommonGenerators
  63. def instancesOf[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O](construct: (A, B, C, D, E, F, G, H, I, J, K, L, M, N) => O)(deconstruct: (O) => (A, B, C, D, E, F, G, H, I, J, K, L, M, N))(implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H], genOfI: Generator[I], genOfJ: Generator[J], genOfK: Generator[K], genOfL: Generator[L], genOfM: Generator[M], genOfN: Generator[N]): Generator[O]

    See the simple [A, B] version of instancesOf() for details.

    See the simple [A, B] version of instancesOf() for details.

    Definition Classes
    CommonGenerators
  64. def instancesOf[A, B, C, D, E, F, G, H, I, J, K, L, M, N](construct: (A, B, C, D, E, F, G, H, I, J, K, L, M) => N)(deconstruct: (N) => (A, B, C, D, E, F, G, H, I, J, K, L, M))(implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H], genOfI: Generator[I], genOfJ: Generator[J], genOfK: Generator[K], genOfL: Generator[L], genOfM: Generator[M]): Generator[N]

    See the simple [A, B] version of instancesOf() for details.

    See the simple [A, B] version of instancesOf() for details.

    Definition Classes
    CommonGenerators
  65. def instancesOf[A, B, C, D, E, F, G, H, I, J, K, L, M](construct: (A, B, C, D, E, F, G, H, I, J, K, L) => M)(deconstruct: (M) => (A, B, C, D, E, F, G, H, I, J, K, L))(implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H], genOfI: Generator[I], genOfJ: Generator[J], genOfK: Generator[K], genOfL: Generator[L]): Generator[M]

    See the simple [A, B] version of instancesOf() for details.

    See the simple [A, B] version of instancesOf() for details.

    Definition Classes
    CommonGenerators
  66. def instancesOf[A, B, C, D, E, F, G, H, I, J, K, L](construct: (A, B, C, D, E, F, G, H, I, J, K) => L)(deconstruct: (L) => (A, B, C, D, E, F, G, H, I, J, K))(implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H], genOfI: Generator[I], genOfJ: Generator[J], genOfK: Generator[K]): Generator[L]

    See the simple [A, B] version of instancesOf() for details.

    See the simple [A, B] version of instancesOf() for details.

    Definition Classes
    CommonGenerators
  67. def instancesOf[A, B, C, D, E, F, G, H, I, J, K](construct: (A, B, C, D, E, F, G, H, I, J) => K)(deconstruct: (K) => (A, B, C, D, E, F, G, H, I, J))(implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H], genOfI: Generator[I], genOfJ: Generator[J]): Generator[K]

    See the simple [A, B] version of instancesOf() for details.

    See the simple [A, B] version of instancesOf() for details.

    Definition Classes
    CommonGenerators
  68. def instancesOf[A, B, C, D, E, F, G, H, I, J](construct: (A, B, C, D, E, F, G, H, I) => J)(deconstruct: (J) => (A, B, C, D, E, F, G, H, I))(implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H], genOfI: Generator[I]): Generator[J]

    See the simple [A, B] version of instancesOf() for details.

    See the simple [A, B] version of instancesOf() for details.

    Definition Classes
    CommonGenerators
  69. def instancesOf[A, B, C, D, E, F, G, H, I](construct: (A, B, C, D, E, F, G, H) => I)(deconstruct: (I) => (A, B, C, D, E, F, G, H))(implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H]): Generator[I]

    See the simple [A, B] version of instancesOf() for details.

    See the simple [A, B] version of instancesOf() for details.

    Definition Classes
    CommonGenerators
  70. def instancesOf[A, B, C, D, E, F, G, H](construct: (A, B, C, D, E, F, G) => H)(deconstruct: (H) => (A, B, C, D, E, F, G))(implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G]): Generator[H]

    See the simple [A, B] version of instancesOf() for details.

    See the simple [A, B] version of instancesOf() for details.

    Definition Classes
    CommonGenerators
  71. def instancesOf[A, B, C, D, E, F, G](construct: (A, B, C, D, E, F) => G)(deconstruct: (G) => (A, B, C, D, E, F))(implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F]): Generator[G]

    See the simple [A, B] version of instancesOf() for details.

    See the simple [A, B] version of instancesOf() for details.

    Definition Classes
    CommonGenerators
  72. def instancesOf[A, B, C, D, E, F](construct: (A, B, C, D, E) => F)(deconstruct: (F) => (A, B, C, D, E))(implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E]): Generator[F]

    See the simple [A, B] version of instancesOf() for details.

    See the simple [A, B] version of instancesOf() for details.

    Definition Classes
    CommonGenerators
  73. def instancesOf[A, B, C, D, E](construct: (A, B, C, D) => E)(deconstruct: (E) => (A, B, C, D))(implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D]): Generator[E]

    See the simple [A, B] version of instancesOf() for details.

    See the simple [A, B] version of instancesOf() for details.

    Definition Classes
    CommonGenerators
  74. def instancesOf[A, B, C, D](construct: (A, B, C) => D)(deconstruct: (D) => (A, B, C))(implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C]): Generator[D]

    See the simple [A, B] version of instancesOf() for details.

    See the simple [A, B] version of instancesOf() for details.

    Definition Classes
    CommonGenerators
  75. def instancesOf[A, B, C](construct: (A, B) => C)(deconstruct: (C) => (A, B))(implicit genOfA: Generator[A], genOfB: Generator[B]): Generator[C]

    See the simple [A, B] version of instancesOf() for details.

    See the simple [A, B] version of instancesOf() for details.

    Definition Classes
    CommonGenerators
  76. def instancesOf[A, B](construct: (A) => B)(deconstruct: (B) => A)(implicit genOfA: Generator[A]): Generator[B]

    The instancesOf function (which has overloads depending on how many parameters you need) is one way to create a Generator for case classes and other situations where you want to build a type out of other types.

    The instancesOf function (which has overloads depending on how many parameters you need) is one way to create a Generator for case classes and other situations where you want to build a type out of other types.

    To understand how it works, look at this example:

    case class Person(name: String, age: Int)
    implicit val persons: Generator[Person] =
      instancesOf(Person) { p =>
        (p.name, p.age)
      } (strings, posZIntValues)

    What's going on here? instancesOf is taking two types (String and Int), a function (a case class constructor) that turns those types into a third type (Person), and a second function that takes a Person and deconstructs it back to its component pieces. From those, it creates a Generator.

    The last parameters -- the (strings, posZIntValues) -- are the Generators for the component types. If you are good with using the default Generators for those types, you can just let those parameters be resolved implicitly. (But in this case, that could result in negative ages, which doesn't make any sense.)

    After creating a Generator this way, you can use it like any other Generator in your property checks.

    Alternatively, you can construct Generators for case classes using for comprehensions, like this:

    implicit val persons: Generator[Person] = for {
      name <- strings
      age <- posZIntValues
    }
      yield Person(name, age)

    Which approach you use is mainly up to personal taste and the coding standards of your project.

    A

    the input type

    B

    the target type to be generated

    construct

    a constructor that builds the target type from its constituents; most often, a case class constructor

    deconstruct

    a deconstructor function that takes the target type and breaks is down into its constituents

    genOfA

    a Generator for the input type

    returns

    a Generator for the target type

    Definition Classes
    CommonGenerators
  77. val ints: Generator[Int]

    A Generator that produces Int values.

    A Generator that produces Int values.

    Definition Classes
    CommonGenerators
  78. def intsBetween(from: Int, to: Int): Generator[Int]

    Create a Generator that returns Ints in the specified range.

    Create a Generator that returns Ints in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  79. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  80. def lists[T](implicit genOfT: Generator[T]): Generator[List[T]] with HavingLength[List[T]]

    Given an existing Generator[T], this creates a Generator[List[T]].

    Given an existing Generator[T], this creates a Generator[List[T]].

    T

    the type that we are producing a List of

    genOfT

    a Generator that produces values of type T

    returns

    a List of values of type T

    Definition Classes
    CommonGenerators
  81. val longs: Generator[Long]

    A Generator that produces Long values.

    A Generator that produces Long values.

    Definition Classes
    CommonGenerators
  82. def longsBetween(from: Long, to: Long): Generator[Long]

    Create a Generator that returns Longs in the specified range.

    Create a Generator that returns Longs in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  83. def maps[K, V](implicit genOfTupleKV: Generator[(K, V)]): Generator[Map[K, V]] with HavingSize[Map[K, V]]

    Given a Generator that produces Tuples of key/value pairs, this gives you one that produces Maps with those pairs.

    Given a Generator that produces Tuples of key/value pairs, this gives you one that produces Maps with those pairs.

    If you are simply looking for random pairing of the key and value types, this is pretty easy to use: if both the key and value types have Generators, then the Tuple and Map ones will be automatically and implicitly created when you need them.

    The resulting Generator also has the HavingSize trait, so you can use it to generate Maps with specific sizes.

    K

    the type of the keys for the Map

    V

    the type of the values for the Map

    returns

    a Generator of Maps from K to V

    Definition Classes
    CommonGenerators
  84. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  85. val negDoubleValues: Generator[Double]

    A Generator that produces negative Double values, not including zero but including infinity and NaN.

    A Generator that produces negative Double values, not including zero but including infinity and NaN.

    Definition Classes
    CommonGenerators
  86. val negDoubles: Generator[NegDouble]

    A Generator that produces NegDouble values.

    A Generator that produces NegDouble values.

    Definition Classes
    CommonGenerators
  87. def negDoublesBetween(from: NegDouble, to: NegDouble): Generator[NegDouble]

    Create a Generator that returns NegDoubles in the specified range.

    Create a Generator that returns NegDoubles in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  88. val negFiniteDoubleValues: Generator[Double]

    A Generator that produces negative Double values, not including zero, infinity or NaN.

    A Generator that produces negative Double values, not including zero, infinity or NaN.

    Definition Classes
    CommonGenerators
  89. val negFiniteDoubles: Generator[NegFiniteDouble]

    A Generator that produces NegFiniteDouble values.

    A Generator that produces NegFiniteDouble values.

    Definition Classes
    CommonGenerators
  90. def negFiniteDoublesBetween(from: NegFiniteDouble, to: NegFiniteDouble): Generator[NegFiniteDouble]

    Create a Generator that returns NegFiniteDoubles in the specified range.

    Create a Generator that returns NegFiniteDoubles in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  91. val negFiniteFloatValues: Generator[Float]

    A Generator that produces negative Float values, not including zero, infinity or NaN.

    A Generator that produces negative Float values, not including zero, infinity or NaN.

    Definition Classes
    CommonGenerators
  92. val negFiniteFloats: Generator[NegFiniteFloat]

    A Generator that produces NegFiniteFloat values.

    A Generator that produces NegFiniteFloat values.

    Definition Classes
    CommonGenerators
  93. def negFiniteFloatsBetween(from: NegFiniteFloat, to: NegFiniteFloat): Generator[NegFiniteFloat]

    Create a Generator that returns NegFiniteFloats in the specified range.

    Create a Generator that returns NegFiniteFloats in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  94. val negFloatValues: Generator[Float]

    A Generator that produces negative Float values, not including zero but including infinity and NaN.

    A Generator that produces negative Float values, not including zero but including infinity and NaN.

    Definition Classes
    CommonGenerators
  95. val negFloats: Generator[NegFloat]

    A Generator that produces NegFloat values.

    A Generator that produces NegFloat values.

    Definition Classes
    CommonGenerators
  96. def negFloatsBetween(from: NegFloat, to: NegFloat): Generator[NegFloat]

    Create a Generator that returns NegFloats in the specified range.

    Create a Generator that returns NegFloats in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  97. val negIntValues: Generator[Int]

    A Generator that produces negative Int values, not including zero.

    A Generator that produces negative Int values, not including zero.

    Definition Classes
    CommonGenerators
  98. val negInts: Generator[NegInt]

    A Generator that produces NegInt values.

    A Generator that produces NegInt values.

    Definition Classes
    CommonGenerators
  99. def negIntsBetween(from: NegInt, to: NegInt): Generator[NegInt]

    Create a Generator that returns NegInts in the specified range.

    Create a Generator that returns NegInts in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  100. val negLongValues: Generator[Long]

    A Generator that produces negative Long values, not including zero.

    A Generator that produces negative Long values, not including zero.

    Definition Classes
    CommonGenerators
  101. val negLongs: Generator[NegLong]

    A Generator that produces NegLong values.

    A Generator that produces NegLong values.

    Definition Classes
    CommonGenerators
  102. def negLongsBetween(from: NegLong, to: NegLong): Generator[NegLong]

    Create a Generator that returns NegLongs in the specified range.

    Create a Generator that returns NegLongs in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  103. val negZDoubleValues: Generator[Double]

    A Generator that produces negative Double values, including zero, infinity and NaN.

    A Generator that produces negative Double values, including zero, infinity and NaN.

    Definition Classes
    CommonGenerators
  104. val negZDoubles: Generator[NegZDouble]

    A Generator that produces NegZDouble values.

    A Generator that produces NegZDouble values.

    Definition Classes
    CommonGenerators
  105. def negZDoublesBetween(from: NegZDouble, to: NegZDouble): Generator[NegZDouble]

    Create a Generator that returns NegZDoubles in the specified range.

    Create a Generator that returns NegZDoubles in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  106. val negZFiniteDoubleValues: Generator[Double]

    A Generator that produces negative Double values, including zero but not including infinity or NaN.

    A Generator that produces negative Double values, including zero but not including infinity or NaN.

    Definition Classes
    CommonGenerators
  107. val negZFiniteDoubles: Generator[NegZFiniteDouble]

    A Generator that produces NegZFiniteDouble values.

    A Generator that produces NegZFiniteDouble values.

    Definition Classes
    CommonGenerators
  108. def negZFiniteDoublesBetween(from: NegZFiniteDouble, to: NegZFiniteDouble): Generator[NegZFiniteDouble]

    Create a Generator that returns NegZFiniteDoubles in the specified range.

    Create a Generator that returns NegZFiniteDoubles in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  109. val negZFiniteFloatValues: Generator[Float]

    A Generator that produces negative Float values, including zero but not including infinity or NaN.

    A Generator that produces negative Float values, including zero but not including infinity or NaN.

    Definition Classes
    CommonGenerators
  110. val negZFiniteFloats: Generator[NegZFiniteFloat]

    A Generator that produces NegZFiniteFloat values.

    A Generator that produces NegZFiniteFloat values.

    Definition Classes
    CommonGenerators
  111. def negZFiniteFloatsBetween(from: NegZFiniteFloat, to: NegZFiniteFloat): Generator[NegZFiniteFloat]

    Create a Generator that returns NegZFiniteFloats in the specified range.

    Create a Generator that returns NegZFiniteFloats in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  112. val negZFloatValues: Generator[Float]

    A Generator that produces negative Float values, including zero, infinity and NaN.

    A Generator that produces negative Float values, including zero, infinity and NaN.

    Definition Classes
    CommonGenerators
  113. val negZFloats: Generator[NegZFloat]

    A Generator that produces NegZFloat values.

    A Generator that produces NegZFloat values.

    Definition Classes
    CommonGenerators
  114. def negZFloatsBetween(from: NegZFloat, to: NegZFloat): Generator[NegZFloat]

    Create a Generator that returns NegZFloats in the specified range.

    Create a Generator that returns NegZFloats in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  115. val negZIntValues: Generator[Int]

    A Generator that produces negative Int values, including zero.

    A Generator that produces negative Int values, including zero.

    Definition Classes
    CommonGenerators
  116. val negZInts: Generator[NegZInt]

    A Generator that produces NegZInt values.

    A Generator that produces NegZInt values.

    Definition Classes
    CommonGenerators
  117. def negZIntsBetween(from: NegZInt, to: NegZInt): Generator[NegZInt]

    Create a Generator that returns NegZInts in the specified range.

    Create a Generator that returns NegZInts in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  118. val negZLongValues: Generator[Long]

    A Generator that produces negative Long values, including zero.

    A Generator that produces negative Long values, including zero.

    Definition Classes
    CommonGenerators
  119. val negZLongs: Generator[NegZLong]

    A Generator that produces NegZLong values.

    A Generator that produces NegZLong values.

    Definition Classes
    CommonGenerators
  120. def negZLongsBetween(from: NegZLong, to: NegZLong): Generator[NegZLong]

    Create a Generator that returns NegZLongs in the specified range.

    Create a Generator that returns NegZLongs in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  121. val nonZeroDoubleValues: Generator[Double]

    A Generator that produces non-zero Double values, including infinity and NaN.

    A Generator that produces non-zero Double values, including infinity and NaN.

    Definition Classes
    CommonGenerators
  122. val nonZeroDoubles: Generator[NonZeroDouble]

    A Generator that produces NonZeroDouble values.

    A Generator that produces NonZeroDouble values.

    Definition Classes
    CommonGenerators
  123. def nonZeroDoublesBetween(from: NonZeroDouble, to: NonZeroDouble): Generator[NonZeroDouble]

    Create a Generator that returns NonZeroDoubles in the specified range.

    Create a Generator that returns NonZeroDoubles in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  124. val nonZeroFiniteDoubleValues: Generator[Double]

    A Generator that produces non-zero Double values, not including infinity and NaN.

    A Generator that produces non-zero Double values, not including infinity and NaN.

    Definition Classes
    CommonGenerators
  125. val nonZeroFiniteDoubles: Generator[NonZeroFiniteDouble]

    A Generator that produces NonZeroFiniteDouble values.

    A Generator that produces NonZeroFiniteDouble values.

    Definition Classes
    CommonGenerators
  126. def nonZeroFiniteDoublesBetween(from: NonZeroFiniteDouble, to: NonZeroFiniteDouble): Generator[NonZeroFiniteDouble]

    Create a Generator that returns NonZeroFiniteDoubles in the specified range.

    Create a Generator that returns NonZeroFiniteDoubles in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  127. val nonZeroFiniteFloatValues: Generator[Float]

    A Generator that produces non-zero Float values, not including infinity or NaN.

    A Generator that produces non-zero Float values, not including infinity or NaN.

    Definition Classes
    CommonGenerators
  128. val nonZeroFiniteFloats: Generator[NonZeroFiniteFloat]

    A Generator that produces NonZeroFiniteFloat values.

    A Generator that produces NonZeroFiniteFloat values.

    Definition Classes
    CommonGenerators
  129. def nonZeroFiniteFloatsBetween(from: NonZeroFiniteFloat, to: NonZeroFiniteFloat): Generator[NonZeroFiniteFloat]

    Create a Generator that returns NonZeroFiniteFloats in the specified range.

    Create a Generator that returns NonZeroFiniteFloats in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  130. val nonZeroFloatValues: Generator[Float]

    A Generator that produces non-zero Float values, including infinity and NaN.

    A Generator that produces non-zero Float values, including infinity and NaN.

    Definition Classes
    CommonGenerators
  131. val nonZeroFloats: Generator[NonZeroFloat]

    A Generator that produces NonZeroFloat values.

    A Generator that produces NonZeroFloat values.

    Definition Classes
    CommonGenerators
  132. def nonZeroFloatsBetween(from: NonZeroFloat, to: NonZeroFloat): Generator[NonZeroFloat]

    Create a Generator that returns NonZeroFloats in the specified range.

    Create a Generator that returns NonZeroFloats in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  133. val nonZeroIntValues: Generator[Int]

    A Generator that produces non-zero Int values.

    A Generator that produces non-zero Int values.

    Definition Classes
    CommonGenerators
  134. val nonZeroInts: Generator[NonZeroInt]

    A Generator that produces NonZeroInt values.

    A Generator that produces NonZeroInt values.

    Definition Classes
    CommonGenerators
  135. def nonZeroIntsBetween(from: NonZeroInt, to: NonZeroInt): Generator[NonZeroInt]

    Create a Generator that returns NonZeroInts in the specified range.

    Create a Generator that returns NonZeroInts in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  136. val nonZeroLongValues: Generator[Long]

    A Generator that produces non-zero Long values.

    A Generator that produces non-zero Long values.

    Definition Classes
    CommonGenerators
  137. val nonZeroLongs: Generator[NonZeroLong]

    A Generator that produces NonZeroLong values.

    A Generator that produces NonZeroLong values.

    Definition Classes
    CommonGenerators
  138. def nonZeroLongsBetween(from: NonZeroLong, to: NonZeroLong): Generator[NonZeroLong]

    Create a Generator that returns NonZeroLongs in the specified range.

    Create a Generator that returns NonZeroLongs in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  139. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  140. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  141. val numericCharValues: Generator[Char]

    A Generator that produces digit Chars.

    A Generator that produces digit Chars.

    Definition Classes
    CommonGenerators
  142. val numericChars: Generator[NumericChar]

    A Generator that produces NumericChar values.

    A Generator that produces NumericChar values.

    Definition Classes
    CommonGenerators
  143. def options[T](implicit genOfT: Generator[T]): Generator[Option[T]]

    Given an existing Generator[T], this creates a Generator[Option[T]].

    Given an existing Generator[T], this creates a Generator[Option[T]].

    T

    the type that we are producing an Option of

    genOfT

    a Generator that produces values of type T

    returns

    a Generator that produces Option[T]

    Definition Classes
    CommonGenerators
  144. def ors[G, B](implicit genOfG: Generator[G], genOfB: Generator[B]): Generator[Or[G, B]]

    Given Generators for two types, G and B, this provides one for G Or B.

    Given Generators for two types, G and B, this provides one for G Or B.

    G

    the "good" type for an Or

    B

    the "bad" type for an Or

    genOfG

    a Generator that produces type G

    genOfB

    a Generator that produces type B

    returns

    a Generator that produces G Or B

    Definition Classes
    CommonGenerators
  145. val posDoubleValues: Generator[Double]

    A Generator that produces positive Double values, not including zero but including infinity and NaN.

    A Generator that produces positive Double values, not including zero but including infinity and NaN.

    Definition Classes
    CommonGenerators
  146. val posDoubles: Generator[PosDouble]

    A Generator that produces PosDouble values.

    A Generator that produces PosDouble values.

    Definition Classes
    CommonGenerators
  147. def posDoublesBetween(from: PosDouble, to: PosDouble): Generator[PosDouble]

    Create a Generator that returns PosDoubles in the specified range.

    Create a Generator that returns PosDoubles in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  148. val posFiniteDoubleValues: Generator[Double]

    A Generator that produces positive Double values, not including zero, infinity or NaN.

    A Generator that produces positive Double values, not including zero, infinity or NaN.

    Definition Classes
    CommonGenerators
  149. val posFiniteDoubles: Generator[PosFiniteDouble]

    A Generator that produces PosFiniteDouble values.

    A Generator that produces PosFiniteDouble values.

    Definition Classes
    CommonGenerators
  150. def posFiniteDoublesBetween(from: PosFiniteDouble, to: PosFiniteDouble): Generator[PosFiniteDouble]

    Create a Generator that returns PosFiniteDoubles in the specified range.

    Create a Generator that returns PosFiniteDoubles in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  151. val posFiniteFloatValues: Generator[Float]

    A Generator that produces positive Float values, not including zero, infinity or NaN.

    A Generator that produces positive Float values, not including zero, infinity or NaN.

    Definition Classes
    CommonGenerators
  152. val posFiniteFloats: Generator[PosFiniteFloat]

    A Generator that produces PosFiniteFloat values.

    A Generator that produces PosFiniteFloat values.

    Definition Classes
    CommonGenerators
  153. def posFiniteFloatsBetween(from: PosFiniteFloat, to: PosFiniteFloat): Generator[PosFiniteFloat]

    Create a Generator that returns PosFiniteFloats in the specified range.

    Create a Generator that returns PosFiniteFloats in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  154. val posFloatValues: Generator[Float]

    A Generator that produces positive Float values, not including zero but including infinites and NaN.

    A Generator that produces positive Float values, not including zero but including infinites and NaN.

    Definition Classes
    CommonGenerators
  155. val posFloats: Generator[PosFloat]

    A Generator that produces PosFloat values.

    A Generator that produces PosFloat values.

    Definition Classes
    CommonGenerators
  156. def posFloatsBetween(from: PosFloat, to: PosFloat): Generator[PosFloat]

    Create a Generator that returns PosFloats in the specified range.

    Create a Generator that returns PosFloats in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  157. val posIntValues: Generator[Int]

    A Generator that produces positive Int values, not including zero.

    A Generator that produces positive Int values, not including zero.

    Definition Classes
    CommonGenerators
  158. val posInts: Generator[PosInt]

    A Generator that produces PosInt values.

    A Generator that produces PosInt values.

    Definition Classes
    CommonGenerators
  159. def posIntsBetween(from: PosInt, to: PosInt): Generator[PosInt]

    Create a Generator that returns PosInts in the specified range.

    Create a Generator that returns PosInts in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  160. val posLongValues: Generator[Long]

    A Generator that produces positive Long values, not including zero.

    A Generator that produces positive Long values, not including zero.

    Definition Classes
    CommonGenerators
  161. val posLongs: Generator[PosLong]

    A Generator that produces PosLong values.

    A Generator that produces PosLong values.

    Definition Classes
    CommonGenerators
  162. def posLongsBetween(from: PosLong, to: PosLong): Generator[PosLong]

    Create a Generator that returns PosLongs in the specified range.

    Create a Generator that returns PosLongs in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  163. val posZDoubleValues: Generator[Double]

    A Generator that produces positive Double values, including zero, infinity and NaN.

    A Generator that produces positive Double values, including zero, infinity and NaN.

    Definition Classes
    CommonGenerators
  164. val posZDoubles: Generator[PosZDouble]

    A Generator that produces PosZDouble values.

    A Generator that produces PosZDouble values.

    Definition Classes
    CommonGenerators
  165. def posZDoublesBetween(from: PosZDouble, to: PosZDouble): Generator[PosZDouble]

    Create a Generator that returns PosZDoubles in the specified range.

    Create a Generator that returns PosZDoubles in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  166. val posZFiniteDoubleValues: Generator[Double]

    A Generator that produces positive Int values.

    A Generator that produces positive Int values.

    Definition Classes
    CommonGenerators
  167. val posZFiniteDoubles: Generator[PosZFiniteDouble]

    A Generator that produces PosZFiniteDouble values.

    A Generator that produces PosZFiniteDouble values.

    Definition Classes
    CommonGenerators
  168. def posZFiniteDoublesBetween(from: PosZFiniteDouble, to: PosZFiniteDouble): Generator[PosZFiniteDouble]

    Create a Generator that returns PosZFiniteDoubles in the specified range.

    Create a Generator that returns PosZFiniteDoubles in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  169. val posZFiniteFloatValues: Generator[Float]

    A Generator that produces positive Float values, including zero but not including infinity or NaN.

    A Generator that produces positive Float values, including zero but not including infinity or NaN.

    Definition Classes
    CommonGenerators
  170. val posZFiniteFloats: Generator[PosZFiniteFloat]

    A Generator that produces PosZFiniteFloat values.

    A Generator that produces PosZFiniteFloat values.

    Definition Classes
    CommonGenerators
  171. def posZFiniteFloatsBetween(from: PosZFiniteFloat, to: PosZFiniteFloat): Generator[PosZFiniteFloat]

    Create a Generator that returns PosZFiniteFloats in the specified range.

    Create a Generator that returns PosZFiniteFloats in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  172. val posZFloatValues: Generator[Float]

    A Generator that produces positive Float values, including zero, infinity and NaN.

    A Generator that produces positive Float values, including zero, infinity and NaN.

    Definition Classes
    CommonGenerators
  173. val posZFloats: Generator[PosZFloat]

    A Generator that produces PosZFloat values.

    A Generator that produces PosZFloat values.

    Definition Classes
    CommonGenerators
  174. def posZFloatsBetween(from: PosZFloat, to: PosZFloat): Generator[PosZFloat]

    Create a Generator that returns PosZFloats in the specified range.

    Create a Generator that returns PosZFloats in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  175. val posZIntValues: Generator[Int]

    A Generator that produces positive Int values, including zero.

    A Generator that produces positive Int values, including zero.

    Definition Classes
    CommonGenerators
  176. val posZInts: Generator[PosZInt]

    A Generator that produces PosZInt values.

    A Generator that produces PosZInt values.

    Definition Classes
    CommonGenerators
  177. def posZIntsBetween(from: PosZInt, to: PosZInt): Generator[PosZInt]

    Create a Generator that returns PosZInts in the specified range.

    Create a Generator that returns PosZInts in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  178. val posZLongValues: Generator[Long]

    A Generator that produces positive Long values, including zero.

    A Generator that produces positive Long values, including zero.

    Definition Classes
    CommonGenerators
  179. val posZLongs: Generator[PosZLong]

    A Generator that produces PosZLong values.

    A Generator that produces PosZLong values.

    Definition Classes
    CommonGenerators
  180. def posZLongsBetween(from: PosZLong, to: PosZLong): Generator[PosZLong]

    Create a Generator that returns PosZLongs in the specified range.

    Create a Generator that returns PosZLongs in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  181. def sets[T](implicit genOfT: Generator[T]): Generator[Set[T]] with HavingSize[Set[T]]

    Given a Generator that produces values of type T, this creates one for a Set of T.

    Given a Generator that produces values of type T, this creates one for a Set of T.

    Note that the Set type is considered to have a "size", so you can use the configuration parameters Configuration.minSize and Configuration.sizeRange to constrain the sizes of the resulting Sets when you use this Generator.

    The resulting Generator also has the HavingSize trait, so you can use it to generate Sets with specific sizes.

    T

    the type to produce

    genOfT

    a Generator that produces values of type T

    returns

    a Generator that produces Set[T].

    Definition Classes
    CommonGenerators
  182. val shorts: Generator[Short]

    A Generator that produces Short values.

    A Generator that produces Short values.

    Definition Classes
    CommonGenerators
  183. def shortsBetween(from: Short, to: Short): Generator[Short]

    Create a Generator that returns Shorts in the specified range.

    Create a Generator that returns Shorts in the specified range.

    The range is inclusive: both from and to may be produced by this Generator. Moreover, from and to are considered to be edge cases, so they usually will be produced in a typical run.

    The value of from must be less than or equal to the value of to.

    from

    one end of the desired range

    to

    the other end of the desired range

    returns

    a value within that range, inclusive of the bounds

    Definition Classes
    CommonGenerators
  184. def sortedMaps[K, V](implicit genOfTupleKV: Generator[(K, V)], ordering: Ordering[K]): Generator[SortedMap[K, V]] with HavingSize[SortedMap[K, V]]

    Given a Generator that produces Tuples of key/value pairs, this gives you one that produces SortedMaps with those pairs.

    Given a Generator that produces Tuples of key/value pairs, this gives you one that produces SortedMaps with those pairs.

    If you are simply looking for random pairing of the key and value types, this is pretty easy to use: if both the key and value types have Generators, then the Tuple and SortedMap ones will be automatically and implicitly created when you need them.

    The resulting Generator also has the HavingSize trait, so you can use it to generate SortedMaps with specific sizes.

    K

    the type of the keys for the SortedMap

    V

    the type of the values for the SortedMap

    returns

    a Generator of SortedMaps from K to V

    Definition Classes
    CommonGenerators
  185. def sortedSets[T](implicit genOfT: Generator[T], ordering: Ordering[T]): Generator[SortedSet[T]] with HavingSize[SortedSet[T]]

    Given a Generator that produces values of type T, this creates one for a SortedSet of T.

    Given a Generator that produces values of type T, this creates one for a SortedSet of T.

    Note that the SortedSet type is considered to have a "size", so you can use the configuration parameters Configuration.minSize and Configuration.sizeRange to constrain the sizes of the resulting SortedSets when you use this Generator.

    The resulting Generator also has the HavingSize trait, so you can use it to generate SortedSets with specific sizes.

    T

    the type to produce

    genOfT

    a Generator that produces values of type T

    returns

    a Generator that produces SortedSet[T].

    Definition Classes
    CommonGenerators
  186. def specificValue[T](theValue: T): Generator[T]

    Creates a Generator that will always return exactly the same value.

    Creates a Generator that will always return exactly the same value.

    This is specialized, but occasionally useful. It is mainly appropriate when you have a function that requires a Generator, but only one value makes sense for the Property you are evaluating.

    T

    the type of that value

    theValue

    the value to produce

    returns

    a Generator that will always produce that value

    Definition Classes
    CommonGenerators
  187. def specificValues[T](first: T, second: T, rest: T*): Generator[T]

    Given a list of values of type T, this creates a Generator that will only produce those values.

    Given a list of values of type T, this creates a Generator that will only produce those values.

    The order in which the values are produced is random, based on the Randomizer passed in to the next function. It may produce the same value multiple times.

    T

    the type that will be produced by the resulting Generator

    first

    a value of type T

    second

    another value of type T

    rest

    more values of type T, as many as you wish

    returns

    a Generator that produces exactly the specified values

    Definition Classes
    CommonGenerators
  188. val strings: Generator[String]

    A Generator that produces String values.

    A Generator that produces String values.

    Definition Classes
    CommonGenerators
  189. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  190. def toString(): String
    Definition Classes
    AnyRef → Any
  191. def tuple10s[A, B, C, D, E, F, G, H, I, J](implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H], genOfI: Generator[I], genOfJ: Generator[J]): Generator[(A, B, C, D, E, F, G, H, I, J)]

    See tuple2s.

    See tuple2s.

    Definition Classes
    CommonGenerators
  192. def tuple11s[A, B, C, D, E, F, G, H, I, J, K](implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H], genOfI: Generator[I], genOfJ: Generator[J], genOfK: Generator[K]): Generator[(A, B, C, D, E, F, G, H, I, J, K)]

    See tuple2s.

    See tuple2s.

    Definition Classes
    CommonGenerators
  193. def tuple12s[A, B, C, D, E, F, G, H, I, J, K, L](implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H], genOfI: Generator[I], genOfJ: Generator[J], genOfK: Generator[K], genOfL: Generator[L]): Generator[(A, B, C, D, E, F, G, H, I, J, K, L)]

    See tuple2s.

    See tuple2s.

    Definition Classes
    CommonGenerators
  194. def tuple13s[A, B, C, D, E, F, G, H, I, J, K, L, M](implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H], genOfI: Generator[I], genOfJ: Generator[J], genOfK: Generator[K], genOfL: Generator[L], genOfM: Generator[M]): Generator[(A, B, C, D, E, F, G, H, I, J, K, L, M)]

    See tuple2s.

    See tuple2s.

    Definition Classes
    CommonGenerators
  195. def tuple14s[A, B, C, D, E, F, G, H, I, J, K, L, M, N](implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H], genOfI: Generator[I], genOfJ: Generator[J], genOfK: Generator[K], genOfL: Generator[L], genOfM: Generator[M], genOfN: Generator[N]): Generator[(A, B, C, D, E, F, G, H, I, J, K, L, M, N)]

    See tuple2s.

    See tuple2s.

    Definition Classes
    CommonGenerators
  196. def tuple15s[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O](implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H], genOfI: Generator[I], genOfJ: Generator[J], genOfK: Generator[K], genOfL: Generator[L], genOfM: Generator[M], genOfN: Generator[N], genOfO: Generator[O]): Generator[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)]

    See tuple2s.

    See tuple2s.

    Definition Classes
    CommonGenerators
  197. def tuple16s[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P](implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H], genOfI: Generator[I], genOfJ: Generator[J], genOfK: Generator[K], genOfL: Generator[L], genOfM: Generator[M], genOfN: Generator[N], genOfO: Generator[O], genOfP: Generator[P]): Generator[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)]

    See tuple2s.

    See tuple2s.

    Definition Classes
    CommonGenerators
  198. def tuple17s[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q](implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H], genOfI: Generator[I], genOfJ: Generator[J], genOfK: Generator[K], genOfL: Generator[L], genOfM: Generator[M], genOfN: Generator[N], genOfO: Generator[O], genOfP: Generator[P], genOfQ: Generator[Q]): Generator[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)]

    See tuple2s.

    See tuple2s.

    Definition Classes
    CommonGenerators
  199. def tuple18s[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R](implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H], genOfI: Generator[I], genOfJ: Generator[J], genOfK: Generator[K], genOfL: Generator[L], genOfM: Generator[M], genOfN: Generator[N], genOfO: Generator[O], genOfP: Generator[P], genOfQ: Generator[Q], genOfR: Generator[R]): Generator[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R)]

    See tuple2s.

    See tuple2s.

    Definition Classes
    CommonGenerators
  200. def tuple19s[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S](implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H], genOfI: Generator[I], genOfJ: Generator[J], genOfK: Generator[K], genOfL: Generator[L], genOfM: Generator[M], genOfN: Generator[N], genOfO: Generator[O], genOfP: Generator[P], genOfQ: Generator[Q], genOfR: Generator[R], genOfS: Generator[S]): Generator[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S)]

    See tuple2s.

    See tuple2s.

    Definition Classes
    CommonGenerators
  201. def tuple20s[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T](implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H], genOfI: Generator[I], genOfJ: Generator[J], genOfK: Generator[K], genOfL: Generator[L], genOfM: Generator[M], genOfN: Generator[N], genOfO: Generator[O], genOfP: Generator[P], genOfQ: Generator[Q], genOfR: Generator[R], genOfS: Generator[S], genOfT: Generator[T]): Generator[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T)]

    See tuple2s.

    See tuple2s.

    Definition Classes
    CommonGenerators
  202. def tuple21s[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U](implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H], genOfI: Generator[I], genOfJ: Generator[J], genOfK: Generator[K], genOfL: Generator[L], genOfM: Generator[M], genOfN: Generator[N], genOfO: Generator[O], genOfP: Generator[P], genOfQ: Generator[Q], genOfR: Generator[R], genOfS: Generator[S], genOfT: Generator[T], genOfU: Generator[U]): Generator[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U)]

    See tuple2s.

    See tuple2s.

    Definition Classes
    CommonGenerators
  203. def tuple22s[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V](implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H], genOfI: Generator[I], genOfJ: Generator[J], genOfK: Generator[K], genOfL: Generator[L], genOfM: Generator[M], genOfN: Generator[N], genOfO: Generator[O], genOfP: Generator[P], genOfQ: Generator[Q], genOfR: Generator[R], genOfS: Generator[S], genOfT: Generator[T], genOfU: Generator[U], genOfV: Generator[V]): Generator[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V)]

    See tuple2s.

    See tuple2s.

    Definition Classes
    CommonGenerators
  204. def tuple2s[A, B](implicit genOfA: Generator[A], genOfB: Generator[B]): Generator[(A, B)]

    Given Generators for types A and B, get one that produces Tuples of those types.

    Given Generators for types A and B, get one that produces Tuples of those types.

    tuple2s (and its variants, up through tuple22s) will create Generators on demand for essentially arbitrary Tuples, so long as you have Generators in implicit scope for all of the component types.

    A

    the first type in the Tuple

    B

    the second type in the Tuple

    genOfA

    a Generator for type A

    genOfB

    a Generator for type B

    returns

    a Generator that produces the desired types, Tupled together.

    Definition Classes
    CommonGenerators
  205. def tuple3s[A, B, C](implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C]): Generator[(A, B, C)]

    See tuple2s.

    See tuple2s.

    Definition Classes
    CommonGenerators
  206. def tuple4s[A, B, C, D](implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D]): Generator[(A, B, C, D)]

    See tuple2s.

    See tuple2s.

    Definition Classes
    CommonGenerators
  207. def tuple5s[A, B, C, D, E](implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E]): Generator[(A, B, C, D, E)]

    See tuple2s.

    See tuple2s.

    Definition Classes
    CommonGenerators
  208. def tuple6s[A, B, C, D, E, F](implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F]): Generator[(A, B, C, D, E, F)]

    See tuple2s.

    See tuple2s.

    Definition Classes
    CommonGenerators
  209. def tuple7s[A, B, C, D, E, F, G](implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G]): Generator[(A, B, C, D, E, F, G)]

    See tuple2s.

    See tuple2s.

    Definition Classes
    CommonGenerators
  210. def tuple8s[A, B, C, D, E, F, G, H](implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H]): Generator[(A, B, C, D, E, F, G, H)]

    See tuple2s.

    See tuple2s.

    Definition Classes
    CommonGenerators
  211. def tuple9s[A, B, C, D, E, F, G, H, I](implicit genOfA: Generator[A], genOfB: Generator[B], genOfC: Generator[C], genOfD: Generator[D], genOfE: Generator[E], genOfF: Generator[F], genOfG: Generator[G], genOfH: Generator[H], genOfI: Generator[I]): Generator[(A, B, C, D, E, F, G, H, I)]

    See tuple2s.

    See tuple2s.

    Definition Classes
    CommonGenerators
  212. def vectors[T](implicit genOfT: Generator[T]): Generator[Vector[T]] with HavingLength[Vector[T]]

    Given a Generator for type T, this creates one for a Vector of T.

    Given a Generator for type T, this creates one for a Vector of T.

    Note that the Vector type is considered to have a "size", so you can use the configuration parameters Configuration.minSize and Configuration.sizeRange to constrain the sizes of the resulting Vectors when you use this Generator.

    The resulting Generator also has the HavingLength trait, so you can use it to generate Vectors with specific lengths.

    T

    the type to produce

    genOfT

    a Generator that produces values of type T

    returns

    a Generator that produces values of type Vector[T]

    Definition Classes
    CommonGenerators
  213. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  214. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  215. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from CommonGenerators

Inherited from AnyRef

Inherited from Any

Creating Generators from Specific Values

These functions let you create Generators that only return specific values

Creating Higher-Order Generators from other Generators

These functions let you create Generators that are built from more than one existing Generator.

Generators for Many Common Types

These cover types from both the Scala Standard Library and Scalactic

Generators that produce the values from Scalactic Types

Scalactic has many highly-precise numeric types such as NonZeroLong, PosZFloat or FiniteDouble. These help you make sure your code is using exactly the numbers you intend, and they are very convenient for using with Generators. But if the code under test is not using Scalactic, you sometimes find that you need to type .value a lot. These Generators do that for so: you can choose a precise numeric Generator, but get the conventional numeric type from it.

Generators for standard Collections

These functions take one or more types T, and create Generators that produce collections of T.

Range-based Generator Creation

Functions that create Generators for values in a specific range of a specific type.

Generators that Produce Functions

These functions create Generators that produce random functions with specified parameter and return types.

Generators for instances of case classes

These functions are one way to create Generators for case class instances.

Tools for Developing Generators

Ungrouped