diff options
Diffstat (limited to 'src/main/java/au/id/zancanaro/javacheck/Generators.java')
-rw-r--r-- | src/main/java/au/id/zancanaro/javacheck/Generators.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main/java/au/id/zancanaro/javacheck/Generators.java b/src/main/java/au/id/zancanaro/javacheck/Generators.java index eab3eed..548bd29 100644 --- a/src/main/java/au/id/zancanaro/javacheck/Generators.java +++ b/src/main/java/au/id/zancanaro/javacheck/Generators.java @@ -7,6 +7,7 @@ import java.util.List; import java.util.function.Function; import java.util.function.Predicate; +@SuppressWarnings("unused") public final class Generators { private Generators() { } @@ -26,6 +27,12 @@ public final class Generators { }; } + public static <T> Generator<T> noShrink(Generator<T> gen) { + return (random, size) -> new RoseTree<>( + gen.generate(random, size).getValue(), + Collections.emptyList()); + } + @SafeVarargs public static <T> Generator<T> oneOf(Generator<T>... gens) { return integer(0, gens.length).flatMap(index -> gens[index]); @@ -91,8 +98,6 @@ public final class Generators { }; } - ; - public static <T> Generator<List<T>> listOf(Generator<T> gen) { return (random, size) -> { Generator<Integer> countGen = sized(s -> integer(0, s)); |