示例#1
0
        /// <summary>
        /// Invokes the code that this plan represents.
        /// </summary>
        /// <param name="executionResults"></param>
        /// <returns></returns>
        public bool Execute(out ResultTuple executionResult, TextWriter executionLog,
                            TextWriter debugLog, out bool preconditionViolated, out Exception exceptionThrown,
                            out bool contractViolated, bool forbidNull, bool useRandoopContracts)
        {
            numTimesExecuted++;
            long startTime = 0;

            Timer.QueryPerformanceCounter(ref startTime);

            // Execute parent plans
            ResultTuple[] results1 = new ResultTuple[parentPlans.Length];
            for (int i = 0; i < parentPlans.Length; i++)
            {
                Plan        plan = parentPlans[i];
                ResultTuple tempResults;
                if (!plan.ExecuteHelper(out tempResults, executionLog, debugLog, out preconditionViolated, out exceptionThrown, out contractViolated, forbidNull, useRandoopContracts, out CanGenerateContractAssertion))
                {
                    executionResult = null;
                    return(false);
                }
                results1[i] = tempResults;
            }

            // Execute.
            if (!transformer.Execute(out executionResult, results1, parameterChoosers, executionLog, debugLog,
                                     out preconditionViolated, out exceptionThrown, out contractViolated, forbidNull, useRandoopContracts, out CanGenerateContractAssertion))
            {
                executionResult = null;
                return(false);
            }

            RecordExecutionTime(startTime);
            return(true);
        }
示例#2
0
        /// <summary>
        /// Invokes the code that this plan represents.
        /// TODO: what's the difference between this and the other Execute method?
        /// </summary>
        /// <param name="executionResults"></param>
        /// <returns></returns>
        public bool ExecuteHelper(out ResultTuple executionResult, TextWriter executionLog,
                                  TextWriter debugLog, out bool preconditionViolated, out Exception exceptionThrown, out bool contractViolated,
                                  bool forbidNull, bool useRandoopContracts, out ContractState contractStates)
        {
            // Execute parent plans
            ResultTuple[] results1 = new ResultTuple[parentPlans.Length];
            for (int i = 0; i < parentPlans.Length; i++)
            {
                Plan        plan = parentPlans[i];
                ResultTuple tempResults;
                if (!plan.ExecuteHelper(out tempResults, executionLog, debugLog, out preconditionViolated, out exceptionThrown, out contractViolated, forbidNull, useRandoopContracts, out contractStates))
                {
                    executionResult = null;
                    return(false);
                }
                results1[i] = tempResults;
            }

            //// Execute
            if (!transformer.Execute(out executionResult, results1, parameterChoosers, executionLog, debugLog,
                                     out preconditionViolated, out exceptionThrown, out contractViolated, forbidNull, useRandoopContracts, out contractStates))
            {
                executionResult = null;
                return(false);
            }

            return(true);
        }