mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Parser tests, part 1
This commit is contained in:
52
SabreTools.Test/DatTools/ParserTests.cs
Normal file
52
SabreTools.Test/DatTools/ParserTests.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
using SabreTools.DatFiles;
|
||||
using SabreTools.DatTools;
|
||||
using Xunit;
|
||||
|
||||
namespace SabreTools.Test.DatTools
|
||||
{
|
||||
public class ParserTests
|
||||
{
|
||||
// TODO: Create files for each of these
|
||||
// TODO: Ensure that all stress all bits of reading
|
||||
// TODO: Add total count? Might be a good metric if everything read
|
||||
[Theory]
|
||||
[InlineData(null, (DatFormat)0x00)]
|
||||
//[InlineData(null, DatFormat.Logiqx)]
|
||||
//[InlineData(null, DatFormat.LogiqxDeprecated)] // Not parsed separately
|
||||
//[InlineData(null, DatFormat.SoftwareList)]
|
||||
//[InlineData(null, DatFormat.Listxml)]
|
||||
//[InlineData(null, DatFormat.OfflineList)]
|
||||
//[InlineData(null, DatFormat.SabreXML)]
|
||||
//[InlineData(null, DatFormat.OpenMSX)]
|
||||
//[InlineData(null, DatFormat.ClrMamePro)]
|
||||
//[InlineData(null, DatFormat.RomCenter)]
|
||||
//[InlineData(null, DatFormat.DOSCenter)]
|
||||
//[InlineData(null, DatFormat.AttractMode)]
|
||||
//[InlineData(null, DatFormat.MissFile)] // Parsing is not supported
|
||||
//[InlineData(null, DatFormat.CSV)]
|
||||
//[InlineData(null, DatFormat.SSV)]
|
||||
//[InlineData(null, DatFormat.TSV)]
|
||||
//[InlineData(null, DatFormat.Listrom)]
|
||||
[InlineData("test-smdb.txt", DatFormat.EverdriveSMDB)]
|
||||
//[InlineData(null, DatFormat.SabreJSON)]
|
||||
[InlineData("test-sfv.sfv", DatFormat.RedumpSFV)]
|
||||
[InlineData("test-md5.md5", DatFormat.RedumpMD5)]
|
||||
[InlineData("test-sha1.sha1", DatFormat.RedumpSHA1)]
|
||||
[InlineData("test-sha256.sha256", DatFormat.RedumpSHA256)]
|
||||
[InlineData("test-sha384.sha384", DatFormat.RedumpSHA384)]
|
||||
[InlineData("test-sha512.sha512", DatFormat.RedumpSHA512)]
|
||||
[InlineData("test-spamsum.spamsum", DatFormat.RedumpSpamSum)]
|
||||
public void CreateAndParseTest(string filename, DatFormat datFormat)
|
||||
{
|
||||
// For all filenames, add the local path for test data
|
||||
if (filename != null)
|
||||
filename = Path.Combine(Environment.CurrentDirectory, "TestData", filename);
|
||||
|
||||
var datFile = Parser.CreateAndParse(filename);
|
||||
Assert.Equal(datFormat, datFile.Header.DatFormat);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,12 +9,23 @@
|
||||
<ProjectReference Include="..\SabreTools.Core\SabreTools.Core.csproj" />
|
||||
<ProjectReference Include="..\SabreTools.DatFiles\SabreTools.DatFiles.csproj" />
|
||||
<ProjectReference Include="..\SabreTools.DatItems\SabreTools.DatItems.csproj" />
|
||||
<ProjectReference Include="..\SabreTools.DatTools\SabreTools.DatTools.csproj" />
|
||||
<ProjectReference Include="..\SabreTools.FileTypes\SabreTools.FileTypes.csproj" />
|
||||
<ProjectReference Include="..\SabreTools.Filtering\SabreTools.Filtering.csproj" />
|
||||
<ProjectReference Include="..\SabreTools.IO\SabreTools.IO.csproj" />
|
||||
<ProjectReference Include="..\SabreTools.Skippers\SabreTools.Skippers.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="TestData\*" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="TestData\*">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
|
||||
1
SabreTools.Test/TestData/test-md5.md5
Normal file
1
SabreTools.Test/TestData/test-md5.md5
Normal file
@@ -0,0 +1 @@
|
||||
d41d8cd98f00b204e9800998ecf8427e rom.bin
|
||||
1
SabreTools.Test/TestData/test-sfv.sfv
Normal file
1
SabreTools.Test/TestData/test-sfv.sfv
Normal file
@@ -0,0 +1 @@
|
||||
rom.bin 00000000
|
||||
1
SabreTools.Test/TestData/test-sha1.sha1
Normal file
1
SabreTools.Test/TestData/test-sha1.sha1
Normal file
@@ -0,0 +1 @@
|
||||
da39a3ee5e6b4b0d3255bfef95601890afd80709 rom.bin
|
||||
1
SabreTools.Test/TestData/test-sha256.sha256
Normal file
1
SabreTools.Test/TestData/test-sha256.sha256
Normal file
@@ -0,0 +1 @@
|
||||
ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad rom.bin
|
||||
1
SabreTools.Test/TestData/test-sha384.sha384
Normal file
1
SabreTools.Test/TestData/test-sha384.sha384
Normal file
@@ -0,0 +1 @@
|
||||
cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7 rom.bin
|
||||
1
SabreTools.Test/TestData/test-sha512.sha512
Normal file
1
SabreTools.Test/TestData/test-sha512.sha512
Normal file
@@ -0,0 +1 @@
|
||||
ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f rom.bin
|
||||
1
SabreTools.Test/TestData/test-smdb.txt
Normal file
1
SabreTools.Test/TestData/test-smdb.txt
Normal file
@@ -0,0 +1 @@
|
||||
ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad test/rom.bin da39a3ee5e6b4b0d3255bfef95601890afd80709 d41d8cd98f00b204e9800998ecf8427e 00000000
|
||||
1
SabreTools.Test/TestData/test-spamsum.spamsum
Normal file
1
SabreTools.Test/TestData/test-spamsum.spamsum
Normal file
@@ -0,0 +1 @@
|
||||
QXX rom.bin
|
||||
Reference in New Issue
Block a user