Class Shrinkers


  • public class Shrinkers
    extends Object
    Class providing shrinkers for various value types.
    Author:
    Herbert Praehofer
    • Field Detail

      • posIntShrinker

        public static Shrinker<Integer> posIntShrinker
        A shrinker for positive int values.
      • intShrinker

        public static Shrinker<Integer> intShrinker
        A shrinker for arbitrary int values.
      • intListShrinker

        public static Shrinker<FList<Integer>> intListShrinker
        A shrinker for lists of integers
      • doubleShrinker

        public static Shrinker<Double> doubleShrinker
        A shrinker for double values.
      • charShrinker

        public static Shrinker<Character> charShrinker
        A shrinker for char values.
    • Constructor Detail

      • Shrinkers

        public Shrinkers()
    • Method Detail

      • empty

        public static <E> Shrinker<E> empty()
        An shrinker which does not provide values.
        Type Parameters:
        E - the type of values (for type checking)
        Returns:
        the shrinker not providing a simple shrunk value
      • fListShrinker

        public static <E> Shrinker<FList<E>> fListShrinker()
        A shrinker for FList lists. Lists are shrunk by removing elements.
        Type Parameters:
        E - the type of list elements
        Returns:
        a shrinker for lists
      • concat

        @SafeVarargs
        private static <A> Stream<A> concat​(Stream<A>... streams)
        Concatenates multiple streams to a single stream.
        Type Parameters:
        A - the type of elements of the stream
        Parameters:
        streams - the streams to concatenate
        Returns:
        the concatenated stream
      • fListShrinker

        public static <E> Shrinker<FList<E>> fListShrinker​(Shrinker<E> eShrinker)
        A shrinker for FList lists where a given shrinker is used for shrinking the elements. This shrinker shrinks list by removing elements and shrinking elements by the given shrinker.
        Type Parameters:
        E - the type of list elements
        Parameters:
        eShrinker - the shrinker for element values
        Returns:
        the shrinker for lists