Johannes Link

Results 390 comments of Johannes Link

Here's a first take... Imagine class `StringStack` with the following public interface: ```java public class StringStack { public void push(String element) { ... } public String pop() { ... }...

I made the example runnable. You find it here: https://github.com/jlink/property-based-testing/tree/master/pbt-java/src/test/java/pbt/stateful/stackWithModel

The property looks like that: ```java class StringStackProperties { @Property(tries = 100) void checkMyStackMachine(@ForAll("sequences") ActionSequence sequence) { Tuple2 initial = Tuple.of(new StringStack(), new ArrayList()); sequence.run(initial); } @Provide Arbitrary sequences() {...

I changed the ModelAction interface to allow for precondition equivalence checking between model and state: ```java interface ModelAction { default boolean preconditionOnModel(M modelState) { return true; } default boolean preconditionOnState(S...

> I would like to write code like Have you tried it? Should already work.

Would that feature be useful if shared values couldn't be shrunk? Without shrinking this is rather easy to implement...

The easy implementation is to just store the generated unshrinkable value on first access. Going for a full flatmap and flat combine behind the scenes would IMO require a data...

> ```java > @Provide > Arbitrary fullNames(@ForAll("firstNames") String firstName, @ForAll("lastNames") lastName) { > return firstName + lastName; > } > ``` That code doesn’t compile though. Jqwik needs a clear...

Did some experimentation in https://github.com/jlink/jqwik/blob/main/engine/src/test/java/experiments/SharedArbitraryExperiments.java