mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Address some nullability in tests
This commit is contained in:
@@ -29,8 +29,12 @@ namespace SabreTools.DatTools
|
||||
/// <param name="filename">Name of the file to be parsed</param>
|
||||
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
||||
/// <param name="throwOnError">True if the error that is thrown should be thrown back to the caller, false otherwise</param>
|
||||
public static DatFile CreateAndParse(string filename, bool statsOnly = false, bool throwOnError = false)
|
||||
public static DatFile CreateAndParse(string? filename, bool statsOnly = false, bool throwOnError = false)
|
||||
{
|
||||
// Null filenames are invalid
|
||||
if (filename == null)
|
||||
return DatFile.Create();
|
||||
|
||||
DatFile datFile = DatFile.Create();
|
||||
ParseInto(datFile, new ParentablePath(filename), statsOnly: statsOnly, throwOnError: throwOnError);
|
||||
return datFile;
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace SabreTools.Filtering
|
||||
/// Populate the filters objects using a set of key:value filters
|
||||
/// </summary>
|
||||
/// <param name="filters">List of key:value where ~key/!key is negated</param>
|
||||
public void PopulateFiltersFromList(List<string> filters)
|
||||
public void PopulateFiltersFromList(List<string>? filters)
|
||||
{
|
||||
// Instantiate the filters, if necessary
|
||||
MachineFilter ??= new MachineFilter();
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace SabreTools.Filtering
|
||||
/// Populate the exclusion objects using a set of field names
|
||||
/// </summary>
|
||||
/// <param name="fields">List of field names</param>
|
||||
public void PopulateExclusionsFromList(List<string> fields)
|
||||
public void PopulateExclusionsFromList(List<string>? fields)
|
||||
{
|
||||
// Instantiate the removers, if necessary
|
||||
DatHeaderRemover ??= new DatHeaderRemover();
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(null, ChipType.NULL)]
|
||||
[InlineData("cpu", ChipType.CPU)]
|
||||
[InlineData("audio", ChipType.Audio)]
|
||||
public void AsChipTypeTest(string field, ChipType expected)
|
||||
public void AsChipTypeTest(string? field, ChipType expected)
|
||||
{
|
||||
ChipType actual = field.AsChipType();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -35,7 +35,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("mahjong", ControlType.Mahjong)]
|
||||
[InlineData("hanafuda", ControlType.Hanafuda)]
|
||||
[InlineData("gambling", ControlType.Gambling)]
|
||||
public void AsControlTypeTest(string field, ControlType expected)
|
||||
public void AsControlTypeTest(string? field, ControlType expected)
|
||||
{
|
||||
ControlType actual = field.AsControlType();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -58,7 +58,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("header datname", DatHeaderField.Name)]
|
||||
[InlineData("DAT.DATNAME", DatHeaderField.Name)]
|
||||
[InlineData("dAt.DAtnamE", DatHeaderField.Name)]
|
||||
public void AsDatHeaderFieldProcessingTest(string field, DatHeaderField expected)
|
||||
public void AsDatHeaderFieldProcessingTest(string? field, DatHeaderField expected)
|
||||
{
|
||||
// TODO: Write new test for all supported fields
|
||||
DatHeaderField actual = field.AsDatHeaderField();
|
||||
@@ -78,7 +78,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("datitem name", DatItemField.Name)]
|
||||
[InlineData("ITEM.NAME", DatItemField.Name)]
|
||||
[InlineData("iTeM.namE", DatItemField.Name)]
|
||||
public void AsDatItemFieldProcessingTest(string field, DatItemField expected)
|
||||
public void AsDatItemFieldProcessingTest(string? field, DatItemField expected)
|
||||
{
|
||||
// TODO: Write new test for all supported fields
|
||||
DatItemField actual = field.AsDatItemField();
|
||||
@@ -108,7 +108,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("midiout", DeviceType.MIDIOut)]
|
||||
[InlineData("picture", DeviceType.Picture)]
|
||||
[InlineData("vidfile", DeviceType.VidFile)]
|
||||
public void AsDeviceTypeTest(string field, DeviceType expected)
|
||||
public void AsDeviceTypeTest(string? field, DeviceType expected)
|
||||
{
|
||||
DeviceType actual = field.AsDeviceType();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -121,7 +121,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("lcd", DisplayType.LCD)]
|
||||
[InlineData("svg", DisplayType.SVG)]
|
||||
[InlineData("unknown", DisplayType.Unknown)]
|
||||
public void AsDisplayTypeTest(string field, DisplayType expected)
|
||||
public void AsDisplayTypeTest(string? field, DisplayType expected)
|
||||
{
|
||||
DisplayType actual = field.AsDisplayType();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -131,7 +131,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(null, Endianness.NULL)]
|
||||
[InlineData("big", Endianness.Big)]
|
||||
[InlineData("little", Endianness.Little)]
|
||||
public void AsEndiannessTest(string field, Endianness expected)
|
||||
public void AsEndiannessTest(string? field, Endianness expected)
|
||||
{
|
||||
Endianness actual = field.AsEndianness();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -141,7 +141,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(null, FeatureStatus.NULL)]
|
||||
[InlineData("unemulated", FeatureStatus.Unemulated)]
|
||||
[InlineData("imperfect", FeatureStatus.Imperfect)]
|
||||
public void AsFeatureStatusTest(string field, FeatureStatus expected)
|
||||
public void AsFeatureStatusTest(string? field, FeatureStatus expected)
|
||||
{
|
||||
FeatureStatus actual = field.AsFeatureStatus();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -163,7 +163,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("lan", FeatureType.Lan)]
|
||||
[InlineData("wan", FeatureType.Wan)]
|
||||
[InlineData("timing", FeatureType.Timing)]
|
||||
public void AsFeatureTypeTest(string field, FeatureType expected)
|
||||
public void AsFeatureTypeTest(string? field, FeatureType expected)
|
||||
{
|
||||
FeatureType actual = field.AsFeatureType();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -178,7 +178,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("nodump", ItemStatus.Nodump)]
|
||||
[InlineData("yes", ItemStatus.Nodump)]
|
||||
[InlineData("verified", ItemStatus.Verified)]
|
||||
public void AsItemStatusTest(string field, ItemStatus expected)
|
||||
public void AsItemStatusTest(string? field, ItemStatus expected)
|
||||
{
|
||||
ItemStatus actual = field.AsItemStatus();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -239,7 +239,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("sound", ItemType.Sound)]
|
||||
[InlineData("sourcedetails", ItemType.SourceDetails)]
|
||||
[InlineData("source_details", ItemType.SourceDetails)]
|
||||
public void AsItemTypeTest(string field, ItemType expected)
|
||||
public void AsItemTypeTest(string? field, ItemType expected)
|
||||
{
|
||||
ItemType actual = field.AsItemType();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -261,7 +261,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("continue", LoadFlag.Continue)]
|
||||
[InlineData("reload_plain", LoadFlag.ReloadPlain)]
|
||||
[InlineData("ignore", LoadFlag.Ignore)]
|
||||
public void AsLoadFlagTest(string field, LoadFlag expected)
|
||||
public void AsLoadFlagTest(string? field, LoadFlag expected)
|
||||
{
|
||||
LoadFlag actual = field.AsLoadFlag();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -273,7 +273,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("user", LogLevel.USER)]
|
||||
[InlineData("warning", LogLevel.WARNING)]
|
||||
[InlineData("error", LogLevel.ERROR)]
|
||||
public void AsLogLevelTest(string field, LogLevel expected)
|
||||
public void AsLogLevelTest(string? field, LogLevel expected)
|
||||
{
|
||||
LogLevel actual = field.AsLogLevel();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -292,7 +292,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("machine name", MachineField.Name)]
|
||||
[InlineData("GAME.NAME", MachineField.Name)]
|
||||
[InlineData("gAmE.namE", MachineField.Name)]
|
||||
public void AsMachineFieldProcessingTest(string field, MachineField expected)
|
||||
public void AsMachineFieldProcessingTest(string? field, MachineField expected)
|
||||
{
|
||||
MachineField actual = field.AsMachineField();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -368,7 +368,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("game.title_id", MachineField.TitleID)]
|
||||
[InlineData("game.type", MachineField.Type)]
|
||||
[InlineData("game.year", MachineField.Year)]
|
||||
public void AsMachineFieldTest(string field, MachineField expected)
|
||||
public void AsMachineFieldTest(string? field, MachineField expected)
|
||||
{
|
||||
MachineField actual = field.AsMachineField();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -382,7 +382,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("device", MachineType.Device)]
|
||||
[InlineData("mech", MachineType.Mechanical)]
|
||||
[InlineData("mechanical", MachineType.Mechanical)]
|
||||
public void AsMachineTypeTest(string field, MachineType expected)
|
||||
public void AsMachineTypeTest(string? field, MachineType expected)
|
||||
{
|
||||
MachineType actual = field.AsMachineType();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -402,7 +402,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("full", MergingFlag.FullNonMerged)]
|
||||
[InlineData("fullnonmerged", MergingFlag.FullNonMerged)]
|
||||
[InlineData("fullunmerged", MergingFlag.FullNonMerged)]
|
||||
public void AsMergingFlagTest(string field, MergingFlag expected)
|
||||
public void AsMergingFlagTest(string? field, MergingFlag expected)
|
||||
{
|
||||
MergingFlag actual = field.AsMergingFlag();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -414,7 +414,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("obsolete", NodumpFlag.Obsolete)]
|
||||
[InlineData("required", NodumpFlag.Required)]
|
||||
[InlineData("ignore", NodumpFlag.Ignore)]
|
||||
public void AsNodumpFlagTest(string field, NodumpFlag expected)
|
||||
public void AsNodumpFlagTest(string? field, NodumpFlag expected)
|
||||
{
|
||||
NodumpFlag actual = field.AsNodumpFlag();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -425,7 +425,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("rom", OpenMSXSubType.Rom)]
|
||||
[InlineData("megarom", OpenMSXSubType.MegaRom)]
|
||||
[InlineData("sccpluscart", OpenMSXSubType.SCCPlusCart)]
|
||||
public void AsOpenMSXSubTypeTest(string field, OpenMSXSubType expected)
|
||||
public void AsOpenMSXSubTypeTest(string? field, OpenMSXSubType expected)
|
||||
{
|
||||
OpenMSXSubType actual = field.AsOpenMSXSubType();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -440,7 +440,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("unzip", PackingFlag.Unzip)]
|
||||
[InlineData("partial", PackingFlag.Partial)]
|
||||
[InlineData("flat", PackingFlag.Flat)]
|
||||
public void AsPackingFlagTest(string field, PackingFlag expected)
|
||||
public void AsPackingFlagTest(string? field, PackingFlag expected)
|
||||
{
|
||||
PackingFlag actual = field.AsPackingFlag();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -454,7 +454,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("le", Relation.LessThanOrEqual)]
|
||||
[InlineData("lt", Relation.LessThan)]
|
||||
[InlineData("ge", Relation.GreaterThanOrEqual)]
|
||||
public void AsRelationTest(string field, Relation expected)
|
||||
public void AsRelationTest(string? field, Relation expected)
|
||||
{
|
||||
Relation actual = field.AsRelation();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -465,7 +465,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("no", Runnable.No)]
|
||||
[InlineData("partial", Runnable.Partial)]
|
||||
[InlineData("yes", Runnable.Yes)]
|
||||
public void AsRunnableTest(string field, Runnable expected)
|
||||
public void AsRunnableTest(string? field, Runnable expected)
|
||||
{
|
||||
Runnable actual = field.AsRunnable();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -476,7 +476,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("none", SoftwareListStatus.None)]
|
||||
[InlineData("original", SoftwareListStatus.Original)]
|
||||
[InlineData("compatible", SoftwareListStatus.Compatible)]
|
||||
public void AsSoftwareListStatusTest(string field, SoftwareListStatus expected)
|
||||
public void AsSoftwareListStatusTest(string? field, SoftwareListStatus expected)
|
||||
{
|
||||
SoftwareListStatus actual = field.AsSoftwareListStatus();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -489,7 +489,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("partial", Supported.Partial)]
|
||||
[InlineData("yes", Supported.Yes)]
|
||||
[InlineData("supported", Supported.Yes)]
|
||||
public void AsSupportedTest(string field, Supported expected)
|
||||
public void AsSupportedTest(string? field, Supported expected)
|
||||
{
|
||||
Supported actual = field.AsSupported();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -500,7 +500,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("good", SupportStatus.Good)]
|
||||
[InlineData("imperfect", SupportStatus.Imperfect)]
|
||||
[InlineData("preliminary", SupportStatus.Preliminary)]
|
||||
public void AsSupportStatusTest(string field, SupportStatus expected)
|
||||
public void AsSupportStatusTest(string? field, SupportStatus expected)
|
||||
{
|
||||
SupportStatus actual = field.AsSupportStatus();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -514,9 +514,9 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(ChipType.NULL, null)]
|
||||
[InlineData(ChipType.CPU, "cpu")]
|
||||
[InlineData(ChipType.Audio, "audio")]
|
||||
public void FromChipTypeTest(ChipType field, string expected)
|
||||
public void FromChipTypeTest(ChipType field, string? expected)
|
||||
{
|
||||
string actual = field.FromChipType();
|
||||
string? actual = field.FromChipType();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -537,9 +537,9 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(ControlType.Mahjong, "mahjong")]
|
||||
[InlineData(ControlType.Hanafuda, "hanafuda")]
|
||||
[InlineData(ControlType.Gambling, "gambling")]
|
||||
public void FromControlTypeTest(ControlType field, string expected)
|
||||
public void FromControlTypeTest(ControlType field, string? expected)
|
||||
{
|
||||
string actual = field.FromControlType();
|
||||
string? actual = field.FromControlType();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -569,9 +569,9 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(DeviceType.MIDIOut, "midiout")]
|
||||
[InlineData(DeviceType.Picture, "picture")]
|
||||
[InlineData(DeviceType.VidFile, "vidfile")]
|
||||
public void FromDeviceTypeTest(DeviceType field, string expected)
|
||||
public void FromDeviceTypeTest(DeviceType field, string? expected)
|
||||
{
|
||||
string actual = field.FromDeviceType();
|
||||
string? actual = field.FromDeviceType();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -582,9 +582,9 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(DisplayType.LCD, "lcd")]
|
||||
[InlineData(DisplayType.SVG, "svg")]
|
||||
[InlineData(DisplayType.Unknown, "unknown")]
|
||||
public void FromDisplayTypeTest(DisplayType field, string expected)
|
||||
public void FromDisplayTypeTest(DisplayType field, string? expected)
|
||||
{
|
||||
string actual = field.FromDisplayType();
|
||||
string? actual = field.FromDisplayType();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -592,9 +592,9 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(Endianness.NULL, null)]
|
||||
[InlineData(Endianness.Big, "big")]
|
||||
[InlineData(Endianness.Little, "little")]
|
||||
public void FromEndiannessTest(Endianness field, string expected)
|
||||
public void FromEndiannessTest(Endianness field, string? expected)
|
||||
{
|
||||
string actual = field.FromEndianness();
|
||||
string? actual = field.FromEndianness();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -602,9 +602,9 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(FeatureStatus.NULL, null)]
|
||||
[InlineData(FeatureStatus.Unemulated, "unemulated")]
|
||||
[InlineData(FeatureStatus.Imperfect, "imperfect")]
|
||||
public void FromFeatureStatusTest(FeatureStatus field, string expected)
|
||||
public void FromFeatureStatusTest(FeatureStatus field, string? expected)
|
||||
{
|
||||
string actual = field.FromFeatureStatus();
|
||||
string? actual = field.FromFeatureStatus();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -624,9 +624,9 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(FeatureType.Lan, "lan")]
|
||||
[InlineData(FeatureType.Wan, "wan")]
|
||||
[InlineData(FeatureType.Timing, "timing")]
|
||||
public void FromFeatureTypeTest(FeatureType field, string expected)
|
||||
public void FromFeatureTypeTest(FeatureType field, string? expected)
|
||||
{
|
||||
string actual = field.FromFeatureType();
|
||||
string? actual = field.FromFeatureType();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -643,9 +643,9 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(ItemStatus.Nodump, false, "nodump")]
|
||||
[InlineData(ItemStatus.Verified, true, "verified")]
|
||||
[InlineData(ItemStatus.Verified, false, "verified")]
|
||||
public void FromItemStatusTest(ItemStatus field, bool yesno, string expected)
|
||||
public void FromItemStatusTest(ItemStatus field, bool yesno, string? expected)
|
||||
{
|
||||
string actual = field.FromItemStatus(yesno);
|
||||
string? actual = field.FromItemStatus(yesno);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -694,9 +694,9 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(ItemType.SoftwareList, "softwarelist")]
|
||||
[InlineData(ItemType.Sound, "sound")]
|
||||
[InlineData(ItemType.SourceDetails, "source_details")]
|
||||
public void FromItemTypeTest(ItemType field, string expected)
|
||||
public void FromItemTypeTest(ItemType field, string? expected)
|
||||
{
|
||||
string actual = field.FromItemType();
|
||||
string? actual = field.FromItemType();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -716,9 +716,9 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(LoadFlag.Continue, "continue")]
|
||||
[InlineData(LoadFlag.ReloadPlain, "reload_plain")]
|
||||
[InlineData(LoadFlag.Ignore, "ignore")]
|
||||
public void FromLoadFlagTest(LoadFlag field, string expected)
|
||||
public void FromLoadFlagTest(LoadFlag field, string? expected)
|
||||
{
|
||||
string actual = field.FromLoadFlag();
|
||||
string? actual = field.FromLoadFlag();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -733,9 +733,9 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(MachineType.Device, false, "device")]
|
||||
[InlineData(MachineType.Mechanical, true, "mech")]
|
||||
[InlineData(MachineType.Mechanical, false, "mechanical")]
|
||||
public void FromMachineTypeTest(MachineType field, bool old, string expected)
|
||||
public void FromMachineTypeTest(MachineType field, bool old, string? expected)
|
||||
{
|
||||
string actual = field.FromMachineType(old);
|
||||
string? actual = field.FromMachineType(old);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -754,9 +754,9 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(MergingFlag.DeviceNonMerged, false, "device")]
|
||||
[InlineData(MergingFlag.FullNonMerged, true, "fullunmerged")]
|
||||
[InlineData(MergingFlag.FullNonMerged, false, "full")]
|
||||
public void FromMergingFlagTest(MergingFlag field, bool romcenter, string expected)
|
||||
public void FromMergingFlagTest(MergingFlag field, bool romcenter, string? expected)
|
||||
{
|
||||
string actual = field.FromMergingFlag(romcenter);
|
||||
string? actual = field.FromMergingFlag(romcenter);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -765,9 +765,9 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(NodumpFlag.Obsolete, "obsolete")]
|
||||
[InlineData(NodumpFlag.Required, "required")]
|
||||
[InlineData(NodumpFlag.Ignore, "ignore")]
|
||||
public void FromNodumpFlagTest(NodumpFlag field, string expected)
|
||||
public void FromNodumpFlagTest(NodumpFlag field, string? expected)
|
||||
{
|
||||
string actual = field.FromNodumpFlag();
|
||||
string? actual = field.FromNodumpFlag();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -776,9 +776,9 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(OpenMSXSubType.Rom, "rom")]
|
||||
[InlineData(OpenMSXSubType.MegaRom, "megarom")]
|
||||
[InlineData(OpenMSXSubType.SCCPlusCart, "sccpluscart")]
|
||||
public void FromOpenMSXSubTypeTest(OpenMSXSubType field, string expected)
|
||||
public void FromOpenMSXSubTypeTest(OpenMSXSubType field, string? expected)
|
||||
{
|
||||
string actual = field.FromOpenMSXSubType();
|
||||
string? actual = field.FromOpenMSXSubType();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -793,9 +793,9 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(PackingFlag.Partial, false, "partial")]
|
||||
[InlineData(PackingFlag.Flat, true, "flat")]
|
||||
[InlineData(PackingFlag.Flat, false, "flat")]
|
||||
public void FromPackingFlagTest(PackingFlag field, bool yesno, string expected)
|
||||
public void FromPackingFlagTest(PackingFlag field, bool yesno, string? expected)
|
||||
{
|
||||
string actual = field.FromPackingFlag(yesno);
|
||||
string? actual = field.FromPackingFlag(yesno);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -807,9 +807,9 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(Relation.LessThanOrEqual, "le")]
|
||||
[InlineData(Relation.LessThan, "lt")]
|
||||
[InlineData(Relation.GreaterThanOrEqual, "ge")]
|
||||
public void FromRelationTest(Relation field, string expected)
|
||||
public void FromRelationTest(Relation field, string? expected)
|
||||
{
|
||||
string actual = field.FromRelation();
|
||||
string? actual = field.FromRelation();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -818,9 +818,9 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(Runnable.No, "no")]
|
||||
[InlineData(Runnable.Partial, "partial")]
|
||||
[InlineData(Runnable.Yes, "yes")]
|
||||
public void FromRunnableTest(Runnable field, string expected)
|
||||
public void FromRunnableTest(Runnable field, string? expected)
|
||||
{
|
||||
string actual = field.FromRunnable();
|
||||
string? actual = field.FromRunnable();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -828,9 +828,9 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(SoftwareListStatus.None, "none")]
|
||||
[InlineData(SoftwareListStatus.Original, "original")]
|
||||
[InlineData(SoftwareListStatus.Compatible, "compatible")]
|
||||
public void FromSoftwareListStatusTest(SoftwareListStatus field, string expected)
|
||||
public void FromSoftwareListStatusTest(SoftwareListStatus field, string? expected)
|
||||
{
|
||||
string actual = field.FromSoftwareListStatus();
|
||||
string? actual = field.FromSoftwareListStatus();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -843,9 +843,9 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(Supported.Partial, false, "partial")]
|
||||
[InlineData(Supported.Yes, true, "supported")]
|
||||
[InlineData(Supported.Yes, false, "yes")]
|
||||
public void FromSupportedTest(Supported field, bool verbose, string expected)
|
||||
public void FromSupportedTest(Supported field, bool verbose, string? expected)
|
||||
{
|
||||
string actual = field.FromSupported(verbose);
|
||||
string? actual = field.FromSupported(verbose);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -854,9 +854,9 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(SupportStatus.Good, "good")]
|
||||
[InlineData(SupportStatus.Imperfect, "imperfect")]
|
||||
[InlineData(SupportStatus.Preliminary, "preliminary")]
|
||||
public void FromSupportStatusTest(SupportStatus field, string expected)
|
||||
public void FromSupportStatusTest(SupportStatus field, string? expected)
|
||||
{
|
||||
string actual = field.FromSupportStatus();
|
||||
string? actual = field.FromSupportStatus();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("10h", null)]
|
||||
[InlineData("0x10", 16L)]
|
||||
[InlineData(" 12345 ", 12345L)]
|
||||
public void CleanLongTest(string input, long? expected)
|
||||
public void CleanLongTest(string? input, long? expected)
|
||||
{
|
||||
long? actual = NumberHelper.ConvertToInt64(input);
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -28,9 +28,9 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("da39a3ee5e6b4b0d3255bfef95601890afd80709", -1, "da39a3ee5e6b4b0d3255bfef95601890afd80709.gz")]
|
||||
[InlineData("da39a3ee5e6b4b0d3255bfef95601890afd80709", 0, "da39a3ee5e6b4b0d3255bfef95601890afd80709.gz")]
|
||||
[InlineData("da39a3ee5e6b4b0d3255bfef95601890afd80709", 1, "da\\da39a3ee5e6b4b0d3255bfef95601890afd80709.gz")]
|
||||
public void GetDepotPathTest(string hash, int depth, string expected)
|
||||
public void GetDepotPathTest(string? hash, int depth, string? expected)
|
||||
{
|
||||
string actual = Utilities.GetDepotPath(hash, depth);
|
||||
string? actual = Utilities.GetDepotPath(hash, depth);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("INVALID.EXT", false)]
|
||||
[InlineData("valid_extension.dat", true)]
|
||||
[InlineData("valid_extension.DAT", true)]
|
||||
public void HasValidDatExtensionTest(string path, bool expected)
|
||||
public void HasValidDatExtensionTest(string? path, bool expected)
|
||||
{
|
||||
bool actual = Utilities.HasValidDatExtension(path);
|
||||
Assert.Equal(expected, actual);
|
||||
|
||||
@@ -108,8 +108,10 @@ namespace SabreTools.Test.DatFiles
|
||||
};
|
||||
|
||||
dict.ClearMarked();
|
||||
Assert.Single(dict.Keys);
|
||||
Assert.Single(dict["game-1"]);
|
||||
string key = Assert.Single(dict.Keys);
|
||||
Assert.Equal("game-1", key);
|
||||
Assert.NotNull(dict[key]);
|
||||
Assert.Single(dict[key]!);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
||||
@@ -187,7 +187,7 @@ namespace SabreTools.Test.DatItems
|
||||
[InlineData(new byte[] { 0x00 }, new byte[] { 0x00, 0x01 }, false)]
|
||||
[InlineData(new byte[] { 0x00 }, new byte[] { 0x01 }, false)]
|
||||
[InlineData(new byte[] { 0x00 }, new byte[] { 0x00 }, true)]
|
||||
public void ConditionalHashEqualsTest(byte[] first, byte[] second, bool expected)
|
||||
public void ConditionalHashEqualsTest(byte[]? first, byte[]? second, bool expected)
|
||||
{
|
||||
bool actual = SabreTools.Core.Tools.Utilities.ConditionalHashEquals(first, second);
|
||||
Assert.Equal(expected, actual);
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace SabreTools.Test.DatTools
|
||||
[InlineData("test-sha384.sha384", DatFormat.RedumpSHA384, 1)]
|
||||
[InlineData("test-sha512.sha512", DatFormat.RedumpSHA512, 1)]
|
||||
[InlineData("test-spamsum.spamsum", DatFormat.RedumpSpamSum, 1)]
|
||||
public void CreateAndParseTest(string filename, DatFormat datFormat, int totalCount)
|
||||
public void CreateAndParseTest(string? filename, DatFormat datFormat, int totalCount)
|
||||
{
|
||||
// For all filenames, add the local path for test data
|
||||
if (filename != null)
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace SabreTools.Test.Filtering
|
||||
[InlineData("", "name")]
|
||||
[InlineData("C:\\Normal\\Depth\\Path", "name")]
|
||||
[InlineData("C:\\AbnormalFolderLengthPath\\ThatReallyPushesTheLimit\\OfHowLongYou\\ReallyShouldNameThings\\AndItGetsEvenWorse\\TheMoreSubfoldersThatYouTraverse\\BecauseWhyWouldYouStop\\AtSomethingReasonable\\LikeReallyThisIsGettingDumb\\AndIKnowItsJustATest\\ButNotAsMuchAsMe", "nam")]
|
||||
public void CleanDatItemTrimTest(string root, string expected)
|
||||
public void CleanDatItemTrimTest(string? root, string expected)
|
||||
{
|
||||
// Setup cleaner
|
||||
var cleaner = new Cleaner
|
||||
|
||||
@@ -11,13 +11,15 @@ namespace SabreTools.Test.Filtering
|
||||
public void PopulateExclusionNullListTest()
|
||||
{
|
||||
// Setup the list
|
||||
List<string> exclusions = null;
|
||||
List<string>? exclusions = null;
|
||||
|
||||
// Setup the remover
|
||||
var remover = new Remover();
|
||||
remover.PopulateExclusionsFromList(exclusions);
|
||||
|
||||
// Check the exclusion lists
|
||||
Assert.NotNull(remover.DatHeaderRemover);
|
||||
Assert.NotNull(remover.DatItemRemover);
|
||||
Assert.Empty(remover.DatHeaderRemover.DatHeaderFields);
|
||||
Assert.Empty(remover.DatItemRemover.MachineFields);
|
||||
Assert.Empty(remover.DatItemRemover.DatItemFields);
|
||||
@@ -34,6 +36,8 @@ namespace SabreTools.Test.Filtering
|
||||
remover.PopulateExclusionsFromList(exclusions);
|
||||
|
||||
// Check the exclusion lists
|
||||
Assert.NotNull(remover.DatHeaderRemover);
|
||||
Assert.NotNull(remover.DatItemRemover);
|
||||
Assert.Empty(remover.DatHeaderRemover.DatHeaderFields);
|
||||
Assert.Empty(remover.DatItemRemover.MachineFields);
|
||||
Assert.Empty(remover.DatItemRemover.DatItemFields);
|
||||
@@ -43,16 +47,18 @@ namespace SabreTools.Test.Filtering
|
||||
public void PopulateExclusionHeaderFieldTest()
|
||||
{
|
||||
// Setup the list
|
||||
List<string> exclusions = new()
|
||||
{
|
||||
List<string> exclusions =
|
||||
[
|
||||
"header.datname",
|
||||
};
|
||||
];
|
||||
|
||||
// Setup the remover
|
||||
var remover = new Remover();
|
||||
remover.PopulateExclusionsFromList(exclusions);
|
||||
|
||||
// Check the exclusion lists
|
||||
Assert.NotNull(remover.DatHeaderRemover);
|
||||
Assert.NotNull(remover.DatItemRemover);
|
||||
Assert.Single(remover.DatHeaderRemover.DatHeaderFields);
|
||||
Assert.Empty(remover.DatItemRemover.MachineFields);
|
||||
Assert.Empty(remover.DatItemRemover.DatItemFields);
|
||||
@@ -62,16 +68,18 @@ namespace SabreTools.Test.Filtering
|
||||
public void PopulateExclusionMachineFieldTest()
|
||||
{
|
||||
// Setup the list
|
||||
List<string> exclusions = new()
|
||||
{
|
||||
List<string> exclusions =
|
||||
[
|
||||
"machine.name",
|
||||
};
|
||||
];
|
||||
|
||||
// Setup the remover
|
||||
var remover = new Remover();
|
||||
remover.PopulateExclusionsFromList(exclusions);
|
||||
|
||||
// Check the exclusion lists
|
||||
Assert.NotNull(remover.DatHeaderRemover);
|
||||
Assert.NotNull(remover.DatItemRemover);
|
||||
Assert.Empty(remover.DatHeaderRemover.DatHeaderFields);
|
||||
Assert.Single(remover.DatItemRemover.MachineFields);
|
||||
Assert.Empty(remover.DatItemRemover.DatItemFields);
|
||||
@@ -81,16 +89,18 @@ namespace SabreTools.Test.Filtering
|
||||
public void PopulateExclusionDatItemFieldTest()
|
||||
{
|
||||
// Setup the list
|
||||
List<string> exclusions = new()
|
||||
{
|
||||
List<string> exclusions =
|
||||
[
|
||||
"item.name",
|
||||
};
|
||||
];
|
||||
|
||||
// Setup the remover
|
||||
var remover = new Remover();
|
||||
remover.PopulateExclusionsFromList(exclusions);
|
||||
|
||||
// Check the exclusion lists
|
||||
Assert.NotNull(remover.DatHeaderRemover);
|
||||
Assert.NotNull(remover.DatItemRemover);
|
||||
Assert.Empty(remover.DatHeaderRemover.DatHeaderFields);
|
||||
Assert.Empty(remover.DatItemRemover.MachineFields);
|
||||
Assert.Single(remover.DatItemRemover.DatItemFields);
|
||||
@@ -100,7 +110,7 @@ namespace SabreTools.Test.Filtering
|
||||
public void PopulateFilterNullListTest()
|
||||
{
|
||||
// Setup the list
|
||||
List<string> filters = null;
|
||||
List<string>? filters = null;
|
||||
|
||||
// Setup the filter
|
||||
var filter = new SabreTools.Filtering.Filter();
|
||||
@@ -115,7 +125,7 @@ namespace SabreTools.Test.Filtering
|
||||
public void PopulateFilterEmptyListTest()
|
||||
{
|
||||
// Setup the list
|
||||
List<string> filters = new();
|
||||
List<string> filters = [];
|
||||
|
||||
// Setup the filter
|
||||
var filter = new SabreTools.Filtering.Filter();
|
||||
@@ -130,31 +140,11 @@ namespace SabreTools.Test.Filtering
|
||||
public void PopulateFilterMachineFieldTest()
|
||||
{
|
||||
// Setup the list
|
||||
List<string> filters = new()
|
||||
{
|
||||
List<string> filters =
|
||||
[
|
||||
"machine.name:foo",
|
||||
"!machine.name:bar",
|
||||
};
|
||||
|
||||
// Setup the filter
|
||||
var filter = new SabreTools.Filtering.Filter();
|
||||
filter.PopulateFiltersFromList(filters);
|
||||
|
||||
// Check the filters
|
||||
Assert.Contains("foo", filter.MachineFilter.Name.PositiveSet);
|
||||
Assert.Contains("bar", filter.MachineFilter.Name.NegativeSet);
|
||||
Assert.NotNull(filter.DatItemFilter);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PopulateFilterDatItemFieldTest()
|
||||
{
|
||||
// Setup the list
|
||||
List<string> filters = new()
|
||||
{
|
||||
"item.name:foo",
|
||||
"!item.name:bar"
|
||||
};
|
||||
];
|
||||
|
||||
// Setup the filter
|
||||
var filter = new SabreTools.Filtering.Filter();
|
||||
@@ -162,6 +152,28 @@ namespace SabreTools.Test.Filtering
|
||||
|
||||
// Check the filters
|
||||
Assert.NotNull(filter.MachineFilter);
|
||||
Assert.NotNull(filter.DatItemFilter);
|
||||
Assert.Contains("foo", filter.MachineFilter.Name.PositiveSet);
|
||||
Assert.Contains("bar", filter.MachineFilter.Name.NegativeSet);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PopulateFilterDatItemFieldTest()
|
||||
{
|
||||
// Setup the list
|
||||
List<string> filters =
|
||||
[
|
||||
"item.name:foo",
|
||||
"!item.name:bar"
|
||||
];
|
||||
|
||||
// Setup the filter
|
||||
var filter = new SabreTools.Filtering.Filter();
|
||||
filter.PopulateFiltersFromList(filters);
|
||||
|
||||
// Check the filters
|
||||
Assert.NotNull(filter.MachineFilter);
|
||||
Assert.NotNull(filter.DatItemFilter);
|
||||
Assert.Contains("foo", filter.DatItemFilter.Name.PositiveSet);
|
||||
Assert.Contains("bar", filter.DatItemFilter.Name.NegativeSet);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace SabreTools.Test.Parser
|
||||
Assert.Null(dat.ADDITIONAL_ELEMENTS);
|
||||
foreach (var file in dat.File)
|
||||
{
|
||||
Assert.NotNull(file);
|
||||
Assert.Null(file.ADDITIONAL_ATTRIBUTES);
|
||||
Assert.Null(file.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
@@ -55,6 +56,7 @@ namespace SabreTools.Test.Parser
|
||||
// Validate we're not missing any attributes or elements
|
||||
foreach (var file in dat.Row)
|
||||
{
|
||||
Assert.NotNull(file);
|
||||
Assert.Null(file.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
}
|
||||
@@ -80,75 +82,92 @@ namespace SabreTools.Test.Parser
|
||||
{
|
||||
Assert.Null(dat?.ClrMamePro);
|
||||
}
|
||||
|
||||
Assert.NotNull(dat?.Game);
|
||||
Assert.Equal(count, dat.Game.Length);
|
||||
|
||||
// Validate we're not missing any attributes or elements
|
||||
Assert.NotNull(dat?.ADDITIONAL_ELEMENTS);
|
||||
Assert.Empty(dat.ADDITIONAL_ELEMENTS);
|
||||
foreach (var game in dat.Game)
|
||||
{
|
||||
Assert.NotNull(game?.ADDITIONAL_ELEMENTS);
|
||||
Assert.Empty(game.ADDITIONAL_ELEMENTS);
|
||||
foreach (var release in game.Release ?? Array.Empty<Models.ClrMamePro.Release>())
|
||||
{
|
||||
Assert.NotNull(release?.ADDITIONAL_ELEMENTS);
|
||||
Assert.Empty(release.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
|
||||
foreach (var biosset in game.BiosSet ?? Array.Empty<Models.ClrMamePro.BiosSet>())
|
||||
{
|
||||
Assert.NotNull(biosset?.ADDITIONAL_ELEMENTS);
|
||||
Assert.Empty(biosset.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
|
||||
foreach (var rom in game.Rom ?? Array.Empty<Models.ClrMamePro.Rom>())
|
||||
{
|
||||
Assert.NotNull(rom?.ADDITIONAL_ELEMENTS);
|
||||
Assert.Empty(rom.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
|
||||
foreach (var disk in game.Disk ?? Array.Empty<Models.ClrMamePro.Disk>())
|
||||
{
|
||||
Assert.NotNull(disk?.ADDITIONAL_ELEMENTS);
|
||||
Assert.Empty(disk.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
|
||||
foreach (var media in game.Media ?? Array.Empty<Models.ClrMamePro.Media>())
|
||||
{
|
||||
Assert.NotNull(media?.ADDITIONAL_ELEMENTS);
|
||||
Assert.Empty(media.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
|
||||
foreach (var sample in game.Sample ?? Array.Empty<Models.ClrMamePro.Sample>())
|
||||
{
|
||||
Assert.NotNull(sample?.ADDITIONAL_ELEMENTS);
|
||||
Assert.Empty(sample.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
|
||||
foreach (var archive in game.Archive ?? Array.Empty<Models.ClrMamePro.Archive>())
|
||||
{
|
||||
Assert.NotNull(archive?.ADDITIONAL_ELEMENTS);
|
||||
Assert.Empty(archive.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
|
||||
foreach (var chip in game.Chip ?? Array.Empty<Models.ClrMamePro.Chip>())
|
||||
{
|
||||
Assert.NotNull(chip?.ADDITIONAL_ELEMENTS);
|
||||
Assert.Empty(chip.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
|
||||
foreach (var video in game.Video ?? Array.Empty<Models.ClrMamePro.Video>())
|
||||
{
|
||||
Assert.NotNull(video?.ADDITIONAL_ELEMENTS);
|
||||
Assert.Empty(video.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
|
||||
if (game.Sound != null)
|
||||
{
|
||||
Assert.NotNull(game.Sound?.ADDITIONAL_ELEMENTS);
|
||||
Assert.Empty(game.Sound.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
|
||||
if (game.Input != null)
|
||||
{
|
||||
Assert.NotNull(game.Input?.ADDITIONAL_ELEMENTS);
|
||||
Assert.Empty(game.Input.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
|
||||
foreach (var dipswitch in game.DipSwitch ?? Array.Empty<Models.ClrMamePro.DipSwitch>())
|
||||
{
|
||||
Assert.NotNull(dipswitch?.ADDITIONAL_ELEMENTS);
|
||||
Assert.Empty(dipswitch.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
|
||||
if (game.Driver != null)
|
||||
{
|
||||
Assert.NotNull(game.Driver?.ADDITIONAL_ELEMENTS);
|
||||
Assert.Empty(game.Driver.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
}
|
||||
@@ -167,16 +186,25 @@ namespace SabreTools.Test.Parser
|
||||
|
||||
// Validate the values
|
||||
Assert.NotNull(dat?.DosCenter);
|
||||
|
||||
Assert.NotNull(dat?.Game);
|
||||
Assert.Equal(count, dat.Game.Length);
|
||||
|
||||
// Validate we're not missing any attributes or elements
|
||||
Assert.NotNull(dat?.ADDITIONAL_ELEMENTS);
|
||||
Assert.Empty(dat.ADDITIONAL_ELEMENTS);
|
||||
|
||||
Assert.NotNull(dat.DosCenter?.ADDITIONAL_ELEMENTS);
|
||||
Assert.Empty(dat.DosCenter.ADDITIONAL_ELEMENTS);
|
||||
foreach (var game in dat.Game)
|
||||
{
|
||||
Assert.NotNull(game?.ADDITIONAL_ELEMENTS);
|
||||
Assert.Empty(game.ADDITIONAL_ELEMENTS);
|
||||
|
||||
Assert.NotNull(game.File);
|
||||
foreach (var file in game.File)
|
||||
{
|
||||
Assert.NotNull(file?.ADDITIONAL_ELEMENTS);
|
||||
Assert.Empty(file.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
}
|
||||
@@ -225,24 +253,31 @@ namespace SabreTools.Test.Parser
|
||||
switch (hash)
|
||||
{
|
||||
case Serialization.Hash.CRC:
|
||||
Assert.NotNull(dat.SFV);
|
||||
Assert.Equal(count, dat.SFV.Length);
|
||||
break;
|
||||
case Serialization.Hash.MD5:
|
||||
Assert.NotNull(dat.MD5);
|
||||
Assert.Equal(count, dat.MD5.Length);
|
||||
break;
|
||||
case Serialization.Hash.SHA1:
|
||||
Assert.NotNull(dat.SHA1);
|
||||
Assert.Equal(count, dat.SHA1.Length);
|
||||
break;
|
||||
case Serialization.Hash.SHA256:
|
||||
Assert.NotNull(dat.SHA256);
|
||||
Assert.Equal(count, dat.SHA256.Length);
|
||||
break;
|
||||
case Serialization.Hash.SHA384:
|
||||
Assert.NotNull(dat.SHA384);
|
||||
Assert.Equal(count, dat.SHA384.Length);
|
||||
break;
|
||||
case Serialization.Hash.SHA512:
|
||||
Assert.NotNull(dat.SHA512);
|
||||
Assert.Equal(count, dat.SHA512.Length);
|
||||
break;
|
||||
case Serialization.Hash.SpamSum:
|
||||
Assert.NotNull(dat.SpamSum);
|
||||
Assert.Equal(count, dat.SpamSum.Length);
|
||||
break;
|
||||
default:
|
||||
@@ -265,6 +300,7 @@ namespace SabreTools.Test.Parser
|
||||
Assert.Equal(count, dat.Set.Length);
|
||||
|
||||
// Validate we're not missing any attributes or elements
|
||||
Assert.NotNull(dat.ADDITIONAL_ELEMENTS);
|
||||
Assert.Empty(dat.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
|
||||
@@ -611,70 +647,71 @@ namespace SabreTools.Test.Parser
|
||||
|
||||
foreach (var dir in dat.Dir ?? Array.Empty<Models.Logiqx.Dir>())
|
||||
{
|
||||
Assert.NotNull(dir.Game);
|
||||
foreach (var game in dir.Game)
|
||||
{
|
||||
Assert.Null(game.ADDITIONAL_ATTRIBUTES);
|
||||
Assert.Null(game.ADDITIONAL_ELEMENTS);
|
||||
|
||||
foreach (var item in game.Release ?? Array.Empty<Models.Logiqx.Release>())
|
||||
{
|
||||
Assert.Null(item.ADDITIONAL_ATTRIBUTES);
|
||||
Assert.Null(item.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
{
|
||||
Assert.Null(item.ADDITIONAL_ATTRIBUTES);
|
||||
Assert.Null(item.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
|
||||
foreach (var item in game.BiosSet ?? Array.Empty<Models.Logiqx.BiosSet>())
|
||||
{
|
||||
Assert.Null(item.ADDITIONAL_ATTRIBUTES);
|
||||
Assert.Null(item.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
foreach (var item in game.BiosSet ?? Array.Empty<Models.Logiqx.BiosSet>())
|
||||
{
|
||||
Assert.Null(item.ADDITIONAL_ATTRIBUTES);
|
||||
Assert.Null(item.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
|
||||
foreach (var item in game.Rom ?? Array.Empty<Models.Logiqx.Rom>())
|
||||
{
|
||||
Assert.Null(item.ADDITIONAL_ATTRIBUTES);
|
||||
Assert.Null(item.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
foreach (var item in game.Rom ?? Array.Empty<Models.Logiqx.Rom>())
|
||||
{
|
||||
Assert.Null(item.ADDITIONAL_ATTRIBUTES);
|
||||
Assert.Null(item.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
|
||||
foreach (var item in game.Disk ?? Array.Empty<Models.Logiqx.Disk>())
|
||||
{
|
||||
Assert.Null(item.ADDITIONAL_ATTRIBUTES);
|
||||
Assert.Null(item.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
foreach (var item in game.Disk ?? Array.Empty<Models.Logiqx.Disk>())
|
||||
{
|
||||
Assert.Null(item.ADDITIONAL_ATTRIBUTES);
|
||||
Assert.Null(item.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
|
||||
foreach (var item in game.Media ?? Array.Empty<Models.Logiqx.Media>())
|
||||
{
|
||||
Assert.Null(item.ADDITIONAL_ATTRIBUTES);
|
||||
Assert.Null(item.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
foreach (var item in game.Media ?? Array.Empty<Models.Logiqx.Media>())
|
||||
{
|
||||
Assert.Null(item.ADDITIONAL_ATTRIBUTES);
|
||||
Assert.Null(item.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
|
||||
foreach (var item in game.DeviceRef ?? Array.Empty<Models.Logiqx.DeviceRef>())
|
||||
{
|
||||
Assert.Null(item.ADDITIONAL_ATTRIBUTES);
|
||||
Assert.Null(item.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
foreach (var item in game.DeviceRef ?? Array.Empty<Models.Logiqx.DeviceRef>())
|
||||
{
|
||||
Assert.Null(item.ADDITIONAL_ATTRIBUTES);
|
||||
Assert.Null(item.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
|
||||
foreach (var item in game.Sample ?? Array.Empty<Models.Logiqx.Sample>())
|
||||
{
|
||||
Assert.Null(item.ADDITIONAL_ATTRIBUTES);
|
||||
Assert.Null(item.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
foreach (var item in game.Sample ?? Array.Empty<Models.Logiqx.Sample>())
|
||||
{
|
||||
Assert.Null(item.ADDITIONAL_ATTRIBUTES);
|
||||
Assert.Null(item.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
|
||||
foreach (var item in game.Archive ?? Array.Empty<Models.Logiqx.Archive>())
|
||||
{
|
||||
Assert.Null(item.ADDITIONAL_ATTRIBUTES);
|
||||
Assert.Null(item.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
foreach (var item in game.Archive ?? Array.Empty<Models.Logiqx.Archive>())
|
||||
{
|
||||
Assert.Null(item.ADDITIONAL_ATTRIBUTES);
|
||||
Assert.Null(item.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
|
||||
if (game.Driver != null)
|
||||
{
|
||||
Assert.Null(game.Driver.ADDITIONAL_ATTRIBUTES);
|
||||
Assert.Null(game.Driver.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
if (game.Driver != null)
|
||||
{
|
||||
Assert.Null(game.Driver.ADDITIONAL_ATTRIBUTES);
|
||||
Assert.Null(game.Driver.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
|
||||
foreach (var item in game.SoftwareList ?? Array.Empty<Models.Logiqx.SoftwareList>())
|
||||
{
|
||||
Assert.Null(item.ADDITIONAL_ATTRIBUTES);
|
||||
Assert.Null(item.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
foreach (var item in game.SoftwareList ?? Array.Empty<Models.Logiqx.SoftwareList>())
|
||||
{
|
||||
Assert.Null(item.ADDITIONAL_ATTRIBUTES);
|
||||
Assert.Null(item.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
|
||||
if (game.Trurip != null)
|
||||
{
|
||||
@@ -949,18 +986,29 @@ namespace SabreTools.Test.Parser
|
||||
Assert.Equal(count, dat.Games.Rom.Length);
|
||||
|
||||
// Validate we're not missing any attributes or elements
|
||||
Assert.NotNull(dat.ADDITIONAL_ELEMENTS);
|
||||
Assert.Empty(dat.ADDITIONAL_ELEMENTS);
|
||||
if (dat.Credits != null)
|
||||
{
|
||||
Assert.NotNull(dat.Credits.ADDITIONAL_ELEMENTS);
|
||||
Assert.Empty(dat.Credits.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
|
||||
if (dat.Dat != null)
|
||||
{
|
||||
Assert.NotNull(dat.Dat.ADDITIONAL_ELEMENTS);
|
||||
Assert.Empty(dat.Dat.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
|
||||
if (dat.Emulator != null)
|
||||
{
|
||||
Assert.NotNull(dat.Emulator.ADDITIONAL_ELEMENTS);
|
||||
Assert.Empty(dat.Emulator.ADDITIONAL_ELEMENTS);
|
||||
}
|
||||
|
||||
if (dat.Games != null)
|
||||
{
|
||||
Assert.NotNull(dat.Games.ADDITIONAL_ELEMENTS);
|
||||
Assert.Empty(dat.Games.ADDITIONAL_ELEMENTS);
|
||||
foreach (var rom in dat.Games.Rom ?? Array.Empty<Models.RomCenter.Rom>())
|
||||
{
|
||||
@@ -985,7 +1033,7 @@ namespace SabreTools.Test.Parser
|
||||
var dat = new Serialization.Files.SeparatedValue().Deserialize(filename, delim);
|
||||
|
||||
// Validate the values
|
||||
Assert.NotNull(dat);
|
||||
Assert.NotNull(dat?.Row);
|
||||
Assert.Equal(count, dat.Row.Length);
|
||||
|
||||
// Validate we're not missing any attributes or elements
|
||||
|
||||
Reference in New Issue
Block a user