Exemple #1
0
 public ActionFactoryAnonymousInnerClass(RandomizedTester <T, F> outerInstance, IEnumerator <Action <T, F> > iterator, int actionToSkip, Org.Neo4j.Test.randomized.Action <T, F> failingAction)
 {
     this.outerInstance  = outerInstance;
     this._iterator      = iterator;
     this._actionToSkip  = actionToSkip;
     this._failingAction = failingAction;
 }
Exemple #2
0
        /// <summary>
        /// Starts with the existing list of actions that were produced by <seealso cref="run(int)"/>, trying to prune actions
        /// from that list, while still being able to reproduce the exact same failure. The result is a new
        /// <seealso cref="RandomizedTester"/> instance. with a potentially reduced list of actions.
        /// </summary>
        /// <returns> a reduced list of actions to reproduce the failure. </returns>
        public virtual RandomizedTester <T, F> FindMinimalReproducible()
        {
            RandomizedTester <T, F> minimal = this;

            while (true)
            {
                RandomizedTester <T, F> candidate = minimal.ReduceOneAction();
                if (candidate == minimal)
                {
                    return(candidate);
                }
                minimal = candidate;
            }
        }
Exemple #3
0
        private RandomizedTester <T, F> ReduceOneAction()
        {
            int numberOfIterations = _givenActions.Count;

            if (numberOfIterations == 1)
            {
                return(this);
            }
            for (int actionToSkip = 0; actionToSkip < _givenActions.Count; actionToSkip++)
            {
                RandomizedTester <T, F> reducedActions = new RandomizedTester <T, F>(_targetFactory, ActionFactoryThatSkipsOneAction(_givenActions.GetEnumerator(), actionToSkip, _failingAction), _failingAction, _failure);
                Result <T, F>           result         = reducedActions.Run(numberOfIterations - 1);
                if (result.Failure && result.Index == _givenActions.Count - 1 && result.Failure.Equals(_failure))
                {
                    return(reducedActions);
                }
            }
            return(this);
        }