<commit_before>﻿using Conz.Core;
using NUnit.Framework;

namespace Conz.UnitTests.Core {
  [TestFixture]
  public class ParserTest : BaseTestCase {
    [Test]
    public void TestParseNullGivesEmpty() {
      var actual = mParser.Parse(null);
      Assert.That(actual.Length, Is.EqualTo(1));
      Assert.That(actual[0].Style, Is.Null);
      Assert.That(actual[0].Text, Is.EqualTo(""));
    }

    [TestCase("")]
    [TestCase(" ")]
    [TestCase("abc")]
    [TestCase("abc\r\n")]
    [TestCase("abc\r\ndef")]
    public void TestParseNothingStyled(string text) {
      var actual = mParser.Parse(text);
      Assert.That(actual.Length, Is.EqualTo(1));
      Assert.That(actual[0].Style, Is.Null);
      Assert.That(actual[0].Text, Is.EqualTo(text));
    }

    [Test]
    public void TestParseWithTextStyled() {
      var actual = mParser.Parse("|a|hello world|");
      Assert.That(actual.Length, Is.EqualTo(1));
      Assert.That(actual[0].Style, Is.EqualTo("a"));
      Assert.That(actual[0].Text, Is.EqualTo("hello world"));      
    }

    [SetUp]
    public void DoSetup() {
      mParser = new Parser();
    }

    private Parser mParser;
  }
}<commit_msg>updated to use test case source<commit_after>﻿using System.Collections;
using Conz.Core;
using NUnit.Framework;

namespace Conz.UnitTests.Core {
  [TestFixture]
  public class ParserTest : BaseTestCase {
    [Test]
    public void TestParseNullGivesEmpty() {
      var actual = mParser.Parse(null);
      Assert.That(actual.Length, Is.EqualTo(1));
      Assert.That(actual[0].Style, Is.Null);
      Assert.That(actual[0].Text, Is.EqualTo(""));
    }

    [TestCase("")]
    [TestCase(" ")]
    [TestCase("abc")]
    [TestCase("abc\r\n")]
    [TestCase("abc\r\ndef")]
    public void TestParseNothingStyled(string text) {
      var actual = mParser.Parse(text);
      Assert.That(actual.Length, Is.EqualTo(1));
      Assert.That(actual[0].Style, Is.Null);
      Assert.That(actual[0].Text, Is.EqualTo(text));
    }

    [TestCaseSource("GetParseTests")]
    public void TestParseWithTextStyled(string text, Segment[] expected) {
      AssertAreEqual(mParser.Parse(text), expected);
    }

    [SetUp]
    public void DoSetup() {
      mParser = new Parser();
    }

    private IEnumerable GetParseTests() {
      yield return new TestCaseData("|a|hello world|", BA(new Segment("a", "hello world")));
      yield return new TestCaseData("|a|hello world||a|hello world|", BA(new Segment("a", "hello world"),
                                                                         new Segment("a", "hello world")));
    }

    private Parser mParser;
  }
}
{'fraction_non_alphanumeric': 0.15572519083969466, 'fraction_numerical': 0.0057251908396946565, 'mean_word_length': 2.9652042360060515, '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': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '655914', 'n_tokens_mistral': 833, 'n_tokens_neox': 831, 'n_words': 161}