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,94 +26,71 @@
|
||||
// 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.FAT32
|
||||
{
|
||||
[TestFixture]
|
||||
public class GPT
|
||||
public class GPT : FilesystemTest
|
||||
{
|
||||
readonly string[] _testFiles =
|
||||
public GPT() : base("FAT32") {}
|
||||
|
||||
public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT32 (GPT)");
|
||||
public override IFilesystem _plugin => new FAT();
|
||||
public override bool _partitions => true;
|
||||
|
||||
public override string[] _testFiles => new[]
|
||||
{
|
||||
"macosx_10.11.aif"
|
||||
};
|
||||
public override MediaType[] _mediaTypes => new[]
|
||||
{
|
||||
MediaType.GENERIC_HDD
|
||||
};
|
||||
|
||||
readonly ulong[] _sectors =
|
||||
public override ulong[] _sectors => new ulong[]
|
||||
{
|
||||
4194304
|
||||
};
|
||||
|
||||
readonly uint[] _sectorSize =
|
||||
public override uint[] _sectorSize => new uint[]
|
||||
{
|
||||
512
|
||||
};
|
||||
|
||||
readonly long[] _clusters =
|
||||
public override string[] _appId => null;
|
||||
public override bool[] _bootable => new[]
|
||||
{
|
||||
true
|
||||
};
|
||||
|
||||
public override long[] _clusters => new long[]
|
||||
{
|
||||
523775
|
||||
};
|
||||
|
||||
readonly int[] _clusterSize =
|
||||
public override uint[] _clusterSize => new uint[]
|
||||
{
|
||||
4096
|
||||
};
|
||||
|
||||
readonly string[] _volumeName =
|
||||
public override string[] _oemId => new[]
|
||||
{
|
||||
"BSD 4.4"
|
||||
};
|
||||
public override string[] _type => null;
|
||||
public override string[] _volumeName => new[]
|
||||
{
|
||||
"VOLUMELABEL"
|
||||
};
|
||||
|
||||
readonly string[] _volumeSerial =
|
||||
public override string[] _volumeSerial => new[]
|
||||
{
|
||||
"7ABE1F1B"
|
||||
};
|
||||
|
||||
readonly string[] _oemId =
|
||||
{
|
||||
"BSD 4.4"
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT32 (GPT)", _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 FAT();
|
||||
int part = -1;
|
||||
|
||||
for(int j = 0; j < partitions.Count; j++)
|
||||
if(partitions[j].Type == "Microsoft Basic data")
|
||||
{
|
||||
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("FAT32", fs.XmlFsType.Type, _testFiles[i]);
|
||||
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
|
||||
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
|
||||
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user