Пример #1
0
        /// <summary>
        /// Retrieves the race information.
        /// </summary>
        /// <param name="example">The counter example.</param>
        /// <param name="error">The race error.</param>
        /// <returns>The race errors.</returns>
        public IEnumerable <RaceError> GetRaceInformation(CallCounterexample example, RaceError error)
        {
            string raceName, access1, access2;

            DetermineNatureOfRace(example, out raceName, out access1, out access2);
            PopulateModelWithStatesIfNecessary(example);

            string raceyArrayName = GetArrayName(example.FailingRequires);
            IEnumerable <SourceLocationInfo> possibleSourcesForFirstAccess =
                GetPossibleSourceLocationsForFirstAccessInRace(
                    example, raceyArrayName, AccessType.Create(access1), GetStateName(example));
            SourceLocationInfo sourceInfoForSecondAccess = new SourceLocationInfo(
                GetAttributes(example.FailingCall), GetSourceFileName(), example.FailingCall.tok);

            error.RaceType = raceName;
            error.Access1  = access1;
            error.Access2  = access2;

            List <RaceError> errors = new List <RaceError>();

            foreach (SourceLocationInfo possibleSourceForFirstAccess in possibleSourcesForFirstAccess)
            {
                RaceError race = new RaceError(error.CounterExample, error.Implementation)
                {
                    RaceType = raceName,
                    Access1  = access1,
                    Access2  = access2,
                    Start    = possibleSourceForFirstAccess,
                    End      = sourceInfoForSecondAccess
                };

                errors.Add(race);
            }

            if (!errors.Any())
            {
                return new List <RaceError> {
                           error
                }
            }
            ;
            return(errors);
        }