Beispiel #1
0
        protected override CheckStateTransition <T> Decorate(
            GenerationStates.Generation_End <T> generationEndState,
            GenerationStates.Generation_Begin <T> generationBeginState,
            CheckStateContext <T> nextContext)
        {
            var nextContextResized = Resize(_resizeStrategy, generationEndState, nextContext);

            return(new CheckStateTransition <T>(generationBeginState, nextContextResized));
        }
Beispiel #2
0
        private static CheckStateContext <T> Resize(
            ResizeStrategy <T> resizeStrategy,
            GenerationStates.Generation_End <T> generationEndState,
            CheckStateContext <T> nextContext)
        {
            if (generationEndState.WasLateDiscard)
            {
                if (nextContext.ConsecutiveLateDiscards >= MaxConsecutiveDiscards)
                {
                    return(nextContext
                           .WithNextGenParameters(nextContext.NextParameters with
                    {
                        Size = nextContext.NextParameters.Size.BigIncrement()
                    })
                           .ResetConsecutiveDiscards());
                }
                else
                {
                    return(nextContext);
                }
            }
            else
            {
                var resizeStrategyInfo = new ResizeStrategyInformation <T>(
                    nextContext,
                    generationEndState.CounterexampleContext,
                    generationEndState.Instance);

                var nextSize = resizeStrategy(resizeStrategyInfo);

                return(nextContext
                       .WithNextGenParameters(nextContext.NextParameters with {
                    Size = nextSize
                }));
            }
        }