예제 #1
0
        private void MutantAnalyzerOnMutantExecuted(object sender, CppMutantEventArgs e)
        {
            lock (Sync)
            {
                var mutant     = e.Mutant;
                var lineNumber = mutant.Mutation.LineNumber;
                var status     = $"{Environment.NewLine}Line: {lineNumber} - {mutant.ResultStatus.ToString()} - {mutant.Mutation.DisplayName}".PrintWithDateTimeSimple();

                if (mutant.ResultStatus == MutantStatus.Survived)
                {
                    _chalk.Yellow($"{status}{Environment.NewLine}");
                }
                else if (mutant.ResultStatus == MutantStatus.BuildError)
                {
                    _chalk.Red($"{status}{Environment.NewLine}");
                }
                else if (mutant.ResultStatus == MutantStatus.Timeout)
                {
                    _chalk.Cyan($"{status}{Environment.NewLine}");
                }
                else
                {
                    _chalk.Green($"{status}{Environment.NewLine}");
                }

                if (_options.EnableDiagnostics)
                {
                    _chalk.Red($"{e.BuildLog.ConvertToPlainText()}{Environment.NewLine}");
                    _chalk.Red($"{e.TestLog.ConvertToPlainText()}{Environment.NewLine}");
                }

                _mutantProgress++;
                UpdateProgress();
            }
        }
예제 #2
0
        private void MutantAnalyzerOnMutantExecuted(object sender, MutantEventArgs e)
        {
            lock (_sync)
            {
                var mutant     = e.Mutant;
                var lineNumber = mutant.Mutation.OriginalNode.GetLocation().GetLineSpan().StartLinePosition.Line + 1;
                var status     = $"{Environment.NewLine}Line: {lineNumber} - {mutant.ResultStatus.ToString()} - {mutant.Mutation.DisplayName}".PrintWithDateTimeSimple();

                switch (mutant.ResultStatus)
                {
                case MutantStatus.Survived:
                    _chalk.Yellow(status);
                    break;

                case MutantStatus.Timeout:
                    _chalk.Cyan(status);
                    break;

                case MutantStatus.BuildError:
                    _chalk.Red(status);
                    break;

                default:
                    _chalk.Green(status);
                    break;
                }

                if (EnableDiagnostics)
                {
                    _chalk.Red($"{Environment.NewLine}{e.BuildLog.ConvertToPlainText()}{Environment.NewLine}");
                    _chalk.Red($"{Environment.NewLine}{e.TestLog.ConvertToPlainText()}{Environment.NewLine}");
                }

                MutantProgress++;
                UpdateProgress();
            }
        }