Skip to content

Commit

Permalink
Merge pull request #17 from jqwik-team/upgrade-jqwik-173
Browse files Browse the repository at this point in the history
Upgrade to jqwik 1.7.3
  • Loading branch information
Befrish authored Mar 27, 2023
2 parents eb06c90 + a73d491 commit 9a7a704
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 65 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ void generateSizableListFrom(@ForAll @From("integersMin3") final io.vavr.collect

## Version compatibility

| jqwik-vavr | jqwik | vavr |
|:----------:|:----------:|:----------:|
| 1.0.0 | 1.3.6 | 0.10.3 |
| 2.0.0 | 1.6.5 | 0.10.4 |
| jqwik-vavr | jqwik | vavr |
|:----------:|:-----:|:------:|
| 1.0.0 | 1.3.6 | 0.10.3 |
| 2.0.0 | 1.6.5 | 0.10.4 |
| 3.0.0 | 1.7.3 | 0.10.4 |

## Installation with Maven (Version >= 2.0.0)

Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ static isSnapshotRelease(versionString) {

ext {
moduleName = 'net.jqwik.vavr'
jqwikVavrVersion = '2.1.0-SNAPSHOT'
jqwikVersion = '1.6.5'
junitPlatformVersion = '1.8.2'
jqwikVavrVersion = '3.0.0-SNAPSHOT'
jqwikVersion = '1.7.3'
junitPlatformVersion = '1.9.2'
vavrVersion = '0.10.4'
hamcrestVersion = '2.2'
isSnapshotRelease = isSnapshotRelease(jqwikVavrVersion)
Expand Down Expand Up @@ -131,6 +131,6 @@ signing {
}

wrapper {
gradleVersion = '7.4.2'
// upgrade with: ./gradlew wrapper --gradle-version 7.4.2
gradleVersion = '8.0.2'
// upgrade with: ./gradlew wrapper
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>net.jqwik</groupId>
<artifactId>jqwik-vavr</artifactId>
<version>2.1.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
<packaging>jar</packaging>

<url>https://github.com/Befrish/jqwik-vavr</url>
Expand Down Expand Up @@ -40,7 +40,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<jqwik.version>1.6.5</jqwik.version>
<jqwik.version>1.7.3</jqwik.version>
<vavr.version>0.10.4</vavr.version>

<hamcrest.version>2.2</hamcrest.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,10 @@ public ListBasedArbitrary<T, U> uniqueElements(final Function<T, Object> by) {
return clone;
}

@Override
public ListBasedArbitrary<T, U> uniqueElements() {
final ListBasedArbitrary<T, U> clone = typedClone();
clone.listArbitrary = listArbitrary.uniqueElements();
return clone;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,9 @@ public SetBasedArbitrary<T, U> uniqueElements(final Function<T, Object> by) {
return clone;
}

@Override
public SetBasedArbitrary<T, U> uniqueElements() {
// Set based arbitraries have unique elements by default
return this;
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@
import net.jqwik.vavr.api.VavrArbitraries;
import net.jqwik.vavr.arbitraries.base.VavrTraversableArbitraryTestBase;

import java.util.function.Function;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.lessThanOrEqualTo;
import static org.hamcrest.Matchers.not;

class VavrListArbitraryTest extends VavrTraversableArbitraryTestBase<List<Integer>, List<Boolean>> {

Expand All @@ -25,4 +29,18 @@ void generateDistinct(@ForAll @UniqueElements final List<Integer> list) {
assertThat(list.distinct().size(), is(list.size()));
}

@Property
void generateDistinctByEvenOdd(@ForAll @UniqueElements(by = ByEvenOdd.class) final List<Integer> list) {
assertThat(list.size(), lessThanOrEqualTo(2));
if (list.size() == 2) {
assertThat(list.get(0) % 2, not(list.get(1) % 2));
}
}

private static class ByEvenOdd implements Function<Integer, Object> {
@Override
public Boolean apply(Integer o) {
return o % 2 == 0;
}
}
}

0 comments on commit 9a7a704

Please sign in to comment.