<commit_before>﻿namespace Http.Grammar
{
    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.Linq;
    using System.Reflection;
    using System.Text;
    using System.Threading.Tasks;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using SLANG;

    [TestClass]
    public class ReflectionTests
    {
        private static Assembly Assembly;

        [ClassInitialize]
        public static void ClassInitialize(TestContext context)
        {
            Assembly = Assembly.Load("Http.Grammar");
        }

        [TestMethod]
        public void AllElementsShouldBePublic()
        {
            var allTypes = Assembly.GetTypes();
            var elementTypes = allTypes.Where(type => typeof(Element).IsAssignableFrom(type)).ToList();
            foreach (var type in elementTypes)
            {
                Assert.IsTrue(type.IsPublic, "typeof({0}).IsPublic", type.FullName);
            }
        }

        [TestMethod]
        public void AllLexersShouldBePublic()
        {
            var allTypes = Assembly.GetTypes();
            var elementTypes = allTypes.Where(type => typeof(Lexer<>).IsAssignableFrom(type)).ToList();
            foreach (var type in elementTypes)
            {
                Assert.IsTrue(type.IsPublic, "typeof({0}).IsPublic", type.FullName);
            }
        }

        [TestMethod]
        public void AllLexersShouldHaveParameterlessConstructors()
        {
            var allTypes = Assembly.GetTypes();
            var elementTypes = allTypes.Where(type => type.GetInterfaces().Where(i => i.IsGenericType).Select(i => i.GetGenericTypeDefinition()).Contains(typeof(ILexer<>))).ToList();
            foreach (var type in elementTypes)
            {
                var constructor = type.GetConstructor(Type.EmptyTypes);
                Assert.IsNotNull(constructor, "typeof({0}).GetConstructor(Type.EmptyTypes)", type.FullName);
            }
        }
    }
}<commit_msg>Updating a reflection based test<commit_after>﻿namespace Http.Grammar
{
    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.Linq;
    using System.Reflection;
    using System.Text;
    using System.Threading.Tasks;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using SLANG;

    [TestClass]
    public class ReflectionTests
    {
        private static Assembly Assembly;

        [ClassInitialize]
        public static void ClassInitialize(TestContext context)
        {
            Assembly = Assembly.Load("Http.Grammar");
        }

        [TestMethod]
        public void AllElementsShouldBePublic()
        {
            var allTypes = Assembly.GetTypes();
            var elementTypes = allTypes.Where(type => typeof(Element).IsAssignableFrom(type)).ToList();
            foreach (var type in elementTypes)
            {
                Assert.IsTrue(type.IsPublic, "typeof({0}).IsPublic", type.FullName);
            }
        }

        [TestMethod]
        public void AllLexersShouldBePublic()
        {
            var allTypes = Assembly.GetTypes();
            var elementTypes = allTypes.Where(type => typeof(Lexer<>).IsAssignableFrom(type) && !type.IsAbstract).ToList();
            foreach (var type in elementTypes)
            {
                Assert.IsTrue(type.IsPublic, "typeof({0}).IsPublic", type.FullName);
            }
        }

        [TestMethod]
        public void AllLexersShouldHaveParameterlessConstructors()
        {
            var allTypes = Assembly.GetTypes();
            var elementTypes = allTypes.Where(type => type.GetInterfaces().Where(i => i.IsGenericType).Select(i => i.GetGenericTypeDefinition()).Contains(typeof(ILexer<>))).ToList();
            foreach (var type in elementTypes)
            {
                var constructor = type.GetConstructor(Type.EmptyTypes);
                Assert.IsNotNull(constructor, "typeof({0}).GetConstructor(Type.EmptyTypes)", type.FullName);
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.1055514065222803, 'fraction_numerical': 0.0014936519790888724, 'mean_word_length': 2.20926517571885, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, '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': '2001626', 'n_tokens_mistral': 1053, 'n_tokens_neox': 1033, 'n_words': 201}