Class QuickCheck
- java.lang.Object
-
- de.cuioss.test.generator.internal.net.java.quickcheck.QuickCheck
-
public final class QuickCheck extends Object
QuickCheck is an implementation of the Haskell QuickCheck generator based test tool (...).
-
-
Field Summary
Fields Modifier and Type Field Description static intMAX_NUMBER_OF_RUNSstatic intMIN_NUMBER_OF_RUNSstatic StringSYSTEM_PROPERTY_RUNS
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> voidforAll(int runs, Generator<T> generator, Characteristic<T> characteristic)Check theCharacteristicfor all values generated by the givenGenerator.static <T> voidforAll(Generator<T> generator, Characteristic<T> characteristic)Check theCharacteristicfor all values generated by the givenGenerator.static <T> voidforAllVerbose(int runs, Generator<T> generator, Characteristic<T> characteristic)Check theCharacteristicfor all values generated by the givenGenerator.static <T> voidforAllVerbose(Generator<T> generator, Characteristic<T> characteristic)Check theCharacteristicfor all values generated by the givenGenerator.static intgetDefaultNumberOfRuns()static voidguard(boolean predicate)All executions ofCharacteristic.specify(Object)which execute this method will be skipped and a new test case will be generated.
-
-
-
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
-
-
Method Detail
-
forAll
public static <T> void forAll(Generator<T> generator, Characteristic<T> characteristic) throws GeneratorException, CharacteristicException
Check theCharacteristicfor all values generated by the givenGenerator. The execution will fail fast if any of the calls of theCharacteristic.specify(Object)method throws an exception.- Type Parameters:
T- type of the generated values- Throws:
CharacteristicException- if a characteristic is nottruefor a generated valueGeneratorException- 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 theCharacteristicfor all values generated by the givenGenerator. The execution will fail fast if any of the calls of theCharacteristic.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 nottruefor a generated valueGeneratorException- if generation of the next value failed.
-
forAllVerbose
public static <T> void forAllVerbose(Generator<T> generator, Characteristic<T> characteristic) throws GeneratorException, CharacteristicException
Check theCharacteristicfor all values generated by the givenGenerator. The execution will fail fast if any of the calls of theCharacteristic.specify(Object)method throws an exception.- Type Parameters:
T- type of the generated values- Throws:
CharacteristicException- if a characteristic is nottruefor a generated valueGeneratorException- 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 theCharacteristicfor all values generated by the givenGenerator. The execution will fail fast if any of the calls of theCharacteristic.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 nottruefor a generated valueGeneratorException- if generation of the next value failed.
-
guard
public static void guard(boolean predicate)
All executions ofCharacteristic.specify(Object)which execute this method 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.
-
-