mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-10 22:54:14 +00:00
Split legality tests into subtests by folder
This commit is contained in:
parent
feb2eab7e5
commit
e3c28156bf
1 changed files with 19 additions and 14 deletions
|
@ -27,33 +27,38 @@ namespace PKHeX.Tests.Legality
|
|||
WordFilter.IsFiltered(badword, out _).Should().BeTrue("the word should have been identified as a bad word");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestFilesPassOrFailLegalityChecks()
|
||||
[Theory]
|
||||
[InlineData("Legal", true)]
|
||||
[InlineData("Illegal", false)]
|
||||
public void TestPublicFiles(string name, bool isValid)
|
||||
{
|
||||
var folder = TestUtil.GetRepoPath();
|
||||
folder = Path.Combine(folder, "Legality");
|
||||
ParseSettings.AllowGBCartEra = true;
|
||||
VerifyAll(folder, "Legal", true);
|
||||
VerifyAll(folder, "Illegal", false);
|
||||
VerifyAll(folder, name, isValid);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestPrivateFiles()
|
||||
[Theory]
|
||||
[InlineData("Legal", true)]
|
||||
[InlineData("Illegal", false)]
|
||||
[InlineData("PassingHacks", true)] // mad hacks, stuff to be flagged in the future
|
||||
[InlineData("FalseFlags", false)] // legal quirks, to be fixed in the future
|
||||
public void TestPrivateFiles(string name, bool isValid)
|
||||
{
|
||||
var folder = TestUtil.GetRepoPath();
|
||||
folder = Path.Combine(folder, "Legality", "Private");
|
||||
ParseSettings.AllowGBCartEra = true;
|
||||
VerifyAll(folder, "Legal", true);
|
||||
VerifyAll(folder, "Illegal", false);
|
||||
VerifyAll(folder, "PassingHacks", true); // mad hacks, stuff to be flagged in the future
|
||||
VerifyAll(folder, "FalseFlags", false); // legal quirks, to be fixed in the future
|
||||
VerifyAll(folder, name, isValid, false);
|
||||
}
|
||||
|
||||
// ReSharper disable once UnusedParameter.Local
|
||||
private static void VerifyAll(string folder, string name, bool isValid)
|
||||
private static void VerifyAll(string folder, string name, bool isValid, bool checkDir = true)
|
||||
{
|
||||
var path = Path.Combine(folder, name);
|
||||
Directory.Exists(path).Should().BeTrue($"the specified test directory at '{path}' should exist");
|
||||
bool exists = Directory.Exists(path);
|
||||
if (checkDir)
|
||||
exists.Should().BeTrue($"the specified test directory at '{path}' should exist");
|
||||
else if (!exists)
|
||||
return;
|
||||
|
||||
var files = Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories);
|
||||
var ctr = 0;
|
||||
foreach (var file in files)
|
||||
|
|
Loading…
Reference in a new issue