Esempio n. 1
0
        private MutationTestInfo ProceedTestResult(MethodTurtleBase turtle)
        {
            var mutationInfo = new MutationTestInfo(0, 0);

            while (_pendingTest.Count != 0)
            {
                var testResult = _dispatcher.ReadATest();
                var mutation   = _pendingTest[testResult.Uid];
                if (!CheckTestResult(turtle, mutation, testResult))
                {
                    Interlocked.Increment(ref mutationInfo.MutantsFailures);
                }
                Interlocked.Increment(ref mutationInfo.MutantsCount);
                _pendingTest.Remove(testResult.Uid);
            }
            return(mutationInfo);
        }
Esempio n. 2
0
        private MutationTestInfo MutateAndTest()
        {
            var mutationInfo = new MutationTestInfo(0, 0);

            if (_mutationsToApply.Count == 0)
            {
                PopulateDefaultTurtles();
            }
            foreach (var turtleType in _mutationsToApply)
            {
                var turtle = (MethodTurtleBase)Activator.CreateInstance(turtleType);
                Console.WriteLine(turtle.Description);
                _pendingTest = new Dictionary <string, MutantMetaData>();
                foreach (var mutation in turtle.Mutate(_method, _module, _originalOffsets))
                {
                    SendMutationTestToDispatcher(mutation);
                }
                mutationInfo += ProceedTestResult(turtle);
            }
            return(mutationInfo);
        }
Esempio n. 3
0
        private MutationTestInfo MutateAndCount()
        {
            var mutationsInfo = new MutationTestInfo(0, 0);

            if (_mutationsToApply.Count == 0)
            {
                PopulateDefaultTurtles();
            }
            foreach (var turtleType in _mutationsToApply)
            {
                var turtle = (MethodTurtleBase)Activator.CreateInstance(turtleType);
                foreach (var mutation in turtle.Mutate(_method, _module, _originalOffsets))
                {
                    mutationsInfo.MutantsCount++;
                    _report.AddResult(mutation.MethodDefinition.GetCurrentSequencePoint(mutation.ILIndex), mutation, false);
                    turtle.MutantComplete(mutation);
                }
            }
            mutationsInfo.MutantsFailures = mutationsInfo.MutantsCount;
            return(mutationsInfo);
        }