<commit_before>﻿using System;
using System.Collections.Generic;

namespace TDDUnit {
  class TestTestCase : TestCase {
    public TestTestCase(string name) : base(name) {
    }

    public override void SetUp() {
      base.SetUp();

      m_result = new TestResult();
    }

    public void TestTemplateMethod() {
      WasRunObj test = new WasRunObj("TestMethod");
      test.Run(m_result);
      Assert.Equal("SetUp TestMethod TearDown ", test.Log);
    }

    public void TestResult() {
      WasRunObj test = new WasRunObj("TestMethod");
      test.Run(m_result);
      Assert.Equal("1 run, 0 failed", m_result.Summary);
    }

    public void TestFailedResult() {
      WasRunObj test = new WasRunObj("TestBrokenMethod");
      test.Run(m_result);
      Assert.Equal("1 run, 1 failed", m_result.Summary);
    }

    public void TestFailedResultFormatting() {
      m_result.TestStarted();
      m_result.TestFailed();
      Assert.Equal("1 run, 1 failed", m_result.Summary);
    }

    public void TestFailedSetUp() {
      WasRunSetUpFailed test = new WasRunSetUpFailed("TestMethod");
      
      m_result.TestStarted();
      try {
        test.Run(new TestResult());
      } catch (Exception) {
        m_result.TestFailed();
      }
      Assert.Equal("1 run, 0 failed", m_result.Summary);
    }

    public void TestNoTearDownWhenSetUpFailed() {
      WasRunSetUpFailed test = new WasRunSetUpFailed("TestMethod");

      test.Run(m_result);
      Assert.Equal("SetUp ", test.Log);
    }

    public void TestSuite() {
      TestSuite suite = new TestSuite();
      suite.Add(new WasRunObj("TestMethod"));
      suite.Add(new WasRunObj("TestBrokenMethod"));

      suite.Run(m_result);
      Assert.Equal("2 run, 1 failed", m_result.Summary);
    }

    public void TestRunAllTests() {
      TestSuite suite = new TestSuite(typeof (WasRunObj));
      suite.Run(m_result);
      Assert.Equal("2 run, 1 failed", m_result.Summary);
    }

    public void TestTearDownWhenTestFailed() {
      WasRunObj test = new WasRunObj("TestBrokenMethod");
      test.Run(m_result);
      Assert.Equal("SetUp TestBrokenMethod TearDown ", test.Log);
    }

    public void TestYieldFailedTestNames() {
      TestSuite suite = new TestSuite(typeof (WasRunObj));
      Assert.That(new HashSet<string>(suite.FailedTests(m_result))
        .SetEquals(new HashSet<string>(new string[] { "TestBrokenMethod" })));
    }

    private TestResult m_result;
  }

  class Program {
    static void Main() {
      TestSuite suite = new TestSuite(typeof (TestTestCase));
      TestResult result = new TestResult();
      
      suite.Run(result);
      Console.WriteLine(result.Summary);
    }
  }
}
<commit_msg>Use failed tests names feature<commit_after>﻿using System;
using System.Collections.Generic;

namespace TDDUnit {
  class TestTestCase : TestCase {
    public TestTestCase(string name) : base(name) {
    }

    public override void SetUp() {
      base.SetUp();

      m_result = new TestResult();
    }

    public void TestTemplateMethod() {
      WasRunObj test = new WasRunObj("TestMethod");
      test.Run(m_result);
      Assert.Equal("SetUp TestMethod TearDown ", test.Log);
    }

    public void TestResult() {
      WasRunObj test = new WasRunObj("TestMethod");
      test.Run(m_result);
      Assert.Equal("1 run, 0 failed", m_result.Summary);
    }

    public void TestFailedResult() {
      WasRunObj test = new WasRunObj("TestBrokenMethod");
      test.Run(m_result);
      Assert.Equal("1 run, 1 failed", m_result.Summary);
    }

    public void TestFailedResultFormatting() {
      m_result.TestStarted();
      m_result.TestFailed();
      Assert.Equal("1 run, 1 failed", m_result.Summary);
    }

    public void TestFailedSetUp() {
      WasRunSetUpFailed test = new WasRunSetUpFailed("TestMethod");
      
      m_result.TestStarted();
      try {
        test.Run(new TestResult());
      } catch (Exception) {
        m_result.TestFailed();
      }
      Assert.Equal("1 run, 0 failed", m_result.Summary);
    }

    public void TestNoTearDownWhenSetUpFailed() {
      WasRunSetUpFailed test = new WasRunSetUpFailed("TestMethod");

      test.Run(m_result);
      Assert.Equal("SetUp ", test.Log);
    }

    public void TestSuite() {
      TestSuite suite = new TestSuite();
      suite.Add(new WasRunObj("TestMethod"));
      suite.Add(new WasRunObj("TestBrokenMethod"));

      suite.Run(m_result);
      Assert.Equal("2 run, 1 failed", m_result.Summary);
    }

    public void TestRunAllTests() {
      TestSuite suite = new TestSuite(typeof (WasRunObj));
      suite.Run(m_result);
      Assert.Equal("2 run, 1 failed", m_result.Summary);
    }

    public void TestTearDownWhenTestFailed() {
      WasRunObj test = new WasRunObj("TestBrokenMethod");
      test.Run(m_result);
      Assert.Equal("SetUp TestBrokenMethod TearDown ", test.Log);
    }

    public void TestYieldFailedTestNames() {
      TestSuite suite = new TestSuite(typeof (WasRunObj));
      Assert.That(new HashSet<string>(suite.FailedTests(m_result))
        .SetEquals(new HashSet<string>(new string[] { "TestBrokenMethod" })));
    }

    private TestResult m_result;
  }

  class Program {
    static void Main() {
      TestSuite suite = new TestSuite(typeof (TestTestCase));
      TestResult result = new TestResult();

      foreach (string test in suite.FailedTests(result)) {
        Console.WriteLine("Failed: " + test);
      }
      Console.WriteLine(result.Summary);
    }
  }
}

{'fraction_non_alphanumeric': 0.12018967718402335, 'fraction_numerical': 0.0043771657851541124, 'mean_word_length': 2.9567099567099566, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '553949', 'n_tokens_mistral': 1688, 'n_tokens_neox': 1642, 'n_words': 358}