Make filesystem tests inherit a single class.

This commit is contained in:
2021-03-01 19:34:30 +00:00
parent 62cb57b5da
commit 7cacb9bf84
114 changed files with 4247 additions and 6071 deletions

View File

@@ -37,87 +37,64 @@ using NUnit.Framework;
namespace Aaru.Tests.Filesystems.HTFS
{
[TestFixture]
public class Whole
public class Whole : FilesystemTest
{
readonly string[] _testFiles =
public Whole() : base("HTFS") {}
public override string _dataFolder =>
Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "High Throughtput File System");
public override IFilesystem _plugin => new SysVfs();
public override bool _partitions => false;
public override string[] _testFiles => new[]
{
"scoopenserver_5.0.7hw_dmf.img.lz", "scoopenserver_5.0.7hw_dshd.img.lz",
"scoopenserver_5.0.7hw_mf2dd.img.lz", "scoopenserver_5.0.7hw_mf2ed.img.lz",
"scoopenserver_5.0.7hw_mf2hd.img.lz"
};
readonly MediaType[] _mediaTypes =
public override MediaType[] _mediaTypes => new[]
{
MediaType.DMF, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD
};
readonly ulong[] _sectors =
public override ulong[] _sectors => new ulong[]
{
3360, 2400, 1440, 5760, 2880
};
readonly uint[] _sectorSize =
public override uint[] _sectorSize => new uint[]
{
512, 512, 512, 512, 512
};
readonly long[] _clusters =
public override string[] _appId => null;
public override bool[] _bootable => new[]
{
false, false, false, false, false
};
public override long[] _clusters => new long[]
{
1680, 1200, 720, 2880, 1440
};
readonly int[] _clusterSize =
public override uint[] _clusterSize => new uint[]
{
1024, 1024, 1024, 1024, 1024
};
public override string[] _oemId => null;
public override string[] _type => null;
readonly string[] _volumeName =
public override string[] _volumeName => new[]
{
"", "", "", "", ""
};
readonly string[] _volumeSerial =
public override string[] _volumeSerial => new string[]
{
null, null, null, null, null
};
readonly string[] _type =
{
"HTFS", "HTFS", "HTFS", "HTFS", "HTFS"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "High Throughtput File System",
_testFiles[i]);
IFilter filter = new LZip();
filter.Open(location);
IMediaImage image = new ZZZRawImage();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new SysVfs();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
}