Skip to content

Commit

Permalink
Split API and engine
Browse files Browse the repository at this point in the history
  • Loading branch information
vlsi committed Jan 19, 2020
1 parent cc40e74 commit 20fd375
Show file tree
Hide file tree
Showing 198 changed files with 663 additions and 266 deletions.
78 changes: 78 additions & 0 deletions core-api/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.pholser</groupId>
<artifactId>junit-quickcheck</artifactId>
<version>0.10-SNAPSHOT</version>
</parent>

<artifactId>junit-quickcheck-core-api</artifactId>
<version>0.10-SNAPSHOT</version>
<packaging>jar</packaging>
<name>junit-quickcheck-core-api</name>
<description>Property-based testing, JUnit-style: core functionality</description>
<url>http://github.com/pholser/junit-quickcheck</url>

<dependencies>
<dependency>
<groupId>org.javaruntype</groupId>
<artifactId>javaruntype</artifactId>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ a copy of this software and associated documentation files (the
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import com.pholser.junit.quickcheck.generator.Generator;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.*;

import com.pholser.junit.quickcheck.generator.Generator;

/**
* <p>Mark a parameter of a {@link Property} method with this annotation to
* have random values supplied to it via the specified
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ a copy of this software and associated documentation files (the
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

package com.pholser.junit.quickcheck.generator;
package com.pholser.junit.quickcheck;

import com.pholser.junit.quickcheck.generator.Generator;

/**
* Raised if a problem arises when attempting to configure a generator with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ a copy of this software and associated documentation files (the

package com.pholser.junit.quickcheck;

import com.pholser.junit.quickcheck.internal.ParameterSampler;
import com.pholser.junit.quickcheck.internal.sampling.ExhaustiveParameterSampler;
import com.pholser.junit.quickcheck.internal.sampling.TupleParameterSampler;

/**
* Represents different modes of execution of property-based tests.
*
Expand All @@ -40,23 +36,13 @@ public enum Mode {
* Verify {@link Property#trials()} tuples of arguments for a property's
* parameters.
*/
SAMPLING {
@Override ParameterSampler sampler(int defaultSampleSize) {
return new TupleParameterSampler(defaultSampleSize);
}
},
SAMPLING,

/**
* Generate {@link Property#trials()} arguments for each parameter
* property, and verify the cross-products of those sets of arguments.
* This behavior mirrors that of the JUnit
* {@link org.junit.experimental.theories.Theories} runner.
*/
EXHAUSTIVE {
@Override ParameterSampler sampler(int defaultSampleSize) {
return new ExhaustiveParameterSampler(defaultSampleSize);
}
};

abstract ParameterSampler sampler(int defaultSampleSize);
EXHAUSTIVE;
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ a copy of this software and associated documentation files (the

package com.pholser.junit.quickcheck;

import com.pholser.junit.quickcheck.generator.Gen;

import java.util.Objects;

/**
* Typed pair of elements.
*
* @param <F> type of first element of pair
* @param <S> type of second element of pair
* @see com.pholser.junit.quickcheck.generator.Gen#frequency(Pair, Pair[])
* @see Gen#frequency(Pair, Pair[])
*/
public final class Pair<F, S> {
public final F first;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ a copy of this software and associated documentation files (the
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.*;

import com.pholser.junit.quickcheck.generator.Generator;

/**
* <p>Mark a parameter of a {@link Property} method with this annotation to
* have random values supplied to it via one of the
* {@link com.pholser.junit.quickcheck.generator.Generator}s specified by the
* {@link Generator}s specified by the
* aggregated {@link From} annotations.</p>
*
* <p>Alternatively, you can specify many generators via many repetitions of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ a copy of this software and associated documentation files (the
import java.util.Map;
import java.util.function.Consumer;

import com.pholser.junit.quickcheck.GeneratorConfigurationException;
import com.pholser.junit.quickcheck.internal.Reflection;
import com.pholser.junit.quickcheck.internal.ReflectionException;
import com.pholser.junit.quickcheck.random.SourceOfRandomness;
import org.javaruntype.type.TypeParameter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.pholser.junit.quickcheck.internal.generator;
package com.pholser.junit.quickcheck.generator;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;
Expand Down
Loading

0 comments on commit 20fd375

Please sign in to comment.