2020-12-18 14:22:56 -08:00
|
|
|
using SabreTools.Core;
|
|
|
|
|
using SabreTools.Core.Tools;
|
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
|
|
namespace SabreTools.Test.Core
|
|
|
|
|
{
|
|
|
|
|
public class ConvertersTests
|
|
|
|
|
{
|
2023-04-20 10:34:37 -04:00
|
|
|
#region String to Enum
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(null, ChipType.NULL)]
|
|
|
|
|
[InlineData("cpu", ChipType.CPU)]
|
|
|
|
|
[InlineData("audio", ChipType.Audio)]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void AsChipTypeTest(string? field, ChipType expected)
|
2023-04-20 10:34:37 -04:00
|
|
|
{
|
|
|
|
|
ChipType actual = field.AsChipType();
|
|
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(null, ControlType.NULL)]
|
|
|
|
|
[InlineData("joy", ControlType.Joy)]
|
|
|
|
|
[InlineData("stick", ControlType.Stick)]
|
|
|
|
|
[InlineData("paddle", ControlType.Paddle)]
|
|
|
|
|
[InlineData("pedal", ControlType.Pedal)]
|
|
|
|
|
[InlineData("lightgun", ControlType.Lightgun)]
|
|
|
|
|
[InlineData("positional", ControlType.Positional)]
|
|
|
|
|
[InlineData("dial", ControlType.Dial)]
|
|
|
|
|
[InlineData("trackball", ControlType.Trackball)]
|
|
|
|
|
[InlineData("mouse", ControlType.Mouse)]
|
|
|
|
|
[InlineData("only_buttons", ControlType.OnlyButtons)]
|
|
|
|
|
[InlineData("keypad", ControlType.Keypad)]
|
|
|
|
|
[InlineData("keyboard", ControlType.Keyboard)]
|
|
|
|
|
[InlineData("mahjong", ControlType.Mahjong)]
|
|
|
|
|
[InlineData("hanafuda", ControlType.Hanafuda)]
|
|
|
|
|
[InlineData("gambling", ControlType.Gambling)]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void AsControlTypeTest(string? field, ControlType expected)
|
2023-04-20 10:34:37 -04:00
|
|
|
{
|
|
|
|
|
ControlType actual = field.AsControlType();
|
|
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-18 14:22:56 -08:00
|
|
|
[Theory]
|
|
|
|
|
[InlineData(null, DatHeaderField.NULL)]
|
|
|
|
|
[InlineData("datname", DatHeaderField.NULL)]
|
|
|
|
|
[InlineData("dat-datname", DatHeaderField.Name)]
|
|
|
|
|
[InlineData("dat.datname", DatHeaderField.Name)]
|
|
|
|
|
[InlineData("dat_datname", DatHeaderField.Name)]
|
|
|
|
|
[InlineData("dat datname", DatHeaderField.Name)]
|
|
|
|
|
[InlineData("datheader-datname", DatHeaderField.Name)]
|
|
|
|
|
[InlineData("datheader.datname", DatHeaderField.Name)]
|
|
|
|
|
[InlineData("datheader_datname", DatHeaderField.Name)]
|
|
|
|
|
[InlineData("datheader datname", DatHeaderField.Name)]
|
|
|
|
|
[InlineData("header-datname", DatHeaderField.Name)]
|
|
|
|
|
[InlineData("header.datname", DatHeaderField.Name)]
|
|
|
|
|
[InlineData("header_datname", DatHeaderField.Name)]
|
|
|
|
|
[InlineData("header datname", DatHeaderField.Name)]
|
|
|
|
|
[InlineData("DAT.DATNAME", DatHeaderField.Name)]
|
|
|
|
|
[InlineData("dAt.DAtnamE", DatHeaderField.Name)]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void AsDatHeaderFieldProcessingTest(string? field, DatHeaderField expected)
|
2020-12-18 14:22:56 -08:00
|
|
|
{
|
2023-04-20 10:34:37 -04:00
|
|
|
// TODO: Write new test for all supported fields
|
2020-12-18 14:22:56 -08:00
|
|
|
DatHeaderField actual = field.AsDatHeaderField();
|
|
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(null, DatItemField.NULL)]
|
|
|
|
|
[InlineData("name", DatItemField.NULL)]
|
|
|
|
|
[InlineData("item-name", DatItemField.Name)]
|
|
|
|
|
[InlineData("item.name", DatItemField.Name)]
|
|
|
|
|
[InlineData("item_name", DatItemField.Name)]
|
|
|
|
|
[InlineData("item name", DatItemField.Name)]
|
|
|
|
|
[InlineData("datitem-name", DatItemField.Name)]
|
|
|
|
|
[InlineData("datitem.name", DatItemField.Name)]
|
|
|
|
|
[InlineData("datitem_name", DatItemField.Name)]
|
|
|
|
|
[InlineData("datitem name", DatItemField.Name)]
|
|
|
|
|
[InlineData("ITEM.NAME", DatItemField.Name)]
|
|
|
|
|
[InlineData("iTeM.namE", DatItemField.Name)]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void AsDatItemFieldProcessingTest(string? field, DatItemField expected)
|
2020-12-18 14:22:56 -08:00
|
|
|
{
|
2023-04-20 10:34:37 -04:00
|
|
|
// TODO: Write new test for all supported fields
|
2020-12-18 14:22:56 -08:00
|
|
|
DatItemField actual = field.AsDatItemField();
|
|
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-20 10:34:37 -04:00
|
|
|
[Theory]
|
|
|
|
|
[InlineData(null, DeviceType.NULL)]
|
|
|
|
|
[InlineData("unknown", DeviceType.Unknown)]
|
|
|
|
|
[InlineData("cartridge", DeviceType.Cartridge)]
|
|
|
|
|
[InlineData("floppydisk", DeviceType.FloppyDisk)]
|
|
|
|
|
[InlineData("harddisk", DeviceType.HardDisk)]
|
|
|
|
|
[InlineData("cylinder", DeviceType.Cylinder)]
|
|
|
|
|
[InlineData("cassette", DeviceType.Cassette)]
|
|
|
|
|
[InlineData("punchcard", DeviceType.PunchCard)]
|
|
|
|
|
[InlineData("punchtape", DeviceType.PunchTape)]
|
|
|
|
|
[InlineData("printout", DeviceType.Printout)]
|
|
|
|
|
[InlineData("serial", DeviceType.Serial)]
|
|
|
|
|
[InlineData("parallel", DeviceType.Parallel)]
|
|
|
|
|
[InlineData("snapshot", DeviceType.Snapshot)]
|
|
|
|
|
[InlineData("quickload", DeviceType.QuickLoad)]
|
|
|
|
|
[InlineData("memcard", DeviceType.MemCard)]
|
|
|
|
|
[InlineData("cdrom", DeviceType.CDROM)]
|
|
|
|
|
[InlineData("magtape", DeviceType.MagTape)]
|
|
|
|
|
[InlineData("romimage", DeviceType.ROMImage)]
|
|
|
|
|
[InlineData("midiin", DeviceType.MIDIIn)]
|
|
|
|
|
[InlineData("midiout", DeviceType.MIDIOut)]
|
|
|
|
|
[InlineData("picture", DeviceType.Picture)]
|
|
|
|
|
[InlineData("vidfile", DeviceType.VidFile)]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void AsDeviceTypeTest(string? field, DeviceType expected)
|
2023-04-20 10:34:37 -04:00
|
|
|
{
|
|
|
|
|
DeviceType actual = field.AsDeviceType();
|
|
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(null, DisplayType.NULL)]
|
|
|
|
|
[InlineData("raster", DisplayType.Raster)]
|
|
|
|
|
[InlineData("vector", DisplayType.Vector)]
|
|
|
|
|
[InlineData("lcd", DisplayType.LCD)]
|
|
|
|
|
[InlineData("svg", DisplayType.SVG)]
|
|
|
|
|
[InlineData("unknown", DisplayType.Unknown)]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void AsDisplayTypeTest(string? field, DisplayType expected)
|
2023-04-20 10:34:37 -04:00
|
|
|
{
|
|
|
|
|
DisplayType actual = field.AsDisplayType();
|
|
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(null, Endianness.NULL)]
|
|
|
|
|
[InlineData("big", Endianness.Big)]
|
|
|
|
|
[InlineData("little", Endianness.Little)]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void AsEndiannessTest(string? field, Endianness expected)
|
2023-04-20 10:34:37 -04:00
|
|
|
{
|
|
|
|
|
Endianness actual = field.AsEndianness();
|
|
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(null, FeatureStatus.NULL)]
|
|
|
|
|
[InlineData("unemulated", FeatureStatus.Unemulated)]
|
|
|
|
|
[InlineData("imperfect", FeatureStatus.Imperfect)]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void AsFeatureStatusTest(string? field, FeatureStatus expected)
|
2023-04-20 10:34:37 -04:00
|
|
|
{
|
|
|
|
|
FeatureStatus actual = field.AsFeatureStatus();
|
|
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(null, FeatureType.NULL)]
|
|
|
|
|
[InlineData("protection", FeatureType.Protection)]
|
|
|
|
|
[InlineData("palette", FeatureType.Palette)]
|
|
|
|
|
[InlineData("graphics", FeatureType.Graphics)]
|
|
|
|
|
[InlineData("sound", FeatureType.Sound)]
|
|
|
|
|
[InlineData("controls", FeatureType.Controls)]
|
|
|
|
|
[InlineData("keyboard", FeatureType.Keyboard)]
|
|
|
|
|
[InlineData("mouse", FeatureType.Mouse)]
|
|
|
|
|
[InlineData("microphone", FeatureType.Microphone)]
|
|
|
|
|
[InlineData("camera", FeatureType.Camera)]
|
|
|
|
|
[InlineData("disk", FeatureType.Disk)]
|
|
|
|
|
[InlineData("printer", FeatureType.Printer)]
|
|
|
|
|
[InlineData("lan", FeatureType.Lan)]
|
|
|
|
|
[InlineData("wan", FeatureType.Wan)]
|
|
|
|
|
[InlineData("timing", FeatureType.Timing)]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void AsFeatureTypeTest(string? field, FeatureType expected)
|
2023-04-20 10:34:37 -04:00
|
|
|
{
|
|
|
|
|
FeatureType actual = field.AsFeatureType();
|
|
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(null, ItemStatus.NULL)]
|
|
|
|
|
[InlineData("none", ItemStatus.None)]
|
|
|
|
|
[InlineData("no", ItemStatus.None)]
|
|
|
|
|
[InlineData("good", ItemStatus.Good)]
|
|
|
|
|
[InlineData("baddump", ItemStatus.BadDump)]
|
|
|
|
|
[InlineData("nodump", ItemStatus.Nodump)]
|
|
|
|
|
[InlineData("yes", ItemStatus.Nodump)]
|
|
|
|
|
[InlineData("verified", ItemStatus.Verified)]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void AsItemStatusTest(string? field, ItemStatus expected)
|
2023-04-20 10:34:37 -04:00
|
|
|
{
|
|
|
|
|
ItemStatus actual = field.AsItemStatus();
|
|
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(null, ItemType.NULL)]
|
|
|
|
|
[InlineData("adjuster", ItemType.Adjuster)]
|
|
|
|
|
[InlineData("analog", ItemType.Analog)]
|
|
|
|
|
[InlineData("archive", ItemType.Archive)]
|
|
|
|
|
[InlineData("biosset", ItemType.BiosSet)]
|
|
|
|
|
[InlineData("blank", ItemType.Blank)]
|
|
|
|
|
[InlineData("chip", ItemType.Chip)]
|
|
|
|
|
[InlineData("condition", ItemType.Condition)]
|
|
|
|
|
[InlineData("configuration", ItemType.Configuration)]
|
2023-08-14 13:17:51 -04:00
|
|
|
[InlineData("conflocation", ItemType.ConfLocation)]
|
|
|
|
|
[InlineData("confsetting", ItemType.ConfSetting)]
|
2023-04-20 10:34:37 -04:00
|
|
|
[InlineData("control", ItemType.Control)]
|
|
|
|
|
[InlineData("dataarea", ItemType.DataArea)]
|
|
|
|
|
[InlineData("device", ItemType.Device)]
|
|
|
|
|
[InlineData("deviceref", ItemType.DeviceReference)]
|
|
|
|
|
[InlineData("device_ref", ItemType.DeviceReference)]
|
2023-08-14 13:17:51 -04:00
|
|
|
[InlineData("diplocation", ItemType.DipLocation)]
|
2023-04-20 10:34:37 -04:00
|
|
|
[InlineData("dipswitch", ItemType.DipSwitch)]
|
2023-08-14 13:17:51 -04:00
|
|
|
[InlineData("dipvalue", ItemType.DipValue)]
|
2023-04-20 10:34:37 -04:00
|
|
|
[InlineData("disk", ItemType.Disk)]
|
|
|
|
|
[InlineData("diskarea", ItemType.DiskArea)]
|
|
|
|
|
[InlineData("display", ItemType.Display)]
|
|
|
|
|
[InlineData("driver", ItemType.Driver)]
|
|
|
|
|
[InlineData("extension", ItemType.Extension)]
|
|
|
|
|
[InlineData("feature", ItemType.Feature)]
|
|
|
|
|
[InlineData("file", ItemType.File)]
|
|
|
|
|
[InlineData("info", ItemType.Info)]
|
|
|
|
|
[InlineData("input", ItemType.Input)]
|
|
|
|
|
[InlineData("instance", ItemType.Instance)]
|
|
|
|
|
[InlineData("media", ItemType.Media)]
|
|
|
|
|
[InlineData("part", ItemType.Part)]
|
|
|
|
|
[InlineData("partfeature", ItemType.PartFeature)]
|
|
|
|
|
[InlineData("part_feature", ItemType.PartFeature)]
|
|
|
|
|
[InlineData("port", ItemType.Port)]
|
|
|
|
|
[InlineData("ramoption", ItemType.RamOption)]
|
|
|
|
|
[InlineData("ram_option", ItemType.RamOption)]
|
|
|
|
|
[InlineData("release", ItemType.Release)]
|
|
|
|
|
[InlineData("releasedetails", ItemType.ReleaseDetails)]
|
|
|
|
|
[InlineData("release_details", ItemType.ReleaseDetails)]
|
|
|
|
|
[InlineData("rom", ItemType.Rom)]
|
|
|
|
|
[InlineData("sample", ItemType.Sample)]
|
|
|
|
|
[InlineData("serials", ItemType.Serials)]
|
|
|
|
|
[InlineData("sharedfeat", ItemType.SharedFeature)]
|
|
|
|
|
[InlineData("shared_feat", ItemType.SharedFeature)]
|
|
|
|
|
[InlineData("sharedfeature", ItemType.SharedFeature)]
|
|
|
|
|
[InlineData("shared_feature", ItemType.SharedFeature)]
|
|
|
|
|
[InlineData("slot", ItemType.Slot)]
|
|
|
|
|
[InlineData("slotoption", ItemType.SlotOption)]
|
|
|
|
|
[InlineData("slot_option", ItemType.SlotOption)]
|
|
|
|
|
[InlineData("softwarelist", ItemType.SoftwareList)]
|
|
|
|
|
[InlineData("software_list", ItemType.SoftwareList)]
|
|
|
|
|
[InlineData("sound", ItemType.Sound)]
|
|
|
|
|
[InlineData("sourcedetails", ItemType.SourceDetails)]
|
|
|
|
|
[InlineData("source_details", ItemType.SourceDetails)]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void AsItemTypeTest(string? field, ItemType expected)
|
2023-04-20 10:34:37 -04:00
|
|
|
{
|
|
|
|
|
ItemType actual = field.AsItemType();
|
|
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(null, LoadFlag.NULL)]
|
|
|
|
|
[InlineData("load16_byte", LoadFlag.Load16Byte)]
|
|
|
|
|
[InlineData("load16_word", LoadFlag.Load16Word)]
|
|
|
|
|
[InlineData("load16_word_swap", LoadFlag.Load16WordSwap)]
|
|
|
|
|
[InlineData("load32_byte", LoadFlag.Load32Byte)]
|
|
|
|
|
[InlineData("load32_word", LoadFlag.Load32Word)]
|
|
|
|
|
[InlineData("load32_word_swap", LoadFlag.Load32WordSwap)]
|
|
|
|
|
[InlineData("load32_dword", LoadFlag.Load32DWord)]
|
|
|
|
|
[InlineData("load64_word", LoadFlag.Load64Word)]
|
|
|
|
|
[InlineData("load64_word_swap", LoadFlag.Load64WordSwap)]
|
|
|
|
|
[InlineData("reload", LoadFlag.Reload)]
|
|
|
|
|
[InlineData("fill", LoadFlag.Fill)]
|
|
|
|
|
[InlineData("continue", LoadFlag.Continue)]
|
|
|
|
|
[InlineData("reload_plain", LoadFlag.ReloadPlain)]
|
|
|
|
|
[InlineData("ignore", LoadFlag.Ignore)]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void AsLoadFlagTest(string? field, LoadFlag expected)
|
2023-04-20 10:34:37 -04:00
|
|
|
{
|
|
|
|
|
LoadFlag actual = field.AsLoadFlag();
|
|
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(null, LogLevel.VERBOSE)]
|
|
|
|
|
[InlineData("verbose", LogLevel.VERBOSE)]
|
|
|
|
|
[InlineData("user", LogLevel.USER)]
|
|
|
|
|
[InlineData("warning", LogLevel.WARNING)]
|
|
|
|
|
[InlineData("error", LogLevel.ERROR)]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void AsLogLevelTest(string? field, LogLevel expected)
|
2023-04-20 10:34:37 -04:00
|
|
|
{
|
|
|
|
|
LogLevel actual = field.AsLogLevel();
|
|
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-18 14:22:56 -08:00
|
|
|
[Theory]
|
|
|
|
|
[InlineData(null, MachineField.NULL)]
|
|
|
|
|
[InlineData("name", MachineField.NULL)]
|
|
|
|
|
[InlineData("game-name", MachineField.Name)]
|
|
|
|
|
[InlineData("game.name", MachineField.Name)]
|
|
|
|
|
[InlineData("game_name", MachineField.Name)]
|
|
|
|
|
[InlineData("game name", MachineField.Name)]
|
|
|
|
|
[InlineData("machine-name", MachineField.Name)]
|
|
|
|
|
[InlineData("machine.name", MachineField.Name)]
|
|
|
|
|
[InlineData("machine_name", MachineField.Name)]
|
|
|
|
|
[InlineData("machine name", MachineField.Name)]
|
|
|
|
|
[InlineData("GAME.NAME", MachineField.Name)]
|
|
|
|
|
[InlineData("gAmE.namE", MachineField.Name)]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void AsMachineFieldProcessingTest(string? field, MachineField expected)
|
2023-04-20 10:34:37 -04:00
|
|
|
{
|
|
|
|
|
MachineField actual = field.AsMachineField();
|
|
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(null, MachineField.NULL)]
|
|
|
|
|
[InlineData("game.board", MachineField.Board)]
|
|
|
|
|
[InlineData("game.buttons", MachineField.Buttons)]
|
|
|
|
|
[InlineData("game.category", MachineField.Category)]
|
|
|
|
|
[InlineData("game.cloneof", MachineField.CloneOf)]
|
|
|
|
|
[InlineData("game.clone_of", MachineField.CloneOf)]
|
2023-04-20 16:30:00 -04:00
|
|
|
[InlineData("game.cloneofid", MachineField.CloneOfID)]
|
|
|
|
|
[InlineData("game.nointrocloneofid", MachineField.CloneOfID)]
|
|
|
|
|
[InlineData("game.nointro_cloneofid", MachineField.CloneOfID)]
|
|
|
|
|
[InlineData("game.no_intro_cloneofid", MachineField.CloneOfID)]
|
|
|
|
|
[InlineData("game.no_intro_clone_of_id", MachineField.CloneOfID)]
|
2023-04-20 10:34:37 -04:00
|
|
|
[InlineData("game.comment", MachineField.Comment)]
|
|
|
|
|
[InlineData("game.extra", MachineField.Comment)]
|
|
|
|
|
[InlineData("game.control", MachineField.Control)]
|
|
|
|
|
[InlineData("game.country", MachineField.Country)]
|
|
|
|
|
[InlineData("game.crc", MachineField.CRC)]
|
|
|
|
|
[InlineData("game.hascrc", MachineField.CRC)]
|
|
|
|
|
[InlineData("game.has_crc", MachineField.CRC)]
|
|
|
|
|
[InlineData("game.desc", MachineField.Description)]
|
|
|
|
|
[InlineData("game.description", MachineField.Description)]
|
|
|
|
|
[InlineData("game.developer", MachineField.Developer)]
|
|
|
|
|
[InlineData("game.displaycount", MachineField.DisplayCount)]
|
|
|
|
|
[InlineData("game.display_count", MachineField.DisplayCount)]
|
|
|
|
|
[InlineData("game.displaytype", MachineField.DisplayType)]
|
|
|
|
|
[InlineData("game.display_type", MachineField.DisplayType)]
|
|
|
|
|
[InlineData("game.enabled", MachineField.Enabled)]
|
|
|
|
|
[InlineData("game.genmsxid", MachineField.GenMSXID)]
|
|
|
|
|
[InlineData("game.genmsx_id", MachineField.GenMSXID)]
|
|
|
|
|
[InlineData("game.gen_msxid", MachineField.GenMSXID)]
|
|
|
|
|
[InlineData("game.gen_msx_id", MachineField.GenMSXID)]
|
|
|
|
|
[InlineData("game.genre", MachineField.Genre)]
|
|
|
|
|
[InlineData("game.history", MachineField.History)]
|
2023-04-20 16:30:00 -04:00
|
|
|
[InlineData("game.id", MachineField.ID)]
|
|
|
|
|
[InlineData("game.nointroid", MachineField.ID)]
|
|
|
|
|
[InlineData("game.nointro_id", MachineField.ID)]
|
|
|
|
|
[InlineData("game.no_intro_id", MachineField.ID)]
|
2023-04-20 10:34:37 -04:00
|
|
|
[InlineData("game.manufacturer", MachineField.Manufacturer)]
|
|
|
|
|
[InlineData("game.name", MachineField.Name)]
|
|
|
|
|
[InlineData("game.players", MachineField.Players)]
|
|
|
|
|
[InlineData("game.publisher", MachineField.Publisher)]
|
|
|
|
|
[InlineData("game.ratings", MachineField.Ratings)]
|
|
|
|
|
[InlineData("game.rebuildto", MachineField.RebuildTo)]
|
|
|
|
|
[InlineData("game.rebuild_to", MachineField.RebuildTo)]
|
|
|
|
|
[InlineData("game.relatedto", MachineField.RelatedTo)]
|
|
|
|
|
[InlineData("game.related_to", MachineField.RelatedTo)]
|
|
|
|
|
[InlineData("game.romof", MachineField.RomOf)]
|
|
|
|
|
[InlineData("game.rom_of", MachineField.RomOf)]
|
|
|
|
|
[InlineData("game.rotation", MachineField.Rotation)]
|
|
|
|
|
[InlineData("game.runnable", MachineField.Runnable)]
|
|
|
|
|
[InlineData("game.sampleof", MachineField.SampleOf)]
|
|
|
|
|
[InlineData("game.sample_of", MachineField.SampleOf)]
|
|
|
|
|
[InlineData("game.score", MachineField.Score)]
|
|
|
|
|
[InlineData("game.sourcefile", MachineField.SourceFile)]
|
|
|
|
|
[InlineData("game.source_file", MachineField.SourceFile)]
|
|
|
|
|
[InlineData("game.amstatus", MachineField.Status)]
|
|
|
|
|
[InlineData("game.am_status", MachineField.Status)]
|
|
|
|
|
[InlineData("game.gamestatus", MachineField.Status)]
|
|
|
|
|
[InlineData("game.supportstatus", MachineField.Status)]
|
|
|
|
|
[InlineData("game.support_status", MachineField.Status)]
|
|
|
|
|
[InlineData("game.subgenre", MachineField.Subgenre)]
|
|
|
|
|
[InlineData("game.sub_genre", MachineField.Subgenre)]
|
|
|
|
|
[InlineData("game.supported", MachineField.Supported)]
|
|
|
|
|
[InlineData("game.system", MachineField.System)]
|
|
|
|
|
[InlineData("game.msxsystem", MachineField.System)]
|
|
|
|
|
[InlineData("game.msx_system", MachineField.System)]
|
|
|
|
|
[InlineData("game.titleid", MachineField.TitleID)]
|
|
|
|
|
[InlineData("game.title_id", MachineField.TitleID)]
|
|
|
|
|
[InlineData("game.type", MachineField.Type)]
|
|
|
|
|
[InlineData("game.year", MachineField.Year)]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void AsMachineFieldTest(string? field, MachineField expected)
|
2020-12-18 14:22:56 -08:00
|
|
|
{
|
|
|
|
|
MachineField actual = field.AsMachineField();
|
|
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
2023-04-20 10:34:37 -04:00
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(null, MachineType.None)]
|
|
|
|
|
[InlineData("none", MachineType.None)]
|
|
|
|
|
[InlineData("bios", MachineType.Bios)]
|
|
|
|
|
[InlineData("dev", MachineType.Device)]
|
|
|
|
|
[InlineData("device", MachineType.Device)]
|
|
|
|
|
[InlineData("mech", MachineType.Mechanical)]
|
|
|
|
|
[InlineData("mechanical", MachineType.Mechanical)]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void AsMachineTypeTest(string? field, MachineType expected)
|
2023-04-20 10:34:37 -04:00
|
|
|
{
|
|
|
|
|
MachineType actual = field.AsMachineType();
|
|
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(null, MergingFlag.None)]
|
|
|
|
|
[InlineData("none", MergingFlag.None)]
|
|
|
|
|
[InlineData("split", MergingFlag.Split)]
|
|
|
|
|
[InlineData("merged", MergingFlag.Merged)]
|
|
|
|
|
[InlineData("nonmerged", MergingFlag.NonMerged)]
|
|
|
|
|
[InlineData("unmerged", MergingFlag.NonMerged)]
|
|
|
|
|
[InlineData("fullmerged", MergingFlag.FullMerged)]
|
|
|
|
|
[InlineData("device", MergingFlag.DeviceNonMerged)]
|
|
|
|
|
[InlineData("devicenonmerged", MergingFlag.DeviceNonMerged)]
|
|
|
|
|
[InlineData("deviceunmerged", MergingFlag.DeviceNonMerged)]
|
|
|
|
|
[InlineData("full", MergingFlag.FullNonMerged)]
|
|
|
|
|
[InlineData("fullnonmerged", MergingFlag.FullNonMerged)]
|
|
|
|
|
[InlineData("fullunmerged", MergingFlag.FullNonMerged)]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void AsMergingFlagTest(string? field, MergingFlag expected)
|
2023-04-20 10:34:37 -04:00
|
|
|
{
|
|
|
|
|
MergingFlag actual = field.AsMergingFlag();
|
|
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(null, NodumpFlag.None)]
|
|
|
|
|
[InlineData("none", NodumpFlag.None)]
|
|
|
|
|
[InlineData("obsolete", NodumpFlag.Obsolete)]
|
|
|
|
|
[InlineData("required", NodumpFlag.Required)]
|
|
|
|
|
[InlineData("ignore", NodumpFlag.Ignore)]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void AsNodumpFlagTest(string? field, NodumpFlag expected)
|
2023-04-20 10:34:37 -04:00
|
|
|
{
|
|
|
|
|
NodumpFlag actual = field.AsNodumpFlag();
|
|
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(null, OpenMSXSubType.NULL)]
|
|
|
|
|
[InlineData("rom", OpenMSXSubType.Rom)]
|
|
|
|
|
[InlineData("megarom", OpenMSXSubType.MegaRom)]
|
|
|
|
|
[InlineData("sccpluscart", OpenMSXSubType.SCCPlusCart)]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void AsOpenMSXSubTypeTest(string? field, OpenMSXSubType expected)
|
2023-04-20 10:34:37 -04:00
|
|
|
{
|
|
|
|
|
OpenMSXSubType actual = field.AsOpenMSXSubType();
|
|
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(null, PackingFlag.None)]
|
|
|
|
|
[InlineData("none", PackingFlag.None)]
|
|
|
|
|
[InlineData("yes", PackingFlag.Zip)]
|
|
|
|
|
[InlineData("zip", PackingFlag.Zip)]
|
|
|
|
|
[InlineData("no", PackingFlag.Unzip)]
|
|
|
|
|
[InlineData("unzip", PackingFlag.Unzip)]
|
|
|
|
|
[InlineData("partial", PackingFlag.Partial)]
|
|
|
|
|
[InlineData("flat", PackingFlag.Flat)]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void AsPackingFlagTest(string? field, PackingFlag expected)
|
2023-04-20 10:34:37 -04:00
|
|
|
{
|
|
|
|
|
PackingFlag actual = field.AsPackingFlag();
|
|
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(null, Relation.NULL)]
|
|
|
|
|
[InlineData("eq", Relation.Equal)]
|
|
|
|
|
[InlineData("ne", Relation.NotEqual)]
|
|
|
|
|
[InlineData("gt", Relation.GreaterThan)]
|
|
|
|
|
[InlineData("le", Relation.LessThanOrEqual)]
|
|
|
|
|
[InlineData("lt", Relation.LessThan)]
|
|
|
|
|
[InlineData("ge", Relation.GreaterThanOrEqual)]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void AsRelationTest(string? field, Relation expected)
|
2023-04-20 10:34:37 -04:00
|
|
|
{
|
|
|
|
|
Relation actual = field.AsRelation();
|
|
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(null, Runnable.NULL)]
|
|
|
|
|
[InlineData("no", Runnable.No)]
|
|
|
|
|
[InlineData("partial", Runnable.Partial)]
|
|
|
|
|
[InlineData("yes", Runnable.Yes)]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void AsRunnableTest(string? field, Runnable expected)
|
2023-04-20 10:34:37 -04:00
|
|
|
{
|
|
|
|
|
Runnable actual = field.AsRunnable();
|
|
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(null, SoftwareListStatus.None)]
|
|
|
|
|
[InlineData("none", SoftwareListStatus.None)]
|
|
|
|
|
[InlineData("original", SoftwareListStatus.Original)]
|
|
|
|
|
[InlineData("compatible", SoftwareListStatus.Compatible)]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void AsSoftwareListStatusTest(string? field, SoftwareListStatus expected)
|
2023-04-20 10:34:37 -04:00
|
|
|
{
|
|
|
|
|
SoftwareListStatus actual = field.AsSoftwareListStatus();
|
|
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(null, Supported.NULL)]
|
|
|
|
|
[InlineData("no", Supported.No)]
|
|
|
|
|
[InlineData("unsupported", Supported.No)]
|
|
|
|
|
[InlineData("partial", Supported.Partial)]
|
|
|
|
|
[InlineData("yes", Supported.Yes)]
|
|
|
|
|
[InlineData("supported", Supported.Yes)]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void AsSupportedTest(string? field, Supported expected)
|
2023-04-20 10:34:37 -04:00
|
|
|
{
|
|
|
|
|
Supported actual = field.AsSupported();
|
|
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(null, SupportStatus.NULL)]
|
|
|
|
|
[InlineData("good", SupportStatus.Good)]
|
|
|
|
|
[InlineData("imperfect", SupportStatus.Imperfect)]
|
|
|
|
|
[InlineData("preliminary", SupportStatus.Preliminary)]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void AsSupportStatusTest(string? field, SupportStatus expected)
|
2023-04-20 10:34:37 -04:00
|
|
|
{
|
|
|
|
|
SupportStatus actual = field.AsSupportStatus();
|
|
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
2023-04-20 12:12:56 -04:00
|
|
|
|
|
|
|
|
#region Enum to String
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(ChipType.NULL, null)]
|
|
|
|
|
[InlineData(ChipType.CPU, "cpu")]
|
|
|
|
|
[InlineData(ChipType.Audio, "audio")]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void FromChipTypeTest(ChipType field, string? expected)
|
2023-04-20 12:12:56 -04:00
|
|
|
{
|
2024-03-05 13:32:49 -05:00
|
|
|
string? actual = field.FromChipType();
|
2023-04-20 12:12:56 -04:00
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(ControlType.NULL, null)]
|
|
|
|
|
[InlineData(ControlType.Joy, "joy")]
|
|
|
|
|
[InlineData(ControlType.Stick, "stick")]
|
|
|
|
|
[InlineData(ControlType.Paddle, "paddle")]
|
|
|
|
|
[InlineData(ControlType.Pedal, "pedal")]
|
|
|
|
|
[InlineData(ControlType.Lightgun, "lightgun")]
|
|
|
|
|
[InlineData(ControlType.Positional, "positional")]
|
|
|
|
|
[InlineData(ControlType.Dial, "dial")]
|
|
|
|
|
[InlineData(ControlType.Trackball, "trackball")]
|
|
|
|
|
[InlineData(ControlType.Mouse, "mouse")]
|
|
|
|
|
[InlineData(ControlType.OnlyButtons, "only_buttons")]
|
|
|
|
|
[InlineData(ControlType.Keypad, "keypad")]
|
|
|
|
|
[InlineData(ControlType.Keyboard, "keyboard")]
|
|
|
|
|
[InlineData(ControlType.Mahjong, "mahjong")]
|
|
|
|
|
[InlineData(ControlType.Hanafuda, "hanafuda")]
|
|
|
|
|
[InlineData(ControlType.Gambling, "gambling")]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void FromControlTypeTest(ControlType field, string? expected)
|
2023-04-20 12:12:56 -04:00
|
|
|
{
|
2024-03-05 13:32:49 -05:00
|
|
|
string? actual = field.FromControlType();
|
2023-04-20 12:12:56 -04:00
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO: Write new test for all supported DatHeaderField values
|
|
|
|
|
// TODO: Write new test for all supported DatItemField values
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(DeviceType.NULL, null)]
|
|
|
|
|
[InlineData(DeviceType.Unknown, "unknown")]
|
|
|
|
|
[InlineData(DeviceType.Cartridge, "cartridge")]
|
|
|
|
|
[InlineData(DeviceType.FloppyDisk, "floppydisk")]
|
|
|
|
|
[InlineData(DeviceType.HardDisk, "harddisk")]
|
|
|
|
|
[InlineData(DeviceType.Cylinder, "cylinder")]
|
|
|
|
|
[InlineData(DeviceType.Cassette, "cassette")]
|
|
|
|
|
[InlineData(DeviceType.PunchCard, "punchcard")]
|
|
|
|
|
[InlineData(DeviceType.PunchTape, "punchtape")]
|
|
|
|
|
[InlineData(DeviceType.Printout, "printout")]
|
|
|
|
|
[InlineData(DeviceType.Serial, "serial")]
|
|
|
|
|
[InlineData(DeviceType.Parallel, "parallel")]
|
|
|
|
|
[InlineData(DeviceType.Snapshot, "snapshot")]
|
|
|
|
|
[InlineData(DeviceType.QuickLoad, "quickload")]
|
|
|
|
|
[InlineData(DeviceType.MemCard, "memcard")]
|
|
|
|
|
[InlineData(DeviceType.CDROM, "cdrom")]
|
|
|
|
|
[InlineData(DeviceType.MagTape, "magtape")]
|
|
|
|
|
[InlineData(DeviceType.ROMImage, "romimage")]
|
|
|
|
|
[InlineData(DeviceType.MIDIIn, "midiin")]
|
|
|
|
|
[InlineData(DeviceType.MIDIOut, "midiout")]
|
|
|
|
|
[InlineData(DeviceType.Picture, "picture")]
|
|
|
|
|
[InlineData(DeviceType.VidFile, "vidfile")]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void FromDeviceTypeTest(DeviceType field, string? expected)
|
2023-04-20 12:12:56 -04:00
|
|
|
{
|
2024-03-05 13:32:49 -05:00
|
|
|
string? actual = field.FromDeviceType();
|
2023-04-20 12:12:56 -04:00
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(DisplayType.NULL, null)]
|
|
|
|
|
[InlineData(DisplayType.Raster, "raster")]
|
|
|
|
|
[InlineData(DisplayType.Vector, "vector")]
|
|
|
|
|
[InlineData(DisplayType.LCD, "lcd")]
|
|
|
|
|
[InlineData(DisplayType.SVG, "svg")]
|
|
|
|
|
[InlineData(DisplayType.Unknown, "unknown")]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void FromDisplayTypeTest(DisplayType field, string? expected)
|
2023-04-20 12:12:56 -04:00
|
|
|
{
|
2024-03-05 13:32:49 -05:00
|
|
|
string? actual = field.FromDisplayType();
|
2023-04-20 12:12:56 -04:00
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(Endianness.NULL, null)]
|
|
|
|
|
[InlineData(Endianness.Big, "big")]
|
|
|
|
|
[InlineData(Endianness.Little, "little")]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void FromEndiannessTest(Endianness field, string? expected)
|
2023-04-20 12:12:56 -04:00
|
|
|
{
|
2024-03-05 13:32:49 -05:00
|
|
|
string? actual = field.FromEndianness();
|
2023-04-20 12:12:56 -04:00
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(FeatureStatus.NULL, null)]
|
|
|
|
|
[InlineData(FeatureStatus.Unemulated, "unemulated")]
|
|
|
|
|
[InlineData(FeatureStatus.Imperfect, "imperfect")]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void FromFeatureStatusTest(FeatureStatus field, string? expected)
|
2023-04-20 12:12:56 -04:00
|
|
|
{
|
2024-03-05 13:32:49 -05:00
|
|
|
string? actual = field.FromFeatureStatus();
|
2023-04-20 12:12:56 -04:00
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(FeatureType.NULL, null)]
|
|
|
|
|
[InlineData(FeatureType.Protection, "protection")]
|
|
|
|
|
[InlineData(FeatureType.Palette, "palette")]
|
|
|
|
|
[InlineData(FeatureType.Graphics, "graphics")]
|
|
|
|
|
[InlineData(FeatureType.Sound, "sound")]
|
|
|
|
|
[InlineData(FeatureType.Controls, "controls")]
|
|
|
|
|
[InlineData(FeatureType.Keyboard, "keyboard")]
|
|
|
|
|
[InlineData(FeatureType.Mouse, "mouse")]
|
|
|
|
|
[InlineData(FeatureType.Microphone, "microphone")]
|
|
|
|
|
[InlineData(FeatureType.Camera, "camera")]
|
|
|
|
|
[InlineData(FeatureType.Disk, "disk")]
|
|
|
|
|
[InlineData(FeatureType.Printer, "printer")]
|
|
|
|
|
[InlineData(FeatureType.Lan, "lan")]
|
|
|
|
|
[InlineData(FeatureType.Wan, "wan")]
|
|
|
|
|
[InlineData(FeatureType.Timing, "timing")]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void FromFeatureTypeTest(FeatureType field, string? expected)
|
2023-04-20 12:12:56 -04:00
|
|
|
{
|
2024-03-05 13:32:49 -05:00
|
|
|
string? actual = field.FromFeatureType();
|
2023-04-20 12:12:56 -04:00
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(ItemStatus.NULL, true, null)]
|
|
|
|
|
[InlineData(ItemStatus.NULL, false, null)]
|
|
|
|
|
[InlineData(ItemStatus.None, true, "no")]
|
|
|
|
|
[InlineData(ItemStatus.None, false, "none")]
|
|
|
|
|
[InlineData(ItemStatus.Good, true, "good")]
|
|
|
|
|
[InlineData(ItemStatus.Good, false, "good")]
|
|
|
|
|
[InlineData(ItemStatus.BadDump, true, "baddump")]
|
|
|
|
|
[InlineData(ItemStatus.BadDump, false, "baddump")]
|
|
|
|
|
[InlineData(ItemStatus.Nodump, true, "yes")]
|
|
|
|
|
[InlineData(ItemStatus.Nodump, false, "nodump")]
|
|
|
|
|
[InlineData(ItemStatus.Verified, true, "verified")]
|
|
|
|
|
[InlineData(ItemStatus.Verified, false, "verified")]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void FromItemStatusTest(ItemStatus field, bool yesno, string? expected)
|
2023-04-20 12:12:56 -04:00
|
|
|
{
|
2024-03-05 13:32:49 -05:00
|
|
|
string? actual = field.FromItemStatus(yesno);
|
2023-04-20 12:12:56 -04:00
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(ItemType.NULL, null)]
|
|
|
|
|
[InlineData(ItemType.Adjuster, "adjuster")]
|
|
|
|
|
[InlineData(ItemType.Analog, "analog")]
|
|
|
|
|
[InlineData(ItemType.Archive, "archive")]
|
|
|
|
|
[InlineData(ItemType.BiosSet, "biosset")]
|
|
|
|
|
[InlineData(ItemType.Blank, "blank")]
|
|
|
|
|
[InlineData(ItemType.Chip, "chip")]
|
|
|
|
|
[InlineData(ItemType.Condition, "condition")]
|
|
|
|
|
[InlineData(ItemType.Configuration, "configuration")]
|
2023-08-14 13:17:51 -04:00
|
|
|
[InlineData(ItemType.ConfLocation, "conflocation")]
|
|
|
|
|
[InlineData(ItemType.ConfSetting, "confsetting")]
|
2023-04-20 12:12:56 -04:00
|
|
|
[InlineData(ItemType.Control, "control")]
|
|
|
|
|
[InlineData(ItemType.DataArea, "dataarea")]
|
|
|
|
|
[InlineData(ItemType.Device, "device")]
|
|
|
|
|
[InlineData(ItemType.DeviceReference, "device_ref")]
|
2023-08-14 13:17:51 -04:00
|
|
|
[InlineData(ItemType.DipLocation, "diplocation")]
|
2023-04-20 12:12:56 -04:00
|
|
|
[InlineData(ItemType.DipSwitch, "dipswitch")]
|
2023-08-14 13:17:51 -04:00
|
|
|
[InlineData(ItemType.DipValue, "dipvalue")]
|
2023-04-20 12:12:56 -04:00
|
|
|
[InlineData(ItemType.Disk, "disk")]
|
|
|
|
|
[InlineData(ItemType.DiskArea, "diskarea")]
|
|
|
|
|
[InlineData(ItemType.Display, "display")]
|
|
|
|
|
[InlineData(ItemType.Driver, "driver")]
|
|
|
|
|
[InlineData(ItemType.Extension, "extension")]
|
|
|
|
|
[InlineData(ItemType.Feature, "feature")]
|
|
|
|
|
[InlineData(ItemType.File, "file")]
|
|
|
|
|
[InlineData(ItemType.Info, "info")]
|
|
|
|
|
[InlineData(ItemType.Input, "input")]
|
|
|
|
|
[InlineData(ItemType.Instance, "instance")]
|
|
|
|
|
[InlineData(ItemType.Media, "media")]
|
|
|
|
|
[InlineData(ItemType.Part, "part")]
|
|
|
|
|
[InlineData(ItemType.PartFeature, "part_feature")]
|
|
|
|
|
[InlineData(ItemType.Port, "port")]
|
|
|
|
|
[InlineData(ItemType.RamOption, "ramoption")]
|
|
|
|
|
[InlineData(ItemType.Release, "release")]
|
|
|
|
|
[InlineData(ItemType.ReleaseDetails, "release_details")]
|
|
|
|
|
[InlineData(ItemType.Rom, "rom")]
|
|
|
|
|
[InlineData(ItemType.Sample, "sample")]
|
|
|
|
|
[InlineData(ItemType.Serials, "serials")]
|
|
|
|
|
[InlineData(ItemType.SharedFeature, "sharedfeat")]
|
|
|
|
|
[InlineData(ItemType.Slot, "slot")]
|
|
|
|
|
[InlineData(ItemType.SlotOption, "slotoption")]
|
|
|
|
|
[InlineData(ItemType.SoftwareList, "softwarelist")]
|
|
|
|
|
[InlineData(ItemType.Sound, "sound")]
|
|
|
|
|
[InlineData(ItemType.SourceDetails, "source_details")]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void FromItemTypeTest(ItemType field, string? expected)
|
2023-04-20 12:12:56 -04:00
|
|
|
{
|
2024-03-05 13:32:49 -05:00
|
|
|
string? actual = field.FromItemType();
|
2023-04-20 12:12:56 -04:00
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(LoadFlag.NULL, null)]
|
|
|
|
|
[InlineData(LoadFlag.Load16Byte, "load16_byte")]
|
|
|
|
|
[InlineData(LoadFlag.Load16Word, "load16_word")]
|
|
|
|
|
[InlineData(LoadFlag.Load16WordSwap, "load16_word_swap")]
|
|
|
|
|
[InlineData(LoadFlag.Load32Byte, "load32_byte")]
|
|
|
|
|
[InlineData(LoadFlag.Load32Word, "load32_word")]
|
|
|
|
|
[InlineData(LoadFlag.Load32WordSwap, "load32_word_swap")]
|
|
|
|
|
[InlineData(LoadFlag.Load32DWord, "load32_dword")]
|
|
|
|
|
[InlineData(LoadFlag.Load64Word, "load64_word")]
|
|
|
|
|
[InlineData(LoadFlag.Load64WordSwap, "load64_word_swap")]
|
|
|
|
|
[InlineData(LoadFlag.Reload, "reload")]
|
|
|
|
|
[InlineData(LoadFlag.Fill, "fill")]
|
|
|
|
|
[InlineData(LoadFlag.Continue, "continue")]
|
|
|
|
|
[InlineData(LoadFlag.ReloadPlain, "reload_plain")]
|
|
|
|
|
[InlineData(LoadFlag.Ignore, "ignore")]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void FromLoadFlagTest(LoadFlag field, string? expected)
|
2023-04-20 12:12:56 -04:00
|
|
|
{
|
2024-03-05 13:32:49 -05:00
|
|
|
string? actual = field.FromLoadFlag();
|
2023-04-20 12:12:56 -04:00
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO: Write new test for all supported MachineField values
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(MachineType.None, true, "none")]
|
|
|
|
|
[InlineData(MachineType.None, false, "none")]
|
|
|
|
|
[InlineData(MachineType.Bios, true, "bios")]
|
|
|
|
|
[InlineData(MachineType.Bios, false, "bios")]
|
|
|
|
|
[InlineData(MachineType.Device, true, "dev")]
|
|
|
|
|
[InlineData(MachineType.Device, false, "device")]
|
|
|
|
|
[InlineData(MachineType.Mechanical, true, "mech")]
|
|
|
|
|
[InlineData(MachineType.Mechanical, false, "mechanical")]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void FromMachineTypeTest(MachineType field, bool old, string? expected)
|
2023-04-20 12:12:56 -04:00
|
|
|
{
|
2024-03-05 13:32:49 -05:00
|
|
|
string? actual = field.FromMachineType(old);
|
2023-04-20 12:12:56 -04:00
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(MergingFlag.None, true, "none")]
|
|
|
|
|
[InlineData(MergingFlag.None, false, "none")]
|
|
|
|
|
[InlineData(MergingFlag.Split, true, "split")]
|
|
|
|
|
[InlineData(MergingFlag.Split, false, "split")]
|
|
|
|
|
[InlineData(MergingFlag.Merged, true, "merged")]
|
|
|
|
|
[InlineData(MergingFlag.Merged, false, "merged")]
|
|
|
|
|
[InlineData(MergingFlag.NonMerged, true, "unmerged")]
|
|
|
|
|
[InlineData(MergingFlag.NonMerged, false, "nonmerged")]
|
|
|
|
|
[InlineData(MergingFlag.FullMerged, true, "fullmerged")]
|
|
|
|
|
[InlineData(MergingFlag.FullMerged, false, "fullmerged")]
|
|
|
|
|
[InlineData(MergingFlag.DeviceNonMerged, true, "deviceunmerged")]
|
|
|
|
|
[InlineData(MergingFlag.DeviceNonMerged, false, "device")]
|
|
|
|
|
[InlineData(MergingFlag.FullNonMerged, true, "fullunmerged")]
|
|
|
|
|
[InlineData(MergingFlag.FullNonMerged, false, "full")]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void FromMergingFlagTest(MergingFlag field, bool romcenter, string? expected)
|
2023-04-20 12:12:56 -04:00
|
|
|
{
|
2024-03-05 13:32:49 -05:00
|
|
|
string? actual = field.FromMergingFlag(romcenter);
|
2023-04-20 12:12:56 -04:00
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(NodumpFlag.None, "none")]
|
|
|
|
|
[InlineData(NodumpFlag.Obsolete, "obsolete")]
|
|
|
|
|
[InlineData(NodumpFlag.Required, "required")]
|
|
|
|
|
[InlineData(NodumpFlag.Ignore, "ignore")]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void FromNodumpFlagTest(NodumpFlag field, string? expected)
|
2023-04-20 12:12:56 -04:00
|
|
|
{
|
2024-03-05 13:32:49 -05:00
|
|
|
string? actual = field.FromNodumpFlag();
|
2023-04-20 12:12:56 -04:00
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(OpenMSXSubType.NULL, null)]
|
|
|
|
|
[InlineData(OpenMSXSubType.Rom, "rom")]
|
|
|
|
|
[InlineData(OpenMSXSubType.MegaRom, "megarom")]
|
|
|
|
|
[InlineData(OpenMSXSubType.SCCPlusCart, "sccpluscart")]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void FromOpenMSXSubTypeTest(OpenMSXSubType field, string? expected)
|
2023-04-20 12:12:56 -04:00
|
|
|
{
|
2024-03-05 13:32:49 -05:00
|
|
|
string? actual = field.FromOpenMSXSubType();
|
2023-04-20 12:12:56 -04:00
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(PackingFlag.None, true, "none")]
|
|
|
|
|
[InlineData(PackingFlag.None, false, "none")]
|
|
|
|
|
[InlineData(PackingFlag.Zip, true, "yes")]
|
|
|
|
|
[InlineData(PackingFlag.Zip, false, "zip")]
|
|
|
|
|
[InlineData(PackingFlag.Unzip, true, "no")]
|
|
|
|
|
[InlineData(PackingFlag.Unzip, false, "unzip")]
|
|
|
|
|
[InlineData(PackingFlag.Partial, true, "partial")]
|
|
|
|
|
[InlineData(PackingFlag.Partial, false, "partial")]
|
|
|
|
|
[InlineData(PackingFlag.Flat, true, "flat")]
|
|
|
|
|
[InlineData(PackingFlag.Flat, false, "flat")]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void FromPackingFlagTest(PackingFlag field, bool yesno, string? expected)
|
2023-04-20 12:12:56 -04:00
|
|
|
{
|
2024-03-05 13:32:49 -05:00
|
|
|
string? actual = field.FromPackingFlag(yesno);
|
2023-04-20 12:12:56 -04:00
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(Relation.NULL, null)]
|
|
|
|
|
[InlineData(Relation.Equal, "eq")]
|
|
|
|
|
[InlineData(Relation.NotEqual, "ne")]
|
|
|
|
|
[InlineData(Relation.GreaterThan, "gt")]
|
|
|
|
|
[InlineData(Relation.LessThanOrEqual, "le")]
|
|
|
|
|
[InlineData(Relation.LessThan, "lt")]
|
|
|
|
|
[InlineData(Relation.GreaterThanOrEqual, "ge")]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void FromRelationTest(Relation field, string? expected)
|
2023-04-20 12:12:56 -04:00
|
|
|
{
|
2024-03-05 13:32:49 -05:00
|
|
|
string? actual = field.FromRelation();
|
2023-04-20 12:12:56 -04:00
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(Runnable.NULL, null)]
|
|
|
|
|
[InlineData(Runnable.No, "no")]
|
|
|
|
|
[InlineData(Runnable.Partial, "partial")]
|
|
|
|
|
[InlineData(Runnable.Yes, "yes")]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void FromRunnableTest(Runnable field, string? expected)
|
2023-04-20 12:12:56 -04:00
|
|
|
{
|
2024-03-05 13:32:49 -05:00
|
|
|
string? actual = field.FromRunnable();
|
2023-04-20 12:12:56 -04:00
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(SoftwareListStatus.None, "none")]
|
|
|
|
|
[InlineData(SoftwareListStatus.Original, "original")]
|
|
|
|
|
[InlineData(SoftwareListStatus.Compatible, "compatible")]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void FromSoftwareListStatusTest(SoftwareListStatus field, string? expected)
|
2023-04-20 12:12:56 -04:00
|
|
|
{
|
2024-03-05 13:32:49 -05:00
|
|
|
string? actual = field.FromSoftwareListStatus();
|
2023-04-20 12:12:56 -04:00
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(Supported.NULL, true, null)]
|
|
|
|
|
[InlineData(Supported.NULL, false, null)]
|
|
|
|
|
[InlineData(Supported.No, true, "unsupported")]
|
|
|
|
|
[InlineData(Supported.No, false, "no")]
|
|
|
|
|
[InlineData(Supported.Partial, true, "partial")]
|
|
|
|
|
[InlineData(Supported.Partial, false, "partial")]
|
|
|
|
|
[InlineData(Supported.Yes, true, "supported")]
|
|
|
|
|
[InlineData(Supported.Yes, false, "yes")]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void FromSupportedTest(Supported field, bool verbose, string? expected)
|
2023-04-20 12:12:56 -04:00
|
|
|
{
|
2024-03-05 13:32:49 -05:00
|
|
|
string? actual = field.FromSupported(verbose);
|
2023-04-20 12:12:56 -04:00
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(SupportStatus.NULL, null)]
|
|
|
|
|
[InlineData(SupportStatus.Good, "good")]
|
|
|
|
|
[InlineData(SupportStatus.Imperfect, "imperfect")]
|
|
|
|
|
[InlineData(SupportStatus.Preliminary, "preliminary")]
|
2024-03-05 13:32:49 -05:00
|
|
|
public void FromSupportStatusTest(SupportStatus field, string? expected)
|
2023-04-20 12:12:56 -04:00
|
|
|
{
|
2024-03-05 13:32:49 -05:00
|
|
|
string? actual = field.FromSupportStatus();
|
2023-04-20 12:12:56 -04:00
|
|
|
Assert.Equal(expected, actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
2023-04-20 13:54:59 -04:00
|
|
|
|
|
|
|
|
#region Generators
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(ChipType.NULL, 2)]
|
|
|
|
|
[InlineData(ControlType.NULL, 15)]
|
|
|
|
|
[InlineData(DatHeaderField.NULL, 94)]
|
|
|
|
|
[InlineData(DatItemField.NULL, 197)]
|
|
|
|
|
[InlineData(DeviceType.NULL, 21)]
|
|
|
|
|
[InlineData(DisplayType.NULL, 5)]
|
|
|
|
|
[InlineData(Endianness.NULL, 2)]
|
|
|
|
|
[InlineData(FeatureStatus.NULL, 2)]
|
|
|
|
|
[InlineData(FeatureType.NULL, 14)]
|
|
|
|
|
[InlineData(ItemStatus.NULL, 7)]
|
2023-08-14 14:53:28 -04:00
|
|
|
[InlineData(ItemType.NULL, 54)]
|
2023-04-20 13:54:59 -04:00
|
|
|
[InlineData(LoadFlag.NULL, 14)]
|
|
|
|
|
[InlineData(LogLevel.VERBOSE, 4)]
|
|
|
|
|
[InlineData(MachineField.NULL, 68)]
|
|
|
|
|
[InlineData(MachineType.None, 6)]
|
|
|
|
|
[InlineData(MergingFlag.None, 12)]
|
|
|
|
|
[InlineData(NodumpFlag.None, 4)]
|
|
|
|
|
[InlineData(OpenMSXSubType.NULL, 3)]
|
|
|
|
|
[InlineData(PackingFlag.None, 7)]
|
|
|
|
|
[InlineData(Relation.NULL, 6)]
|
|
|
|
|
[InlineData(Runnable.NULL, 3)]
|
|
|
|
|
[InlineData(SoftwareListStatus.None, 3)]
|
|
|
|
|
[InlineData(Supported.NULL, 5)]
|
|
|
|
|
[InlineData(SupportStatus.NULL, 3)]
|
|
|
|
|
public void GenerateToEnumTest<T>(T value, int expected)
|
|
|
|
|
{
|
|
|
|
|
var actual = Converters.GenerateToEnum<T>();
|
|
|
|
|
Assert.Equal(default, value);
|
|
|
|
|
Assert.Equal(expected, actual.Keys.Count);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
2020-12-18 14:22:56 -08:00
|
|
|
}
|
|
|
|
|
}
|