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:
@@ -26,92 +26,68 @@
|
||||
// Copyright © 2011-2021 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
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.AOFS
|
||||
{
|
||||
[TestFixture]
|
||||
public class RDB
|
||||
public class RDB : FilesystemTest
|
||||
{
|
||||
readonly string[] _testFiles =
|
||||
public RDB() : base("Amiga OFS") {}
|
||||
|
||||
public override string _dataFolder =>
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Old File System (RDB)");
|
||||
public override IFilesystem _plugin => new AmigaDOSPlugin();
|
||||
public override bool _partitions => true;
|
||||
|
||||
public override string[] _testFiles => new[]
|
||||
{
|
||||
"amigaos_3.9.aif", "amigaos_3.9_intl.aif", "aros.aif", "aros_intl.aif"
|
||||
};
|
||||
public override MediaType[] _mediaTypes => new[]
|
||||
{
|
||||
MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD
|
||||
};
|
||||
|
||||
readonly ulong[] _sectors =
|
||||
public override ulong[] _sectors => new ulong[]
|
||||
{
|
||||
1024128, 1024128, 409600, 409600
|
||||
};
|
||||
|
||||
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[]
|
||||
{
|
||||
510032, 510032, 407232, 407232
|
||||
};
|
||||
|
||||
readonly int[] _clusterSize =
|
||||
public override uint[] _clusterSize => new uint[]
|
||||
{
|
||||
1024, 1024, 512, 512
|
||||
};
|
||||
public override string[] _oemId => null;
|
||||
public override string[] _type => null;
|
||||
|
||||
readonly string[] _volumeName =
|
||||
public override string[] _volumeName => new[]
|
||||
{
|
||||
"Volume label", "Volume label", "Volume label", "Volume label"
|
||||
};
|
||||
|
||||
readonly string[] _volumeSerial =
|
||||
public override string[] _volumeSerial => new[]
|
||||
{
|
||||
"A56D13BB", "A56D0415", "A582F3A0", "A5830B06"
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Old File System (RDB)",
|
||||
_testFiles[i]);
|
||||
|
||||
IFilter filter = new ZZZNoFilter();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new AaruFormat();
|
||||
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
|
||||
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
|
||||
List<Partition> partitions = Core.Partitions.GetAll(image);
|
||||
IFilesystem fs = new AmigaDOSPlugin();
|
||||
int part = -1;
|
||||
|
||||
for(int j = 0; j < partitions.Count; j++)
|
||||
if(partitions[j].Type == "\"DOS\\0\"" ||
|
||||
partitions[j].Type == "\"DOS\\2\"" ||
|
||||
partitions[j].Type == "\"DOS\\4\"")
|
||||
{
|
||||
part = j;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
Assert.AreNotEqual(-1, part, $"Partition not found on {_testFiles[i]}");
|
||||
Assert.AreEqual(true, fs.Identify(image, partitions[part]), _testFiles[i]);
|
||||
fs.GetInformation(image, partitions[part], out _, null);
|
||||
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
|
||||
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
|
||||
Assert.AreEqual("Amiga OFS", 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