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

@@ -26,21 +26,24 @@
// 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 MBR
public class MBR : FilesystemTest
{
readonly string[] _testFiles =
public MBR() : base("FAT32") {}
public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT32 (MBR)");
public override IFilesystem _plugin => new FAT();
public override bool _partitions => true;
public override string[] _testFiles => new[]
{
"drdos_7.03.aif", "drdos_8.00.aif", "msdos_7.10.aif", "macosx_10.11.aif", "win10.aif", "win2000.aif",
"win95osr2.1.aif", "win95osr2.5.aif", "win95osr2.aif", "win98se.aif", "win98.aif", "winme.aif",
@@ -48,32 +51,55 @@ namespace Aaru.Tests.Filesystems.FAT32
"freebsd_8.2.aif", "freedos_1.2.aif", "ecs20_fstester.aif", "linux_2.2_umsdos32_flashdrive.aif",
"linux_4.19_fat32_msdos_flashdrive.aif", "linux_4.19_vfat32_flashdrive.aif"
};
public override MediaType[] _mediaTypes => new[]
{
MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD,
MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD,
MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD,
MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD,
MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD,
MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD
};
readonly ulong[] _sectors =
public override ulong[] _sectors => new ulong[]
{
8388608, 8388608, 8388608, 4194304, 4194304, 8388608, 4194304, 4194304, 4194304, 4194304, 4194304, 4194304,
4194304, 4194304, 262144, 4194304, 4194304, 4194304, 4194304, 8388608, 1024000, 1024000, 1024000, 1024000
};
readonly uint[] _sectorSize =
public override uint[] _sectorSize => new uint[]
{
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512,
512, 512, 512
};
readonly long[] _clusters =
public override string[] _appId => null;
public override bool[] _bootable => new[]
{
true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, true, true,
true, true, true, true, true, true
};
public override long[] _clusters => new long[]
{
1048233, 1048233, 1048233, 524287, 524016, 1048233, 524152, 524152, 524152, 524112, 524112, 524112, 523520,
1048560, 260096, 524160, 524112, 524112, 65514, 1048233, 127744, 127882, 127744, 127744
};
readonly int[] _clusterSize =
public override uint[] _clusterSize => new uint[]
{
4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 2048, 512, 4096, 4096, 4096,
32768, 4096, 4096, 4096, 4096, 4096
};
public override string[] _oemId => new[]
{
"DRDOS7.X", "IBM 7.1", "MSWIN4.1", "BSD 4.4", "MSDOS5.0", "MSDOS5.0", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1",
"MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSDOS5.0", "BeOS ", "mkfs.fat", "MSWIN4.1", "BSD 4.4", "BSD 4.4",
"BSD4.4 ", "FRDOS4.1", "mkfs.fat", "mkdosfs", "mkfs.fat", "mkfs.fat"
};
public override string[] _type => null;
readonly string[] _volumeName =
public override string[] _volumeName => new[]
{
"VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
"VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
@@ -81,43 +107,11 @@ namespace Aaru.Tests.Filesystems.FAT32
"DICSETTER", "DICSETTER", "DICSETTER"
};
readonly string[] _volumeSerial =
public override string[] _volumeSerial => new[]
{
"5955996C", "1BFB1A43", "3B331809", "42D51EF1", "48073346", "EC62E6DE", "2A310DE4", "0C140DFC", "3E310D18",
"0D3D0EED", "0E131162", "3F500F02", "82EB4C04", "00000000", "B488C502", "5CAC9B4E", "41540E0E", "4E600E0F",
"26E20E0F", "3E0C1BE8", "63084BBA", "5CC7908D", "D1290612", "79BCA86E"
};
readonly string[] _oemId =
{
"DRDOS7.X", "IBM 7.1", "MSWIN4.1", "BSD 4.4", "MSDOS5.0", "MSDOS5.0", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1",
"MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSDOS5.0", "BeOS ", "mkfs.fat", "MSWIN4.1", "BSD 4.4", "BSD 4.4",
"BSD4.4 ", "FRDOS4.1", "mkfs.fat", "mkdosfs", "mkfs.fat", "mkfs.fat"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT32 (MBR)", _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();
Assert.AreEqual(true, fs.Identify(image, partitions[0]), _testFiles[i]);
fs.GetInformation(image, partitions[0], 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]);
}
}
}
}