mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Make filesystem tests inherit a single class.
This commit is contained in:
@@ -29,94 +29,68 @@
|
||||
using System.IO;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.DiscImages;
|
||||
using Aaru.Filesystems;
|
||||
using Aaru.Filters;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Filesystems.COHERENT
|
||||
{
|
||||
[TestFixture]
|
||||
public class Coherent
|
||||
public class Whole : FilesystemTest
|
||||
{
|
||||
readonly string[] _testFiles =
|
||||
public Whole() : base("Coherent fs") {}
|
||||
|
||||
public override string _dataFolder =>
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "COHERENT filesystem");
|
||||
|
||||
public override IFilesystem _plugin => new SysVfs();
|
||||
public override bool _partitions => false;
|
||||
|
||||
public override string[] _testFiles => new[]
|
||||
{
|
||||
"coherentunix_4.2.10_dsdd.img.lz", "coherentunix_4.2.10_dshd.img.lz", "coherentunix_4.2.10_mf2dd.img.lz",
|
||||
"coherentunix_4.2.10_mf2hd.img.lz"
|
||||
};
|
||||
|
||||
readonly MediaType[] _mediaTypes =
|
||||
public override MediaType[] _mediaTypes => new[]
|
||||
{
|
||||
MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD
|
||||
};
|
||||
|
||||
readonly ulong[] _sectors =
|
||||
public override ulong[] _sectors => new ulong[]
|
||||
{
|
||||
720, 2400, 1440, 2880
|
||||
};
|
||||
|
||||
readonly uint[] _sectorSize =
|
||||
public override uint[] _sectorSize => new uint[]
|
||||
{
|
||||
512, 512, 512, 512
|
||||
};
|
||||
public override string[] _appId => null;
|
||||
public override bool[] _bootable => new[]
|
||||
{
|
||||
false, false, false, false
|
||||
};
|
||||
|
||||
readonly long[] _clusters =
|
||||
public override long[] _clusters => new long[]
|
||||
{
|
||||
720, 2400, 1440, 2880
|
||||
};
|
||||
|
||||
readonly int[] _clusterSize =
|
||||
public override uint[] _clusterSize => new uint[]
|
||||
{
|
||||
512, 512, 512, 512
|
||||
};
|
||||
public override string[] _oemId => null;
|
||||
public override string[] _type => null;
|
||||
|
||||
readonly string[] _volumeName =
|
||||
public override string[] _volumeName => new[]
|
||||
{
|
||||
"noname", "noname", "noname", "noname"
|
||||
};
|
||||
|
||||
readonly string[] _volumeSerial =
|
||||
public override string[] _volumeSerial => new string[]
|
||||
{
|
||||
null, null, null, null, null
|
||||
};
|
||||
|
||||
readonly string[] _type =
|
||||
{
|
||||
"Coherent fs", "Coherent fs", "Coherent fs", "Coherent fs"
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "COHERENT filesystem",
|
||||
_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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user