<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using NUnit.Framework;
using Prometheus.Advanced.DataContracts;
using Prometheus.Internal;
using Prometheus.SummaryImpl;

namespace Prometheus.Tests
{
    
    [TestFixture]
    public class SummaryTests
    {
        [Test]
        public void TestSummaryConcurrency([Range(0, 1000000, 10000)] int n)
        {
            var random = new Random(42);
            var mutations = n%10000 + 10000;
            var concLevel = n%5 + 1;
            var total = mutations * concLevel;
                
            var sum = new Summary("test_summary", "helpless", new string[0]);
            var allVars = new double[total];
            double sampleSum = 0;
            var tasks = new List<Task>();

            for (var i = 0; i < concLevel; i++)
            {
                var vals = new double[mutations];
                for (var j = 0; j < mutations; j++)
                {
                    var v = random.NormDouble();
                    vals[j] = v;
                    allVars[i * mutations + j] = v;
                    sampleSum += v;
                }<commit_msg>fixes concurency test for summary metric<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using NUnit.Framework;
using Prometheus.Advanced.DataContracts;
using Prometheus.Internal;
using Prometheus.SummaryImpl;

namespace Prometheus.Tests
{
    
    [TestFixture]
    public class SummaryTests
    {
        [Test]
        public void TestSummaryConcurrency([Range(0, 1000000, 10000)] int n)
        {
            var random = new Random(42);
            var mutations = n%10000 + 10000;
            var concLevel = (n / 10000) % 5 + 1;
            var total = mutations * concLevel;
                
            var sum = new Summary("test_summary", "helpless", new string[0]);
            var allVars = new double[total];
            double sampleSum = 0;
            var tasks = new List<Task>();

            for (var i = 0; i < concLevel; i++)
            {
                var vals = new double[mutations];
                for (var j = 0; j < mutations; j++)
                {
                    var v = random.NormDouble();
                    vals[j] = v;
                    allVars[i * mutations + j] = v;
                    sampleSum += v;
                }
{'fraction_non_alphanumeric': 0.09855670103092784, 'fraction_numerical': 0.027628865979381443, 'mean_word_length': 1.628385698808234, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, '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': '7475774', 'n_tokens_mistral': 727, 'n_tokens_neox': 637, 'n_words': 193}