mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-27 14:30:56 +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");
|
WordFilter.IsFiltered(badword, out _).Should().BeTrue("the word should have been identified as a bad word");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Theory]
|
||||||
public void TestFilesPassOrFailLegalityChecks()
|
[InlineData("Legal", true)]
|
||||||
|
[InlineData("Illegal", false)]
|
||||||
|
public void TestPublicFiles(string name, bool isValid)
|
||||||
{
|
{
|
||||||
var folder = TestUtil.GetRepoPath();
|
var folder = TestUtil.GetRepoPath();
|
||||||
folder = Path.Combine(folder, "Legality");
|
folder = Path.Combine(folder, "Legality");
|
||||||
ParseSettings.AllowGBCartEra = true;
|
VerifyAll(folder, name, isValid);
|
||||||
VerifyAll(folder, "Legal", true);
|
|
||||||
VerifyAll(folder, "Illegal", false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Theory]
|
||||||
public void TestPrivateFiles()
|
[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();
|
var folder = TestUtil.GetRepoPath();
|
||||||
folder = Path.Combine(folder, "Legality", "Private");
|
folder = Path.Combine(folder, "Legality", "Private");
|
||||||
ParseSettings.AllowGBCartEra = true;
|
VerifyAll(folder, name, isValid, false);
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReSharper disable once UnusedParameter.Local
|
// 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);
|
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 files = Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories);
|
||||||
var ctr = 0;
|
var ctr = 0;
|
||||||
foreach (var file in files)
|
foreach (var file in files)
|
||||||
|
|
Loading…
Reference in a new issue