Skip to content

Commit

Permalink
tidying
Browse files Browse the repository at this point in the history
  • Loading branch information
Magnus Mikkelsen committed Jun 29, 2020
1 parent a367eb3 commit b6a5527
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 588 deletions.
40 changes: 0 additions & 40 deletions Src/BenchMarking/BenchMarkXeger.cs

This file was deleted.

17 changes: 17 additions & 0 deletions Src/Fare.Benchmarking/Benchmark.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using BenchmarkDotNet.Attributes;

namespace Fare.Benchmarking
{
public class Benchmark
{
private const string Pattern = ".";
private readonly Random random = new Random();

[Benchmark]
public Xeger XegerCtorSimple() => new Xeger(Pattern);

[Benchmark]
public Xeger XegerCtorInjectRandom() => new Xeger(Pattern, this.random);
}
}
File renamed without changes.
12 changes: 12 additions & 0 deletions Src/Fare.Benchmarking/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using BenchmarkDotNet.Running;

namespace Fare.Benchmarking
{
public class Program
{
public static void Main(string[] args)
{
var summary = BenchmarkRunner.Run<Benchmark>();
}
}
}
51 changes: 0 additions & 51 deletions Src/Fare.IntegrationTests/XegerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,6 @@ public XegerTests(ITestOutputHelper testOutput)
this._testOutput = testOutput;
}

[Fact]
public void NewXeger2()
{
new PR56Option2.Xeger(".");
new PR56Option2.Xeger(".");
new PR56Option2.Xeger(".");
new PR56Option2.Xeger(".");
new PR56Option2.Xeger(".");
new PR56Option2.Xeger(".");
new PR56Option2.Xeger(".");
new PR56Option2.Xeger(".");
new PR56Option2.Xeger(".");
new PR56Option2.Xeger(".");
}

[Fact]
public void NewXeger()
{
new Xeger(".");
new Xeger(".");
new Xeger(".");
new Xeger(".");
new Xeger(".");
new Xeger(".");
new Xeger(".");
new Xeger(".");
new Xeger(".");
new Xeger(".");
}

[Theory, MemberData(nameof(RegexPatternTestCases))]
public void GeneratedTextIsCorrect(string pattern)
{
Expand Down Expand Up @@ -71,27 +41,6 @@ public void GeneratedTextIsCorrect(string pattern)
Assert.All(result, regex => Assert.Matches(pattern, regex));
}

[Fact]
public void GeneratedTextsAreDifferentWhenUsingDefaultCtorAndNewXegerRapidly()
{
// Arrange
const int repeatCount = 10;

// Act
var result = Enumerable.Repeat(0, repeatCount)
.Select(_ =>
{
Xeger sut = new Xeger(".{10}");
string generatedValue = sut.Generate();
this._testOutput.WriteLine($"Generated value: {generatedValue}");
return generatedValue;
})
.ToArray();

// Assert
Assert.Equal(result.Distinct(), result);
}

#if REX_AVAILABLE
[Theory, MemberData(nameof(RegexPatternTestCases))]
public void GeneratedTextIsCorrectWithRexEngine(string pattern)
Expand Down
14 changes: 7 additions & 7 deletions Src/Fare.sln
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
..\Build.fsx = ..\Build.fsx
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BenchMarking", "BenchMarking\BenchMarking.csproj", "{EA6FAD38-1671-47A5-A8AA-C845B45FA31A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Fare.Benchmarking", "Fare.Benchmarking\Fare.Benchmarking.csproj", "{67368248-4A8C-4D5B-B155-4D9307634F40}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -35,12 +35,12 @@ Global
{20F5CC3B-9D71-472A-BD28-3A4C104A00E4}.Release|Any CPU.Build.0 = Release|Any CPU
{20F5CC3B-9D71-472A-BD28-3A4C104A00E4}.Verify|Any CPU.ActiveCfg = Verify|Any CPU
{20F5CC3B-9D71-472A-BD28-3A4C104A00E4}.Verify|Any CPU.Build.0 = Verify|Any CPU
{EA6FAD38-1671-47A5-A8AA-C845B45FA31A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EA6FAD38-1671-47A5-A8AA-C845B45FA31A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EA6FAD38-1671-47A5-A8AA-C845B45FA31A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EA6FAD38-1671-47A5-A8AA-C845B45FA31A}.Release|Any CPU.Build.0 = Release|Any CPU
{EA6FAD38-1671-47A5-A8AA-C845B45FA31A}.Verify|Any CPU.ActiveCfg = Debug|Any CPU
{EA6FAD38-1671-47A5-A8AA-C845B45FA31A}.Verify|Any CPU.Build.0 = Debug|Any CPU
{67368248-4A8C-4D5B-B155-4D9307634F40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{67368248-4A8C-4D5B-B155-4D9307634F40}.Debug|Any CPU.Build.0 = Debug|Any CPU
{67368248-4A8C-4D5B-B155-4D9307634F40}.Release|Any CPU.ActiveCfg = Release|Any CPU
{67368248-4A8C-4D5B-B155-4D9307634F40}.Release|Any CPU.Build.0 = Release|Any CPU
{67368248-4A8C-4D5B-B155-4D9307634F40}.Verify|Any CPU.ActiveCfg = Debug|Any CPU
{67368248-4A8C-4D5B-B155-4D9307634F40}.Verify|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
154 changes: 0 additions & 154 deletions Src/Fare/XegerOption1AndAHalf.cs

This file was deleted.

Loading

0 comments on commit b6a5527

Please sign in to comment.