<commit_before>﻿using System;
using System.Linq;
using Lury.Compiling.Logger;
using Lury.Compiling.Utils;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace UnitTest
{
    [TestClass]
    public class CompileOutputTest
    {
        private const int number = 0;
        private const string code = "code";
        private const string sourceCode = "source code";
        private static readonly CharPosition pos = new CharPosition(1, 8);
        private const string appendix = "appendix";

        private static OutputLogger logger = new OutputLogger();

        [ClassInitialize]
        public static void ClassInitialize(TestContext context)
        {
            logger.ReportInfo(number, code, sourceCode, pos, appendix);
            logger.ReportWarn(1, code, sourceCode, pos, appendix);
            logger.ReportError(2, code, sourceCode, pos, appendix);
            logger.ReportInfo(3, code, sourceCode, pos, appendix);
            logger.ReportWarn(4, code, sourceCode, pos, appendix);
            logger.ReportError(5, code, sourceCode, pos, appendix);

            CompileOutput.MessageProviders.Add(new MessageProviderInfo());
            CompileOutput.MessageProviders.Add(new MessageProviderWarn());
            CompileOutput.MessageProviders.Add(new MessageProviderError());
        }

        [TestMethod]
        public void ConstructorTest()
        {
            CompileOutput output = logger.Outputs.First();

            Assert.AreEqual(OutputCategory.Info, output.Category);
            Assert.AreEqual(number, output.OutputNumber);
            Assert.AreEqual(code, output.Code);
            Assert.AreEqual(sourceCode, output.SourceCode);
            Assert.AreEqual(pos, output.Position);
            Assert.AreEqual(appendix, output.Appendix);
        }

        [TestMethod]
        public void OutputNumberTest()
        {
            CompileOutput output = logger.Outputs.First();
            Assert.AreEqual(number, output.OutputNumber);
        }

        [TestMethod]
        public void CategoryTest()
        {
            CompileOutput output = logger.Outputs.First();
            Assert.AreEqual(OutputCategory.Info, output.Category);
        }

        [TestMethod]
        public void PositionTest()
        {
            CompileOutput output = logger.Outputs.First();
            Assert.AreEqual(pos, output.Position);
        }

        [TestMethod]
        public void CodeTest()
        {
            CompileOutput output = logger.Outputs.First();
            Assert.AreEqual(code, output.Code);
        }

        [TestMethod]
        public void SourceCodeTest()
        {
            CompileOutput output = logger.Outputs.First();
            Assert.AreEqual(sourceCode, output.SourceCode);
        }

        [TestMethod]
        public void AppendixTest()
        {
            CompileOutput output = logger.Outputs.First();
            Assert.AreEqual(appendix, output.Appendix);
        }<commit_msg>Update unittest CompileOutputTest<commit_after>﻿using System;
using System.Linq;
using Lury.Compiling.Logger;
using Lury.Compiling.Utils;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace UnitTest
{
    [TestClass]
    public class CompileOutputTest
    {
        private const int number = 0;
        private const string code = "code";
        private const string sourceCode = "source code";
        private static readonly CharPosition pos = new CharPosition(1, 8);
        private const string appendix = "appendix";
        private const string sourceName = "sourceName";
        private const int codePosLength = 3;
        private static readonly CodePosition codePos = new CodePosition(sourceName, pos, codePosLength);

        private static OutputLogger logger = new OutputLogger();

        [ClassInitialize]
        public static void ClassInitialize(TestContext context)
        {
            logger.ReportInfo(number, code, sourceCode, codePos, appendix);
            logger.ReportWarn(1, code, sourceCode, codePos, appendix);
            logger.ReportError(2, code, sourceCode, codePos, appendix);
            logger.ReportInfo(3, code, sourceCode, codePos, appendix);
            logger.ReportWarn(4, code, sourceCode, codePos, appendix);
            logger.ReportError(5, code, sourceCode, codePos, appendix);

            CompileOutput.MessageProviders.Add(new MessageProviderInfo());
            CompileOutput.MessageProviders.Add(new MessageProviderWarn());
            CompileOutput.MessageProviders.Add(new MessageProviderError());
        }

        [TestMethod]
        public void ConstructorTest()
        {
            CompileOutput output = logger.Outputs.First();

            Assert.AreEqual(OutputCategory.Info, output.Category);
            Assert.AreEqual(number, output.OutputNumber);
            Assert.AreEqual(code, output.Code);
            Assert.AreEqual(sourceCode, output.SourceCode);
            Assert.AreEqual(codePos, output.Position);
            Assert.AreEqual(appendix, output.Appendix);
        }

        [TestMethod]
        public void OutputNumberTest()
        {
            CompileOutput output = logger.Outputs.First();
            Assert.AreEqual(number, output.OutputNumber);
        }

        [TestMethod]
        public void CategoryTest()
        {
            CompileOutput output = logger.Outputs.First();
            Assert.AreEqual(OutputCategory.Info, output.Category);
        }

        [TestMethod]
        public void PositionTest()
        {
            CompileOutput output = logger.Outputs.First();
            Assert.AreEqual(codePos, output.Position);
        }

        [TestMethod]
        public void CodeTest()
        {
            CompileOutput output = logger.Outputs.First();
            Assert.AreEqual(code, output.Code);
        }

        [TestMethod]
        public void SourceCodeTest()
        {
            CompileOutput output = logger.Outputs.First();
            Assert.AreEqual(sourceCode, output.SourceCode);
        }

        [TestMethod]
        public void AppendixTest()
        {
            CompileOutput output = logger.Outputs.First();
            Assert.AreEqual(appendix, output.Appendix);
        }
{'fraction_non_alphanumeric': 0.09146735617323852, 'fraction_numerical': 0.0027472527472527475, 'mean_word_length': 2.27633668607729, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '216769', 'n_tokens_mistral': 1574, 'n_tokens_neox': 1511, 'n_words': 353}