Module de.cuioss.test.generator
Class QuickCheck
java.lang.Object
de.cuioss.test.generator.internal.net.java.quickcheck.QuickCheck
QuickCheck is an implementation of the Haskell QuickCheck generator based
test tool (...).
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <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 intstatic voidguard(boolean predicate) All executions ofCharacteristic.specify(Object)which execute this method will be skipped and a new test case will be generated.
-
Field Details
-
MAX_NUMBER_OF_RUNS
- See Also:
-
MIN_NUMBER_OF_RUNS
- See Also:
-
SYSTEM_PROPERTY_RUNS
-
-
Constructor Details
-
QuickCheck
public QuickCheck()
-
-
Method Details
-
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
-
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
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.
-