Skip to content

Commit

Permalink
Removed unused unit test methods:
Browse files Browse the repository at this point in the history
- Removed output space helper methods from SyllableGeneratorTests
- The unit tests that were using them were split into smaller, simpler tests that no longer need them
  • Loading branch information
kesac committed Jan 7, 2024
1 parent a00cb49 commit 0ab25a0
Showing 1 changed file with 0 additions and 65 deletions.
65 changes: 0 additions & 65 deletions Syllabore/Syllabore.Tests/SyllableGeneratorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,71 +45,6 @@ private static SyllableGenerator GetConsonantOnlyGenerator()
.WithTrailingConsonantSequences("bbbb", "bbbbb");
}

/// <summary>
/// Helper method to check that the output of a provider never contains
/// <strong>any</strong> of the specified substrings.
/// </summary>
private bool EachOutputNeverContainsAnyOf(SyllableGenerator p, params string[] invalidSubstrings)
{
bool outputNeverAppears = true;
for (int i = 0; i < 1000; i++)
{
var s = p.NextSyllable();
if (s.ContainsAny(invalidSubstrings))
{
outputNeverAppears = false;
break;
}
}

return outputNeverAppears;
}

/// <summary>
/// Helper method to check that the output of a provider always contains at least one
/// instance of <strong>any</strong> of the specified substrings.
/// </summary>
private bool EachOutputContainsAnyOf(SyllableGenerator p, params string[] validSubstrings)
{
bool outputAlwaysAppears = true;
for (int i = 0; i < 1000; i++)
{
var s = p.NextSyllable();
if (!s.ContainsAny(validSubstrings))
{
outputAlwaysAppears = false;
break;
}
}

return outputAlwaysAppears;
}

/// <summary>
/// Helper method to check that the output of a provider always contains at least one
/// instance of <strong>all</strong> of the specified substrings.
/// </summary>
private bool AllOutputContainsAtLeastOnce(SyllableGenerator p, params string[] validSubstrings)
{
bool[] substringAppeared = new bool[validSubstrings.Length];

for (int i = 0; i < 1000; i++)
{
var s = p.NextSyllable();

for (int j = 0; j < validSubstrings.Length; j++)
{
if (s.Contains(validSubstrings[j]))
{
substringAppeared[j] = true;
}
}
}

return substringAppeared.All(x => x);

}

[TestMethod]
public void SyllableGenerator_NoGraphemes_StartingSyllableGenerationThrowsException()
{
Expand Down

0 comments on commit 0ab25a0

Please sign in to comment.