Skip to content

Commit

Permalink
Fixed #119
Browse files Browse the repository at this point in the history
  • Loading branch information
jlink committed Sep 15, 2020
1 parent 99fe758 commit ee0de5f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 13 deletions.
15 changes: 5 additions & 10 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
- 1.3.6

- Update JUnit to https://junit.org/junit5/docs/5.7.0/release-notes/

- Update JUnit to https://junit.org/junit5/docs/5.7.0/release-notes/
- https://github.com/junit-team/junit5/issues/1771 in JqwikIntegrationTests

- https://github.com/jlink/jqwik/issues/119
Minimize warning logs about combinatorial explosion to 1

- Shrink nullable generators to null if possible

- Shrink frequencyOf consistently to earlier parts, e.g.
Expand All @@ -20,12 +16,11 @@

- Edge Cases

- Warning "WARNING: Combinatorial explosion of edge case generation. Stopped creating more after 10000 generated cases."
- should only appear ONCE per property run
- if possible contain more info about arbitrary/generator for which it occurs

- Restrict number of generated edge cases to number of tries
- For embedded/individual use of generators only use a max of 100 edge cases

- Arbitrary.withoutEdgeCases()
- should also work for individual generators
- should also work for embedded/individual generators
- Maybe introduce ArbitraryDecorator or something like that

- Arbitrary.addEdgeCase(value)
Expand Down
6 changes: 5 additions & 1 deletion docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,17 @@ title: jqwik Release Notes

#### Breaking Changes

- No known breaking changes
- A maximum of 1000 (instead of 10000) edge cases is generated _per arbitrary_.

#### Bug Fixes

- With a lot of edge cases sometimes _only_ edge cases were generated.
Now the minimum ratio is 1 edge case in 3 generating steps.

- Warning about combinatorial explosion of edge cases generation is
now [logged only once](https://github.com/jlink/jqwik/issues/119).


## 1.3.5

<p style="padding-left:1em;font-size:larger">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.stream.*;

import net.jqwik.api.*;
import net.jqwik.api.lifecycle.*;
import net.jqwik.engine.*;
import net.jqwik.engine.properties.shrinking.*;
import net.jqwik.engine.support.*;
Expand All @@ -15,10 +16,17 @@
*/
public class EdgeCasesFacadeImpl extends EdgeCases.EdgeCasesFacade {

private static final int MAX_NUMBER_OF_EDGE_CASES = 10000;
private static final int MAX_NUMBER_OF_EDGE_CASES = 1000;

private static final Logger LOG = Logger.getLogger(EdgeCasesFacadeImpl.class.getName());

private Store<Boolean> warningAlreadyLogged =
Store.create(
Tuple.of(EdgeCasesFacadeImpl.class, "warning"),
Lifespan.PROPERTY,
() -> false
);

@Override
public <T> EdgeCases<T> fromSuppliers(final List<Supplier<Shrinkable<T>>> suppliers) {
return new EdgeCases<T>() {
Expand Down Expand Up @@ -92,11 +100,17 @@ public <T, U> EdgeCases<U> flatMapArbitrary(EdgeCases<T> self, Function<T, Arbit
}

private void logTooManyEdgeCases(int maxNumberOfEdgeCases) {
if (warningAlreadyLogged.get()) {
// This is a terrible hack to suppress multiple logging
// TODO: Remove by properly implementing generation of edge cases
return;
}
String message = String.format(
"Combinatorial explosion of edge case generation. Stopped creating more after %s generated cases.",
maxNumberOfEdgeCases
);
LOG.warning(message);
warningAlreadyLogged.update(ignore -> true);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion engine/src/test/java/examples/bugs/JqwikLogExplosion.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// see https://github.com/jlink/jqwik/issues/119
class JqwikLogExplosion {

@Property(edgeCases = EdgeCasesMode.NONE)
@Property(edgeCases = EdgeCasesMode.MIXIN)
public void my_property(@ForAll("things") final List<Thing2> thing) {
// Spams the following warning, despite "EdgeCasesMode.NONE"
// Aug 30, 2020 2:23:01 PM net.jqwik.engine.facades.EdgeCasesFacadeImpl logTooManyEdgeCases
Expand Down

0 comments on commit ee0de5f

Please sign in to comment.