net.java.quickcheck
Class QuickCheck

java.lang.Object
  extended by net.java.quickcheck.QuickCheck

public class QuickCheck
extends Object

QuickCheck is an implementation of the Haskell QuickCheck generator based test tool (http://www.cs.chalmers.se/~rjmh/QuickCheck/).


Field Summary
static int MAX_NUMBER_OF_RUNS
           
static int MIN_NUMBER_OF_RUNS
           
static String SYSTEM_PROPERTY_RUNS
           
 
Constructor Summary
QuickCheck()
           
 
Method Summary
static
<T> void
forAll(Generator<T> generator, Characteristic<T> characteristic)
          Check the Characteristic for all values generated by the given Generator.
static
<T> void
forAll(int runs, Generator<T> generator, Characteristic<T> characteristic)
          Check the Characteristic for all values generated by the given Generator.
static
<T> void
forAllVerbose(Generator<T> generator, Characteristic<T> characteristic)
          Check the Characteristic for all values generated by the given Generator.
static
<T> void
forAllVerbose(int runs, Generator<T> generator, Characteristic<T> characteristic)
          Check the Characteristic for all values generated by the given Generator.
static int getDefaultNumberOfRuns()
           
static void guard(boolean predicate)
          All executions of Characteristic.specify(Object) which execute guard(boolean) will be skipped and a new test case will be generated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_NUMBER_OF_RUNS

public static final int MAX_NUMBER_OF_RUNS
See Also:
Constant Field Values

MIN_NUMBER_OF_RUNS

public static final int MIN_NUMBER_OF_RUNS
See Also:
Constant Field Values

SYSTEM_PROPERTY_RUNS

public static final String SYSTEM_PROPERTY_RUNS
Constructor Detail

QuickCheck

public QuickCheck()
Method Detail

forAll

public static <T> void forAll(Generator<T> generator,
                              Characteristic<T> characteristic)
                   throws GeneratorException,
                          CharacteristicException
Check the Characteristic for all values generated by the given Generator. The execution will fail fast if any of the calls of the Characteristic.specify(Object) method throws an exception.

Type Parameters:
T - type of the generated values
Throws:
CharacteristicException - if a characteristic is not true for a generated value
GeneratorException - if generation of the next value failed.

getDefaultNumberOfRuns

public static int getDefaultNumberOfRuns()

forAll

public static <T> void forAll(int runs,
                              Generator<T> generator,
                              Characteristic<T> characteristic)
                   throws GeneratorException,
                          CharacteristicException
Check the Characteristic for all values generated by the given Generator. The execution will fail fast if any of the calls of the Characteristic.specify(Object) method throws an exception.

Type Parameters:
T - type of the generated values
Parameters:
runs - number of runs and generated values for this characteristic
Throws:
CharacteristicException - if a characteristic is not true for a generated value
GeneratorException - if generation of the next value failed.

forAllVerbose

public static <T> void forAllVerbose(Generator<T> generator,
                                     Characteristic<T> characteristic)
                          throws GeneratorException,
                                 CharacteristicException
Check the Characteristic for all values generated by the given Generator. The execution will fail fast if any of the calls of the Characteristic.specify(Object) method throws an exception.

Type Parameters:
T - type of the generated values
Throws:
CharacteristicException - if a characteristic is not true for a generated value
GeneratorException - if generation of the next value failed.

forAllVerbose

public static <T> void forAllVerbose(int runs,
                                     Generator<T> generator,
                                     Characteristic<T> characteristic)
                          throws GeneratorException,
                                 CharacteristicException
Check the Characteristic for all values generated by the given Generator. The execution will fail fast if any of the calls of the Characteristic.specify(Object) method throws an exception.

Type Parameters:
T - type of the generated values
Parameters:
runs - number of runs and generated values for this characteristic
Throws:
CharacteristicException - if a characteristic is not true for a generated value
GeneratorException - if generation of the next value failed.

guard

public static void guard(boolean predicate)
All executions of Characteristic.specify(Object) which execute guard(boolean) will be skipped and a new test case will be generated. Execution will be stopped if it is not possible to create a new test cases after a reasonable amount of tries.

Parameters:
predicate - Skip the current test case if the predicate is true.


Copyright © 2011. All Rights Reserved.