<commit_before>﻿using BenchmarkDotNet.Jobs;
using System;
using System.Linq;
using System.Threading;
using Xunit;
using BenchmarkDotNet.Reports;
using System.Collections.Generic;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Exporters;
using BenchmarkDotNet.Extensions;
using BenchmarkDotNet.Loggers;
using BenchmarkDotNet.Running;

namespace BenchmarkDotNet.IntegrationTests
{
    [Config(typeof(SingleRunFastConfig))]
    public class BaselineDiffColumnTest
    {
        [Params(1, 2)]
        public int ParamProperty { get; set; }

        [Fact]
        public void Test()
        {
            // This is the common way to run benchmarks, it should wire up the BenchmarkBaselineDeltaResultExtender for us
            var summary = BenchmarkRunner.Run<BaselineDiffColumnTest>();

            var table = summary.Table;
            var headerRow = table.FullHeader;
            var column = summary.Config.GetColumns().OfType<BaselineDiffColumn>().FirstOrDefault();
            Assert.NotNull(column);

            Assert.Equal(column.ColumnName, headerRow.Penult());
            var testNameColumn = Array.FindIndex(headerRow, c => c == "Method");
            var extraColumn = Array.FindIndex(headerRow, c => c == column.ColumnName);
            foreach (var row in table.FullContent)
            {
                Assert.Equal(row.Length, extraColumn + 2);
                if (row[testNameColumn] == "BenchmarkSlow") // This is our baseline
                    Assert.Equal("1.00", row[extraColumn]);
                else if (row[testNameColumn] == "BenchmarkFast") // This should have been compared to the baseline
                    Assert.Contains(".", row[extraColumn]);
            }
        }

        [Benchmark(Baseline = true)]<commit_msg>Fix in BaselineDiffColumnTest, see also #122<commit_after>﻿using BenchmarkDotNet.Jobs;
using System;
using System.Linq;
using System.Threading;
using Xunit;
using BenchmarkDotNet.Reports;
using System.Collections.Generic;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Exporters;
using BenchmarkDotNet.Extensions;
using BenchmarkDotNet.Loggers;
using BenchmarkDotNet.Running;

namespace BenchmarkDotNet.IntegrationTests
{
    [Config(typeof(SingleRunFastConfig))]
    public class BaselineDiffColumnTest
    {
        [Params(1, 2)]
        public int ParamProperty { get; set; }

        [Fact]
        public void Test()
        {
            // This is the common way to run benchmarks, it should wire up the BenchmarkBaselineDeltaResultExtender for us
            var summary = BenchmarkRunner.Run<BaselineDiffColumnTest>();

            var table = summary.Table;
            var headerRow = table.FullHeader;
            var column = summary.Config.GetColumns().OfType<BaselineDiffColumn>().FirstOrDefault();
            Assert.NotNull(column);

            Assert.Equal(column.ColumnName, headerRow.Last());
            var testNameColumn = Array.FindIndex(headerRow, c => c == "Method");
            var extraColumn = Array.FindIndex(headerRow, c => c == column.ColumnName);
            foreach (var row in table.FullContent)
            {
                Assert.Equal(row.Length, extraColumn + 1);
                if (row[testNameColumn] == "BenchmarkSlow") // This is our baseline
                    Assert.Equal("1.00", row[extraColumn]);
                else if (row[testNameColumn] == "BenchmarkFast") // This should have been compared to the baseline
                    Assert.Contains(".", row[extraColumn]);
            }
        }

        [Benchmark(Baseline = true)]
{'fraction_non_alphanumeric': 0.09709791158123135, 'fraction_numerical': 0.0040683482506102524, 'mean_word_length': 2.7327935222672064, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3747447', 'n_tokens_mistral': 1025, 'n_tokens_neox': 963, 'n_words': 246}