From 7cacb9bf84d407dba250741409c6f1f4fd428c8d Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Mon, 1 Mar 2021 19:34:30 +0000 Subject: [PATCH] Make filesystem tests inherit a single class. --- Aaru.Tests/Filesystems/ADFS.cs | 68 +- Aaru.Tests/Filesystems/AFFS/MBR+RDB.cs | 75 +- Aaru.Tests/Filesystems/AFFS/MBR.cs | 77 +- Aaru.Tests/Filesystems/AFFS/RDB.cs | 77 +- Aaru.Tests/Filesystems/AFFS/Whole.cs | 69 +- Aaru.Tests/Filesystems/AFFS2/RDB.cs | 75 +- Aaru.Tests/Filesystems/AFS/MBR.cs | 81 +- Aaru.Tests/Filesystems/AFS/Whole.cs | 74 +- Aaru.Tests/Filesystems/AOFS/MBR+RDB.cs | 74 +- Aaru.Tests/Filesystems/AOFS/MBR.cs | 74 +- Aaru.Tests/Filesystems/AOFS/RDB.cs | 76 +- Aaru.Tests/Filesystems/AOFS/Whole.cs | 69 +- Aaru.Tests/Filesystems/Atheos.cs | 72 +- Aaru.Tests/Filesystems/BeFS/APM.cs | 80 +- Aaru.Tests/Filesystems/BeFS/GPT.cs | 74 +- Aaru.Tests/Filesystems/BeFS/MBR.cs | 75 +- Aaru.Tests/Filesystems/BeFS/Whole.cs | 72 +- Aaru.Tests/Filesystems/COHERENT/MBR.cs | 79 +- Aaru.Tests/Filesystems/COHERENT/Whole.cs | 74 +- Aaru.Tests/Filesystems/DTFS/MBR.cs | 76 +- Aaru.Tests/Filesystems/DTFS/Whole.cs | 71 +- Aaru.Tests/Filesystems/EAFS/MBR.cs | 76 +- Aaru.Tests/Filesystems/EAFS/Whole.cs | 72 +- Aaru.Tests/Filesystems/F2FS.cs | 73 +- Aaru.Tests/Filesystems/FAT12/APM.cs | 80 +- Aaru.Tests/Filesystems/FAT12/GPT.cs | 80 +- Aaru.Tests/Filesystems/FAT12/Human.cs | 80 +- Aaru.Tests/Filesystems/FAT12/MBR.cs | 101 +-- Aaru.Tests/Filesystems/FAT12/Whole.cs | 872 +++++++++++++-------- Aaru.Tests/Filesystems/FAT16/APM.cs | 81 +- Aaru.Tests/Filesystems/FAT16/Atari.cs | 83 +- Aaru.Tests/Filesystems/FAT16/GPT.cs | 81 +- Aaru.Tests/Filesystems/FAT16/Human.cs | 87 +- Aaru.Tests/Filesystems/FAT16/MBR.cs | 105 +-- Aaru.Tests/Filesystems/FAT16/RDB.cs | 81 +- Aaru.Tests/Filesystems/FAT16/Whole.cs | 94 +-- Aaru.Tests/Filesystems/FAT32/APM.cs | 84 +- Aaru.Tests/Filesystems/FAT32/GPT.cs | 81 +- Aaru.Tests/Filesystems/FAT32/MBR.cs | 80 +- Aaru.Tests/Filesystems/FATX/Xbox.cs | 59 +- Aaru.Tests/Filesystems/FATX/Xbox360.cs | 62 +- Aaru.Tests/Filesystems/FilesystemTest.cs | 224 ++++++ Aaru.Tests/Filesystems/HAMMER.cs | 71 +- Aaru.Tests/Filesystems/HFS+/APM.cs | 90 +-- Aaru.Tests/Filesystems/HFS+/GPT.cs | 83 +- Aaru.Tests/Filesystems/HFS+/MBR.cs | 87 +- Aaru.Tests/Filesystems/HFS/APM.cs | 83 +- Aaru.Tests/Filesystems/HFS/MBR.cs | 73 +- Aaru.Tests/Filesystems/HFS/Optical.cs | 74 +- Aaru.Tests/Filesystems/HFS/RDB.cs | 72 +- Aaru.Tests/Filesystems/HFS/Whole.cs | 67 +- Aaru.Tests/Filesystems/HFSX/APM.cs | 84 +- Aaru.Tests/Filesystems/HFSX/GPT.cs | 87 +- Aaru.Tests/Filesystems/HFSX/MBR.cs | 85 +- Aaru.Tests/Filesystems/HPFS.cs | 76 +- Aaru.Tests/Filesystems/HPOFS.cs | 77 +- Aaru.Tests/Filesystems/HTFS/MBR.cs | 80 +- Aaru.Tests/Filesystems/HTFS/Whole.cs | 73 +- Aaru.Tests/Filesystems/ISO9660.cs | 376 +++++---- Aaru.Tests/Filesystems/JFS2.cs | 74 +- Aaru.Tests/Filesystems/LisaFS.cs | 76 +- Aaru.Tests/Filesystems/Locus.cs | 74 +- Aaru.Tests/Filesystems/MFS.cs | 69 +- Aaru.Tests/Filesystems/MINIX/V1/MBR.cs | 78 +- Aaru.Tests/Filesystems/MINIX/V1/Whole.cs | 70 +- Aaru.Tests/Filesystems/MINIX/V2/MBR.cs | 77 +- Aaru.Tests/Filesystems/MINIX/V2/Whole.cs | 69 +- Aaru.Tests/Filesystems/MINIX/V3/MBR.cs | 77 +- Aaru.Tests/Filesystems/MINIX/V3/Whole.cs | 71 +- Aaru.Tests/Filesystems/NILFS2.cs | 75 +- Aaru.Tests/Filesystems/NTFS/GPT.cs | 84 +- Aaru.Tests/Filesystems/NTFS/MBR.cs | 91 +-- Aaru.Tests/Filesystems/PFS3.cs | 81 +- Aaru.Tests/Filesystems/ProDOS/APM.cs | 77 +- Aaru.Tests/Filesystems/QNX4/MBR.cs | 75 +- Aaru.Tests/Filesystems/QNX4/Whole.cs | 69 +- Aaru.Tests/Filesystems/ReFS.cs | 81 +- Aaru.Tests/Filesystems/Reiser3.cs | 78 +- Aaru.Tests/Filesystems/Reiser4.cs | 76 +- Aaru.Tests/Filesystems/SFS/MBR+RDB.cs | 75 +- Aaru.Tests/Filesystems/SFS/MBR.cs | 75 +- Aaru.Tests/Filesystems/SFS/RDB.cs | 77 +- Aaru.Tests/Filesystems/SysV/MBR.cs | 81 +- Aaru.Tests/Filesystems/SysV/RDB.cs | 80 +- Aaru.Tests/Filesystems/SysV/Whole.cs | 75 +- Aaru.Tests/Filesystems/UDF/1.02/Whole.cs | 107 +-- Aaru.Tests/Filesystems/UDF/1.50/Optical.cs | 87 +- Aaru.Tests/Filesystems/UDF/1.50/Whole.cs | 108 +-- Aaru.Tests/Filesystems/UDF/2.00/Optical.cs | 87 +- Aaru.Tests/Filesystems/UDF/2.00/Whole.cs | 108 +-- Aaru.Tests/Filesystems/UDF/2.01/Optical.cs | 90 +-- Aaru.Tests/Filesystems/UDF/2.01/Whole.cs | 109 +-- Aaru.Tests/Filesystems/UDF/2.50/Whole.cs | 108 +-- Aaru.Tests/Filesystems/UDF/2.60/Whole.cs | 108 +-- Aaru.Tests/Filesystems/UFS/APM.cs | 88 +-- Aaru.Tests/Filesystems/UFS/MBR.cs | 105 +-- Aaru.Tests/Filesystems/UFS/NeXT Floppy.cs | 89 +-- Aaru.Tests/Filesystems/UFS/NeXT.cs | 88 +-- Aaru.Tests/Filesystems/UFS/RDB.cs | 86 +- Aaru.Tests/Filesystems/UFS/Sun i86.cs | 86 +- Aaru.Tests/Filesystems/UFS/Whole.cs | 78 +- Aaru.Tests/Filesystems/UNIXBFS/MBR.cs | 73 +- Aaru.Tests/Filesystems/UNIXBFS/RDB.cs | 80 +- Aaru.Tests/Filesystems/UNIXBFS/Whole.cs | 67 +- Aaru.Tests/Filesystems/XENIX/MBR.cs | 81 +- Aaru.Tests/Filesystems/XENIX/Whole.cs | 74 +- Aaru.Tests/Filesystems/XFS.cs | 73 +- Aaru.Tests/Filesystems/Xia.cs | 73 +- Aaru.Tests/Filesystems/ZFS.cs | 72 +- Aaru.Tests/Filesystems/btrfs.cs | 74 +- Aaru.Tests/Filesystems/exFAT/APM.cs | 71 +- Aaru.Tests/Filesystems/exFAT/GPT.cs | 71 +- Aaru.Tests/Filesystems/exFAT/MBR.cs | 73 +- Aaru.Tests/Filesystems/ext2.cs | 83 +- 114 files changed, 4247 insertions(+), 6071 deletions(-) create mode 100644 Aaru.Tests/Filesystems/FilesystemTest.cs diff --git a/Aaru.Tests/Filesystems/ADFS.cs b/Aaru.Tests/Filesystems/ADFS.cs index 6bf4ae0ab..07316ca52 100644 --- a/Aaru.Tests/Filesystems/ADFS.cs +++ b/Aaru.Tests/Filesystems/ADFS.cs @@ -29,97 +29,71 @@ 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 { [TestFixture] - public class Adfs + public class Adfs : FilesystemTest { - readonly string[] _testFiles = + public Adfs() : base("Acorn Advanced Disc Filing System") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", + "Acorn Advanced Disc Filing System"); + + public override IFilesystem _plugin => new AcornADFS(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] { "adfs_d.adf.lz", "adfs_e.adf.lz", "adfs_f.adf.lz", "adfs_e+.adf.lz", "adfs_f+.adf.lz", "adfs_s.adf.lz", "adfs_m.adf.lz", "adfs_l.adf.lz", "hdd_old.hdf.lz", "hdd_new.hdf.lz" }; - readonly MediaType[] _mediaTypes = + public override MediaType[] _mediaTypes => new[] { MediaType.ACORN_35_DS_DD, MediaType.ACORN_35_DS_DD, MediaType.ACORN_35_DS_HD, MediaType.ACORN_35_DS_DD, MediaType.ACORN_35_DS_HD, MediaType.ACORN_525_SS_DD_40, MediaType.ACORN_525_SS_DD_80, MediaType.ACORN_525_DS_DD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 800, 800, 1600, 800, 1600, 640, 1280, 2560, 78336, 78336 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 1024, 1024, 1024, 1024, 1024, 256, 256, 256, 256, 256 }; - readonly bool[] _bootable = + public override string[] _appId => null; + public override bool[] _bootable => new[] { false, false, false, false, false, false, false, false, false, false }; - readonly long[] _clusters = + public override long[] _clusters => new long[] { 800, 800, 1600, 800, 1600, 640, 1280, 2560, 78336, 78336 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly uint[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 1024, 1024, 1024, 1024, 1024, 256, 256, 256, 256, 256 }; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "ADFSD", "ADFSE ", null, "ADFSE+ ", null, "$", "$", "$", "VolLablOld", null }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "3E48", "E13A", null, "1142", null, "F20D", "D6CA", "0CA6", "080E", null }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", - "Acorn Advanced Disc Filing 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 AcornADFS(); - - 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(_bootable[i], fs.XmlFsType.Bootable, _testFiles[i]); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); - Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); - Assert.AreEqual("Acorn Advanced Disc Filing System", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/AFFS/MBR+RDB.cs b/Aaru.Tests/Filesystems/AFFS/MBR+RDB.cs index 873154172..ba8491c10 100644 --- a/Aaru.Tests/Filesystems/AFFS/MBR+RDB.cs +++ b/Aaru.Tests/Filesystems/AFFS/MBR+RDB.cs @@ -26,91 +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.AFFS { [TestFixture] - public class MBR_RDB + public class MBR_RDB : FilesystemTest { - readonly string[] _testFiles = + public MBR_RDB() : base("Amiga FFS") {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Fast File System (MBR+RDB)"); + public override IFilesystem _plugin => new AmigaDOSPlugin(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "aros.aif", "aros_intl.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD, MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 409600, 409600 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512 }; + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false + }; - readonly long[] _clusters = + public override long[] _clusters => new long[] { 406224, 406224 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 512, 512 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "Volume label", "Volume label" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "A58348CE", "A5833CD0" }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", - "Amiga Fast File System (MBR+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 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\\1\"" || - partitions[j].Type == "\"DOS\\3\"") - { - 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 FFS", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/AFFS/MBR.cs b/Aaru.Tests/Filesystems/AFFS/MBR.cs index 532d5b3e5..6b906915b 100644 --- a/Aaru.Tests/Filesystems/AFFS/MBR.cs +++ b/Aaru.Tests/Filesystems/AFFS/MBR.cs @@ -26,91 +26,70 @@ // 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.AFFS { [TestFixture] - public class MBR + public class MBR : FilesystemTest { - readonly string[] _testFiles = + public MBR() : base("Amiga FFS") {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Fast File System (MBR)"); + public override IFilesystem _plugin => new AmigaDOSPlugin(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "aros.aif", "aros_intl.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD, MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 409600, 409600 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512 }; + public override string[] _appId => null; - readonly long[] _clusters = + public override bool[] _bootable => new[] + { + false, false + }; + + public override long[] _clusters => new long[] { 408240, 408240 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 512, 512 }; - readonly string[] _volumeName = + public override string[] _oemId => null; + public override string[] _type => null; + + public override string[] _volumeName => new[] { "Volume label", "Volume label" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "A582DCA4", "A582BC91" }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Fast File System (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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new AmigaDOSPlugin(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "0x2D" || - partitions[j].Type == "0x2E") - { - 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 FFS", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/AFFS/RDB.cs b/Aaru.Tests/Filesystems/AFFS/RDB.cs index 8bfc539fc..9a7c8f8ba 100644 --- a/Aaru.Tests/Filesystems/AFFS/RDB.cs +++ b/Aaru.Tests/Filesystems/AFFS/RDB.cs @@ -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.AFFS { [TestFixture] - public class RDB + public class RDB : FilesystemTest { - readonly string[] _testFiles = + public RDB() : base("Amiga FFS") {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Fast 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", "amigaos_4.0.aif", "amigaos_4.0_intl.aif", "amigaos_4.0_cache.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 + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 1024128, 1024128, 409600, 409600, 1024128, 1024128, 1024128 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512, 512, 512, 512, 512, 512 }; + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false, false, false, false, false, false + }; - readonly long[] _clusters = + public override long[] _clusters => new long[] { 510032, 510032, 407232, 407232, 511040, 511040, 511040 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 1024, 1024, 512, 512, 1024, 1024, 1024 }; + 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", "Volume label", "Volume label", "Volume label" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "A56D0F5C", "A56D049C", "A58307A9", "A58304BE", "A56CC7EE", "A56CDDC4", "A56CC133" }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Fast 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 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\\1\"" || - partitions[j].Type == "\"DOS\\3\"" || - partitions[j].Type == "\"DOS\\5\"") - { - 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 FFS", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/AFFS/Whole.cs b/Aaru.Tests/Filesystems/AFFS/Whole.cs index d7b6f84cc..c16d17838 100644 --- a/Aaru.Tests/Filesystems/AFFS/Whole.cs +++ b/Aaru.Tests/Filesystems/AFFS/Whole.cs @@ -29,88 +29,67 @@ 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.AFFS { [TestFixture] - public class Whole + public class Whole : FilesystemTest { - readonly string[] _testFiles = + public Whole() : base("Amiga FFS") {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Fast File System"); + + public override IFilesystem _plugin => new AmigaDOSPlugin(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] { "amigaos_3.9.adf.lz", "amigaos_3.9_intl.adf.lz" }; - readonly MediaType[] _mediaTypes = + public override MediaType[] _mediaTypes => new[] { MediaType.CBM_AMIGA_35_DD, MediaType.CBM_AMIGA_35_DD }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 1760, 1760 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512 }; + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false + }; - readonly long[] _clusters = + public override long[] _clusters => new long[] { 1760, 1760 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 512, 512 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "Volume label", "Volume label" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "A5D9FAE2", "A5DA0CC9" }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Fast 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 AmigaDOSPlugin(); - - 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("Amiga FFS", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/AFFS2/RDB.cs b/Aaru.Tests/Filesystems/AFFS2/RDB.cs index e78d08644..57335bde6 100644 --- a/Aaru.Tests/Filesystems/AFFS2/RDB.cs +++ b/Aaru.Tests/Filesystems/AFFS2/RDB.cs @@ -26,90 +26,69 @@ // 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.AFFS2 { [TestFixture] - public class RDB + public class RDB : FilesystemTest { - readonly string[] _testFiles = + public RDB() : base("Amiga FFS2") {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Fast File System 2 (RDB)"); + + public override IFilesystem _plugin => new AmigaDOSPlugin(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "amigaos_4.0.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 1024128 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512 }; + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false + }; - readonly long[] _clusters = + public override long[] _clusters => new long[] { 511040 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 1024 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "Volume label" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "611D85E5" }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Fast File System 2 (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 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\\7\"") - { - 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 FFS2", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/AFS/MBR.cs b/Aaru.Tests/Filesystems/AFS/MBR.cs index 10e9d624b..311008bea 100644 --- a/Aaru.Tests/Filesystems/AFS/MBR.cs +++ b/Aaru.Tests/Filesystems/AFS/MBR.cs @@ -26,95 +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.AFS { [TestFixture] - public class MBR + public class MBR : FilesystemTest { - readonly string[] _testFiles = + public MBR() : base("Acer Fast Filesystem") {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Acer File System (MBR)"); + public override IFilesystem _plugin => new SysVfs(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "scoopenserver_5.0.7hw.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 1024000 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512 }; + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false + }; - readonly long[] _clusters = + public override long[] _clusters => new long[] { 510048 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 1024 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { - "Volume label" + "d1150" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new string[] { null, null }; - - readonly string[] _type = - { - "Acer Fast Filesystem" - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Acer File System (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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new SysVfs(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "XENIX") - { - 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(_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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/AFS/Whole.cs b/Aaru.Tests/Filesystems/AFS/Whole.cs index 3f77b1db9..1f418b35b 100644 --- a/Aaru.Tests/Filesystems/AFS/Whole.cs +++ b/Aaru.Tests/Filesystems/AFS/Whole.cs @@ -29,96 +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.AFS { [TestFixture] - public class Whole + public class Whole : FilesystemTest { - readonly string[] _testFiles = + public Whole() : base("Acer Fast Filesystem") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Acer 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 }; + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false, false, false, false + }; - readonly long[] _clusters = + 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 = - { - "Acer Fast Filesystem", "Acer Fast Filesystem", "Acer Fast Filesystem", "Acer Fast Filesystem", - "Acer Fast Filesystem" - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Acer 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/AOFS/MBR+RDB.cs b/Aaru.Tests/Filesystems/AOFS/MBR+RDB.cs index 4d11d8b3b..863790703 100644 --- a/Aaru.Tests/Filesystems/AOFS/MBR+RDB.cs +++ b/Aaru.Tests/Filesystems/AOFS/MBR+RDB.cs @@ -26,90 +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 MBR_RDB + public class MBR_RDB : FilesystemTest { - readonly string[] _testFiles = + public MBR_RDB() : base("Amiga OFS") {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Old File System (MBR+RDB)"); + public override IFilesystem _plugin => new AmigaDOSPlugin(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "aros.aif", "aros_intl.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD, MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 409600, 409600 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512 }; + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false + }; - readonly long[] _clusters = + public override long[] _clusters => new long[] { 406224, 406224 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 512, 512 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "Volume label", "Volume label" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "A5833C5B", "A5833085" }; - - [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 (MBR+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 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\"") - { - 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/AOFS/MBR.cs b/Aaru.Tests/Filesystems/AOFS/MBR.cs index 61a0a5c2a..1e33645eb 100644 --- a/Aaru.Tests/Filesystems/AOFS/MBR.cs +++ b/Aaru.Tests/Filesystems/AOFS/MBR.cs @@ -26,90 +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 MBR + public class MBR : FilesystemTest { - readonly string[] _testFiles = + public MBR() : base("Amiga OFS") {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Old File System (MBR)"); + public override IFilesystem _plugin => new AmigaDOSPlugin(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "aros.aif", "aros_intl.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD, MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 409600, 409600 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512 }; + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false + }; - readonly long[] _clusters = + public override long[] _clusters => new long[] { 408240, 408240 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 512, 512 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "Volume label", "Volume label" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "A582C90C", "A582CE0D" }; - - [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 (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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new AmigaDOSPlugin(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "0x2C") - { - 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/AOFS/RDB.cs b/Aaru.Tests/Filesystems/AOFS/RDB.cs index b684d5cf0..0a3091a2c 100644 --- a/Aaru.Tests/Filesystems/AOFS/RDB.cs +++ b/Aaru.Tests/Filesystems/AOFS/RDB.cs @@ -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 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/AOFS/Whole.cs b/Aaru.Tests/Filesystems/AOFS/Whole.cs index f90c271f4..da56478c9 100644 --- a/Aaru.Tests/Filesystems/AOFS/Whole.cs +++ b/Aaru.Tests/Filesystems/AOFS/Whole.cs @@ -29,88 +29,67 @@ 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 Whole + public class Whole : FilesystemTest { - readonly string[] _testFiles = + public Whole() : base("Amiga OFS") {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Old File System"); + + public override IFilesystem _plugin => new AmigaDOSPlugin(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] { "amigaos_3.9.adf.lz", "amigaos_3.9_intl.adf.lz" }; - readonly MediaType[] _mediaTypes = + public override MediaType[] _mediaTypes => new[] { MediaType.CBM_AMIGA_35_DD, MediaType.CBM_AMIGA_35_DD }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 1760, 1760 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512 }; + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false + }; - readonly long[] _clusters = + public override long[] _clusters => new long[] { 1760, 1760 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 512, 512 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "Volume label", "Volume label" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "A5D9FE71", "A5D9F14F" }; - - [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", - _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 AmigaDOSPlugin(); - - 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("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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/Atheos.cs b/Aaru.Tests/Filesystems/Atheos.cs index d07431ddb..b41c37f60 100644 --- a/Aaru.Tests/Filesystems/Atheos.cs +++ b/Aaru.Tests/Filesystems/Atheos.cs @@ -26,88 +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 { [TestFixture] - public class Atheos + public class Atheos : FilesystemTest { - readonly string[] _testFiles = + public Atheos() : base("AtheOS filesystem") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "AtheOS (MBR)"); + public override IFilesystem _plugin => new AtheOS(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "syllable_0.6.7.aif" }; - readonly ulong[] _sectors = + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD + }; + 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[] + { + false + }; + + public override long[] _clusters => new long[] { 2097120 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 1024 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "Volume label" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new string[] { null }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "AtheOS (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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new AtheOS(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "0x2A") - { - 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("AtheOS filesystem", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/BeFS/APM.cs b/Aaru.Tests/Filesystems/BeFS/APM.cs index 98646330e..407b55f0d 100644 --- a/Aaru.Tests/Filesystems/BeFS/APM.cs +++ b/Aaru.Tests/Filesystems/BeFS/APM.cs @@ -26,95 +26,67 @@ // Copyright © 2011-2021 Natalia Portillo // ****************************************************************************/ -using System.Collections.Generic; using System.IO; using Aaru.CommonTypes; using Aaru.CommonTypes.Interfaces; -using Aaru.DiscImages; -using Aaru.Filters; using NUnit.Framework; namespace Aaru.Tests.Filesystems.BeFS { [TestFixture] - public class APM + public class APM : FilesystemTest { - readonly string[] _testFiles = + public APM() : base("BeFS") {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Be File System (APM)"); + public override IFilesystem _plugin => new Aaru.Filesystems.BeFS(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "beos_r3.1.aif", "beos_r4.5.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD, MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 1572864, 1572864 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512 }; + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false + }; - readonly long[] _clusters = + public override long[] _clusters => new long[] { 786336, 786336 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 1024, 1024 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "Volume label", "Volume label" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new string[] { null, null }; - - readonly string[] _oemId = - { - null, null - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Be File System (APM)", - _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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new Aaru.Filesystems.BeFS(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "Be_BFS") - { - 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("BeFS", 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/BeFS/GPT.cs b/Aaru.Tests/Filesystems/BeFS/GPT.cs index 67415016b..56a3a9ce0 100644 --- a/Aaru.Tests/Filesystems/BeFS/GPT.cs +++ b/Aaru.Tests/Filesystems/BeFS/GPT.cs @@ -26,89 +26,67 @@ // Copyright © 2011-2021 Natalia Portillo // ****************************************************************************/ -using System.Collections.Generic; using System.IO; using Aaru.CommonTypes; using Aaru.CommonTypes.Interfaces; -using Aaru.DiscImages; -using Aaru.Filters; using NUnit.Framework; namespace Aaru.Tests.Filesystems.BeFS { [TestFixture] - public class GPT + public class GPT : FilesystemTest { - readonly string[] _testFiles = + public GPT() : base("BeFS") {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Be File System (GPT)"); + public override IFilesystem _plugin => new Aaru.Filesystems.BeFS(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "haiku_hrev51259.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 8388608 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512 }; + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false + }; - readonly long[] _clusters = + public override long[] _clusters => new long[] { 2096640 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 2048 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "Volume label" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new string[] { null, null }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Be File System (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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new Aaru.Filesystems.BeFS(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "Haiku BFS") - { - 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("BeFS", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/BeFS/MBR.cs b/Aaru.Tests/Filesystems/BeFS/MBR.cs index 365fda943..cb7a1a014 100644 --- a/Aaru.Tests/Filesystems/BeFS/MBR.cs +++ b/Aaru.Tests/Filesystems/BeFS/MBR.cs @@ -26,89 +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.Filters; using NUnit.Framework; namespace Aaru.Tests.Filesystems.BeFS { [TestFixture] - public class BeFsMbr + public class MBR : FilesystemTest { - readonly string[] _testFiles = + public MBR() : base("BeFS") {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Be File System (MBR)"); + public override IFilesystem _plugin => new Aaru.Filesystems.BeFS(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "beos_r3.1.aif", "beos_r4.5.aif", "haiku_hrev51259.aif", "syllable_0.6.7.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[] { 1572864, 1572864, 8388608, 2097152 }; - 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[] { 786400, 785232, 2096640, 524272 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 1024, 1024, 2048, 2048 }; - readonly string[] _volumeName = + public override string[] _oemId => null; + public override string[] _type => null; + + public override string[] _volumeName => new[] { "Volume label", "Volume label", "Volume label", "Volume label" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new string[] { null, null, null, null }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Be File System (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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new Aaru.Filesystems.BeFS(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "0xEB") - { - 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("BeFS", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/BeFS/Whole.cs b/Aaru.Tests/Filesystems/BeFS/Whole.cs index c890528ee..2df803c22 100644 --- a/Aaru.Tests/Filesystems/BeFS/Whole.cs +++ b/Aaru.Tests/Filesystems/BeFS/Whole.cs @@ -29,91 +29,65 @@ using System.IO; using Aaru.CommonTypes; using Aaru.CommonTypes.Interfaces; -using Aaru.DiscImages; -using Aaru.Filters; using NUnit.Framework; namespace Aaru.Tests.Filesystems.BeFS { [TestFixture] - public class Whole + public class Whole : FilesystemTest { - readonly string[] _testFiles = + public Whole() : base("BeFS") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Be File System"); + + public override IFilesystem _plugin => new Aaru.Filesystems.BeFS(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] { "beos_r3.1.img.lz", "beos_r4.5.img.lz" }; - readonly MediaType[] _mediaTypes = + public override MediaType[] _mediaTypes => new[] { MediaType.DOS_35_HD, MediaType.DOS_35_HD }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 2880, 2880 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512 }; + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false + }; - readonly long[] _clusters = + public override long[] _clusters => new long[] { 1440, 1440 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 1024, 1024 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "Volume label", "Volume label" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new string[] { null, null }; - - readonly string[] _oemId = - { - null, null - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Be 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 Aaru.Filesystems.BeFS(); - - 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("BeFS", 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/COHERENT/MBR.cs b/Aaru.Tests/Filesystems/COHERENT/MBR.cs index 6d5d66ef0..bf8c541fe 100644 --- a/Aaru.Tests/Filesystems/COHERENT/MBR.cs +++ b/Aaru.Tests/Filesystems/COHERENT/MBR.cs @@ -26,95 +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.COHERENT { [TestFixture] - public class MBR + public class MBR : FilesystemTest { - readonly string[] _testFiles = + public MBR() : base("Coherent fs") {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "COHERENT filesystem (MBR)"); + public override IFilesystem _plugin => new SysVfs(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "coherentunix_4.2.10.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 1024000 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512 }; + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false + }; - readonly long[] _clusters = + public override long[] _clusters => new long[] { 510048 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 1024 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "Volume label" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new string[] { null }; - - readonly string[] _type = - { - "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 (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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new SysVfs(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "0x09") - { - 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(_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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/COHERENT/Whole.cs b/Aaru.Tests/Filesystems/COHERENT/Whole.cs index 42afb3522..730635241 100644 --- a/Aaru.Tests/Filesystems/COHERENT/Whole.cs +++ b/Aaru.Tests/Filesystems/COHERENT/Whole.cs @@ -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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/DTFS/MBR.cs b/Aaru.Tests/Filesystems/DTFS/MBR.cs index ffb18eece..16417197e 100644 --- a/Aaru.Tests/Filesystems/DTFS/MBR.cs +++ b/Aaru.Tests/Filesystems/DTFS/MBR.cs @@ -26,93 +26,67 @@ // 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.DTFS { [TestFixture] - public class MBR + public class MBR : FilesystemTest { - readonly string[] _testFiles = + public MBR() : base("DTFS") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "DTFS (MBR)"); + public override IFilesystem _plugin => new SysVfs(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "scoopenserver_5.0.7hw.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 1024000 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512 }; + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false + }; - readonly long[] _clusters = + public override long[] _clusters => new long[] { 510048 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 1024 }; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "Volume label" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new string[] { null }; - - readonly string[] _type = - { - "DTFS" - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "DTFS (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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new SysVfs(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "XENIX") - { - 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(_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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/DTFS/Whole.cs b/Aaru.Tests/Filesystems/DTFS/Whole.cs index 01e97cb9a..750a83757 100644 --- a/Aaru.Tests/Filesystems/DTFS/Whole.cs +++ b/Aaru.Tests/Filesystems/DTFS/Whole.cs @@ -29,93 +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.DTFS { [TestFixture] - public class Whole + public class Whole : FilesystemTest { - readonly string[] _testFiles = + public Whole() : base("DTFS") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "DTFS"); + + 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 }; + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false, false, false, false + }; - readonly long[] _clusters = + 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 = - { - "DTFS", "DTFS", "DTFS", "DTFS", "DTFS" - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "DTFS", _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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/EAFS/MBR.cs b/Aaru.Tests/Filesystems/EAFS/MBR.cs index 75ea549c8..ab1eca374 100644 --- a/Aaru.Tests/Filesystems/EAFS/MBR.cs +++ b/Aaru.Tests/Filesystems/EAFS/MBR.cs @@ -26,93 +26,67 @@ // 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.EAFS { [TestFixture] - public class MBR + public class MBR : FilesystemTest { - readonly string[] _testFiles = + public MBR() : base("Extended Acer Fast Filesystem") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "EAFS (MBR)"); + public override IFilesystem _plugin => new SysVfs(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "scoopenserver_5.0.7hw.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 1024000 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512 }; + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false + }; - readonly long[] _clusters = + public override long[] _clusters => new long[] { 510048 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 1024 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "Volume label" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new string[] { null }; - - readonly string[] _type = - { - "Extended Acer Fast Filesystem" - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "EAFS (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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new SysVfs(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "XENIX") - { - 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(_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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/EAFS/Whole.cs b/Aaru.Tests/Filesystems/EAFS/Whole.cs index e8bc8d086..fe536b8c1 100644 --- a/Aaru.Tests/Filesystems/EAFS/Whole.cs +++ b/Aaru.Tests/Filesystems/EAFS/Whole.cs @@ -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.EAFS { [TestFixture] - public class Whole + public class Whole : FilesystemTest { - readonly string[] _testFiles = + public Whole() : base("Extended Acer Fast Filesystem") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "EAFS"); + + 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 }; + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false, false, false, false + }; - readonly long[] _clusters = + 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 = - { - "Extended Acer Fast Filesystem", "Extended Acer Fast Filesystem", "Extended Acer Fast Filesystem", - "Extended Acer Fast Filesystem", "Extended Acer Fast Filesystem" - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "EAFS", _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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/F2FS.cs b/Aaru.Tests/Filesystems/F2FS.cs index 1be303b3c..d5ad3b8e1 100644 --- a/Aaru.Tests/Filesystems/F2FS.cs +++ b/Aaru.Tests/Filesystems/F2FS.cs @@ -26,90 +26,67 @@ // 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 Aaru.Partitions; using NUnit.Framework; namespace Aaru.Tests.Filesystems { [TestFixture] - public class F2Fs + public class F2Fs : FilesystemTest { - readonly string[] _testFiles = + public F2Fs() : base("F2FS filesystem") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "F2FS"); + public override IFilesystem _plugin => new F2FS(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "linux.aif", "linux_4.19_f2fs_flashdrive.aif" }; - readonly ulong[] _sectors = + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD, MediaType.GENERIC_HDD + }; + public override ulong[] _sectors => new ulong[] { 262144, 2097152 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512 }; + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false + }; - readonly long[] _clusters = + public override long[] _clusters => new long[] { 32512, 261888 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 4096, 4096 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "VolumeLabel", "DicSetter" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "81bd3a4e-de0c-484c-becc-aaa479b2070a", "422bd2a8-68ab-6f45-9a04-9c264d07dd6e" }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "F2FS", _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]); - IPartition parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions, 0), _testFiles[i]); - IFilesystem fs = new F2FS(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "0x83") - { - 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("F2FS filesystem", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/FAT12/APM.cs b/Aaru.Tests/Filesystems/FAT12/APM.cs index da825d229..c7506ac75 100644 --- a/Aaru.Tests/Filesystems/FAT12/APM.cs +++ b/Aaru.Tests/Filesystems/FAT12/APM.cs @@ -26,94 +26,70 @@ // 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.FAT12 { [TestFixture] - public class APM + public class APM : FilesystemTest { - readonly string[] _testFiles = + public APM() : base("FAT12") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT12 (APM)"); + 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[] { 16384 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512 }; + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + true + }; - readonly long[] _clusters = + public override long[] _clusters => new long[] { 4076 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 2048 }; + public override string[] _oemId => new[] + { + "BSD 4.4" + }; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "VOLUMELABEL" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "32181F09" }; - - 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", "FAT12 (APM)", _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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new FAT(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "DOS_FAT_12") - { - 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("FAT12", 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/FAT12/GPT.cs b/Aaru.Tests/Filesystems/FAT12/GPT.cs index 88dbecb80..141231d89 100644 --- a/Aaru.Tests/Filesystems/FAT12/GPT.cs +++ b/Aaru.Tests/Filesystems/FAT12/GPT.cs @@ -26,94 +26,70 @@ // 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.FAT12 { [TestFixture] - public class GPT + public class GPT : FilesystemTest { - readonly string[] _testFiles = + public GPT() : base("FAT12") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT12 (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[] { 16384 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512 }; + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + true + }; - readonly long[] _clusters = + public override long[] _clusters => new long[] { 4076 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 2048 }; + public override string[] _oemId => new[] + { + "BSD 4.4" + }; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "VOLUMELABEL" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "66901F1B" }; - - 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", "FAT12 (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 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("FAT12", 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/FAT12/Human.cs b/Aaru.Tests/Filesystems/FAT12/Human.cs index 059ddc6bf..284163971 100644 --- a/Aaru.Tests/Filesystems/FAT12/Human.cs +++ b/Aaru.Tests/Filesystems/FAT12/Human.cs @@ -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.FAT12 { [TestFixture] - public class Human + public class Human : FilesystemTest { - readonly string[] _testFiles = + public Human() : base("FAT12") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT12 (Human68K)"); + public override IFilesystem _plugin => new FAT(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] { "diska.aif", "diskb.aif" }; - readonly MediaType[] _mediaTypes = + public override MediaType[] _mediaTypes => new[] { MediaType.SHARP_525, MediaType.SHARP_525 }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 1232, 1232 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 1024, 1024 }; + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + true, true + }; - readonly long[] _clusters = + public override long[] _clusters => new long[] { 1232, 1232 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 1024, 1024 }; - - readonly string[] _volumeName = - { - null, null - }; - - readonly string[] _volumeSerial = - { - null, null - }; - - readonly string[] _oemId = + public override string[] _oemId => new[] { "Hudson soft 2.00", "Hudson soft 2.00" }; + public override string[] _type => null; - [Test] - public void Test() + public override string[] _volumeName => new string[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT12 (Human68K)", - _testFiles[i]); + null, null + }; - IFilter filter = new ZZZNoFilter(); - filter.Open(location); - IMediaImage image = new AaruFormat(); - 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 FAT(); - - 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("FAT12", 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]); - } - } + public override string[] _volumeSerial => new string[] + { + null, null + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/FAT12/MBR.cs b/Aaru.Tests/Filesystems/FAT12/MBR.cs index ea4968c54..5022d8dc5 100644 --- a/Aaru.Tests/Filesystems/FAT12/MBR.cs +++ b/Aaru.Tests/Filesystems/FAT12/MBR.cs @@ -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.FAT12 { [TestFixture] - public class MBR + public class MBR : FilesystemTest { - readonly string[] _testFiles = + public MBR() : base("FAT12") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT12 (MBR)"); + public override IFilesystem _plugin => new FAT(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "compaqmsdos331.aif", "drdos_3.40.aif", "drdos_3.41.aif", "drdos_5.00.aif", "drdos_6.00.aif", "drdos_7.02.aif", "drdos_7.03.aif", "drdos_8.00.aif", "msdos331.aif", "msdos401.aif", "msdos500.aif", @@ -54,8 +57,27 @@ namespace Aaru.Tests.Filesystems.FAT12 "win98se.aif", "winme.aif", "winnt_3.10.aif", "winnt_3.50.aif", "winnt_3.51.aif", "winnt_4.00.aif", "winvista.aif", "beos_r4.5.aif", "linux.aif", "freebsd_6.1.aif", "freebsd_7.0.aif", "freebsd_8.2.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, + 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, + 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[] { 8192, 30720, 28672, 28672, 28672, 28672, 28672, 28672, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 16384, 28672, 28672, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 8192, @@ -64,14 +86,22 @@ namespace Aaru.Tests.Filesystems.FAT12 16384, 16384 }; - 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, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512 }; + 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, true, true, true, + true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true, true, true + }; - readonly long[] _clusters = + public override long[] _clusters => new long[] { 1000, 3654, 3520, 3520, 3520, 3520, 3520, 3520, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 2008, 3520, 3520, 4024, 4031, 4031, 4024, 4024, 4024, 4024, 4024, 4024, 4024, 4024, 1000, 1000, 2008, 2008, 2008, 2008, @@ -79,7 +109,7 @@ namespace Aaru.Tests.Filesystems.FAT12 2044, 2044, 4016, 3072, 2040, 3584, 2044, 2044, 2044 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, @@ -87,7 +117,20 @@ namespace Aaru.Tests.Filesystems.FAT12 4096, 4096, 2048, 2048, 4096, 2048, 4096, 4096, 4096 }; - readonly string[] _volumeName = + public override string[] _oemId => new[] + { + "IBM 3.3", "IBM 3.2", "IBM 3.2", "IBM 3.3", "IBM 3.3", "IBM 3.3", "DRDOS 7", "IBM 5.0", "IBM 3.3", + "MSDOS4.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSWIN4.1", "IBM 3.3", + "IBM 3.3", "IBM 7.0", "IBM 2.0", "IBM 2.0", "IBM 3.0", "IBM 3.1", "IBM 3.3", "IBM 4.0", "IBM 5.0", + "IBM 5.0", "IBM 6.0", "IBM 6.0", "T V3.30 ", "T V4.00 ", "IBM 10.2", "IBM 10.2", "IBM 3.2", "IBM 10.2", + "IBM 10.2", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 4.50", "BSD 4.4", "MSDOS5.0", + "MSDOS5.0", "MSWIN4.0", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSDOS5.0", + "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "BeOS ", "mkfs.fat", "BSD 4.4", "BSD 4.4", "BSD4.4 " + }; + + public override string[] _type => null; + + public override string[] _volumeName => new[] { null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", @@ -100,7 +143,7 @@ namespace Aaru.Tests.Filesystems.FAT12 "VolumeLabel", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { null, null, null, null, null, null, null, "1BFB1273", null, "407D1907", "345D18FB", "332518F4", "395718E9", "076718EF", "1371181B", "23281816", "2F781809", null, null, "294F100F", null, null, null, null, null, @@ -110,41 +153,5 @@ namespace Aaru.Tests.Filesystems.FAT12 "50489A1B", "2CE52101", "94313E7E", "BC184FE6", "BAD08A1E", "00000000", "8D418102", "8FC80E0A", "34FA0E0B", "02140E0B" }; - - readonly string[] _oemId = - { - "IBM 3.3", "IBM 3.2", "IBM 3.2", "IBM 3.3", "IBM 3.3", "IBM 3.3", "DRDOS 7", "IBM 5.0", "IBM 3.3", - "MSDOS4.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSWIN4.1", "IBM 3.3", - "IBM 3.3", "IBM 7.0", "IBM 2.0", "IBM 2.0", "IBM 3.0", "IBM 3.1", "IBM 3.3", "IBM 4.0", "IBM 5.0", - "IBM 5.0", "IBM 6.0", "IBM 6.0", "T V3.30 ", "T V4.00 ", "IBM 10.2", "IBM 10.2", "IBM 3.2", "IBM 10.2", - "IBM 10.2", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 4.50", "BSD 4.4", "MSDOS5.0", - "MSDOS5.0", "MSWIN4.0", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSDOS5.0", - "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "BeOS ", "mkfs.fat", "BSD 4.4", "BSD 4.4", "BSD4.4 " - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT12 (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 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("FAT12", 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/FAT12/Whole.cs b/Aaru.Tests/Filesystems/FAT12/Whole.cs index 77467166d..1464fd675 100644 --- a/Aaru.Tests/Filesystems/FAT12/Whole.cs +++ b/Aaru.Tests/Filesystems/FAT12/Whole.cs @@ -29,17 +29,22 @@ 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.FAT12 { [TestFixture] - public class Whole + public class Whole : FilesystemTest { - readonly string[] _testFiles = + public Whole() : base("FAT12") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT12"); + + public override IFilesystem _plugin => new FAT(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] { // Concurrent DOS 6.00 "concurrentdos_6.00_dshd.img.lz", "concurrentdos_6.00_mf2dd.img.lz", "concurrentdos_6.00_mf2hd.img.lz", @@ -374,7 +379,7 @@ namespace Aaru.Tests.Filesystems.FAT12 "geos41_mf2hd.img.lz" }; - readonly MediaType[] _mediaTypes = + public override MediaType[] _mediaTypes => new[] { // Concurrent DOS 6.00 MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, @@ -692,7 +697,7 @@ namespace Aaru.Tests.Filesystems.FAT12 MediaType.DOS_35_HD }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { // Concurrent DOS 6.00 2400, 1440, 2880, @@ -962,7 +967,7 @@ namespace Aaru.Tests.Filesystems.FAT12 2880 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { // Concurrent DOS 6.00 512, 512, 512, @@ -1231,8 +1236,278 @@ namespace Aaru.Tests.Filesystems.FAT12 // GEOS 4.1 512 }; + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + // Concurrent DOS 6.00 + true, true, true, - readonly long[] _clusters = + // DR-DOS 3.40 + true, true, true, true, true, true, true, + + // DR-DOS 3.41 + true, true, true, true, true, true, true, + + // DR-DOS 5.00 + true, true, true, true, true, true, true, + + // DR-DOS 6.00 + true, true, true, true, true, true, true, true, + + // DR-DOS 7.02 + true, true, true, true, true, true, true, true, + + // DR-DOS 7.03 + true, true, true, true, true, true, + + // DR-DOS 8.00 + true, true, true, true, true, true, true, true, + + // MS-DOS 3.30A + true, true, true, true, true, true, true, + + // MS-DOS 3.31 + true, true, true, true, true, true, true, + + // MS-DOS 4.01 + true, true, true, true, true, true, true, + + // MS-DOS 5.00 + true, true, true, true, true, true, true, true, + + // MS-DOS 6.00 + true, true, true, true, true, true, true, true, + + // MS-DOS 6.20 + true, true, true, true, true, true, true, true, + + // MS-DOS 6.20 RC1 + true, true, true, true, true, true, true, true, + + // MS-DOS 6.21 + true, true, true, true, true, true, true, true, + + // MS-DOS 6.22 + true, true, true, true, true, true, true, true, + + // MS-DOS 7.10 + true, true, true, true, true, true, true, true, + + // MS-DOS 3.20 for Amstrad + true, true, true, true, true, true, + + // MS-DOS 2.11 for AT&T + true, + + // MS-DOS 3.30 for DeLL + true, true, true, true, true, true, true, + + // MS-DOS 3.10 for Epson + true, true, true, + + // MS-DOS 3.20 for Epson + true, true, true, true, true, true, + + // MS-DOS 3.20 for HP + true, false, true, true, true, true, false, + + // MS-DOS 3.21 for Hyosung + true, false, true, true, true, true, false, + + // MS-DOS 3.21 for Kaypro + true, false, true, true, true, true, false, + + // MS-DOS 3.10 for Olivetti + true, true, true, + + // MS-DOS 3.30 for Toshiba + true, true, true, true, true, true, true, + + // MS-DOS 4.01 for Toshiba + true, true, true, true, true, true, true, + + // Novell DOS 7.00 + true, true, true, true, true, true, true, true, + + // OpenDOS 7.01 + true, true, true, true, true, true, true, true, + + // PC-DOS 2.00 + true, + + // PC-DOS 2.10 + true, + + // PC-DOS 2000 + true, true, true, true, true, true, true, true, + + // PC-DOS 3.00 + true, + + // PC-DOS 3.10 + true, + + // PC-DOS 3.30 + true, true, + + // PC-DOS 4.00 + true, true, + + // PC-DOS 5.00 + true, true, true, true, true, true, true, true, + + // PC-DOS 5.02 + true, true, true, true, true, true, true, true, + + // PC-DOS 6.10 + true, true, true, true, true, true, true, true, + + // PC-DOS 6.30 + true, true, true, true, true, true, true, true, + + // mkfs.vfat + true, true, true, true, + + // mkfs.vfat for Atari + false, false, false, false, + + // Microsoft OS/2 1.00 for Tandy + true, true, true, true, + + // Microsoft OS/2 1.10 for AST + true, true, true, true, + + // Microsoft OS/2 1.10 for Nokia + true, true, true, true, + + // Microsoft OS/2 1.21 + true, true, true, true, + + // Microsoft OS/2 1.30.1 + true, true, true, true, true, + + // OS/2 1.20 + true, true, true, true, + + // OS/2 1.30 + true, true, true, true, + + // OS/2 2.00 + true, true, true, true, true, + + // OS/2 2.10 + true, true, true, true, true, + + // OS/2 2.11 + true, true, true, true, true, + + // OS/2 Warp 3 + true, true, true, true, + + // OS/2 Warp 4 + true, true, true, true, + + // eComStation + true, true, true, true, true, + + // Windows 95 + true, true, true, true, true, true, true, true, + + // Windows 95 OSR 2 + true, true, true, true, true, true, true, true, + + // Windows 95 OSR 2.1 + true, true, true, true, true, true, true, true, + + // Windows 95 OSR 2.5 + true, true, true, true, true, true, true, true, + + // Windows 98 + true, true, true, true, true, true, true, true, + + // Windows 98 Second Edition + true, true, true, true, true, true, true, true, + + // Windows Me + true, true, true, true, true, + + // Windows NT 3.10 + true, true, true, true, + + // Windows NT 3.50 + true, true, true, true, + + // Windows NT 3.51 + true, true, true, true, + + // Windows NT 4.00 + true, true, true, true, true, true, + + // Windows 2000 + true, true, true, true, true, + + // Windows Vista + true, true, true, true, true, + + // BeOS R4.5 + true, + + // Hatari + false, false, false, false, false, false, false, false, + + // Atari TOS 1.04 + false, false, + + // NetBSD 1.6 + true, true, + + // NeXTStep 3.3 + false, false, + + // OpenStep for Mach 4.0 + false, false, + + // OpenStep for Mach 4.2 + false, false, + + // Solaris 2.4 + true, true, + + // COHERENT UNIX 4.2.10 + false, false, false, false, + + // SCO OpenServer 5.0.7Hw + true, true, true, + + // Epson MS-DOS 5.00 for PC-98 + true, true, + + // NEC MS-DOS 3.30 for PC-98 + true, true, + + // NEC MS-DOS 5.00 for PC-98 + true, true, + + // NEC MS-DOS 6.20 for PC-98 + true, true, + + // GEOS 1.2 + true, + + // GEOS 2.0 + true, + + // GEOS 3.1 + true, + + // GEOS 3.2 + true, + + // GEOS 4.1 + true + }; + + public override long[] _clusters => new long[] { // Concurrent DOS 6.00 2400, 720, 2880, @@ -1502,7 +1777,7 @@ namespace Aaru.Tests.Filesystems.FAT12 2880 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { // Concurrent DOS 6.00 512, 1024, 512, @@ -1772,7 +2047,279 @@ namespace Aaru.Tests.Filesystems.FAT12 512 }; - readonly string[] _volumeName = + public override string[] _oemId => new[] + { + // Concurrent DOS 6.00 + "DIGITAL ", "DIGITAL ", "DIGITAL ", + + // DR-DOS 3.40 + "DIGITAL ", "DIGITAL ", "DIGITAL ", "DIGITAL ", "DIGITAL ", "DIGITAL ", "DIGITAL ", + + // DR-DOS 3.41 + "DIGITAL ", "DIGITAL ", "DIGITAL ", "DIGITAL ", "DIGITAL ", "DIGITAL ", "DIGITAL ", + + // DR-DOS 5.00 + "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", + + // DR-DOS 6.00 + "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", + + // DR-DOS 7.02 + "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", + + // DR-DOS 7.03 + "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", + + // DR-DOS 8.00 + "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", + + // MS-DOS 3.30A + "MSDOS3.3", null, "MSDOS3.3", "MSDOS3.3", "MSDOS3.3", "MSDOS3.3", null, + + // MS-DOS 3.31 + "IBM 3.3", null, "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", null, + + // MS-DOS 4.01 + "MSDOS4.0", null, "MSDOS4.0", "MSDOS4.0", "MSDOS4.0", "MSDOS4.0", null, + + // MS-DOS 5.00 + "MSDOS5.0", null, "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", null, + + // MS-DOS 6.00 + "MSDOS5.0", null, "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", null, + + // MS-DOS 6.20 + "MSDOS5.0", null, "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", null, + + // MS-DOS 6.20 RC1 + "MSDOS5.0", null, "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", null, + + // MS-DOS 6.21 + "MSDOS5.0", null, "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", null, + + // MS-DOS 6.22 + "MSDOS5.0", null, "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", null, + + // MS-DOS 7.10 + "MSWIN4.1", null, "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", null, + + // MS-DOS 3.20 for Amstrad + "MSDOS3.2", null, "MSDOS3.2", "MSDOS3.2", "MSDOS3.2", null, + + // MS-DOS 2.11 for AT&T + "PSA 1.04", + + // MS-DOS 3.30 for DeLL + "IBM 3.3", null, "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", null, + + // MS-DOS 3.10 for Epson + "EPS 3.10", "EPS 3.10", "EPS 3.10", + + // MS-DOS 3.20 for Epson + "IBM 3.2", "IBM 3.2", "IBM 3.2", "IBM 3.2", "IBM 3.2", "IBM 3.2", + + // MS-DOS 3.20 for HP + "MSDOS3.2", null, "MSDOS3.2", "MSDOS3.2", "MSDOS3.2", "MSDOS3.2", null, + + // MS-DOS 3.21 for Hyosung + "MSDOS3.2", null, "MSDOS3.2", "MSDOS3.2", "MSDOS3.2", "MSDOS3.2", null, + + // MS-DOS 3.21 for Kaypro + "MSDOS3.2", null, "MSDOS3.2", "MSDOS3.2", "MSDOS3.2", "MSDOS3.2", null, + + // MS-DOS 3.10 for Olivetti + "IBM 3.1", "IBM 3.1", "IBM 3.1", + + // MS-DOS 3.30 for Toshiba + "IBM 3.3", null, "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", null, + + // MS-DOS 4.01 for Toshiba + "T V4.00 ", "T V4.00 ", "T V4.00 ", "T V4.00 ", "T V4.00 ", "T V4.00 ", "T V4.00 ", + + // Novell DOS 7.00 + "NWDOS7.0", "NWDOS7.0", "NWDOS7.0", "NWDOS7.0", "NWDOS7.0", "NWDOS7.0", "NWDOS7.0", "NWDOS7.0", + + // OpenDOS 7.01 + "OPENDOS7", "OPENDOS7", "OPENDOS7", "OPENDOS7", "OPENDOS7", "OPENDOS7", "OPENDOS7", "OPENDOS7", + + // PC-DOS 2.00 + "IBM 2.0", + + // PC-DOS 2.10 + "IBM 2.0", + + // PC-DOS 2000 + "IBM 7.0", null, "IBM 7.0", "IBM 7.0", "IBM 7.0", "IBM 7.0", "IBM 7.0", null, + + // PC-DOS 3.00 + "IBM 3.0", + + // PC-DOS 3.10 + "IBM 3.1", + + // PC-DOS 3.30 + "IBM 3.3", "IBM 3.3", + + // PC-DOS 4.00 + "IBM 4.0", "IBM 4.0", + + // PC-DOS 5.00 + "IBM 5.0", null, "IBM 5.0", "IBM 5.0", "IBM 5.0", "IBM 5.0", "IBM 5.0", null, + + // PC-DOS 5.02 + "IBM 5.0", null, "IBM 5.0", "IBM 5.0", "IBM 5.0", "IBM 5.0", "IBM 5.0", null, + + // PC-DOS 6.10 + "IBM 6.0", null, "IBM 6.0", "IBM 6.0", "IBM 6.0", "IBM 6.0", "IBM 6.0", null, + + // PC-DOS 6.30 + "IBM 6.0", null, "IBM 6.0", "IBM 6.0", "IBM 6.0", "IBM 6.0", "IBM 6.0", null, + + // mkfs.vfat + "mkfs.fat", "mkfs.fat", "mkfs.fat", "mkfs.fat", + + // mkfs.vfat for Atari + "mkdosf", "mkdosf", "mkdosf", "mkdosf", + + // Microsoft OS/2 1.00 for Tandy + "TAN 10.0", "TAN 10.0", "TAN 10.0", "TAN 10.0", + + // Microsoft OS/2 1.10 for AST + "IBM 10.1", "IBM 10.1", "IBM 10.1", "IBM 10.1", + + // Microsoft OS/2 1.10 for Nokia + "IBM 10.1", "IBM 10.1", "IBM 10.1", "IBM 10.1", + + // Microsoft OS/2 1.21 + "IBM 10.2", "IBM 10.2", "IBM 10.2", "IBM 10.2", + + // Microsoft OS/2 1.30.1 + "IBM 10.2", "IBM 10.2", "IBM 10.2", "IBM 10.2", "IBM 10.2", + + // OS/2 1.20 + "IBM 10.2", "IBM 10.2", "IBM 10.2", "IBM 10.2", + + // OS/2 1.30 + "IBM 10.2", "IBM 10.2", "IBM 10.2", "IBM 10.2", + + // OS/2 2.00 + "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", + + // OS/2 2.10 + "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", + + // OS/2 2.11 + "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", + + // OS/2 Warp 3 + "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", + + // OS/2 Warp 4 + "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", + + // eComStation + "IBM 4.50", "IBM 4.50", "IBM 4.50", "IBM 4.50", "IBM 4.50", + + // Windows 95 + null, "MSWIN4.0", "MSWIN4.0", "MSWIN4.0", "MSWIN4.0", "MSWIN4.0", null, "MSWIN4.0", + + // Windows 95 OSR 2 + null, "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", null, "MSWIN4.1", + + // Windows 95 OSR 2.1 + null, "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", null, "MSWIN4.1", + + // Windows 95 OSR 2.5 + null, "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", null, "MSWIN4.1", + + // Windows 98 + null, "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", null, "MSWIN4.1", + + // Windows 98 Second Edition + null, "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", null, "MSWIN4.1", + + // Windows Me + "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", + + // Windows NT 3.10 + "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", + + // Windows NT 3.50 + "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", + + // Windows NT 3.51 + "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", + + // Windows NT 4.00 + "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", + + // Windows 2000 + "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", + + // Windows Vista + "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", + + // BeOS R4.5 + "BeOS ", + + // Hatari + "NNNNNN", "NNNNNN", "NNNNNN", "NNNNNN", "NNNNNN", "NNNNNN", "NNNNNN", "NNNNNN", + + // Atari TOS 1.04 + "NNNNNN", "NNNNNN", + + // NetBSD 1.6 + "BSD 4.4", "BSD 4.4", + + // NeXTStep 3.3 + "NEXT ", "NEXT ", + + // OpenStep for Mach 4.0 + "NEXT ", "NEXT ", + + // OpenStep for Mach 4.2 + "NEXT ", "NEXT ", + + // Solaris 2.4 + "MSDOS3.3", "MSDOS3.3", + + // COHERENT UNIX 4.2.10 + "COHERENT", "COHERENT", "COHERENT", "COHERENT", + + // SCO OpenServer 5.0.7Hw + "SCO BOOT", "SCO BOOT", "SCO BOOT", + + // Epson MS-DOS 5.00 for PC-98 + "EPSON5.0", "EPSON5.0", + + // NEC MS-DOS 3.30 for PC-98 + "NEC 2.00", "NEC 2.00", + + // NEC MS-DOS 5.00 for PC-98 + "NEC 5.0", "NEC 5.0", + + // NEC MS-DOS 6.20 for PC-98 + "NEC 5.0", "NEC 5.0", + + // GEOS 1.2 + "GEOWORKS", + + // GEOS 2.0 + "GEOWORKS", + + // GEOS 3.1 + "GEOWORKS", + + // GEOS 3.2 + "GEOWORKS", + + // GEOS 4.1 + "GEOWORKS" + }; + + public override string[] _type => null; + + public override string[] _volumeName => new[] { // Concurrent DOS 6.00 null, null, null, @@ -2048,7 +2595,7 @@ namespace Aaru.Tests.Filesystems.FAT12 "GEOS41" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { // Concurrent DOS 6.00 null, null, null, @@ -2317,308 +2864,5 @@ namespace Aaru.Tests.Filesystems.FAT12 // GEOS 4.1 "8D684C67" }; - - readonly string[] _oemId = - { - // Concurrent DOS 6.00 - "DIGITAL ", "DIGITAL ", "DIGITAL ", - - // DR-DOS 3.40 - "DIGITAL ", "DIGITAL ", "DIGITAL ", "DIGITAL ", "DIGITAL ", "DIGITAL ", "DIGITAL ", - - // DR-DOS 3.41 - "DIGITAL ", "DIGITAL ", "DIGITAL ", "DIGITAL ", "DIGITAL ", "DIGITAL ", "DIGITAL ", - - // DR-DOS 5.00 - "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", - - // DR-DOS 6.00 - "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", - - // DR-DOS 7.02 - "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", - - // DR-DOS 7.03 - "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", - - // DR-DOS 8.00 - "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", "DRDOS 7", - - // MS-DOS 3.30A - "MSDOS3.3", null, "MSDOS3.3", "MSDOS3.3", "MSDOS3.3", "MSDOS3.3", null, - - // MS-DOS 3.31 - "IBM 3.3", null, "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", null, - - // MS-DOS 4.01 - "MSDOS4.0", null, "MSDOS4.0", "MSDOS4.0", "MSDOS4.0", "MSDOS4.0", null, - - // MS-DOS 5.00 - "MSDOS5.0", null, "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", null, - - // MS-DOS 6.00 - "MSDOS5.0", null, "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", null, - - // MS-DOS 6.20 - "MSDOS5.0", null, "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", null, - - // MS-DOS 6.20 RC1 - "MSDOS5.0", null, "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", null, - - // MS-DOS 6.21 - "MSDOS5.0", null, "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", null, - - // MS-DOS 6.22 - "MSDOS5.0", null, "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", null, - - // MS-DOS 7.10 - "MSWIN4.1", null, "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", null, - - // MS-DOS 3.20 for Amstrad - "MSDOS3.2", null, "MSDOS3.2", "MSDOS3.2", "MSDOS3.2", null, - - // MS-DOS 2.11 for AT&T - "PSA 1.04", - - // MS-DOS 3.30 for DeLL - "IBM 3.3", null, "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", null, - - // MS-DOS 3.10 for Epson - "EPS 3.10", "EPS 3.10", "EPS 3.10", - - // MS-DOS 3.20 for Epson - "IBM 3.2", "IBM 3.2", "IBM 3.2", "IBM 3.2", "IBM 3.2", "IBM 3.2", - - // MS-DOS 3.20 for HP - "MSDOS3.2", null, "MSDOS3.2", "MSDOS3.2", "MSDOS3.2", "MSDOS3.2", null, - - // MS-DOS 3.21 for Hyosung - "MSDOS3.2", null, "MSDOS3.2", "MSDOS3.2", "MSDOS3.2", "MSDOS3.2", null, - - // MS-DOS 3.21 for Kaypro - "MSDOS3.2", null, "MSDOS3.2", "MSDOS3.2", "MSDOS3.2", "MSDOS3.2", null, - - // MS-DOS 3.10 for Olivetti - "IBM 3.1", "IBM 3.1", "IBM 3.1", - - // MS-DOS 3.30 for Toshiba - "IBM 3.3", null, "IBM 3.3", "IBM 3.3", "IBM 3.3", "IBM 3.3", null, - - // MS-DOS 4.01 for Toshiba - "T V4.00 ", "T V4.00 ", "T V4.00 ", "T V4.00 ", "T V4.00 ", "T V4.00 ", "T V4.00 ", - - // Novell DOS 7.00 - "NWDOS7.0", "NWDOS7.0", "NWDOS7.0", "NWDOS7.0", "NWDOS7.0", "NWDOS7.0", "NWDOS7.0", "NWDOS7.0", - - // OpenDOS 7.01 - "OPENDOS7", "OPENDOS7", "OPENDOS7", "OPENDOS7", "OPENDOS7", "OPENDOS7", "OPENDOS7", "OPENDOS7", - - // PC-DOS 2.00 - "IBM 2.0", - - // PC-DOS 2.10 - "IBM 2.0", - - // PC-DOS 2000 - "IBM 7.0", null, "IBM 7.0", "IBM 7.0", "IBM 7.0", "IBM 7.0", "IBM 7.0", null, - - // PC-DOS 3.00 - "IBM 3.0", - - // PC-DOS 3.10 - "IBM 3.1", - - // PC-DOS 3.30 - "IBM 3.3", "IBM 3.3", - - // PC-DOS 4.00 - "IBM 4.0", "IBM 4.0", - - // PC-DOS 5.00 - "IBM 5.0", null, "IBM 5.0", "IBM 5.0", "IBM 5.0", "IBM 5.0", "IBM 5.0", null, - - // PC-DOS 5.02 - "IBM 5.0", null, "IBM 5.0", "IBM 5.0", "IBM 5.0", "IBM 5.0", "IBM 5.0", null, - - // PC-DOS 6.10 - "IBM 6.0", null, "IBM 6.0", "IBM 6.0", "IBM 6.0", "IBM 6.0", "IBM 6.0", null, - - // PC-DOS 6.30 - "IBM 6.0", null, "IBM 6.0", "IBM 6.0", "IBM 6.0", "IBM 6.0", "IBM 6.0", null, - - // mkfs.vfat - "mkfs.fat", "mkfs.fat", "mkfs.fat", "mkfs.fat", - - // mkfs.vfat for Atari - "mkdosf", "mkdosf", "mkdosf", "mkdosf", - - // Microsoft OS/2 1.00 for Tandy - "TAN 10.0", "TAN 10.0", "TAN 10.0", "TAN 10.0", - - // Microsoft OS/2 1.10 for AST - "IBM 10.1", "IBM 10.1", "IBM 10.1", "IBM 10.1", - - // Microsoft OS/2 1.10 for Nokia - "IBM 10.1", "IBM 10.1", "IBM 10.1", "IBM 10.1", - - // Microsoft OS/2 1.21 - "IBM 10.2", "IBM 10.2", "IBM 10.2", "IBM 10.2", - - // Microsoft OS/2 1.30.1 - "IBM 10.2", "IBM 10.2", "IBM 10.2", "IBM 10.2", "IBM 10.2", - - // OS/2 1.20 - "IBM 10.2", "IBM 10.2", "IBM 10.2", "IBM 10.2", - - // OS/2 1.30 - "IBM 10.2", "IBM 10.2", "IBM 10.2", "IBM 10.2", - - // OS/2 2.00 - "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", - - // OS/2 2.10 - "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", - - // OS/2 2.11 - "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", - - // OS/2 Warp 3 - "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", - - // OS/2 Warp 4 - "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", - - // eComStation - "IBM 4.50", "IBM 4.50", "IBM 4.50", "IBM 4.50", "IBM 4.50", - - // Windows 95 - null, "MSWIN4.0", "MSWIN4.0", "MSWIN4.0", "MSWIN4.0", "MSWIN4.0", null, "MSWIN4.0", - - // Windows 95 OSR 2 - null, "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", null, "MSWIN4.1", - - // Windows 95 OSR 2.1 - null, "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", null, "MSWIN4.1", - - // Windows 95 OSR 2.5 - null, "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", null, "MSWIN4.1", - - // Windows 98 - null, "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", null, "MSWIN4.1", - - // Windows 98 Second Edition - null, "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", null, "MSWIN4.1", - - // Windows Me - "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", - - // Windows NT 3.10 - "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", - - // Windows NT 3.50 - "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", - - // Windows NT 3.51 - "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", - - // Windows NT 4.00 - "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", - - // Windows 2000 - "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", - - // Windows Vista - "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", - - // BeOS R4.5 - "BeOS ", - - // Hatari - "NNNNNN", "NNNNNN", "NNNNNN", "NNNNNN", "NNNNNN", "NNNNNN", "NNNNNN", "NNNNNN", - - // Atari TOS 1.04 - "NNNNNN", "NNNNNN", - - // NetBSD 1.6 - "BSD 4.4", "BSD 4.4", - - // NeXTStep 3.3 - "NEXT ", "NEXT ", - - // OpenStep for Mach 4.0 - "NEXT ", "NEXT ", - - // OpenStep for Mach 4.2 - "NEXT ", "NEXT ", - - // Solaris 2.4 - "MSDOS3.3", "MSDOS3.3", - - // COHERENT UNIX 4.2.10 - "COHERENT", "COHERENT", "COHERENT", "COHERENT", - - // SCO OpenServer 5.0.7Hw - "SCO BOOT", "SCO BOOT", "SCO BOOT", - - // Epson MS-DOS 5.00 for PC-98 - "EPSON5.0", "EPSON5.0", - - // NEC MS-DOS 3.30 for PC-98 - "NEC 2.00", "NEC 2.00", - - // NEC MS-DOS 5.00 for PC-98 - "NEC 5.0", "NEC 5.0", - - // NEC MS-DOS 6.20 for PC-98 - "NEC 5.0", "NEC 5.0", - - // GEOS 1.2 - "GEOWORKS", - - // GEOS 2.0 - "GEOWORKS", - - // GEOS 3.1 - "GEOWORKS", - - // GEOS 3.2 - "GEOWORKS", - - // GEOS 4.1 - "GEOWORKS" - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT12", _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 FAT(); - - 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("FAT12", 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/FAT16/APM.cs b/Aaru.Tests/Filesystems/FAT16/APM.cs index 82d10412a..76588193f 100644 --- a/Aaru.Tests/Filesystems/FAT16/APM.cs +++ b/Aaru.Tests/Filesystems/FAT16/APM.cs @@ -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.FAT16 { [TestFixture] - public class APM + public class APM : FilesystemTest { - readonly string[] _testFiles = + public APM() : base("FAT16") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (APM)"); + 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[] { 1024000 }; - 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[] { 63995 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 8192 }; + public override string[] _oemId => new[] + { + "BSD 4.4" + }; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "VOLUMELABEL" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "063D1F09" }; - - 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", "FAT16 (APM)", _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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new FAT(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "DOS_FAT_16") - { - 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("FAT16", 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/FAT16/Atari.cs b/Aaru.Tests/Filesystems/FAT16/Atari.cs index fd727c9c5..a62da2238 100644 --- a/Aaru.Tests/Filesystems/FAT16/Atari.cs +++ b/Aaru.Tests/Filesystems/FAT16/Atari.cs @@ -26,95 +26,72 @@ // 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.FAT16 { [TestFixture] - public class Atari + public class Atari : FilesystemTest { - readonly string[] _testFiles = + public Atari() : base("FAT16") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (Atari)"); + public override IFilesystem _plugin => new FAT(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "tos_1.04.aif", "tos_1.04_small.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD, MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 81920, 16384 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + true, true + }; + + public override long[] _clusters => new long[] { 10239, 8191 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 4096, 1024 }; - readonly string[] _volumeName = + public override string[] _oemId => new string[] { null, null }; - readonly string[] _volumeSerial = + public override string[] _type => null; + public override string[] _volumeName => new string[] + { + null, null + }; + + public override string[] _volumeSerial => new[] { "BA9831", "2019E1" }; - - readonly string[] _oemId = - { - null, null - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (Atari)", _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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new FAT(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "GEM" || - partitions[j].Type == "BGM") - { - 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("FAT16", 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/FAT16/GPT.cs b/Aaru.Tests/Filesystems/FAT16/GPT.cs index 88b5d63ff..6b780bc51 100644 --- a/Aaru.Tests/Filesystems/FAT16/GPT.cs +++ b/Aaru.Tests/Filesystems/FAT16/GPT.cs @@ -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.FAT16 { [TestFixture] - public class GPT + public class GPT : FilesystemTest { - readonly string[] _testFiles = + public GPT() : base("FAT16") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (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[] { 1024000 }; - 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[] { 63995 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 8192 }; + public override string[] _oemId => new[] + { + "BSD 4.4" + }; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "VOLUMELABEL" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "2E8A1F1B" }; - - 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", "FAT16 (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 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("FAT16", 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/FAT16/Human.cs b/Aaru.Tests/Filesystems/FAT16/Human.cs index d056738de..d09732239 100644 --- a/Aaru.Tests/Filesystems/FAT16/Human.cs +++ b/Aaru.Tests/Filesystems/FAT16/Human.cs @@ -26,96 +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.FAT16 { [TestFixture] - public class Human + public class Human : FilesystemTest { - readonly string[] _testFiles = + public Human() : base("FAT16") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (Human68K)"); + public override IFilesystem _plugin => new FAT(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "sasidisk.aif", "scsidisk.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD, MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 162096, 204800 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 256, 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + true, true + }; + + public override long[] _clusters => new long[] { 40510, 102367 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 1024, 1024 }; - readonly string[] _volumeName = - { - null, null - }; - - readonly string[] _volumeSerial = - { - null, null - }; - - readonly string[] _oemId = + public override string[] _oemId => new[] { "Hudson soft 2.00", " Hero Soft V1.10" }; - - [Test] - public void Test() + public override string[] _type => null; + public override string[] _volumeName => new string[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (Human68K)", - _testFiles[i]); + null, null + }; - 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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new FAT(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "Human68k") - { - 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("FAT16", 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]); - } - } + public override string[] _volumeSerial => new string[] + { + null, null + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/FAT16/MBR.cs b/Aaru.Tests/Filesystems/FAT16/MBR.cs index 93120f1b6..25f85b51f 100644 --- a/Aaru.Tests/Filesystems/FAT16/MBR.cs +++ b/Aaru.Tests/Filesystems/FAT16/MBR.cs @@ -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.FAT16 { [TestFixture] - public class MBR + public class MBR : FilesystemTest { - readonly string[] _testFiles = + public MBR() : base("FAT16") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (MBR)"); + public override IFilesystem _plugin => new FAT(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "drdos_3.40.aif", "drdos_3.41.aif", "drdos_5.00.aif", "drdos_6.00.aif", "drdos_7.02.aif", "drdos_7.03.aif", "drdos_8.00.aif", "msdos331.aif", "msdos401.aif", "msdos500.aif", "msdos600.aif", "msdos620rc1.aif", @@ -55,8 +58,30 @@ namespace Aaru.Tests.Filesystems.FAT16 "macos_7.6.aif", "macos_8.0.aif", "ecs20_fstester.aif", "linux_2.2_umsdos16_flashdrive.aif", "linux_4.19_fat16_msdos_flashdrive.aif", "linux_4.19_vfat16_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, + 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, + 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, + MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, @@ -66,7 +91,7 @@ namespace Aaru.Tests.Filesystems.FAT16 1024000, 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, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, @@ -74,7 +99,16 @@ namespace Aaru.Tests.Filesystems.FAT16 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, true, true, true, + true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, + true, true, true, true, true, true, true, true, true, true, true + }; + + public override long[] _clusters => new long[] { 63882, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, @@ -83,15 +117,27 @@ namespace Aaru.Tests.Filesystems.FAT16 63941, 63882, 63941, 63872, 63872 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 2048, 8192, 8192, 8192, 8192, 16384, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192 }; + public override string[] _oemId => new[] + { + "IBM 3.2", "IBM 3.2", "IBM 3.3", "IBM 3.3", "IBM 3.3", "DRDOS 7", "IBM 5.0", "IBM 3.3", "MSDOS4.0", + "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSWIN4.1", "IBM 3.3", "IBM 3.3", + "IBM 7.0", "IBM 4.0", "IBM 5.0", "IBM 5.0", "IBM 6.0", "IBM 6.0", "IBM 10.2", "IBM 10.2", "IBM 3.2", + "IBM 10.2", "IBM 10.2", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 4.50", "BSD 4.4", + "MSDOS5.0", "MSDOS5.0", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.0", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", + "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "BeOS ", "mkfs.fat", "CDP 5.0", "MSWIN4.1", + "BSD 4.4", "BSD 4.4", "BSD4.4 ", "PCX 2.0 ", "PCX 2.0 ", "PCX 2.0 ", "PCX 2.0 ", "IBM 4.50", null, + "mkfs.fat", "mkfs.fat" + }; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", @@ -105,7 +151,7 @@ namespace Aaru.Tests.Filesystems.FAT16 "DICSETTER", "DICSETTER" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { null, null, null, null, null, null, "1BFB0748", null, "217B1909", "0C6D18FC", "382B18F4", "3E2018E9", "0D2418EF", "195A181B", "27761816", "356B1809", null, null, "2272100F", "07280FE1", "1F630FF9", "18340FFE", @@ -115,42 +161,5 @@ namespace Aaru.Tests.Filesystems.FAT16 "9AAA4216", "00000000", "A132D985", "374D3BD1", "52BEA34A", "3CF10E0D", "C6C30E0D", "44770E0D", "27761816", "27761816", "27761816", "27761816", "66AAF014", "5CC78D47", "A552A493", "FCC308A7" }; - - readonly string[] _oemId = - { - "IBM 3.2", "IBM 3.2", "IBM 3.3", "IBM 3.3", "IBM 3.3", "DRDOS 7", "IBM 5.0", "IBM 3.3", "MSDOS4.0", - "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSWIN4.1", "IBM 3.3", "IBM 3.3", - "IBM 7.0", "IBM 4.0", "IBM 5.0", "IBM 5.0", "IBM 6.0", "IBM 6.0", "IBM 10.2", "IBM 10.2", "IBM 3.2", - "IBM 10.2", "IBM 10.2", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 4.50", "BSD 4.4", - "MSDOS5.0", "MSDOS5.0", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.0", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", - "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "BeOS ", "mkfs.fat", "CDP 5.0", "MSWIN4.1", - "BSD 4.4", "BSD 4.4", "BSD4.4 ", "PCX 2.0 ", "PCX 2.0 ", "PCX 2.0 ", "PCX 2.0 ", "IBM 4.50", null, - "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", "FAT16 (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 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("FAT16", 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/FAT16/RDB.cs b/Aaru.Tests/Filesystems/FAT16/RDB.cs index c51483d31..df6c2989d 100644 --- a/Aaru.Tests/Filesystems/FAT16/RDB.cs +++ b/Aaru.Tests/Filesystems/FAT16/RDB.cs @@ -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.FAT16 { [TestFixture] - public class RDB + public class RDB : FilesystemTest { - readonly string[] _testFiles = + public RDB() : base("FAT16") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (RDB)"); + public override IFilesystem _plugin => new FAT(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "amigaos_3.9.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 1024128 }; - 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[] { 63689 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 8192 }; + public override string[] _oemId => new[] + { + "CDP 5.0" + }; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "VOLUMELABEL" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "374D40D1" }; - - readonly string[] _oemId = - { - "CDP 5.0" - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new FAT(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "0x06") - { - 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("FAT16", 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/FAT16/Whole.cs b/Aaru.Tests/Filesystems/FAT16/Whole.cs index 94180e22a..a55d003d4 100644 --- a/Aaru.Tests/Filesystems/FAT16/Whole.cs +++ b/Aaru.Tests/Filesystems/FAT16/Whole.cs @@ -29,17 +29,22 @@ 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.FAT16 { [TestFixture] - public class Whole + public class Whole : FilesystemTest { - readonly string[] _testFiles = + public Whole() : base("FAT16") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16"); + + public override IFilesystem _plugin => new FAT(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] { // MS-DOS 3.30A "msdos_3.30A_mf2ed.img.lz", @@ -48,7 +53,7 @@ namespace Aaru.Tests.Filesystems.FAT16 "msdos_3.31_mf2ed.img.lz" }; - readonly MediaType[] _mediaTypes = + public override MediaType[] _mediaTypes => new[] { // MS-DOS 3.30A MediaType.DOS_35_ED, @@ -57,7 +62,7 @@ namespace Aaru.Tests.Filesystems.FAT16 MediaType.DOS_35_ED }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { // MS-DOS 3.30A 5760, @@ -66,7 +71,7 @@ namespace Aaru.Tests.Filesystems.FAT16 5760 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { // MS-DOS 3.30A 512, @@ -75,7 +80,13 @@ namespace Aaru.Tests.Filesystems.FAT16 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + true, true + }; + + public override long[] _clusters => new long[] { // MS-DOS 3.30A 5760, @@ -84,7 +95,7 @@ namespace Aaru.Tests.Filesystems.FAT16 5760 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { // MS-DOS 3.30A 512, @@ -92,26 +103,7 @@ namespace Aaru.Tests.Filesystems.FAT16 // MS-DOS 3.31 512 }; - - readonly string[] _volumeName = - { - // MS-DOS 3.30A - null, - - // MS-DOS 3.31 - null - }; - - readonly string[] _volumeSerial = - { - // MS-DOS 3.30A - null, - - // MS-DOS 3.31 - null - }; - - readonly string[] _oemId = + public override string[] _oemId => new[] { // MS-DOS 3.30A "MSDOS3.3", @@ -119,38 +111,24 @@ namespace Aaru.Tests.Filesystems.FAT16 // MS-DOS 3.31 "IBM 3.3" }; + public override string[] _type => null; - [Test] - public void Test() + public override string[] _volumeName => new string[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16", _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 FAT(); + // MS-DOS 3.30A + null, - var wholePart = new Partition - { - Name = "Whole device", - Length = image.Info.Sectors, - Size = image.Info.Sectors * image.Info.SectorSize - }; + // MS-DOS 3.31 + null + }; - 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("FAT16", 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]); - } - } + public override string[] _volumeSerial => new string[] + { + // MS-DOS 3.30A + null, + + // MS-DOS 3.31 + null + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/FAT32/APM.cs b/Aaru.Tests/Filesystems/FAT32/APM.cs index c30581e00..b3e312eb5 100644 --- a/Aaru.Tests/Filesystems/FAT32/APM.cs +++ b/Aaru.Tests/Filesystems/FAT32/APM.cs @@ -26,94 +26,72 @@ // 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 APM + public class APM : FilesystemTest { - readonly string[] _testFiles = + public APM() : base("FAT32") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT32 (APM)"); + 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[] { 524278 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 4096 }; - readonly string[] _volumeName = - { - "VOLUMELABEL" - }; - - readonly string[] _volumeSerial = - { - "35BD1F0A" - }; - - readonly string[] _oemId = + public override string[] _oemId => new[] { "BSD 4.4" }; - [Test] - public void Test() + public override string[] _type => null; + public override string[] _volumeName => new[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT32 (APM)", _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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new FAT(); - int part = -1; + "VOLUMELABEL" + }; - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "DOS_FAT_32") - { - 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]); - } - } + public override string[] _volumeSerial => new[] + { + "35BD1F0A" + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/FAT32/GPT.cs b/Aaru.Tests/Filesystems/FAT32/GPT.cs index 156283315..eb64ade81 100644 --- a/Aaru.Tests/Filesystems/FAT32/GPT.cs +++ b/Aaru.Tests/Filesystems/FAT32/GPT.cs @@ -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 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/FAT32/MBR.cs b/Aaru.Tests/Filesystems/FAT32/MBR.cs index 67fdc62fd..8b2a4bc95 100644 --- a/Aaru.Tests/Filesystems/FAT32/MBR.cs +++ b/Aaru.Tests/Filesystems/FAT32/MBR.cs @@ -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 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/FATX/Xbox.cs b/Aaru.Tests/Filesystems/FATX/Xbox.cs index d8b8142ef..a215ce8da 100644 --- a/Aaru.Tests/Filesystems/FATX/Xbox.cs +++ b/Aaru.Tests/Filesystems/FATX/Xbox.cs @@ -43,8 +43,54 @@ using FileSystemInfo = Aaru.CommonTypes.Structs.FileSystemInfo; namespace Aaru.Tests.Filesystems.FATX { [TestFixture] - public class Xbox + public class Xbox : FilesystemTest { + public Xbox() : base("FATX filesystem") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Xbox FAT16", "le"); + public override IFilesystem _plugin => new XboxFatPlugin(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] + { + "fatx.img.lz" + }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD + }; + public override ulong[] _sectors => new ulong[] + { + 62720 + }; + public override uint[] _sectorSize => new uint[] + { + 512 + }; + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false + }; + public override long[] _clusters => new long[] + { + 1960 + }; + public override uint[] _clusterSize => new uint[] + { + 16384 + }; + public override string[] _oemId => null; + public override string[] _type => null; + public override string[] _volumeName => new[] + { + "Volume láb€l" + }; + public override string[] _volumeSerial => new[] + { + "4639B7D0" + }; + [SetUp] public void Init() { @@ -79,17 +125,6 @@ namespace Aaru.Tests.Filesystems.FATX IReadOnlyFilesystem _fs; Partition _wholePart; - [Test] - public void Information() - { - Assert.AreEqual(62720, _image.Info.Sectors); - Assert.AreEqual(1960, _fs.XmlFsType.Clusters); - Assert.AreEqual(16384, _fs.XmlFsType.ClusterSize); - Assert.AreEqual("FATX filesystem", _fs.XmlFsType.Type); - Assert.AreEqual("Volume láb€l", _fs.XmlFsType.VolumeName); - Assert.AreEqual("4639B7D0", _fs.XmlFsType.VolumeSerial); - } - [Test] public void MapBlock() { diff --git a/Aaru.Tests/Filesystems/FATX/Xbox360.cs b/Aaru.Tests/Filesystems/FATX/Xbox360.cs index 7f50d08d9..80b12351b 100644 --- a/Aaru.Tests/Filesystems/FATX/Xbox360.cs +++ b/Aaru.Tests/Filesystems/FATX/Xbox360.cs @@ -43,8 +43,57 @@ using FileSystemInfo = Aaru.CommonTypes.Structs.FileSystemInfo; namespace Aaru.Tests.Filesystems.FATX { [TestFixture] - public class Xbox360 + public class Xbox360 : FilesystemTest { + public Xbox360() : base("FATX filesystem") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Xbox FAT16", "be"); + + public override IFilesystem _plugin => new XboxFatPlugin(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] + { + "microsoft256mb.img.lz" + }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD + }; + public override ulong[] _sectors => new ulong[] + { + 491520 + }; + public override uint[] _sectorSize => new uint[] + { + 512 + }; + + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false + }; + + public override long[] _clusters => new long[] + { + 14848 + }; + public override uint[] _clusterSize => new uint[] + { + 16384 + }; + public override string[] _oemId => null; + public override string[] _type => null; + public override string[] _volumeName => new[] + { + string.Empty + }; + public override string[] _volumeSerial => new[] + { + "66C2E9D0" + }; + [SetUp] public void Init() { @@ -76,17 +125,6 @@ namespace Aaru.Tests.Filesystems.FATX IReadOnlyFilesystem _fs; Partition _dataPartition; - [Test] - public void Information() - { - Assert.AreEqual(491520, _image.Info.Sectors); - Assert.AreEqual(14848, _fs.XmlFsType.Clusters); - Assert.AreEqual(16384, _fs.XmlFsType.ClusterSize); - Assert.AreEqual("FATX filesystem", _fs.XmlFsType.Type); - Assert.AreEqual(string.Empty, _fs.XmlFsType.VolumeName); - Assert.AreEqual("66C2E9D0", _fs.XmlFsType.VolumeSerial); - } - [Test] public void MapBlock() { diff --git a/Aaru.Tests/Filesystems/FilesystemTest.cs b/Aaru.Tests/Filesystems/FilesystemTest.cs new file mode 100644 index 000000000..4c8bc32cd --- /dev/null +++ b/Aaru.Tests/Filesystems/FilesystemTest.cs @@ -0,0 +1,224 @@ +using System; +using System.Collections.Generic; +using Aaru.CommonTypes; +using Aaru.CommonTypes.Interfaces; +using Aaru.Core; +using NUnit.Framework; + +namespace Aaru.Tests.Filesystems +{ + public abstract class FilesystemTest + { + readonly string _fileSystemType; + + public FilesystemTest(string fileSystemType) => _fileSystemType = fileSystemType; + + public abstract string _dataFolder { get; } + public abstract IFilesystem _plugin { get; } + public abstract bool _partitions { get; } + public abstract string[] _testFiles { get; } + public abstract MediaType[] _mediaTypes { get; } + public abstract ulong[] _sectors { get; } + public abstract uint[] _sectorSize { get; } + + public abstract string[] _appId { get; } + public abstract bool[] _bootable { get; } + public abstract long[] _clusters { get; } + public abstract uint[] _clusterSize { get; } + public abstract string[] _oemId { get; } + public abstract string[] _type { get; } + public abstract string[] _volumeName { get; } + public abstract string[] _volumeSerial { get; } + + [Test] + public void Detect() + { + Environment.CurrentDirectory = _dataFolder; + + Assert.Multiple(() => + { + foreach(string testFile in _testFiles) + { + var filtersList = new FiltersList(); + IFilter inputFilter = filtersList.GetFilter(testFile); + + Assert.IsNotNull(inputFilter, $"Filter: {testFile}"); + + IMediaImage image = ImageFormat.Detect(inputFilter); + + Assert.IsNotNull(image, $"Image format: {testFile}"); + + Assert.AreEqual(true, image.Open(inputFilter), $"Cannot open image for {testFile}"); + + List idPlugins; + + if(_partitions) + { + List partitionsList = Core.Partitions.GetAll(image); + + Assert.Greater(partitionsList.Count, 0, $"No partitions found for {testFile}"); + + bool found = false; + + foreach(Partition p in partitionsList) + { + Core.Filesystems.Identify(image, out idPlugins, p, true); + + if(idPlugins.Count == 0) + continue; + + if(!idPlugins.Contains(_plugin.Id.ToString())) + continue; + + found = true; + + break; + } + + Assert.True(found, $"Filesystem not identified for {testFile}"); + } + else + { + var wholePart = new Partition + { + Name = "Whole device", + Length = image.Info.Sectors, + Size = image.Info.Sectors * image.Info.SectorSize + }; + + Core.Filesystems.Identify(image, out idPlugins, wholePart, true); + + Assert.Greater(idPlugins.Count, 0, $"No filesystems found for {testFile}"); + + Assert.True(idPlugins.Contains(_plugin.Id.ToString()), $"Not identified for {testFile}"); + } + } + }); + } + + [Test] + public void ImageInfo() + { + Environment.CurrentDirectory = _dataFolder; + + Assert.Multiple(() => + { + for(int i = 0; i < _testFiles.Length; i++) + { + string testFile = _testFiles[i]; + var filtersList = new FiltersList(); + IFilter inputFilter = filtersList.GetFilter(testFile); + + Assert.IsNotNull(inputFilter, $"Filter: {testFile}"); + + IMediaImage image = ImageFormat.Detect(inputFilter); + + Assert.IsNotNull(image, $"Image format: {testFile}"); + + Assert.AreEqual(true, image.Open(inputFilter), $"Cannot open image for {testFile}"); + + 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]); + } + }); + } + + [Test] + public void Info() + { + Environment.CurrentDirectory = _dataFolder; + + Assert.Multiple(() => + { + for(int i = 0; i < _testFiles.Length; i++) + { + bool found = false; + var partition = new Partition(); + + var filtersList = new FiltersList(); + IFilter inputFilter = filtersList.GetFilter(_testFiles[i]); + + Assert.IsNotNull(inputFilter, $"Filter: {_testFiles[i]}"); + + IMediaImage image = ImageFormat.Detect(inputFilter); + + Assert.IsNotNull(image, $"Image format: {_testFiles[i]}"); + + Assert.AreEqual(true, image.Open(inputFilter), $"Cannot open image for {_testFiles[i]}"); + + List idPlugins; + + if(_partitions) + { + List partitionsList = Core.Partitions.GetAll(image); + + Assert.Greater(partitionsList.Count, 0, $"No partitions found for {_testFiles[i]}"); + + // In reverse to skip boot partitions we're not interested in + for(int index = partitionsList.Count - 1; index >= 0; index--) + { + Core.Filesystems.Identify(image, out idPlugins, partitionsList[index], true); + + if(idPlugins.Count == 0) + continue; + + if(!idPlugins.Contains(_plugin.Id.ToString())) + continue; + + found = true; + partition = partitionsList[index]; + + break; + } + } + else + { + partition = new Partition + { + Name = "Whole device", + Length = image.Info.Sectors, + Size = image.Info.Sectors * image.Info.SectorSize + }; + + Core.Filesystems.Identify(image, out idPlugins, partition, true); + + Assert.Greater(idPlugins.Count, 0, $"No filesystems found for {_testFiles[i]}"); + + found = idPlugins.Contains(_plugin.Id.ToString()); + } + + Assert.True(found, $"Filesystem not identified for {_testFiles[i]}"); + + // ReSharper disable once ConditionIsAlwaysTrueOrFalse + // It is not the case, it changes + if(!found) + continue; + + var fs = Activator.CreateInstance(_plugin.GetType()) as IFilesystem; + + Assert.NotNull(fs, $"Could not instantiate filesystem for {_testFiles[i]}"); + + fs.GetInformation(image, partition, out _, null); + + if(_appId != null) + Assert.AreEqual(_appId[i], fs.XmlFsType.ApplicationIdentifier, + $"Application ID: {_testFiles[i]}"); + + Assert.AreEqual(_bootable[i], fs.XmlFsType.Bootable, $"Bootable: {_testFiles[i]}"); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, $"Clusters: {_testFiles[i]}"); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, $"Cluster size: {_testFiles[i]}"); + + if(_oemId != null) + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, $"System ID: {_testFiles[i]}"); + + Assert.AreEqual(_fileSystemType ?? _type[i], fs.XmlFsType.Type, + $"Filesystem type: {_testFiles[i]}"); + + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, $"Volume name: {_testFiles[i]}"); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, $"Volume serial: {_testFiles[i]}"); + } + }); + } + } +} \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/HAMMER.cs b/Aaru.Tests/Filesystems/HAMMER.cs index 59d9c5698..dd449343e 100644 --- a/Aaru.Tests/Filesystems/HAMMER.cs +++ b/Aaru.Tests/Filesystems/HAMMER.cs @@ -26,88 +26,67 @@ // 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 { [TestFixture] - public class Hammer + public class Hammer : FilesystemTest { - readonly string[] _testFiles = + public Hammer() : base("HAMMER") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "HAMMER (MBR)"); + public override IFilesystem _plugin => new HAMMER(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "dflybsd_3.6.1.vdi.lz", "dflybsd_4.0.5.vdi.lz" }; - readonly ulong[] _sectors = + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD, MediaType.GENERIC_HDD + }; + public override ulong[] _sectors => new ulong[] { 104857600, 104857600 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512 }; + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false + }; - readonly long[] _clusters = + public override long[] _clusters => new long[] { 6310, 6310 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 8388608, 8388608 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "Volume label", "Volume label" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "f8e1a8bb-626d-11e7-94b5-0900274691e4", "ff4dc664-6276-11e7-983f-090027c41b46" }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "HAMMER (MBR)", _testFiles[i]); - IFilter filter = new LZip(); - filter.Open(location); - IMediaImage image = new Vdi(); - 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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new HAMMER(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "Hammer") - { - 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("HAMMER", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/HFS+/APM.cs b/Aaru.Tests/Filesystems/HFS+/APM.cs index a01602d8f..de54036aa 100644 --- a/Aaru.Tests/Filesystems/HFS+/APM.cs +++ b/Aaru.Tests/Filesystems/HFS+/APM.cs @@ -26,13 +26,10 @@ // 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; // ReSharper disable CheckNamespace @@ -40,10 +37,16 @@ using NUnit.Framework; namespace Aaru.Tests.Filesystems.HFSPlus { [TestFixture] - public class APM + public class APM : FilesystemTest { + public APM() : base("HFS+") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS+ (APM)"); + public override IFilesystem _plugin => new AppleHFSPlus(); + public override bool _partitions => true; + // Missing Darwin 1.4.1 - readonly string[] _testFiles = + public override string[] _testFiles => new[] { "macosx_10.11.aif", "macosx_10.11_journal.aif", "darwin_1.3.1.aif", "darwin_1.3.1_wrapped.aif", "darwin_1.4.1_wrapped.aif", "darwin_6.0.2.aif", "darwin_6.0.2_wrapped.aif", "darwin_8.0.1_journal.aif", @@ -51,85 +54,62 @@ namespace Aaru.Tests.Filesystems.HFSPlus "macos_9.2.1.aif", "macos_9.2.2.aif", "macosx_10.2.aif", "macosx_10.3_journal.aif", "macosx_10.3.aif", "macosx_10.4_journal.aif", "macosx_10.4.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 + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 409600, 614400, 819200, 614400, 614400, 819200, 614400, 1228800, 819200, 614400, 4194304, 4194304, 4194304, 4194304, 4194304, 4194304, 2097152, 4194304, 2097152, 4194304 }; - 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 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false + }; + + public override long[] _clusters => new long[] { 51190, 76790, 102392, 76774, 76774, 102392, 76774, 153592, 102392, 76774, 524152, 524088, 524088, 524088, 524088, 524008, 261884, 491240, 261884, 491240 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096 }; + public override string[] _oemId => new[] + { + "10.0", "HFSJ", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "8.10", "8.10", "8.10", + "8.10", "8.10", "10.0", "HFSJ", "10.0", "HFSJ", "10.0" + }; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new string[] { null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "FA94762D086A18A9", "33D4A309C8E7BD10", null, null, null, null, null, "4D5140EB8F14A385", "0D592249833E2DC4", "AA616146576BD9BC", null, null, null, null, null, "EFA132FFFAC1ADA6", "009D570FFCF8F20B", "17F6F33AB313EE32", "AD5690C093F66FCF", "A7D63854DF76DDE6" }; - - readonly string[] _oemId = - { - "10.0", "HFSJ", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "8.10", "8.10", "8.10", - "8.10", "8.10", "10.0", "HFSJ", "10.0", "HFSJ", "10.0" - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS+ (APM)", - _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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new AppleHFSPlus(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "Apple_HFS") - { - 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("HFS+", 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/HFS+/GPT.cs b/Aaru.Tests/Filesystems/HFS+/GPT.cs index 543f21a20..8ae47c8c4 100644 --- a/Aaru.Tests/Filesystems/HFS+/GPT.cs +++ b/Aaru.Tests/Filesystems/HFS+/GPT.cs @@ -26,13 +26,10 @@ // 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; // ReSharper disable CheckNamespace @@ -40,84 +37,62 @@ using NUnit.Framework; namespace Aaru.Tests.Filesystems.HFSPlus { [TestFixture] - public class GPT + public class GPT : FilesystemTest { - readonly string[] _testFiles = + public GPT() : base("HFS+") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS+ (GPT)"); + public override IFilesystem _plugin => new AppleHFSPlus(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "macosx_10.11.aif", "macosx_10.11_journal.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD, MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 409600, 614400 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false + }; + + public override long[] _clusters => new long[] { 51190, 76790 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 4096, 4096 }; + public override string[] _oemId => new[] + { + "10.0", "HFSJ" + }; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new string[] { null, null }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "D8C68470046E67BE", "FD3CB598F3C6294A" }; - - readonly string[] _oemId = - { - "10.0", "HFSJ" - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS+ (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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new AppleHFSPlus(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "Apple HFS") - { - 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("HFS+", 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/HFS+/MBR.cs b/Aaru.Tests/Filesystems/HFS+/MBR.cs index 5aac99d3a..b490b8b03 100644 --- a/Aaru.Tests/Filesystems/HFS+/MBR.cs +++ b/Aaru.Tests/Filesystems/HFS+/MBR.cs @@ -26,13 +26,10 @@ // 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; // ReSharper disable CheckNamespace @@ -41,87 +38,69 @@ namespace Aaru.Tests.Filesystems.HFSPlus { // Mising Darwin 6.0.2 wrapped [TestFixture] - public class MBR + public class MBR : FilesystemTest { - readonly string[] _testFiles = + public MBR() : base("HFS+") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS+ (MBR)"); + + public override IFilesystem _plugin => new AppleHFSPlus(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "macosx_10.11.aif", "macosx_10.11_journal.aif", "linux.aif", "linux_journal.aif", "darwin_1.3.1.aif", "darwin_1.3.1_wrapped.aif", "darwin_1.4.1.aif", "darwin_1.4.1_wrapped.aif", "darwin_6.0.2.aif", "darwin_8.0.1_journal.aif", "darwin_8.0.1.aif", "darwin_8.0.1_wrapped.aif", "linux_4.19_hfs+_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 + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 303104, 352256, 262144, 262144, 819200, 614400, 819200, 614400, 819200, 1228800, 819200, 614400, 1024000 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 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[] + { + false, false, false, false, false, false, false, false, false, false, false, false, false + }; + + public override long[] _clusters => new long[] { 37878, 44021, 32512, 32512, 102178, 76708, 102178, 76708, 102178, 153592, 102392, 76774, 127744 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096 }; + public override string[] _oemId => new[] + { + "10.0", "HFSJ", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "H+Lx" + }; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new string[] { null, null, null, null, null, null, null, null, null, null, null, null, null }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "C84F550907D13F50", "016599F88029F73D", null, null, null, null, null, null, null, "F92964F9B3F64ABB", "A8FAC484A0A2B177", "D5D5BF1346AD2B8D", "B9BAC6856878A404" }; - - readonly string[] _oemId = - { - "10.0", "HFSJ", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "H+Lx" - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS+ (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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new AppleHFSPlus(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "0xAF") - { - 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("HFS+", 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/HFS/APM.cs b/Aaru.Tests/Filesystems/HFS/APM.cs index e8cc24867..7ef05a5e0 100644 --- a/Aaru.Tests/Filesystems/HFS/APM.cs +++ b/Aaru.Tests/Filesystems/HFS/APM.cs @@ -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.HFS { [TestFixture] - public class APM + public class APM : FilesystemTest { - readonly string[] _testFiles = + public APM() : base("HFS") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS (APM)"); + public override IFilesystem _plugin => new AppleHFS(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "amigaos_3.9.aif", "darwin_1.3.1.aif", "darwin_1.4.1.aif", "darwin_6.0.2.aif", "darwin_8.0.1.aif", "macos_1.1.aif", "macos_2.0.aif", "macos_6.0.7.aif", "macos_7.5.3.aif", "macos_7.5.aif", "macos_7.6.aif", @@ -50,34 +53,57 @@ namespace Aaru.Tests.Filesystems.HFS "macos_6.0.5.aif", "macos_6.0.8.aif", "macos_6.0.aif", "macos_7.0.aif", "macos_7.1.1.aif", "parted.aif", "silverlining_2.2.1.aif", "speedtools_3.6.aif", "vcpformatter_2.1.1.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, + 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[] { 1024128, 409600, 409600, 409600, 409600, 41820, 41820, 81648, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 409600, 51200, 51200, 41820, 41820, 54840, 54840, 54840, 54840, 54840, 41820, 54840, 54840, 262144, 51200, 51200, 54840 }; - 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, 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[] + { + false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false + }; + + public override long[] _clusters => new long[] { 64003, 51189, 51189, 58502, 58502, 41788, 38950, 39991, 63954, 63990, 63954, 63954, 63954, 63922, 63922, 63922, 63922, 63884, 63883, 63883, 58506, 50926, 50094, 38950, 38950, 38950, 38950, 7673, 38950, 38950, 38950, 38950, 38950, 46071, 50382, 49135, 54643 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 8192, 4096, 4096, 3584, 3584, 512, 512, 1024, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 3584, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 1024, 512, 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", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", @@ -87,46 +113,11 @@ namespace Aaru.Tests.Filesystems.HFS "Volume label", "Volume label", "Untitled", "Untitled #1", "24 MB Disk", "Volume label" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { null, null, null, null, "AAFE1382AF5AA898", null, null, null, null, null, null, null, null, null, null, null, null, "5A7C38B0CAF279C4", "FB49083EBD150509", "632C0B1DB46FD188", null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS (APM)", _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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new AppleHFS(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "Apple_HFS") - { - 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("HFS", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/HFS/MBR.cs b/Aaru.Tests/Filesystems/HFS/MBR.cs index 9125f3404..c39515f6b 100644 --- a/Aaru.Tests/Filesystems/HFS/MBR.cs +++ b/Aaru.Tests/Filesystems/HFS/MBR.cs @@ -26,89 +26,70 @@ // 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.HFS { [TestFixture] - public class MBR + public class MBR : FilesystemTest { - readonly string[] _testFiles = + public MBR() : base("HFS") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS (MBR)"); + public override IFilesystem _plugin => new AppleHFS(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "linux.aif", "darwin_1.3.1.aif", "darwin_1.4.1.aif", "darwin_6.0.2.aif", "darwin_8.0.1.aif", "linux_4.19_hfs_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 + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 262144, 409600, 409600, 409600, 409600, 1024000 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512, 512, 512, 512, 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false, false, false, false, false + }; + + public override long[] _clusters => new long[] { 65018, 51145, 51145, 58452, 58502, 63870 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 2048, 4096, 4096, 3584, 3584, 8192 }; + 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", "Volume label", "DicSetter" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { null, null, null, null, "81FE805D61458753", null }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS (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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new AppleHFS(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "0xAF") - { - 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("HFS", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/HFS/Optical.cs b/Aaru.Tests/Filesystems/HFS/Optical.cs index 569ad4843..d4d36d78a 100644 --- a/Aaru.Tests/Filesystems/HFS/Optical.cs +++ b/Aaru.Tests/Filesystems/HFS/Optical.cs @@ -26,91 +26,69 @@ // 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.HFS { [TestFixture] - public class Optical + public class Optical : FilesystemTest { - readonly string[] _testFiles = + public Optical() : base("HFS") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS (CD-ROM)"); + public override IFilesystem _plugin => new AppleHFS(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "toast_3.5.7_hfs_from_volume.aif", "toast_3.5.7_iso9660_hfs.aif", "toast_4.1.3_hfs_from_volume.aif", "toast_4.1.3_iso9660_hfs.aif", "toast_3.5.7_hfs_from_files.aif", "toast_4.1.3_hfs_from_files.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.CD, MediaType.CD, MediaType.CD, MediaType.CD, MediaType.CD, MediaType.CD, MediaType.CD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 942, 1880, 943, 1882, 1509, 1529 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 2048, 2048, 2048, 2048, 2048, 2048 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false, false, false, false, false + }; + + public override long[] _clusters => new long[] { 3724, 931, 931, 931, 249, 249 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 512, 2048, 2048, 2048, 12288, 12288 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "Disk utils", "Disk utils", "Disk utils", "Disk utils", "Disk utils", "Disk utils" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new string[] { null, null, null, null, null, null }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS (CD-ROM)", - _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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new AppleHFS(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "Apple_HFS") - { - 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("HFS", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/HFS/RDB.cs b/Aaru.Tests/Filesystems/HFS/RDB.cs index d8b1195fd..e13eb4c7c 100644 --- a/Aaru.Tests/Filesystems/HFS/RDB.cs +++ b/Aaru.Tests/Filesystems/HFS/RDB.cs @@ -26,88 +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.HFS { [TestFixture] - public class RDB + public class RDB : FilesystemTest { - readonly string[] _testFiles = + public RDB() : base("HFS") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS (RDB)"); + public override IFilesystem _plugin => new AppleHFS(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "amigaos_3.9.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 1024128 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false + }; + + public override long[] _clusters => new long[] { 63752 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 8192 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "Volume label" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new string[] { null }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS (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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new AppleHFS(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "\"RES\\86\"") - { - 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("HFS", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/HFS/Whole.cs b/Aaru.Tests/Filesystems/HFS/Whole.cs index 7c25bcfca..8a3ccc826 100644 --- a/Aaru.Tests/Filesystems/HFS/Whole.cs +++ b/Aaru.Tests/Filesystems/HFS/Whole.cs @@ -29,90 +29,71 @@ 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.HFS { [TestFixture] - public class Whole + public class Whole : FilesystemTest { - readonly string[] _testFiles = + public Whole() : base("HFS") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS"); + + public override IFilesystem _plugin => new AppleHFS(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] { "macos_1.1_mf2dd.img.lz", "macos_2.0_mf2dd.img.lz", "macos_6.0.7_mf2dd.img.lz", "nextstep_3.3_mf2hd.img.lz", "openstep_4.0_mf2hd.img.lz", "openstep_4.2_mf2hd.img.lz", "rhapsody_dr1_mf2hd.img.lz", "ecs20_mf2hd_fstester.img.lz" }; - readonly MediaType[] _mediaTypes = + public override MediaType[] _mediaTypes => new[] { MediaType.AppleSonyDS, MediaType.AppleSonyDS, MediaType.AppleSonyDS, MediaType.DOS_35_HD, MediaType.DOS_35_HD, MediaType.DOS_35_HD, MediaType.DOS_35_HD, MediaType.DOS_35_HD }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 1600, 1600, 1600, 2880, 2880, 2880, 2880, 2880 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512, 512, 512, 512, 512, 512, 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false, false, false, false, false, false, false + }; + + public override long[] _clusters => new long[] { 1594, 1594, 1594, 2874, 2874, 2874, 2874, 2874 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 512, 512, 512, 512, 512, 512, 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", "Volume label", "Volume label", "Volume label", "VOLUME LABEL" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new string[] { null, null, null, null, null, null, null, null }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS", _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 AppleHFS(); - - 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("HFS", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/HFSX/APM.cs b/Aaru.Tests/Filesystems/HFSX/APM.cs index fcc9b7d88..793be91a2 100644 --- a/Aaru.Tests/Filesystems/HFSX/APM.cs +++ b/Aaru.Tests/Filesystems/HFSX/APM.cs @@ -26,98 +26,74 @@ // 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.HFSX { [TestFixture] - public class APM + public class APM : FilesystemTest { - readonly string[] _testFiles = + public APM() : base("HFSX") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFSX (APM)"); + public override IFilesystem _plugin => new AppleHFSPlus(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "macosx_10.11.aif", "macosx_10.11_journal.aif", "darwin_8.0.1_journal.aif", "darwin_8.0.1.aif", "macosx_10.4_journal.aif", "macosx_10.4.aif" }; + public override MediaType[] _mediaTypes => new[] + { + 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[] { 819200, 1228800, 1638400, 1433600, 4194304, 1024000 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512, 512, 512, 512, 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false, false, false, false, false + }; + + public override long[] _clusters => new long[] { 102390, 153590, 204792, 179192, 491290, 127770 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 4096, 4096, 4096, 4096, 4096, 4096 }; + public override string[] _oemId => new[] + { + "10.0", "HFSJ", "10.0", "10.0", "HFSJ", "10.0" + }; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new string[] { null, null, null, null, null, null }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "CC2D56884950D9AE", "7AF1175D8EA7A072", "BB4ABD7E7E2FF5AF", "E2F212D815EF77B5", "5A8C646A5D77EB16", "258C51A750F6A485" }; - - readonly string[] _oemId = - { - "10.0", "HFSJ", "10.0", "10.0", "HFSJ", "10.0" - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFSX (APM)", - _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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new AppleHFSPlus(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "Apple_HFSX") - { - 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("HFSX", 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/HFSX/GPT.cs b/Aaru.Tests/Filesystems/HFSX/GPT.cs index f9a394dea..4732e1763 100644 --- a/Aaru.Tests/Filesystems/HFSX/GPT.cs +++ b/Aaru.Tests/Filesystems/HFSX/GPT.cs @@ -26,96 +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.HFSX { [TestFixture] - public class GPT + public class GPT : FilesystemTest { - readonly string[] _testFiles = + public GPT() : base("HFSX") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFSX (GPT)"); + public override IFilesystem _plugin => new AppleHFSPlus(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "macosx_10.11.aif", "macosx_10.11_journal.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD, MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 819200, 1228800 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false + }; + + public override long[] _clusters => new long[] { 102390, 153590 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 4096, 4096 }; - - readonly string[] _volumeName = - { - null, null - }; - - readonly string[] _volumeSerial = - { - "328343989312AE9F", "FB98504073464C5C" - }; - - readonly string[] _oemId = + public override string[] _type => null; + public override string[] _oemId => new[] { "10.0", "HFSJ" }; - [Test] - public void Test() + public override string[] _volumeName => new string[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFSX (GPT)", - _testFiles[i]); + null, null + }; - 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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new AppleHFSPlus(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "Apple HFS") - { - 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("HFSX", 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]); - } - } + public override string[] _volumeSerial => new[] + { + "328343989312AE9F", "FB98504073464C5C" + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/HFSX/MBR.cs b/Aaru.Tests/Filesystems/HFSX/MBR.cs index 1fb0ffe62..c2c9469d7 100644 --- a/Aaru.Tests/Filesystems/HFSX/MBR.cs +++ b/Aaru.Tests/Filesystems/HFSX/MBR.cs @@ -26,98 +26,75 @@ // 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.HFSX { [TestFixture] - public class MBR + public class MBR : FilesystemTest { - readonly string[] _testFiles = + public MBR() : base("HFSX") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFSX (MBR)"); + + public override IFilesystem _plugin => new AppleHFSPlus(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "macosx_10.11.aif", "macosx_10.11_journal.aif", "linux.aif", "linux_journal.aif", "darwin_8.0.1_journal.aif", "darwin_8.0.1.aif", "linux_4.19_hfsx_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 + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 393216, 409600, 262144, 262144, 1638400, 1433600, 1024000 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512, 512, 512, 512, 512, 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false, false, false, false, false, false + }; + + public override long[] _clusters => new long[] { 49140, 51187, 32512, 32512, 204792, 179192, 127744 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 4096, 4096, 4096, 4096, 4096, 4096, 4096 }; + public override string[] _oemId => new[] + { + "10.0", "HFSJ", "10.0", "10.0", "10.0", "10.0", "H+Lx" + }; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new string[] { null, null, null, null, null, null, null }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "C2BCCCE6DE5BC98D", "AC54CD78C75CC30F", null, null, "7559DD01BCFADD9A", "AEA39CFBBF14C0FF", "5E4A8781D3C9286C" }; - - readonly string[] _oemId = - { - "10.0", "HFSJ", "10.0", "10.0", "10.0", "10.0", "H+Lx" - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFSX (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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new AppleHFSPlus(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "0xAF") - { - 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("HFSX", 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/HPFS.cs b/Aaru.Tests/Filesystems/HPFS.cs index 5cae741b3..fc328b550 100644 --- a/Aaru.Tests/Filesystems/HPFS.cs +++ b/Aaru.Tests/Filesystems/HPFS.cs @@ -26,90 +26,78 @@ // 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 { [TestFixture] - public class Hpfs + public class Hpfs : FilesystemTest { - readonly string[] _testFiles = + public Hpfs() : base("HPFS") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", + "High Performance File System"); + public override IFilesystem _plugin => new HPFS(); + public override bool _partitions => true; + public override string[] _testFiles => new[] { "ecs.aif", "msos2_1.21.aif", "msos2_1.30.1.aif", "os2_1.20.aif", "os2_1.30.aif", "os2_6.307.aif", "os2_6.514.aif", "os2_6.617.aif", "os2_8.162.aif", "os2_9.023.aif", "winnt_3.10.aif", "winnt_3.50.aif", "ecs20_fstester.aif" }; - readonly ulong[] _sectors = + 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 + }; + public override ulong[] _sectors => new ulong[] { 262144, 1024000, 1024000, 1024000, 1024000, 1024000, 262144, 262144, 262144, 262144, 262144, 262144, 1024000 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512 }; + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + true, true, true, true, true, true, true, true, true, true, true, true, true + }; - readonly long[] _clusters = + public override long[] _clusters => new long[] { 261072, 1023056, 1023056, 1023056, 1023056, 1023056, 262016, 262016, 262016, 262016, 262016, 262112, 1022112 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512 }; + public override string[] _oemId => new[] + { + "IBM 4.50", "OS2 10.1", "OS2 10.0", "OS2 10.0", "OS2 10.0", "OS2 20.0", "OS2 20.0", "OS2 20.1", "OS2 20.0", + "OS2 20.0", "MSDOS5.0", "MSDOS5.0", "IBM 4.50" + }; + 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", "VOLUME LABE" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "2BBBD814", "AC0DDC15", "ABEB2C15", "6C4EE015", "6C406015", "6C49B015", "2BCEB414", "2C157414", "2BF55414", "2BE31414", "E851CB14", "A4EDC29C", "AC096014" }; - - readonly string[] _oemId = - { - "IBM 4.50", "OS2 10.1", "OS2 10.0", "OS2 10.0", "OS2 10.0", "OS2 20.0", "OS2 20.0", "OS2 20.1", "OS2 20.0", - "OS2 20.0", "MSDOS5.0", "MSDOS5.0", "IBM 4.50" - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "High Performance File System", - _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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new HPFS(); - 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("HPFS", 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/HPOFS.cs b/Aaru.Tests/Filesystems/HPOFS.cs index afbd4ba2e..bb370f5f0 100644 --- a/Aaru.Tests/Filesystems/HPOFS.cs +++ b/Aaru.Tests/Filesystems/HPOFS.cs @@ -29,94 +29,69 @@ 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 { [TestFixture] - public class Hpofs + public class Hpofs : FilesystemTest { - readonly string[] _testFiles = + public Hpofs() : base("HPOFS") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", + "High Performance Optical File System"); + public override IFilesystem _plugin => new HPOFS(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] { "rid1.img.lz", "rid10.img.lz", "rid66percent.img.lz", "rid266.img.lz" }; - readonly MediaType[] _mediaTypes = + public override MediaType[] _mediaTypes => new[] { MediaType.DOS_35_HD, MediaType.DOS_35_HD, MediaType.DOS_35_HD, MediaType.DOS_35_HD }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 2880, 2880, 2880, 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[] { 2880, 2880, 2880, 2880 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 512, 512, 512, 512 }; + public override string[] _oemId => new[] + { + "IBM 10.2", "IBM 10.2", "IBM 10.2", "IBM 10.2" + }; + 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[] { "AC226814", "AC160814", "AC306C14", "ABEF2C14" }; - - readonly string[] _oemId = - { - "IBM 10.2", "IBM 10.2", "IBM 10.2", "IBM 10.2" - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", - "High Performance Optical 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 HPOFS(); - - 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("HPOFS", 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/HTFS/MBR.cs b/Aaru.Tests/Filesystems/HTFS/MBR.cs index c4cdf1f55..fa4f09f18 100644 --- a/Aaru.Tests/Filesystems/HTFS/MBR.cs +++ b/Aaru.Tests/Filesystems/HTFS/MBR.cs @@ -26,95 +26,69 @@ // 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.HTFS { [TestFixture] - public class MBR + public class MBR : FilesystemTest { - readonly string[] _testFiles = + public MBR() : base("HTFS") {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "High Throughtput File System (MBR)"); + public override IFilesystem _plugin => new SysVfs(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "scoopenserver_5.0.7hw.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 2097152 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false + }; + + public override long[] _clusters => new long[] { 1020096 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 1024 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "Volume label" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new string[] { null }; - - readonly string[] _type = - { - "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 (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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new SysVfs(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "XENIX") - { - 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(_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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/HTFS/Whole.cs b/Aaru.Tests/Filesystems/HTFS/Whole.cs index 6865a7f1f..b620ca31c 100644 --- a/Aaru.Tests/Filesystems/HTFS/Whole.cs +++ b/Aaru.Tests/Filesystems/HTFS/Whole.cs @@ -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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/ISO9660.cs b/Aaru.Tests/Filesystems/ISO9660.cs index 7e01f2d09..bc43f2c2d 100644 --- a/Aaru.Tests/Filesystems/ISO9660.cs +++ b/Aaru.Tests/Filesystems/ISO9660.cs @@ -29,17 +29,21 @@ 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 { [TestFixture] - public class Iso9660 + public class Iso9660 : FilesystemTest { - readonly string[] _testFiles = + public Iso9660() : base("ISO9660") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "ISO9660"); + public override IFilesystem _plugin => new ISO9660(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] { // Toast 3.5.7 "toast_3.5.7_iso9660_apple.aif", "toast_3.5.7_iso9660_dos_apple.aif", "toast_3.5.7_iso9660_dos.aif", @@ -89,7 +93,7 @@ namespace Aaru.Tests.Filesystems "xorriso_rockridge.aif", "xorriso_violating.aif", "xorriso_zisofs.aif", "xorriso_zisofs_rockridge.aif" }; - readonly MediaType[] _mediaTypes = + public override MediaType[] _mediaTypes => new[] { // Toast 3.5.7 MediaType.CD, MediaType.CD, MediaType.CD, MediaType.CD, MediaType.CD, MediaType.CD, MediaType.CD, @@ -124,7 +128,7 @@ namespace Aaru.Tests.Filesystems MediaType.CD, MediaType.CD, MediaType.CD, MediaType.CD, MediaType.CD }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { // Toast 3.5.7 946, 946, 300, 1880, 300, 951, 300, 946, 300, 946, 946, 300, 300, 951, 300, 300, @@ -151,7 +155,7 @@ namespace Aaru.Tests.Filesystems 3688, 3686, 3686, 3686, 3673, 3673, 3673, 3686, 3675, 3673, 3673, 3675 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { // Toast 3.5.7 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, @@ -178,157 +182,7 @@ namespace Aaru.Tests.Filesystems 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048 }; - readonly long[] _clusters = - { - // Toast 3.5.7 - 946, 946, 244, 946, 244, 951, 249, 946, 244, 946, 946, 244, 244, 951, 249, 244, - - // Toast 4.1.3 - 948, - - // Toast 4.0.3 - 305, 305, 220, 954, 220, 323, 234, 305, 220, - - // Toast 4.0.3 (CD-ROM XA) - // 10, 11, 12, 13, 14, 15, 16, 17, 18, - // mkisofs - 3662, 3606, 3800, 3800, 2983, 2531, 2983, 2531, 2983, 2531, 2894, 2894, 106589, 105241, 5055, 3651, 3651, - 3651, 3651, 3637, 3637, 3637, 3689, 7481, 7487, 3693, 7487, 3925, 3637, 3637, 3637, 3693, - - // Nero MAX - 389, 417, 257, 266, - - // Nero MAX (CD-ROM XA) - // 55, 56, 57, 58, - - // XorrISO - 3688, 3686, 3686, 3686, 3673, 3673, 3673, 3686, 3675, 3673, 3673, 3675 - }; - - readonly int[] _clusterSize = - { - // Toast 3.5.7 - 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, - - // Toast 4.1.3 - 2048, - - // Toast 4.0.3 - 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, - - // Toast 4.0.3 (CD-ROM XA) - // 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, - // mkisofs - 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, - 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, - - // Nero MAX - 2048, 2048, 2048, 2048, - - // Nero MAX (CD-ROM XA) - // 2048, 2048, 2048, 2048, - - // XorrISO - 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048 - }; - - readonly string[] _volumeName = - { - // Toast 3.5.7 - "DISK_UTILS", "DISK_UTILS", "DISK_UTILS", "DISK_UTILS", "DISK_UTILS", "Disk utils", "Disk utils", - "Disk utils", "Disk utils", "DISK_UTILS", "DISK_UTILS", "DISK_UTILS", "DISK_UTILS", "Disk utils", - "Disk utils", "DISK_UTILS", - - // Toast 4.1.3 - "DISK_UTILS", - - // Toast 4.0.3 - "UNTITLED_CD", "UNTITLED_CD", "UNTITLED_CD", "Untitled CD", "UNTITLED_CD", "Untitled CD", "Untitled CD", - "Untitled CD", "Untitled CD", - - // Toast 4.0.3 (CD-ROM XA) - // "UNTITLED_CD", "UNTITLED_CD", "UNTITLED_CD", "UNTITLED_CD", "UNTITLED_CD", "UNTITLED_CD", "UNTITLED_CD", - // "UNTITLED_CD", "UNTITLED_CD", - // mkisofs - "test", "test", "test", "test", "CDROM", "CDROM", "CDROM", "CDROM", "CDROM", "CDROM", "CDROM", "CDROM", - "CDROM", "CDROM", "CDROM", "test", "test", "test", "test", "test", "test", "test", "test", "CDROM", "CDROM", - "test", "CDROM", "test", "test", "test", "test", "test", - - // Nero MAX - "Root", "Root", "Root", "Root", - - // Nero MAX (CD-ROM XA) - // "Root", "Root", "Root", "Root", - - // XorrISO - "test", "test", "test", "test", "test", "test", "test", "test", "test", "test", "test", "test" - }; - - readonly string[] _volumeSerial = - { - // Toast 3.5.7 - null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, - - // Toast 4.1.3 - null, - - // Toast 4.0.3 - null, null, null, null, null, null, null, null, null, null, - - // Toast 4.0.3 (CD-ROM XA) - // null, null, null, null, null, null, null, null, - // mkisofs - null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, null, null, null, - - // Nero MAX - null, null, null, null, - - // Nero MAX (CD-ROM XA) - // null, null, null, null, - - // XorrISO - null, null, null, null, null, null, null, null, null, null, null, null - }; - - readonly string[] _sysid = - { - // Toast 3.5.7 - "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", - "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", - "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", - "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", - "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", - "APPLE COMPUTER, INC., TYPE: 0002", - - // Toast 4.1.3 - "APPLE COMPUTER, INC., TYPE: 0002", - - // Toast 4.0.3 - "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", - "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", - "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", - - // Toast 4.0.3 (CD-ROM XA) - // "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", - // "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", - // "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", - // mkisofs - "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", - "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", - "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", - - // Nero MAX - "", "", "", "", - - // Nero MAX (CD-ROM XA) - // "", "", "", "", - - // XorrISO - "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" - }; - - readonly string[] _appid = + public override string[] _appId => new[] { // Toast 3.5.7 "TOAST ISO 9660 BUILDER COPYRIGHT (C) 1997 ADAPTEC, INC. - HAVE A NICE DAY", @@ -416,40 +270,184 @@ namespace Aaru.Tests.Filesystems "", "", "", "", "", "", "", "", "", "", "", "" }; - [Test] - public void Test() + public override bool[] _bootable => new[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "ISO9660", _testFiles[i]); - IFilter filter = new ZZZNoFilter(); - filter.Open(location); - IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), $"{_testFiles[i]}: Open()"); - Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, $"{_testFiles[i]}: MediaType"); - Assert.AreEqual(_sectors[i], image.Info.Sectors, $"{_testFiles[i]}: Sectors"); - Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, $"{_testFiles[i]}: SectorSize"); - IFilesystem fs = new ISO9660(); + // Toast 3.5.7 + false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, + false, - var wholePart = new Partition - { - Name = "Whole device", - Length = image.Info.Sectors, - Size = image.Info.Sectors * image.Info.SectorSize - }; + // Toast 4.1.3 + false, - Assert.AreEqual(true, fs.Identify(image, wholePart), $"{_testFiles[i]}: Identify()"); - fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, $"{_testFiles[i]}: Clusters"); - Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, $"{_testFiles[i]}: ClusterSize"); - Assert.AreEqual("ISO9660", fs.XmlFsType.Type, $"{_testFiles[i]}: Type"); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, $"{_testFiles[i]}: VolumeName"); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, $"{_testFiles[i]}: VolumeSerial"); - Assert.AreEqual(_sysid[i], fs.XmlFsType.SystemIdentifier, $"{_testFiles[i]}: SystemIdentifier"); + // Toast 4.0.3 + false, false, false, false, false, false, false, false, false, - Assert.AreEqual(_appid[i], fs.XmlFsType.ApplicationIdentifier, - $"{_testFiles[i]}: ApplicationIdentifier"); - } - } + // Toast 4.0.3 (CD-ROM XA) + // false, false, false, false, false, false, false, false, false, + // mkisofs + false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, + false, false, + + // Nero MAX + false, false, false, false, + + // Nero MAX (CD-ROM XA) + // false, false, false, false, + + // XorrISO + false, false, false, false, false, false, false, false, false, false, false, false + }; + + public override long[] _clusters => new long[] + { + // Toast 3.5.7 + 946, 946, 244, 946, 244, 951, 249, 946, 244, 946, 946, 244, 244, 951, 249, 244, + + // Toast 4.1.3 + 948, + + // Toast 4.0.3 + 305, 305, 220, 954, 220, 323, 234, 305, 220, + + // Toast 4.0.3 (CD-ROM XA) + // 10, 11, 12, 13, 14, 15, 16, 17, 18, + // mkisofs + 3662, 3606, 3800, 3800, 2983, 2531, 2983, 2531, 2983, 2531, 2894, 2894, 106589, 105241, 5055, 3651, 3651, + 3651, 3651, 3637, 3637, 3637, 3689, 7481, 7487, 3693, 7487, 3925, 3637, 3637, 3637, 3693, + + // Nero MAX + 389, 417, 257, 266, + + // Nero MAX (CD-ROM XA) + // 55, 56, 57, 58, + + // XorrISO + 3688, 3686, 3686, 3686, 3673, 3673, 3673, 3686, 3675, 3673, 3673, 3675 + }; + + public override uint[] _clusterSize => new uint[] + { + // Toast 3.5.7 + 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, + + // Toast 4.1.3 + 2048, + + // Toast 4.0.3 + 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, + + // Toast 4.0.3 (CD-ROM XA) + // 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, + // mkisofs + 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, + 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, + + // Nero MAX + 2048, 2048, 2048, 2048, + + // Nero MAX (CD-ROM XA) + // 2048, 2048, 2048, 2048, + + // XorrISO + 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048 + }; + public override string[] _oemId => new[] + { + // Toast 3.5.7 + "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", + "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", + "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", + "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", + "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", + "APPLE COMPUTER, INC., TYPE: 0002", + + // Toast 4.1.3 + "APPLE COMPUTER, INC., TYPE: 0002", + + // Toast 4.0.3 + "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", + "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", + "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", + + // Toast 4.0.3 (CD-ROM XA) + // "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", + // "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", + // "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", "APPLE COMPUTER, INC., TYPE: 0002", + // mkisofs + "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", + "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", + "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", "LINUX", + + // Nero MAX + "", "", "", "", + + // Nero MAX (CD-ROM XA) + // "", "", "", "", + + // XorrISO + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" + }; + + public override string[] _type => null; + + public override string[] _volumeName => new[] + { + // Toast 3.5.7 + "DISK_UTILS", "DISK_UTILS", "DISK_UTILS", "DISK_UTILS", "DISK_UTILS", "Disk utils", "Disk utils", + "Disk utils", "Disk utils", "DISK_UTILS", "DISK_UTILS", "DISK_UTILS", "DISK_UTILS", "Disk utils", + "Disk utils", "DISK_UTILS", + + // Toast 4.1.3 + "DISK_UTILS", + + // Toast 4.0.3 + "UNTITLED_CD", "UNTITLED_CD", "UNTITLED_CD", "Untitled CD", "UNTITLED_CD", "Untitled CD", "Untitled CD", + "Untitled CD", "Untitled CD", + + // Toast 4.0.3 (CD-ROM XA) + // "UNTITLED_CD", "UNTITLED_CD", "UNTITLED_CD", "UNTITLED_CD", "UNTITLED_CD", "UNTITLED_CD", "UNTITLED_CD", + // "UNTITLED_CD", "UNTITLED_CD", + // mkisofs + "test", "test", "test", "test", "CDROM", "CDROM", "CDROM", "CDROM", "CDROM", "CDROM", "CDROM", "CDROM", + "CDROM", "CDROM", "CDROM", "test", "test", "test", "test", "test", "test", "test", "test", "CDROM", "CDROM", + "test", "CDROM", "test", "test", "test", "test", "test", + + // Nero MAX + "Root", "Root", "Root", "Root", + + // Nero MAX (CD-ROM XA) + // "Root", "Root", "Root", "Root", + + // XorrISO + "test", "test", "test", "test", "test", "test", "test", "test", "test", "test", "test", "test" + }; + + public override string[] _volumeSerial => new string[] + { + // Toast 3.5.7 + null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, + + // Toast 4.1.3 + null, + + // Toast 4.0.3 + null, null, null, null, null, null, null, null, null, null, + + // Toast 4.0.3 (CD-ROM XA) + // null, null, null, null, null, null, null, null, + // mkisofs + null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, null, null, + + // Nero MAX + null, null, null, null, + + // Nero MAX (CD-ROM XA) + // null, null, null, null, + + // XorrISO + null, null, null, null, null, null, null, null, null, null, null, null + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/JFS2.cs b/Aaru.Tests/Filesystems/JFS2.cs index cddd554ab..42c8dd92e 100644 --- a/Aaru.Tests/Filesystems/JFS2.cs +++ b/Aaru.Tests/Filesystems/JFS2.cs @@ -26,92 +26,72 @@ // 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 { [TestFixture] - public class Jfs2 + public class Jfs2 : FilesystemTest { - readonly string[] _testFiles = + public Jfs2() : base("JFS filesystem") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "JFS2"); + public override IFilesystem _plugin => new JFS(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "linux.aif", "linux_caseinsensitive.aif", "ecs20_fstester.aif", "linux_4.19_jfs_flashdrive.aif", "linux_4.19_jfs_os2_flashdrive.aif" }; - readonly ulong[] _sectors = + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, + MediaType.GENERIC_HDD + }; + public override ulong[] _sectors => new ulong[] { 262144, 262144, 1024000, 1024000, 1024000 }; - 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[] + { + true, true, true, true, true + }; + + public override long[] _clusters => new long[] { 257632, 257632, 1017512, 1017416, 1017416 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 4096, 4096, 4096, 4096, 4096 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "Volume labe", "Volume labe", "Volume labe", "DicSetter", "DicSetter" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "8033b783-0cd1-1645-8ecc-f8f113ad6a47", "d6cd91e9-3899-7e40-8468-baab688ee2e2", "f4077ce9-0000-0000-0000-000000007c10", "91746c77-eb51-7441-85e2-902c925969f8", "08fc8e22-0201-894e-89c9-31ec3f546203" }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "JFS2", _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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new JFS(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "0x83" || - partitions[j].Type == "0x07") - { - 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("JFS filesystem", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/LisaFS.cs b/Aaru.Tests/Filesystems/LisaFS.cs index ee68951e9..469daa878 100644 --- a/Aaru.Tests/Filesystems/LisaFS.cs +++ b/Aaru.Tests/Filesystems/LisaFS.cs @@ -29,17 +29,22 @@ using System.IO; using Aaru.CommonTypes; using Aaru.CommonTypes.Interfaces; -using Aaru.DiscImages; using Aaru.Filesystems.LisaFS; -using Aaru.Filters; using NUnit.Framework; namespace Aaru.Tests.Filesystems { [TestFixture] - public class LisaFs + public class LisaFs : FilesystemTest { - readonly string[] _testFiles = + public LisaFs() : base("LisaFS") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", + "Apple Lisa filesystem"); + public override IFilesystem _plugin => new LisaFS(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] { "166files.dc42.lz", "222files.dc42.lz", "blank2.0.dc42.lz", "blank-disk.dc42.lz", "file-with-a-password.dc42.lz", "tfwdndrc-has-been-erased.dc42.lz", "tfwdndrc-has-been-restored.dc42.lz", @@ -50,7 +55,7 @@ namespace Aaru.Tests.Filesystems "lisafs3.dc42.lz", "lisafs3_with_desktop.dc42.lz" }; - readonly MediaType[] _mediaTypes = + public override MediaType[] _mediaTypes => new[] { MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, @@ -58,79 +63,48 @@ namespace Aaru.Tests.Filesystems MediaType.AppleFileWare, MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 1702, 800, 800, 800 }; - 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 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, + false + }; + + public override long[] _clusters => new long[] { 800, 800, 792, 800, 800, 800, 800, 800, 800, 800, 800, 800, 1684, 792, 800, 800 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "166Files", "222Files", "AOS 4:59 pm 10/02/87", "AOS 3.0", "AOS 3.0", "AOS 3.0", "AOS 3.0", "AOS 3.0", "AOS 3.0", "AOS 3.0", "AOS 3.0", "AOS 3.0", "AOS 4:15 pm 5/06/1983", "Office System 1 2.0", "Office System 1 3.0", "AOS 3.0" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "A23703A202010663", "A23703A201010663", "A32D261301010663", "A22CB48D01010663", "A22CC3A702010663", "A22CB48D14010663", "A22CB48D14010663", "A22CB48D01010663", "A22CB48D01010663", "A22CB48D01010663", "A22CB48D01010663", "A22CB48D01010663", "9924151E190001E1", "9497F10016010D10", "9CF9CF89070100A8", "A4FE1A191F011652" }; - - readonly string[] _oemId = - { - null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple Lisa filesystem", - _testFiles[i]); - - IFilter filter = new LZip(); - filter.Open(location); - IMediaImage image = new DiskCopy42(); - 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 LisaFS(); - - 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("LisaFS", 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/Locus.cs b/Aaru.Tests/Filesystems/Locus.cs index e311f33c4..fea2ffdb6 100644 --- a/Aaru.Tests/Filesystems/Locus.cs +++ b/Aaru.Tests/Filesystems/Locus.cs @@ -29,93 +29,65 @@ using System.IO; using Aaru.CommonTypes; using Aaru.CommonTypes.Interfaces; -using Aaru.DiscImages; -using Aaru.Filters; using NUnit.Framework; namespace Aaru.Tests.Filesystems { [TestFixture] - public class Locus + public class Locus : FilesystemTest { - readonly string[] _testFiles = + public Locus() : base("Locus filesystem") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Locus filesystem"); + public override IFilesystem _plugin => new Aaru.Filesystems.Locus(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] { "mf2dd.img.lz", "mf2hd.img.lz" }; - readonly MediaType[] _mediaTypes = + public override MediaType[] _mediaTypes => new[] { MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 1440, 2880 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false + }; + + public override long[] _clusters => new long[] { 180, 360 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 4096, 4096 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "Label", "Label" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new string[] { null, null }; - - readonly string[] _oemId = - { - null, null - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Locus 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 Aaru.Filesystems.Locus(); - - 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("Locus filesystem", 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/MFS.cs b/Aaru.Tests/Filesystems/MFS.cs index 6a7089b4b..9a0cb0e68 100644 --- a/Aaru.Tests/Filesystems/MFS.cs +++ b/Aaru.Tests/Filesystems/MFS.cs @@ -29,90 +29,69 @@ 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 { [TestFixture] - public class Mfs + public class Mfs : FilesystemTest { - readonly string[] _testFiles = + public Mfs() : base("MFS") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", + "Macintosh File System"); + public override IFilesystem _plugin => new AppleMFS(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] { "macos_0.1_mf1dd.img.lz", "macos_0.5_mf1dd.img.lz", "macos_1.1_mf1dd.img.lz", "macos_2.0_mf1dd.img.lz", "macos_6.0.7_mf1dd.img.lz" }; - readonly MediaType[] _mediaTypes = + public override MediaType[] _mediaTypes => new[] { MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 800, 800, 800, 800, 800 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512, 512, 512, 512, 512, 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false, false, false, false, false, false + }; + + public override long[] _clusters => new long[] { 391, 391, 391, 391, 391 }; - 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[] { "Volume label", "Volume label", "Volume label", "Volume label", "Volume label" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new string[] { null, null, null, null, null, null, null }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Macintosh 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 AppleMFS(); - - 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("MFS", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/MINIX/V1/MBR.cs b/Aaru.Tests/Filesystems/MINIX/V1/MBR.cs index 725684ae3..22fae6463 100644 --- a/Aaru.Tests/Filesystems/MINIX/V1/MBR.cs +++ b/Aaru.Tests/Filesystems/MINIX/V1/MBR.cs @@ -26,85 +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.MINIX.V1 { [TestFixture] - public class MBR + public class MBR : FilesystemTest { - readonly string[] _testFiles = + public MBR() : base(null) {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v1 filesystem (MBR)"); + public override IFilesystem _plugin => new MinixFS(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "linux.aif", "minix_3.1.2a.aif", "linux_4.19_minix1_flashdrive.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 262144, 102400, 131072 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512, 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false, false + }; + + public override long[] _clusters => new long[] { 65535, 50399, 64512 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 1024, 1024, 1024 }; + public override string[] _oemId => null; - readonly string[] _types = + public override string[] _type => new[] { "Minix v1", "Minix 3 v1", "Minix v1" }; - - [Test] - public void Test() + public override string[] _volumeName => new string[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v1 filesystem (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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new MinixFS(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "0x80" || - partitions[j].Type == "0x81" || - partitions[j].Type == "MINIX") - { - 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(_types[i], fs.XmlFsType.Type, _testFiles[i]); - } - } + null, null, null + }; + public override string[] _volumeSerial => new string[] + { + null, null, null + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/MINIX/V1/Whole.cs b/Aaru.Tests/Filesystems/MINIX/V1/Whole.cs index f3ff6a69d..1cc893626 100644 --- a/Aaru.Tests/Filesystems/MINIX/V1/Whole.cs +++ b/Aaru.Tests/Filesystems/MINIX/V1/Whole.cs @@ -29,82 +29,70 @@ 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.MINIX.V1 { [TestFixture] - public class Whole + public class Whole : FilesystemTest { - readonly string[] _testFiles = + public Whole() : base(null) {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v1 filesystem"); + public override IFilesystem _plugin => new MinixFS(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] { "minix_3.1.2a_dsdd.img.lz", "minix_3.1.2a_dshd.img.lz", "minix_3.1.2a_mf2dd.img.lz", "minix_3.1.2a_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 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false, false, false + }; + + public override long[] _clusters => new long[] { 360, 1200, 720, 1440 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 1024, 1024, 1024, 1024 }; + public override string[] _oemId => null; - readonly string[] _types = + public override string[] _type => new[] { "Minix 3 v1", "Minix 3 v1", "Minix 3 v1", "Minix 3 v1" }; - - [Test] - public void Test() + public override string[] _volumeName => new string[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v1 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 MinixFS(); - - 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(_types[i], fs.XmlFsType.Type, _testFiles[i]); - } - } + null, null, null, null + }; + public override string[] _volumeSerial => new string[] + { + null, null, null, null + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/MINIX/V2/MBR.cs b/Aaru.Tests/Filesystems/MINIX/V2/MBR.cs index 64018e3d3..4627b12bb 100644 --- a/Aaru.Tests/Filesystems/MINIX/V2/MBR.cs +++ b/Aaru.Tests/Filesystems/MINIX/V2/MBR.cs @@ -26,84 +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.MINIX.V2 { [TestFixture] - public class MBR + public class MBR : FilesystemTest { - readonly string[] _testFiles = + public MBR() : base(null) {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v2 filesystem (MBR)"); + public override IFilesystem _plugin => new MinixFS(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "minix_3.1.2a.aif", "linux_4.19_minix2_flashdrive.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD, MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 1024000, 1024000 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false + }; + + public override long[] _clusters => new long[] { 511055, 510976 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 1024, 1024 }; + public override string[] _oemId => null; - readonly string[] _types = + public override string[] _type => new[] { "Minix 3 v2", "Minix v2" }; - - [Test] - public void Test() + public override string[] _volumeName => new string[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v2 filesystem (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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new MinixFS(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "0x81" || - partitions[j].Type == "MINIX") - { - 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(_types[i], fs.XmlFsType.Type, _testFiles[i]); - } - } + null, null + }; + public override string[] _volumeSerial => new string[] + { + null, null + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/MINIX/V2/Whole.cs b/Aaru.Tests/Filesystems/MINIX/V2/Whole.cs index bd57e61d6..2dc6e88d1 100644 --- a/Aaru.Tests/Filesystems/MINIX/V2/Whole.cs +++ b/Aaru.Tests/Filesystems/MINIX/V2/Whole.cs @@ -29,82 +29,69 @@ 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.MINIX.V2 { [TestFixture] - public class Whole + public class Whole : FilesystemTest { - readonly string[] _testFiles = + public Whole() : base(null) {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v2 filesystem"); + public override IFilesystem _plugin => new MinixFS(); + public override bool _partitions => false; + public override string[] _testFiles => new[] { "minix_3.1.2a_dsdd.img.lz", "minix_3.1.2a_dshd.img.lz", "minix_3.1.2a_mf2dd.img.lz", "minix_3.1.2a_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 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false, false, false + }; + + public override long[] _clusters => new long[] { 360, 1200, 720, 1440 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 1024, 1024, 1024, 1024 }; + public override string[] _oemId => null; - readonly string[] _types = + public override string[] _type => new[] { "Minix 3 v2", "Minix 3 v2", "Minix 3 v2", "Minix 3 v2" }; - - [Test] - public void Test() + public override string[] _volumeName => new string[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v2 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 MinixFS(); - - 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(_types[i], fs.XmlFsType.Type, _testFiles[i]); - } - } + null, null, null, null + }; + public override string[] _volumeSerial => new string[] + { + null, null, null, null + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/MINIX/V3/MBR.cs b/Aaru.Tests/Filesystems/MINIX/V3/MBR.cs index 335cb9ae2..7d59d24d5 100644 --- a/Aaru.Tests/Filesystems/MINIX/V3/MBR.cs +++ b/Aaru.Tests/Filesystems/MINIX/V3/MBR.cs @@ -26,84 +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.MINIX.V3 { [TestFixture] - public class MBR + public class MBR : FilesystemTest { - readonly string[] _testFiles = + public MBR() : base(null) {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v3 filesystem (MBR)"); + public override IFilesystem _plugin => new MinixFS(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "minix_3.1.2a.aif", "linux_4.19_minix3_flashdrive.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD, MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 4194304, 1024000 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false + }; + + public override long[] _clusters => new long[] { 523151, 510976 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 4096, 1024 }; + public override string[] _oemId => null; - readonly string[] _types = + public override string[] _type => new[] { "Minix v3", "Minix v3" }; - - [Test] - public void Test() + public override string[] _volumeName => new string[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v3 filesystem (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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new MinixFS(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "0x81" || - partitions[j].Type == "MINIX") - { - 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(_types[i], fs.XmlFsType.Type, _testFiles[i]); - } - } + null, null + }; + public override string[] _volumeSerial => new string[] + { + null, null + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/MINIX/V3/Whole.cs b/Aaru.Tests/Filesystems/MINIX/V3/Whole.cs index 616e3d154..f08edeeea 100644 --- a/Aaru.Tests/Filesystems/MINIX/V3/Whole.cs +++ b/Aaru.Tests/Filesystems/MINIX/V3/Whole.cs @@ -29,82 +29,71 @@ 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.MINIX.V3 { [TestFixture] - public class Whole + public class Whole : FilesystemTest { - readonly string[] _testFiles = + public Whole() : base(null) {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v3 filesystem"); + + public override IFilesystem _plugin => new MinixFS(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] { "minix_3.1.2a_dsdd.img.lz", "minix_3.1.2a_dshd.img.lz", "minix_3.1.2a_mf2dd.img.lz", "minix_3.1.2a_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 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false, false, false + }; + + public override long[] _clusters => new long[] { 90, 300, 180, 360 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 4096, 4096, 4096, 4096 }; + public override string[] _oemId => null; - readonly string[] _types = + public override string[] _type => new[] { "Minix v3", "Minix v3", "Minix v3", "Minix v3" }; - - [Test] - public void Test() + public override string[] _volumeName => new string[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v3 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 MinixFS(); - - 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(_types[i], fs.XmlFsType.Type, _testFiles[i]); - } - } + null, null, null, null + }; + public override string[] _volumeSerial => new string[] + { + null, null, null, null + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/NILFS2.cs b/Aaru.Tests/Filesystems/NILFS2.cs index 4244bf5c7..da9514acc 100644 --- a/Aaru.Tests/Filesystems/NILFS2.cs +++ b/Aaru.Tests/Filesystems/NILFS2.cs @@ -26,90 +26,69 @@ // 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 { [TestFixture] - public class Nilfs2 + public class Nilfs2 : FilesystemTest { - readonly string[] _testFiles = + public Nilfs2() : base("NILFS2 filesystem") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", + "New Implementation of a Log-structured File System 2"); + public override IFilesystem _plugin => new NILFS2(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "linux.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 262144 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false + }; + + public override long[] _clusters => new long[] { 32512 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 4096 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "Volume label" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "6b1ca79e-7048-a748-93a0-89c74b02cb5a" }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", - "New Implementation of a Log-structured File System 2", _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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new NILFS2(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "0x83") - { - 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("NILFS2 filesystem", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/NTFS/GPT.cs b/Aaru.Tests/Filesystems/NTFS/GPT.cs index d215fab8b..3f99abcc2 100644 --- a/Aaru.Tests/Filesystems/NTFS/GPT.cs +++ b/Aaru.Tests/Filesystems/NTFS/GPT.cs @@ -26,95 +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.Filters; using NUnit.Framework; namespace Aaru.Tests.Filesystems.NTFS { [TestFixture] - public class GPT + public class GPT : FilesystemTest { - readonly string[] _testFiles = + public GPT() : base("NTFS") {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "New Technology File System (GPT)"); + public override IFilesystem _plugin => new Aaru.Filesystems.NTFS(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "haiku_hrev51259.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 2097152 }; - 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[] { 261887 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 4096 }; + public override string[] _oemId => new string[] + { + null + }; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new string[] { null, null, null, null, null, null, null, null }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "106DA7693F7F6B3F" }; - - readonly string[] _oemId = - { - null - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", - "New Technology File System (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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new Aaru.Filesystems.NTFS(); - 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("NTFS", 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/NTFS/MBR.cs b/Aaru.Tests/Filesystems/NTFS/MBR.cs index 1c025e0ed..f6d633122 100644 --- a/Aaru.Tests/Filesystems/NTFS/MBR.cs +++ b/Aaru.Tests/Filesystems/NTFS/MBR.cs @@ -26,100 +26,77 @@ // Copyright © 2011-2021 Natalia Portillo // ****************************************************************************/ -using System.Collections.Generic; using System.IO; using Aaru.CommonTypes; using Aaru.CommonTypes.Interfaces; -using Aaru.DiscImages; -using Aaru.Filters; using NUnit.Framework; namespace Aaru.Tests.Filesystems.NTFS { [TestFixture] - public class MBR + public class MBR : FilesystemTest { - readonly string[] _testFiles = + public MBR() : base("NTFS") {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "New Technology File System (MBR)"); + + public override IFilesystem _plugin => new Aaru.Filesystems.NTFS(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "win10.aif", "win2000.aif", "winnt_3.10.aif", "winnt_3.50.aif", "winnt_3.51.aif", "winnt_4.00.aif", "winvista.aif", "linux.aif", "haiku_hrev51259.aif", "linux_4.19_ntfs3g_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 + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 524288, 2097152, 1024000, 524288, 524288, 524288, 524288, 262144, 2097152, 1024000 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 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 + }; + + public override long[] _clusters => new long[] { 65263, 1046511, 1023057, 524256, 524256, 524096, 64767, 32511, 261887, 127743 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 4096, 1024, 512, 512, 512, 512, 4096, 4096, 4096, 4096 }; - readonly string[] _volumeName = + public override string[] _oemId => new string[] + { + null, null, null, null, null, null, null, null, null, null + }; + public override string[] _type => null; + + public override string[] _volumeName => new string[] { null, null, null, null, null, null, null, null, null, null }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "C46C1B3C6C1B28A6", "8070C8EC70C8E9CC", "10CC6AC6CC6AA5A6", "7A14F50014F4BFE5", "24884447884419A6", "822C288D2C287E73", "E20AF54B0AF51D6B", "065BB96B7C1BCFDA", "46EC796749C6FA66", "1FC3802B52F9611C" }; - - readonly string[] _oemId = - { - null, null, null, null, null, null, null, null, null, null - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", - "New Technology File System (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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new Aaru.Filesystems.NTFS(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "0x07" || - - // Value incorrectly set by Haiku - partitions[j].Type == "0x86") - { - 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("NTFS", 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/PFS3.cs b/Aaru.Tests/Filesystems/PFS3.cs index fdf58141d..6a0c25729 100644 --- a/Aaru.Tests/Filesystems/PFS3.cs +++ b/Aaru.Tests/Filesystems/PFS3.cs @@ -26,96 +26,69 @@ // 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 { [TestFixture] - public class Pfs3 + public class Pfs3 : FilesystemTest { - readonly string[] _testFiles = + public Pfs3() : base("PFS v3") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", + "Professional File System 3"); + public override IFilesystem _plugin => new PFS(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "uae.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 1024128 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false + }; + + public override long[] _clusters => new long[] { 1023552 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 512 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "PFS" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new string[] { null }; - - readonly string[] _oemId = - { - null - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Professional File System 3", - _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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new PFS(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "\"PFS\\1\"") - { - 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("PFS v3", 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/ProDOS/APM.cs b/Aaru.Tests/Filesystems/ProDOS/APM.cs index 37c19ed83..241d706ee 100644 --- a/Aaru.Tests/Filesystems/ProDOS/APM.cs +++ b/Aaru.Tests/Filesystems/ProDOS/APM.cs @@ -26,92 +26,73 @@ // 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.ProDOS { [TestFixture] - public class APM + public class APM : FilesystemTest { - readonly string[] _testFiles = + public APM() : base("ProDOS") {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "ProDOS filesystem (APM)"); + + public override IFilesystem _plugin => new ProDOSPlugin(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "macos_7.5.3.aif", "macos_7.6.aif", "macos_8.0.aif", "macos_8.1.aif", "macos_9.0.4.aif", "macos_9.1.aif", "macos_9.2.1.aif", "macos_9.2.2.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 + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 49152, 49152, 49152, 49152, 49152, 49152, 49152, 49152 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512, 512, 512, 512, 512, 512, 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false, false, false, false, false, false, false + }; + + public override long[] _clusters => new long[] { 48438, 48438, 48438, 48438, 46326, 46326, 46326, 46326 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 512, 512, 512, 512, 512, 512, 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", "VOLUME.LABEL", "VOLUME.LABEL", "VOLUME.LABEL", "VOLUME.LABEL" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new string[] { null, null, null, null, null, null, null, null }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "ProDOS filesystem (APM)", - _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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new ProDOSPlugin(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "Apple_ProDOS") - { - 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("ProDOS", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/QNX4/MBR.cs b/Aaru.Tests/Filesystems/QNX4/MBR.cs index d436c3d66..977e5dba7 100644 --- a/Aaru.Tests/Filesystems/QNX4/MBR.cs +++ b/Aaru.Tests/Filesystems/QNX4/MBR.cs @@ -26,77 +26,66 @@ // Copyright © 2011-2021 Natalia Portillo // ****************************************************************************/ -using System.Collections.Generic; using System.IO; using Aaru.CommonTypes; using Aaru.CommonTypes.Interfaces; -using Aaru.DiscImages; -using Aaru.Filters; using NUnit.Framework; namespace Aaru.Tests.Filesystems.QNX4 { [TestFixture] - public class MBR + public class MBR : FilesystemTest { - readonly string[] _testFiles = + public MBR() : base("QNX4 filesystem") {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "QNX 4 filesystem (MBR)"); + public override IFilesystem _plugin => new Aaru.Filesystems.QNX4(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "qnx_4.24.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 1024000 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false + }; + + public override long[] _clusters => new long[] { 1023104 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 512 }; - - [Test] - public void Test() + public override string[] _oemId => null; + public override string[] _type => null; + public override string[] _volumeName => new string[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "QNX 4 filesystem (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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new Aaru.Filesystems.QNX4(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "0x4D") - { - 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("QNX4 filesystem", fs.XmlFsType.Type, _testFiles[i]); - } - } + null + }; + public override string[] _volumeSerial => new string[] + { + null + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/QNX4/Whole.cs b/Aaru.Tests/Filesystems/QNX4/Whole.cs index 325f46385..d31d5e00c 100644 --- a/Aaru.Tests/Filesystems/QNX4/Whole.cs +++ b/Aaru.Tests/Filesystems/QNX4/Whole.cs @@ -29,75 +29,64 @@ using System.IO; using Aaru.CommonTypes; using Aaru.CommonTypes.Interfaces; -using Aaru.DiscImages; -using Aaru.Filters; using NUnit.Framework; namespace Aaru.Tests.Filesystems.QNX4 { [TestFixture] - public class Whole + public class Whole : FilesystemTest { - readonly string[] _testFiles = + public Whole() : base("QNX4 filesystem") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "QNX 4 filesystem"); + + public override IFilesystem _plugin => new Aaru.Filesystems.QNX4(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] { "qnx_4.24_dsdd.img.lz", "qnx_4.24_dshd.img.lz", "qnx_4.24_mf2dd.img.lz", "qnx_4.24_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 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false, false, false + }; + + public override long[] _clusters => new long[] { 720, 2400, 1440, 2880 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 512, 512, 512, 512 }; - - [Test] - public void Test() + public override string[] _oemId => null; + public override string[] _type => null; + public override string[] _volumeName => new string[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "QNX 4 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 Aaru.Filesystems.QNX4(); - - 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("QNX4 filesystem", fs.XmlFsType.Type, _testFiles[i]); - } - } + null, null, null, null + }; + public override string[] _volumeSerial => new string[] + { + null, null, null, null + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/ReFS.cs b/Aaru.Tests/Filesystems/ReFS.cs index 1de610ba1..c0f360606 100644 --- a/Aaru.Tests/Filesystems/ReFS.cs +++ b/Aaru.Tests/Filesystems/ReFS.cs @@ -26,96 +26,69 @@ // 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 { [TestFixture] - public class ReFsMbr + public class ReFsMbr : FilesystemTest { - readonly string[] _testFiles = + public ReFsMbr() : base("Resilient File System") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", + "Resilient File System (MBR)"); + public override IFilesystem _plugin => new ReFS(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "win10.vdi.lz" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 67108864 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false + }; + + public override long[] _clusters => new long[] { 8372224 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 4096 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new string[] { null }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new string[] { null }; - - readonly string[] _oemId = - { - null - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Resilient File System (MBR)", - _testFiles[i]); - - IFilter filter = new LZip(); - filter.Open(location); - IMediaImage image = new Vdi(); - 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 partitions = Core.Partitions.GetAll(image); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "0x07") - { - part = j; - - break; - } - - Assert.AreNotEqual(-1, part, $"Partition not found on {_testFiles[i]}"); - IFilesystem fs = new ReFS(); - 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("Resilient File System", 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/Reiser3.cs b/Aaru.Tests/Filesystems/Reiser3.cs index f38a144ce..7e8ab4904 100644 --- a/Aaru.Tests/Filesystems/Reiser3.cs +++ b/Aaru.Tests/Filesystems/Reiser3.cs @@ -26,84 +26,72 @@ // 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 { [TestFixture] - public class Reiser3 + public class Reiser3 : FilesystemTest { - readonly string[] _testFiles = + public Reiser3() : base(null) {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", + "Reiser filesystem v3"); + public override IFilesystem _plugin => new Reiser(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "linux_r3.5.aif", "linux_r3.6.aif", "linux_4.19_reiser_3.5_flashdrive.aif", "linux_4.19_reiser_3.6_flashdrive.aif" }; - readonly ulong[] _sectors = + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD + }; + + public override ulong[] _sectors => new ulong[] { 262144, 262144, 1024000, 1024000 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512, 512, 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false, false, false + }; + + public override long[] _clusters => new long[] { 32512, 32512, 127744, 127744 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 4096, 4096, 4096, 4096 }; - - readonly string[] _reiserversion = + public override string[] _oemId => null; + public override string[] _type => new[] { "Reiser 3.5 filesystem", "Reiser 3.6 filesystem", "Reiser 3.5 filesystem", "Reiser 3.6 filesystem" }; - - [Test] - public void Test() + public override string[] _volumeName => new[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Reiser filesystem v3", - _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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new Reiser(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "0x83") - { - 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(_reiserversion[i], fs.XmlFsType.Type, _testFiles[i]); - } - } + null, "Volume label", null, "DicSetter" + }; + public override string[] _volumeSerial => new[] + { + null, "844155c0-c854-d34e-8133-26ffac2e7b5d", null, "8902ac3c-3e0c-4c4c-84ec-03405c1710f1" + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/Reiser4.cs b/Aaru.Tests/Filesystems/Reiser4.cs index 8ab8f082b..b126c3e58 100644 --- a/Aaru.Tests/Filesystems/Reiser4.cs +++ b/Aaru.Tests/Filesystems/Reiser4.cs @@ -26,89 +26,69 @@ // Copyright © 2011-2021 Natalia Portillo // ****************************************************************************/ -using System.Collections.Generic; using System.IO; using Aaru.CommonTypes; using Aaru.CommonTypes.Interfaces; -using Aaru.DiscImages; -using Aaru.Filters; using NUnit.Framework; namespace Aaru.Tests.Filesystems { [TestFixture] - public class Reiser4 + public class Reiser4 : FilesystemTest { - readonly string[] _testFiles = + public Reiser4() : base("Reiser 4 filesystem") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", + "Reiser filesystem v4"); + public override IFilesystem _plugin => new Aaru.Filesystems.Reiser4(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "linux.aif" }; - readonly ulong[] _sectors = + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD + }; + + public override ulong[] _sectors => new ulong[] { 262144 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false + }; + + public override long[] _clusters => new long[] { 32511 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 4096 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "Volume label" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "b0c1924e-6f10-8c42-b6c5-66a457896460" }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Reiser filesystem v4", - _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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new Aaru.Filesystems.Reiser4(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "0x83") - { - 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("Reiser 4 filesystem", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/SFS/MBR+RDB.cs b/Aaru.Tests/Filesystems/SFS/MBR+RDB.cs index 56d3bd331..a74506b53 100644 --- a/Aaru.Tests/Filesystems/SFS/MBR+RDB.cs +++ b/Aaru.Tests/Filesystems/SFS/MBR+RDB.cs @@ -26,89 +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.Filters; using NUnit.Framework; namespace Aaru.Tests.Filesystems.SFS { [TestFixture] - public class MBR_RDB + public class MBR_RDB : FilesystemTest { - readonly string[] _testFiles = + public MBR_RDB() : base("SmartFileSystem") {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Smart File System (MBR+RDB)"); + public override IFilesystem _plugin => new Aaru.Filesystems.SFS(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "aros.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 409600 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false + }; + + public override long[] _clusters => new long[] { 406224 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 512 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new string[] { null }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new string[] { null }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Smart File System (MBR+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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new Aaru.Filesystems.SFS(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "\"SFS\\0\"") - { - 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("SmartFileSystem", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/SFS/MBR.cs b/Aaru.Tests/Filesystems/SFS/MBR.cs index 256cfcfc5..29fe5428f 100644 --- a/Aaru.Tests/Filesystems/SFS/MBR.cs +++ b/Aaru.Tests/Filesystems/SFS/MBR.cs @@ -26,89 +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.Filters; using NUnit.Framework; namespace Aaru.Tests.Filesystems.SFS { [TestFixture] - public class MBR + public class MBR : FilesystemTest { - readonly string[] _testFiles = + public MBR() : base("SmartFileSystem") {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Smart File System (MBR)"); + public override IFilesystem _plugin => new Aaru.Filesystems.SFS(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "aros.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 409600 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false + }; + + public override long[] _clusters => new long[] { 408240 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 512 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new string[] { null }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new string[] { null }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Smart File System (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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new Aaru.Filesystems.SFS(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "0x2F") - { - 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("SmartFileSystem", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/SFS/RDB.cs b/Aaru.Tests/Filesystems/SFS/RDB.cs index 751c07fd0..18d2ae9e3 100644 --- a/Aaru.Tests/Filesystems/SFS/RDB.cs +++ b/Aaru.Tests/Filesystems/SFS/RDB.cs @@ -26,90 +26,69 @@ // Copyright © 2011-2021 Natalia Portillo // ****************************************************************************/ -using System.Collections.Generic; using System.IO; using Aaru.CommonTypes; using Aaru.CommonTypes.Interfaces; -using Aaru.DiscImages; -using Aaru.Filters; using NUnit.Framework; namespace Aaru.Tests.Filesystems.SFS { [TestFixture] - public class RDB + public class RDB : FilesystemTest { - readonly string[] _testFiles = + public RDB() : base("SmartFileSystem") {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Smart File System (RDB)"); + + public override IFilesystem _plugin => new Aaru.Filesystems.SFS(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "uae.aif", "aros.aif", "amigaos_4.0.aif", "amigaos_4.0_sfs2.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, 409600, 1024128, 1024128 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512, 512, 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false, false, false + }; + + public override long[] _clusters => new long[] { 127000, 407232, 511040, 511040 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 2048, 512, 1024, 1024 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new string[] { null, null, null, null }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new string[] { null, null, null, null }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Smart 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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new Aaru.Filesystems.SFS(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "\"SFS\\0\"" || - partitions[j].Type == "\"SFS\\2\"") - { - 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("SmartFileSystem", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/SysV/MBR.cs b/Aaru.Tests/Filesystems/SysV/MBR.cs index fc8c91f60..533d38e3c 100644 --- a/Aaru.Tests/Filesystems/SysV/MBR.cs +++ b/Aaru.Tests/Filesystems/SysV/MBR.cs @@ -26,96 +26,69 @@ // 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.SysV { [TestFixture] - public class MBR + public class MBR : FilesystemTest { - readonly string[] _testFiles = + public MBR() : base("SVR4 fs") {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "System V filesystem (MBR)"); + public override IFilesystem _plugin => new SysVfs(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "att_unix_svr4v2.1.aif", "att_unix_svr4v2.1_2k.aif", "scoopenserver_5.0.7hw.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 1024000, 1024000, 2097152 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512, 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false, false + }; + + public override long[] _clusters => new long[] { 511056, 255528, 1020096 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 1024, 2048, 1024 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "/usr3", "/usr3", "Volume label" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new string[] { null, null, null }; - - readonly string[] _type = - { - "SVR4 fs", "SVR4 fs", "SVR4 fs" - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "System V filesystem (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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new SysVfs(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "UNIX: /usr" || - partitions[j].Type == "XENIX") - { - 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(_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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/SysV/RDB.cs b/Aaru.Tests/Filesystems/SysV/RDB.cs index 9101d1843..76251a1bb 100644 --- a/Aaru.Tests/Filesystems/SysV/RDB.cs +++ b/Aaru.Tests/Filesystems/SysV/RDB.cs @@ -26,95 +26,69 @@ // 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.SysV { [TestFixture] - public class RDB + public class RDB : FilesystemTest { - readonly string[] _testFiles = + public RDB() : base("SVR4 fs") {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "System V filesystem (RDB)"); + public override IFilesystem _plugin => new SysVfs(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "amix.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 1024128 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false + }; + + public override long[] _clusters => new long[] { 511424 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 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 }; - - readonly string[] _type = - { - "SVR4 fs" - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "System V filesystem (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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new SysVfs(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "\"UNI\\1\"") - { - 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(_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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/SysV/Whole.cs b/Aaru.Tests/Filesystems/SysV/Whole.cs index dc3dee2bf..35a781f83 100644 --- a/Aaru.Tests/Filesystems/SysV/Whole.cs +++ b/Aaru.Tests/Filesystems/SysV/Whole.cs @@ -29,17 +29,23 @@ 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.SysV { [TestFixture] - public class Whole + public class Whole : FilesystemTest { - readonly string[] _testFiles = + public Whole() : base("SVR4 fs") {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "System V filesystem"); + + public override IFilesystem _plugin => new SysVfs(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] { "amix.adf.lz", "att_unix_svr4v2.1_dsdd.img.lz", "att_unix_svr4v2.1_mf2dd.img.lz", "att_unix_svr4v2.1_mf2hd.img.lz", "scoopenserver_5.0.7hw_dmf.img.lz", "scoopenserver_5.0.7hw_dshd.img.lz", @@ -47,79 +53,48 @@ namespace Aaru.Tests.Filesystems.SysV "scoopenserver_5.0.7hw_mf2hd.img.lz" }; - readonly MediaType[] _mediaTypes = + public override MediaType[] _mediaTypes => new[] { MediaType.CBM_AMIGA_35_DD, MediaType.DOS_525_DS_DD_9, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, 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[] { 1760, 720, 1440, 2880, 3360, 2400, 1440, 5760, 2880 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512, 512, 512, 512, 512, 512, 512, 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false, false, false, false, false, false, false, false + }; + + public override long[] _clusters => new long[] { 880, 360, 720, 1440, 1680, 1200, 720, 2880, 1440 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 1024, 1024, 1024, 1024, 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, null, null, null, null }; - - readonly string[] _type = - { - "SVR4 fs", "SVR4 fs", "SVR4 fs", "SVR4 fs", "SVR4 fs", "SVR4 fs", "SVR4 fs", "SVR4 fs", "SVR4 fs" - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "System V 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/UDF/1.02/Whole.cs b/Aaru.Tests/Filesystems/UDF/1.02/Whole.cs index 60fee6844..ab88889dc 100644 --- a/Aaru.Tests/Filesystems/UDF/1.02/Whole.cs +++ b/Aaru.Tests/Filesystems/UDF/1.02/Whole.cs @@ -29,112 +29,73 @@ using System.IO; using Aaru.CommonTypes; using Aaru.CommonTypes.Interfaces; -using Aaru.DiscImages; -using Aaru.Filters; using NUnit.Framework; namespace Aaru.Tests.Filesystems.UDF._102 { [TestFixture] - public class Whole + public class Whole : FilesystemTest { - readonly string[] _testFiles = + public Whole() : base(null) {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Universal Disc Format", "1.02"); + public override IFilesystem _plugin => new Aaru.Filesystems.UDF(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] { - "1.02/linux.aif", "1.02/macosx_10.11.aif", "1.50/linux.aif", "1.50/macosx_10.11.aif", "2.00/linux.aif", - "2.00/macosx_10.11.aif", "2.01/linux.aif", "2.01/macosx_10.11.aif", "2.50/linux.aif", - "2.50/macosx_10.11.aif", "2.60/macosx_10.11.aif", "1.50/solaris_7.aif", "1.50/solaris_9.aif", - "2.01/netbsd_7.1.aif", "1.02/linux_4.19_udf_1.02_flashdrive.aif", "1.50/linux_4.19_udf_1.50_flashdrive.aif", - "2.00/linux_4.19_udf_2.00_flashdrive.aif", "2.01/linux_4.19_udf_2.01_flashdrive.aif" + "linux.aif", "macosx_10.11.aif", "linux_4.19_udf_1.02_flashdrive.aif" + }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { - 1024000, 204800, 1024000, 409600, 1024000, 614400, 1024000, 819200, 1024000, 1024000, 1228800, 8388608, - 8388608, 8388608, 1024000, 1024000, 1024000, 1024000 + 1024000, 204800, 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 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] { - 1024000, 204800, 1024000, 409600, 1024000, 614400, 1024000, 819200, 1024000, 1024000, 1228800, 8388608, - 8388608, 8388608, 1024000, 1024000, 1024000, 1024000 + false, false, false }; - readonly int[] _clusterSize = + public override long[] _clusters => new long[] { - 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512 + 1024000, 204800, 1024000 }; - readonly string[] _udfversion = + public override uint[] _clusterSize => new uint[] { - "UDF v1.02", "UDF v1.02", "UDF v1.50", "UDF v1.50", "UDF v2.00", "UDF v2.00", "UDF v2.01", "UDF v2.01", - "UDF v2.50", "UDF v2.50", "UDF v2.60", "UDF v1.50", "UDF v1.50", "UDF v2.01", "UDF v2.01", "UDF v2.01", - "UDF v2.01", "UDF v2.01" + 512, 512, 512 }; - readonly string[] _volumeName = + public override string[] _oemId => new[] { - "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", - "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "*NoLabel*", "*NoLabel*", - "anonymous", "DicSetter", "DicSetter", "DicSetter", "DicSetter", "DicSetter", "DicSetter" + "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS" }; - readonly string[] _volumeSerial = + public override string[] _type => new[] { - "595c5cfa38ce8b66LinuxUDF", "6D02A231 (Mac OS X newfs_udf) UDF Volume Set", "595c5d00c5b3405aLinuxUDF", - "4DD0458B (Mac OS X newfs_udf) UDF Volume Set", "595c5d07f4fc8e8dLinuxUDF", - "5D91CB4F (Mac OS X newfs_udf) UDF Volume Set", "595c5d0bee60c3bbLinuxUDF", - "48847EB3 (Mac OS X newfs_udf) UDF Volume Set", "595c5d0e4f338552LinuxUDF", - "709E84A1 (Mac OS X newfs_udf) UDF Volume Set", "78CE3237 (Mac OS X newfs_udf) UDF Volume Set", "595EB2A9", - "595EB55A", "7cc94d726669d773", "5cc7882441a86e93LinuxUDF", "5cc78f8bba4dfe00LinuxUDF", - "5cc7f4183e0d5f7aLinuxUDF", "5cc8816fcb3a3b38LinuxUDF", "595EB55A", "7cc94d726669d773" + "UDF v1.02", "UDF v1.02", "UDF v2.01" }; - readonly string[] _oemId = + public override string[] _volumeName => new[] { - "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", - "*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", - "*Apple Mac OS X UDF FS", "*Apple Mac OS X UDF FS", "*SUN SOLARIS UDF", "*SUN SOLARIS UDF", - "*NetBSD userland UDF", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS", - "*Linux UDFFS" + "Volume label", "Volume label", "DicSetter" }; - [Test] - public void Test() + public override string[] _volumeSerial => new[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Universal Disc Format", - _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]); - IFilesystem fs = new Aaru.Filesystems.UDF(); - - 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(_udfversion[i], fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSetIdentifier, _testFiles[i]); - Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); - } - } + "595c5cfa38ce8b66LinuxUDF", "6D02A231 (Mac OS X newfs_udf) UDF Volume Set", "5cc7882441a86e93LinuxUDF" + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/UDF/1.50/Optical.cs b/Aaru.Tests/Filesystems/UDF/1.50/Optical.cs index 24b87ec64..aa35d36fc 100644 --- a/Aaru.Tests/Filesystems/UDF/1.50/Optical.cs +++ b/Aaru.Tests/Filesystems/UDF/1.50/Optical.cs @@ -29,92 +29,73 @@ using System.IO; using Aaru.CommonTypes; using Aaru.CommonTypes.Interfaces; -using Aaru.DiscImages; -using Aaru.Filters; using NUnit.Framework; namespace Aaru.Tests.Filesystems.UDF._150 { [TestFixture] - public class Optical + public class Optical : FilesystemTest { - readonly string[] _testFiles = + public Optical() : base(null) {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Universal Disc Format", "1.50"); + public override IFilesystem _plugin => new Aaru.Filesystems.UDF(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] { - "1.50/ecs20.aif", "2.00/ecs20.aif", "2.01/ecs20.aif", "2.01/ecs20_cdrw.aif" + "ecs20.aif" + }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.DVDPR }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { - 2295104, 2295104, 2295104, 295264 + 2295104 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { - 2048, 2048, 2048, 2048 + 2048 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] { - 2295104, 2295104, 2295104, 295264 + false }; - readonly int[] _clusterSize = + public override long[] _clusters => new long[] { - 2048, 2048, 2048, 2048 + 2295104 }; - readonly string[] _udfversion = + public override uint[] _clusterSize => new uint[] { - "UDF v2.01", "UDF v2.01", "UDF v2.01", "UDF v2.01" + 2048 }; - readonly string[] _volumeName = + public override string[] _oemId => new[] { - "Volume label", "UDF5A5DEF48", "VolLabel", "UDF5A5DFF10" + "*ExpressUDF" }; - readonly string[] _volumeSerial = + public override string[] _type => new[] { - "Volume Set ID not specified", "Volume Set ID not specified", "VolumeSetId", "Volume Set ID not specified" + "UDF v2.01" }; - readonly string[] _oemId = + public override string[] _volumeName => new[] { - "*ExpressUDF", "*ExpressUDF", "*ExpressUDF", "*ExpressUDF" + "Volume label" }; - [Test] - public void Test() + public override string[] _volumeSerial => new[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Universal Disc Format", - _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]); - IFilesystem fs = new Aaru.Filesystems.UDF(); - - 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(_udfversion[i], fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSetIdentifier, _testFiles[i]); - Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); - } - } + "Volume Set ID not specified" + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/UDF/1.50/Whole.cs b/Aaru.Tests/Filesystems/UDF/1.50/Whole.cs index 0b07c038d..ffdbbeca4 100644 --- a/Aaru.Tests/Filesystems/UDF/1.50/Whole.cs +++ b/Aaru.Tests/Filesystems/UDF/1.50/Whole.cs @@ -29,112 +29,74 @@ using System.IO; using Aaru.CommonTypes; using Aaru.CommonTypes.Interfaces; -using Aaru.DiscImages; -using Aaru.Filters; using NUnit.Framework; namespace Aaru.Tests.Filesystems.UDF._150 { [TestFixture] - public class Whole + public class Whole : FilesystemTest { - readonly string[] _testFiles = + public Whole() : base(null) {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Universal Disc Format", "1.50"); + public override IFilesystem _plugin => new Aaru.Filesystems.UDF(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] { - "1.02/linux.aif", "1.02/macosx_10.11.aif", "1.50/linux.aif", "1.50/macosx_10.11.aif", "2.00/linux.aif", - "2.00/macosx_10.11.aif", "2.01/linux.aif", "2.01/macosx_10.11.aif", "2.50/linux.aif", - "2.50/macosx_10.11.aif", "2.60/macosx_10.11.aif", "1.50/solaris_7.aif", "1.50/solaris_9.aif", - "2.01/netbsd_7.1.aif", "1.02/linux_4.19_udf_1.02_flashdrive.aif", "1.50/linux_4.19_udf_1.50_flashdrive.aif", - "2.00/linux_4.19_udf_2.00_flashdrive.aif", "2.01/linux_4.19_udf_2.01_flashdrive.aif" + "linux.aif", "macosx_10.11.aif", "solaris_9.aif", "linux_4.19_udf_1.50_flashdrive.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[] { - 1024000, 204800, 1024000, 409600, 1024000, 614400, 1024000, 819200, 1024000, 1024000, 1228800, 8388608, - 8388608, 8388608, 1024000, 1024000, 1024000, 1024000 + 1024000, 409600, 8388608, 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 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] { - 1024000, 204800, 1024000, 409600, 1024000, 614400, 1024000, 819200, 1024000, 1024000, 1228800, 8388608, - 8388608, 8388608, 1024000, 1024000, 1024000, 1024000 + false, false, false, false }; - readonly int[] _clusterSize = + public override long[] _clusters => new long[] { - 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512 + 1024000, 409600, 8388608, 1024000 }; - readonly string[] _udfversion = + public override uint[] _clusterSize => new uint[] { - "UDF v1.02", "UDF v1.02", "UDF v1.50", "UDF v1.50", "UDF v2.00", "UDF v2.00", "UDF v2.01", "UDF v2.01", - "UDF v2.50", "UDF v2.50", "UDF v2.60", "UDF v1.50", "UDF v1.50", "UDF v2.01", "UDF v2.01", "UDF v2.01", - "UDF v2.01", "UDF v2.01" + 512, 512, 512, 512 }; - readonly string[] _volumeName = + public override string[] _oemId => new[] { - "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", - "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "*NoLabel*", "*NoLabel*", - "anonymous", "DicSetter", "DicSetter", "DicSetter", "DicSetter", "DicSetter", "DicSetter" + "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*SUN SOLARIS UDF", "*Linux UDFFS" }; - readonly string[] _volumeSerial = + public override string[] _type => new[] { - "595c5cfa38ce8b66LinuxUDF", "6D02A231 (Mac OS X newfs_udf) UDF Volume Set", "595c5d00c5b3405aLinuxUDF", - "4DD0458B (Mac OS X newfs_udf) UDF Volume Set", "595c5d07f4fc8e8dLinuxUDF", - "5D91CB4F (Mac OS X newfs_udf) UDF Volume Set", "595c5d0bee60c3bbLinuxUDF", - "48847EB3 (Mac OS X newfs_udf) UDF Volume Set", "595c5d0e4f338552LinuxUDF", - "709E84A1 (Mac OS X newfs_udf) UDF Volume Set", "78CE3237 (Mac OS X newfs_udf) UDF Volume Set", "595EB2A9", - "595EB55A", "7cc94d726669d773", "5cc7882441a86e93LinuxUDF", "5cc78f8bba4dfe00LinuxUDF", - "5cc7f4183e0d5f7aLinuxUDF", "5cc8816fcb3a3b38LinuxUDF", "595EB55A", "7cc94d726669d773" + "UDF v1.50", "UDF v1.50", "UDF v1.50", "UDF v2.01" }; - readonly string[] _oemId = + public override string[] _volumeName => new[] { - "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", - "*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", - "*Apple Mac OS X UDF FS", "*Apple Mac OS X UDF FS", "*SUN SOLARIS UDF", "*SUN SOLARIS UDF", - "*NetBSD userland UDF", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS", - "*Linux UDFFS" + "Volume label", "Volume label", "*NoLabel*", "DicSetter" }; - [Test] - public void Test() + public override string[] _volumeSerial => new[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Universal Disc Format", - _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]); - IFilesystem fs = new Aaru.Filesystems.UDF(); - - 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(_udfversion[i], fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSetIdentifier, _testFiles[i]); - Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); - } - } + "595c5d00c5b3405aLinuxUDF", "4DD0458B (Mac OS X newfs_udf) UDF Volume Set", "595EB55A", + "5cc78f8bba4dfe00LinuxUDF" + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/UDF/2.00/Optical.cs b/Aaru.Tests/Filesystems/UDF/2.00/Optical.cs index e768ae934..86c79f944 100644 --- a/Aaru.Tests/Filesystems/UDF/2.00/Optical.cs +++ b/Aaru.Tests/Filesystems/UDF/2.00/Optical.cs @@ -29,92 +29,73 @@ using System.IO; using Aaru.CommonTypes; using Aaru.CommonTypes.Interfaces; -using Aaru.DiscImages; -using Aaru.Filters; using NUnit.Framework; namespace Aaru.Tests.Filesystems.UDF._200 { [TestFixture] - public class Optical + public class Optical : FilesystemTest { - readonly string[] _testFiles = + public Optical() : base(null) {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Universal Disc Format", "2.00"); + public override IFilesystem _plugin => new Aaru.Filesystems.UDF(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] { - "1.50/ecs20.aif", "2.00/ecs20.aif", "2.01/ecs20.aif", "2.01/ecs20_cdrw.aif" + "ecs20.aif" + }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.DVDPR }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { - 2295104, 2295104, 2295104, 295264 + 2295104 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { - 2048, 2048, 2048, 2048 + 2048 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] { - 2295104, 2295104, 2295104, 295264 + false }; - readonly int[] _clusterSize = + public override long[] _clusters => new long[] { - 2048, 2048, 2048, 2048 + 2295104 }; - readonly string[] _udfversion = + public override uint[] _clusterSize => new uint[] { - "UDF v2.01", "UDF v2.01", "UDF v2.01", "UDF v2.01" + 2048 }; - readonly string[] _volumeName = + public override string[] _oemId => new[] { - "Volume label", "UDF5A5DEF48", "VolLabel", "UDF5A5DFF10" + "*ExpressUDF" }; - readonly string[] _volumeSerial = + public override string[] _type => new[] { - "Volume Set ID not specified", "Volume Set ID not specified", "VolumeSetId", "Volume Set ID not specified" + "UDF v2.01" }; - readonly string[] _oemId = + public override string[] _volumeName => new[] { - "*ExpressUDF", "*ExpressUDF", "*ExpressUDF", "*ExpressUDF" + "UDF5A5DEF48" }; - [Test] - public void Test() + public override string[] _volumeSerial => new[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Universal Disc Format", - _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]); - IFilesystem fs = new Aaru.Filesystems.UDF(); - - 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(_udfversion[i], fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSetIdentifier, _testFiles[i]); - Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); - } - } + "Volume Set ID not specified" + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/UDF/2.00/Whole.cs b/Aaru.Tests/Filesystems/UDF/2.00/Whole.cs index 53849a690..fb8961824 100644 --- a/Aaru.Tests/Filesystems/UDF/2.00/Whole.cs +++ b/Aaru.Tests/Filesystems/UDF/2.00/Whole.cs @@ -29,112 +29,74 @@ using System.IO; using Aaru.CommonTypes; using Aaru.CommonTypes.Interfaces; -using Aaru.DiscImages; -using Aaru.Filters; using NUnit.Framework; namespace Aaru.Tests.Filesystems.UDF._200 { [TestFixture] - public class Whole + public class Whole : FilesystemTest { - readonly string[] _testFiles = + public Whole() : base(null) {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Universal Disc Format", "2.00"); + public override IFilesystem _plugin => new Aaru.Filesystems.UDF(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] { - "1.02/linux.aif", "1.02/macosx_10.11.aif", "1.50/linux.aif", "1.50/macosx_10.11.aif", "2.00/linux.aif", - "2.00/macosx_10.11.aif", "2.01/linux.aif", "2.01/macosx_10.11.aif", "2.50/linux.aif", - "2.50/macosx_10.11.aif", "2.60/macosx_10.11.aif", "1.50/solaris_7.aif", "1.50/solaris_9.aif", - "2.01/netbsd_7.1.aif", "1.02/linux_4.19_udf_1.02_flashdrive.aif", "1.50/linux_4.19_udf_1.50_flashdrive.aif", - "2.00/linux_4.19_udf_2.00_flashdrive.aif", "2.01/linux_4.19_udf_2.01_flashdrive.aif" + "linux.aif", "macosx_10.11.aif", "linux_4.19_udf_2.00_flashdrive.aif" + }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { - 1024000, 204800, 1024000, 409600, 1024000, 614400, 1024000, 819200, 1024000, 1024000, 1228800, 8388608, - 8388608, 8388608, 1024000, 1024000, 1024000, 1024000 + 1024000, 614400, 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 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] { - 1024000, 204800, 1024000, 409600, 1024000, 614400, 1024000, 819200, 1024000, 1024000, 1228800, 8388608, - 8388608, 8388608, 1024000, 1024000, 1024000, 1024000 + false, false, false }; - readonly int[] _clusterSize = + public override long[] _clusters => new long[] { - 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512 + 1024000, 614400, 1024000 }; - readonly string[] _udfversion = + public override uint[] _clusterSize => new uint[] { - "UDF v1.02", "UDF v1.02", "UDF v1.50", "UDF v1.50", "UDF v2.00", "UDF v2.00", "UDF v2.01", "UDF v2.01", - "UDF v2.50", "UDF v2.50", "UDF v2.60", "UDF v1.50", "UDF v1.50", "UDF v2.01", "UDF v2.01", "UDF v2.01", - "UDF v2.01", "UDF v2.01" + 512, 512, 512 }; - readonly string[] _volumeName = + public override string[] _oemId => new[] { - "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", - "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "*NoLabel*", "*NoLabel*", - "anonymous", "DicSetter", "DicSetter", "DicSetter", "DicSetter", "DicSetter", "DicSetter" + "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS" }; - readonly string[] _volumeSerial = + public override string[] _type => new[] + { - "595c5cfa38ce8b66LinuxUDF", "6D02A231 (Mac OS X newfs_udf) UDF Volume Set", "595c5d00c5b3405aLinuxUDF", - "4DD0458B (Mac OS X newfs_udf) UDF Volume Set", "595c5d07f4fc8e8dLinuxUDF", - "5D91CB4F (Mac OS X newfs_udf) UDF Volume Set", "595c5d0bee60c3bbLinuxUDF", - "48847EB3 (Mac OS X newfs_udf) UDF Volume Set", "595c5d0e4f338552LinuxUDF", - "709E84A1 (Mac OS X newfs_udf) UDF Volume Set", "78CE3237 (Mac OS X newfs_udf) UDF Volume Set", "595EB2A9", - "595EB55A", "7cc94d726669d773", "5cc7882441a86e93LinuxUDF", "5cc78f8bba4dfe00LinuxUDF", - "5cc7f4183e0d5f7aLinuxUDF", "5cc8816fcb3a3b38LinuxUDF", "595EB55A", "7cc94d726669d773" + "UDF v2.00", "UDF v2.00", "UDF v2.01" }; - readonly string[] _oemId = + public override string[] _volumeName => new[] { - "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", - "*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", - "*Apple Mac OS X UDF FS", "*Apple Mac OS X UDF FS", "*SUN SOLARIS UDF", "*SUN SOLARIS UDF", - "*NetBSD userland UDF", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS", - "*Linux UDFFS" + "Volume label", "Volume label", "DicSetter" }; - [Test] - public void Test() + public override string[] _volumeSerial => new[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Universal Disc Format", - _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]); - IFilesystem fs = new Aaru.Filesystems.UDF(); - - 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(_udfversion[i], fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSetIdentifier, _testFiles[i]); - Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); - } - } + "595c5d07f4fc8e8dLinuxUDF", "5D91CB4F (Mac OS X newfs_udf) UDF Volume Set", "5cc7f4183e0d5f7aLinuxUDF" + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/UDF/2.01/Optical.cs b/Aaru.Tests/Filesystems/UDF/2.01/Optical.cs index d84938a7c..1f087e172 100644 --- a/Aaru.Tests/Filesystems/UDF/2.01/Optical.cs +++ b/Aaru.Tests/Filesystems/UDF/2.01/Optical.cs @@ -29,92 +29,72 @@ using System.IO; using Aaru.CommonTypes; using Aaru.CommonTypes.Interfaces; -using Aaru.DiscImages; -using Aaru.Filters; using NUnit.Framework; namespace Aaru.Tests.Filesystems.UDF._201 { [TestFixture] - public class Optical + public class Optical : FilesystemTest { - readonly string[] _testFiles = + public Optical() : base(null) {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Universal Disc Format", "2.01"); + public override IFilesystem _plugin => new Aaru.Filesystems.UDF(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] { - "1.50/ecs20.aif", "2.00/ecs20.aif", "2.01/ecs20.aif", "2.01/ecs20_cdrw.aif" + "ecs20.aif", "ecs20_cdrw.aif" + }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.DVDPR, MediaType.CDRW }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { - 2295104, 2295104, 2295104, 295264 + 2295104, 295264 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { - 2048, 2048, 2048, 2048 + 2048, 2048 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] { - 2295104, 2295104, 2295104, 295264 + false, false }; - readonly int[] _clusterSize = + public override long[] _clusters => new long[] { - 2048, 2048, 2048, 2048 + 2295104, 295264 }; - readonly string[] _udfversion = + public override uint[] _clusterSize => new uint[] { - "UDF v2.01", "UDF v2.01", "UDF v2.01", "UDF v2.01" + 2048, 2048 }; - readonly string[] _volumeName = + public override string[] _oemId => new[] { - "Volume label", "UDF5A5DEF48", "VolLabel", "UDF5A5DFF10" + "*ExpressUDF", "*ExpressUDF" + }; + public override string[] _type => new[] + { + "UDF v2.01", "UDF v2.01" }; - readonly string[] _volumeSerial = + public override string[] _volumeName => new[] { - "Volume Set ID not specified", "Volume Set ID not specified", "VolumeSetId", "Volume Set ID not specified" + "VolLabel", "UDF5A5DFF10" }; - readonly string[] _oemId = + public override string[] _volumeSerial => new[] { - "*ExpressUDF", "*ExpressUDF", "*ExpressUDF", "*ExpressUDF" + "VolumeSetId", "Volume Set ID not specified" }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Universal Disc Format", - _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]); - IFilesystem fs = new Aaru.Filesystems.UDF(); - - 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(_udfversion[i], fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSetIdentifier, _testFiles[i]); - Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/UDF/2.01/Whole.cs b/Aaru.Tests/Filesystems/UDF/2.01/Whole.cs index ac845be0c..fcd9c2d6e 100644 --- a/Aaru.Tests/Filesystems/UDF/2.01/Whole.cs +++ b/Aaru.Tests/Filesystems/UDF/2.01/Whole.cs @@ -29,112 +29,75 @@ using System.IO; using Aaru.CommonTypes; using Aaru.CommonTypes.Interfaces; -using Aaru.DiscImages; -using Aaru.Filters; using NUnit.Framework; namespace Aaru.Tests.Filesystems.UDF._201 { [TestFixture] - public class Whole + public class Whole : FilesystemTest { - readonly string[] _testFiles = + public Whole() : base(null) {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Universal Disc Format", "2.01"); + public override IFilesystem _plugin => new Aaru.Filesystems.UDF(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] { - "1.02/linux.aif", "1.02/macosx_10.11.aif", "1.50/linux.aif", "1.50/macosx_10.11.aif", "2.00/linux.aif", - "2.00/macosx_10.11.aif", "2.01/linux.aif", "2.01/macosx_10.11.aif", "2.50/linux.aif", - "2.50/macosx_10.11.aif", "2.60/macosx_10.11.aif", "1.50/solaris_7.aif", "1.50/solaris_9.aif", - "2.01/netbsd_7.1.aif", "1.02/linux_4.19_udf_1.02_flashdrive.aif", "1.50/linux_4.19_udf_1.50_flashdrive.aif", - "2.00/linux_4.19_udf_2.00_flashdrive.aif", "2.01/linux_4.19_udf_2.01_flashdrive.aif" + "linux.aif", "macosx_10.11.aif", "netbsd_7.1.aif", "linux_4.19_udf_2.01_flashdrive.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[] { - 1024000, 204800, 1024000, 409600, 1024000, 614400, 1024000, 819200, 1024000, 1024000, 1228800, 8388608, - 8388608, 8388608, 1024000, 1024000, 1024000, 1024000 + 1024000, 819200, 8388608, 1024000 }; - readonly uint[] _sectorSize = + public override string[] _appId => null; + 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 }; - readonly long[] _clusters = + public override bool[] _bootable => new[] { - 1024000, 204800, 1024000, 409600, 1024000, 614400, 1024000, 819200, 1024000, 1024000, 1228800, 8388608, - 8388608, 8388608, 1024000, 1024000, 1024000, 1024000 + false, false, false, false }; - readonly int[] _clusterSize = + public override long[] _clusters => new long[] { - 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512 + 1024000, 819200, 8388608, 1024000 }; - readonly string[] _udfversion = + public override uint[] _clusterSize => new uint[] { - "UDF v1.02", "UDF v1.02", "UDF v1.50", "UDF v1.50", "UDF v2.00", "UDF v2.00", "UDF v2.01", "UDF v2.01", - "UDF v2.50", "UDF v2.50", "UDF v2.60", "UDF v1.50", "UDF v1.50", "UDF v2.01", "UDF v2.01", "UDF v2.01", - "UDF v2.01", "UDF v2.01" + 512, 512, 512, 512 }; - readonly string[] _volumeName = + public override string[] _oemId => new[] { - "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", - "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "*NoLabel*", "*NoLabel*", - "anonymous", "DicSetter", "DicSetter", "DicSetter", "DicSetter", "DicSetter", "DicSetter" + "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*NetBSD userland UDF", "*Linux UDFFS" }; - readonly string[] _volumeSerial = + public override string[] _type => new[] + { - "595c5cfa38ce8b66LinuxUDF", "6D02A231 (Mac OS X newfs_udf) UDF Volume Set", "595c5d00c5b3405aLinuxUDF", - "4DD0458B (Mac OS X newfs_udf) UDF Volume Set", "595c5d07f4fc8e8dLinuxUDF", - "5D91CB4F (Mac OS X newfs_udf) UDF Volume Set", "595c5d0bee60c3bbLinuxUDF", - "48847EB3 (Mac OS X newfs_udf) UDF Volume Set", "595c5d0e4f338552LinuxUDF", - "709E84A1 (Mac OS X newfs_udf) UDF Volume Set", "78CE3237 (Mac OS X newfs_udf) UDF Volume Set", "595EB2A9", - "595EB55A", "7cc94d726669d773", "5cc7882441a86e93LinuxUDF", "5cc78f8bba4dfe00LinuxUDF", - "5cc7f4183e0d5f7aLinuxUDF", "5cc8816fcb3a3b38LinuxUDF", "595EB55A", "7cc94d726669d773" + "UDF v2.01", "UDF v2.01", "UDF v2.01", "UDF v2.01" }; - readonly string[] _oemId = + public override string[] _volumeName => new[] { - "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", - "*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", - "*Apple Mac OS X UDF FS", "*Apple Mac OS X UDF FS", "*SUN SOLARIS UDF", "*SUN SOLARIS UDF", - "*NetBSD userland UDF", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS", - "*Linux UDFFS" + "Volume label", "Volume label", "anonymous", "DicSetter" }; - [Test] - public void Test() + public override string[] _volumeSerial => new[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Universal Disc Format", - _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]); - IFilesystem fs = new Aaru.Filesystems.UDF(); - - 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(_udfversion[i], fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSetIdentifier, _testFiles[i]); - Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); - } - } + "595c5d0bee60c3bbLinuxUDF", "48847EB3 (Mac OS X newfs_udf) UDF Volume Set", "7cc94d726669d773", + "5cc8816fcb3a3b38LinuxUDF" + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/UDF/2.50/Whole.cs b/Aaru.Tests/Filesystems/UDF/2.50/Whole.cs index 4bb422832..6ee60736b 100644 --- a/Aaru.Tests/Filesystems/UDF/2.50/Whole.cs +++ b/Aaru.Tests/Filesystems/UDF/2.50/Whole.cs @@ -29,112 +29,74 @@ using System.IO; using Aaru.CommonTypes; using Aaru.CommonTypes.Interfaces; -using Aaru.DiscImages; -using Aaru.Filters; using NUnit.Framework; namespace Aaru.Tests.Filesystems.UDF._250 { [TestFixture] - public class Whole + public class Whole : FilesystemTest { - readonly string[] _testFiles = + public Whole() : base(null) {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Universal Disc Format", "2.50"); + public override IFilesystem _plugin => new Aaru.Filesystems.UDF(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] { - "1.02/linux.aif", "1.02/macosx_10.11.aif", "1.50/linux.aif", "1.50/macosx_10.11.aif", "2.00/linux.aif", - "2.00/macosx_10.11.aif", "2.01/linux.aif", "2.01/macosx_10.11.aif", "2.50/linux.aif", - "2.50/macosx_10.11.aif", "2.60/macosx_10.11.aif", "1.50/solaris_7.aif", "1.50/solaris_9.aif", - "2.01/netbsd_7.1.aif", "1.02/linux_4.19_udf_1.02_flashdrive.aif", "1.50/linux_4.19_udf_1.50_flashdrive.aif", - "2.00/linux_4.19_udf_2.00_flashdrive.aif", "2.01/linux_4.19_udf_2.01_flashdrive.aif" + "linux.aif", "macosx_10.11.aif" }; - readonly ulong[] _sectors = + public override MediaType[] _mediaTypes => new[] { - 1024000, 204800, 1024000, 409600, 1024000, 614400, 1024000, 819200, 1024000, 1024000, 1228800, 8388608, - 8388608, 8388608, 1024000, 1024000, 1024000, 1024000 + MediaType.GENERIC_HDD, MediaType.GENERIC_HDD + }; + public override ulong[] _sectors => new ulong[] + { + 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 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] { - 1024000, 204800, 1024000, 409600, 1024000, 614400, 1024000, 819200, 1024000, 1024000, 1228800, 8388608, - 8388608, 8388608, 1024000, 1024000, 1024000, 1024000 + false, false }; - readonly int[] _clusterSize = + public override long[] _clusters => new long[] { - 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512 + 1024000, 1024000 }; - readonly string[] _udfversion = + public override uint[] _clusterSize => new uint[] { - "UDF v1.02", "UDF v1.02", "UDF v1.50", "UDF v1.50", "UDF v2.00", "UDF v2.00", "UDF v2.01", "UDF v2.01", - "UDF v2.50", "UDF v2.50", "UDF v2.60", "UDF v1.50", "UDF v1.50", "UDF v2.01", "UDF v2.01", "UDF v2.01", - "UDF v2.01", "UDF v2.01" + 512, 512 }; - readonly string[] _volumeName = + public override string[] _oemId => new[] { - "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", - "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "*NoLabel*", "*NoLabel*", - "anonymous", "DicSetter", "DicSetter", "DicSetter", "DicSetter", "DicSetter", "DicSetter" + "*Linux UDFFS", "*Apple Mac OS X UDF FS" }; - readonly string[] _volumeSerial = + public override string[] _type => new[] + { - "595c5cfa38ce8b66LinuxUDF", "6D02A231 (Mac OS X newfs_udf) UDF Volume Set", "595c5d00c5b3405aLinuxUDF", - "4DD0458B (Mac OS X newfs_udf) UDF Volume Set", "595c5d07f4fc8e8dLinuxUDF", - "5D91CB4F (Mac OS X newfs_udf) UDF Volume Set", "595c5d0bee60c3bbLinuxUDF", - "48847EB3 (Mac OS X newfs_udf) UDF Volume Set", "595c5d0e4f338552LinuxUDF", - "709E84A1 (Mac OS X newfs_udf) UDF Volume Set", "78CE3237 (Mac OS X newfs_udf) UDF Volume Set", "595EB2A9", - "595EB55A", "7cc94d726669d773", "5cc7882441a86e93LinuxUDF", "5cc78f8bba4dfe00LinuxUDF", - "5cc7f4183e0d5f7aLinuxUDF", "5cc8816fcb3a3b38LinuxUDF", "595EB55A", "7cc94d726669d773" + "UDF v2.50", "UDF v2.50" }; - readonly string[] _oemId = + public override string[] _volumeName => new[] { - "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", - "*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", - "*Apple Mac OS X UDF FS", "*Apple Mac OS X UDF FS", "*SUN SOLARIS UDF", "*SUN SOLARIS UDF", - "*NetBSD userland UDF", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS", - "*Linux UDFFS" + "Volume label", "Volume label" }; - [Test] - public void Test() + public override string[] _volumeSerial => new[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Universal Disc Format", - _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]); - IFilesystem fs = new Aaru.Filesystems.UDF(); - - 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(_udfversion[i], fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSetIdentifier, _testFiles[i]); - Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); - } - } + "595c5d0e4f338552LinuxUDF", "709E84A1 (Mac OS X newfs_udf) UDF Volume Set" + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/UDF/2.60/Whole.cs b/Aaru.Tests/Filesystems/UDF/2.60/Whole.cs index 605cde132..5bc6cdd6c 100644 --- a/Aaru.Tests/Filesystems/UDF/2.60/Whole.cs +++ b/Aaru.Tests/Filesystems/UDF/2.60/Whole.cs @@ -29,112 +29,74 @@ using System.IO; using Aaru.CommonTypes; using Aaru.CommonTypes.Interfaces; -using Aaru.DiscImages; -using Aaru.Filters; using NUnit.Framework; namespace Aaru.Tests.Filesystems.UDF._260 { [TestFixture] - public class Whole + public class Whole : FilesystemTest { - readonly string[] _testFiles = + public Whole() : base(null) {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Universal Disc Format", "2.60"); + public override IFilesystem _plugin => new Aaru.Filesystems.UDF(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] { - "1.02/linux.aif", "1.02/macosx_10.11.aif", "1.50/linux.aif", "1.50/macosx_10.11.aif", "2.00/linux.aif", - "2.00/macosx_10.11.aif", "2.01/linux.aif", "2.01/macosx_10.11.aif", "2.50/linux.aif", - "2.50/macosx_10.11.aif", "2.60/macosx_10.11.aif", "1.50/solaris_7.aif", "1.50/solaris_9.aif", - "2.01/netbsd_7.1.aif", "1.02/linux_4.19_udf_1.02_flashdrive.aif", "1.50/linux_4.19_udf_1.50_flashdrive.aif", - "2.00/linux_4.19_udf_2.00_flashdrive.aif", "2.01/linux_4.19_udf_2.01_flashdrive.aif" + "macosx_10.11.aif" }; - readonly ulong[] _sectors = + public override MediaType[] _mediaTypes => new[] { - 1024000, 204800, 1024000, 409600, 1024000, 614400, 1024000, 819200, 1024000, 1024000, 1228800, 8388608, - 8388608, 8388608, 1024000, 1024000, 1024000, 1024000 + MediaType.GENERIC_HDD + }; + public override ulong[] _sectors => new ulong[] + { + 1228800 }; - 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 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] { - 1024000, 204800, 1024000, 409600, 1024000, 614400, 1024000, 819200, 1024000, 1024000, 1228800, 8388608, - 8388608, 8388608, 1024000, 1024000, 1024000, 1024000 + false }; - readonly int[] _clusterSize = + public override long[] _clusters => new long[] { - 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512 + 1228800 }; - readonly string[] _udfversion = + public override uint[] _clusterSize => new uint[] { - "UDF v1.02", "UDF v1.02", "UDF v1.50", "UDF v1.50", "UDF v2.00", "UDF v2.00", "UDF v2.01", "UDF v2.01", - "UDF v2.50", "UDF v2.50", "UDF v2.60", "UDF v1.50", "UDF v1.50", "UDF v2.01", "UDF v2.01", "UDF v2.01", - "UDF v2.01", "UDF v2.01" + 512 }; - readonly string[] _volumeName = + public override string[] _oemId => new[] { - "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", - "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "*NoLabel*", "*NoLabel*", - "anonymous", "DicSetter", "DicSetter", "DicSetter", "DicSetter", "DicSetter", "DicSetter" + "*Apple Mac OS X UDF FS" }; - readonly string[] _volumeSerial = + public override string[] _type => new[] + { - "595c5cfa38ce8b66LinuxUDF", "6D02A231 (Mac OS X newfs_udf) UDF Volume Set", "595c5d00c5b3405aLinuxUDF", - "4DD0458B (Mac OS X newfs_udf) UDF Volume Set", "595c5d07f4fc8e8dLinuxUDF", - "5D91CB4F (Mac OS X newfs_udf) UDF Volume Set", "595c5d0bee60c3bbLinuxUDF", - "48847EB3 (Mac OS X newfs_udf) UDF Volume Set", "595c5d0e4f338552LinuxUDF", - "709E84A1 (Mac OS X newfs_udf) UDF Volume Set", "78CE3237 (Mac OS X newfs_udf) UDF Volume Set", "595EB2A9", - "595EB55A", "7cc94d726669d773", "5cc7882441a86e93LinuxUDF", "5cc78f8bba4dfe00LinuxUDF", - "5cc7f4183e0d5f7aLinuxUDF", "5cc8816fcb3a3b38LinuxUDF", "595EB55A", "7cc94d726669d773" + "UDF v2.60" }; - readonly string[] _oemId = + public override string[] _volumeName => new[] { - "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", - "*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", - "*Apple Mac OS X UDF FS", "*Apple Mac OS X UDF FS", "*SUN SOLARIS UDF", "*SUN SOLARIS UDF", - "*NetBSD userland UDF", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS", - "*Linux UDFFS" + "Volume label" }; - [Test] - public void Test() + public override string[] _volumeSerial => new[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Universal Disc Format", - _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]); - IFilesystem fs = new Aaru.Filesystems.UDF(); - - 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(_udfversion[i], fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSetIdentifier, _testFiles[i]); - Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); - } - } + "78CE3237 (Mac OS X newfs_udf) UDF Volume Set" + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/UFS/APM.cs b/Aaru.Tests/Filesystems/UFS/APM.cs index 86f849d42..791f09088 100644 --- a/Aaru.Tests/Filesystems/UFS/APM.cs +++ b/Aaru.Tests/Filesystems/UFS/APM.cs @@ -26,97 +26,77 @@ // 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.UFS { [TestFixture] - public class APM + public class APM : FilesystemTest { - readonly string[] _testFiles = + public APM() : base(null) {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "UNIX filesystem (APM)"); + public override IFilesystem _plugin => new FFSPlugin(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "ffs43/darwin_1.3.1.aif", "ffs43/darwin_1.4.1.aif", "ffs43/darwin_6.0.2.aif", "ffs43/darwin_8.0.1.aif", "ufs1/darwin_1.3.1.aif", "ufs1/darwin_1.4.1.aif", "ufs1/darwin_6.0.2.aif", "ufs1/darwin_8.0.1.aif", "ufs1/macosx_10.2.aif", "ufs1/macosx_10.3.aif", "ufs1/macosx_10.4.aif" }; - readonly ulong[] _sectors = + 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 + }; + public override ulong[] _sectors => new ulong[] { 1024000, 1024000, 1024000, 1024000, 204800, 204800, 204800, 204800, 2097152, 2097152, 2097152 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false, false, false, false, false, false, false, false, false, false + }; + + public override long[] _clusters => new long[] { 511488, 511488, 511488, 511488, 102368, 102368, 102368, 102368, 1047660, 1038952, 1038952 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024 }; + public override string[] _oemId => null; - readonly string[] _volumeName = - { - null, null, null, null, null, null, null, null, null, null, null - }; - - readonly string[] _volumeSerial = - { - null, null, null, null, null, null, null, null, null, null, null - }; - - readonly string[] _type = + public override string[] _type => new[] { "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS" }; - [Test] - public void Test() + public override string[] _volumeName => new string[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "UNIX filesystem (APM)", - _testFiles[i]); + null, null, null, null, null, null, null, null, null, null, null + }; - 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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new FFSPlugin(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "Apple_UFS") - { - 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(_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]); - } - } + public override string[] _volumeSerial => new string[] + { + null, null, null, null, null, null, null, null, null, null, null + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/UFS/MBR.cs b/Aaru.Tests/Filesystems/UFS/MBR.cs index b0350d5a9..31d32271b 100644 --- a/Aaru.Tests/Filesystems/UFS/MBR.cs +++ b/Aaru.Tests/Filesystems/UFS/MBR.cs @@ -26,21 +26,25 @@ // 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.UFS { [TestFixture] - public class MBR + public class MBR : FilesystemTest { - readonly string[] _testFiles = + public MBR() : base(null) {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "UNIX filesystem (MBR)"); + public override IFilesystem _plugin => new FFSPlugin(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "ufs1/linux.aif", "ufs2/linux.aif", "ffs43/darwin_1.3.1.aif", "ffs43/darwin_1.4.1.aif", "ffs43/darwin_6.0.2.aif", "ffs43/darwin_8.0.1.aif", "ffs43/dflybsd_1.2.0.aif", "ffs43/dflybsd_3.6.1.aif", @@ -52,92 +56,67 @@ namespace Aaru.Tests.Filesystems.UFS "ufs2/netbsd_7.1.aif" }; - readonly ulong[] _sectors = + 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, + MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, + MediaType.GENERIC_HDD + }; + public override ulong[] _sectors => new ulong[] { 262144, 262144, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 409600, 204800, 204800, 204800, 204800, 2097152, 2097152, 2097152, 2097152, 8388608, 8388608, 2097152, 1024000, 2097152, 2097152, 16777216, 16777216, 16777216, 2097152 }; - 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, 512, 512, 512, 512, 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, false, false, false + }; + + public override long[] _clusters => new long[] { 65024, 65024, 511024, 511024, 511024, 511488, 511950, 255470, 255470, 511992, 204768, 102280, 102280, 102280, 102368, 1048500, 523758, 523758, 262138, 1048231, 2096462, 524284, 511968, 1038240, 1046808, 2096472, 2096472, 4192945, 524272 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 2048, 2048, 1024, 1024, 1024, 1024, 1024, 2048, 2048, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 2048, 2048, 4096, 4096, 2048, 2048, 1024, 1024, 1024, 4096, 4096, 2048, 2048 }; + public override string[] _oemId => null; - readonly string[] _volumeName = - { - null, "VolumeLabel", null, null, null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, "VolumeLabel", "VolumeLabel", "VolumeLabel", "" - }; - - readonly string[] _volumeSerial = - { - null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null - }; - - readonly string[] _type = + public override string[] _type => new[] { "UFS", "UFS2", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS2", "UFS2", "UFS2", "UFS2" }; - [Test] - public void Test() + public override string[] _volumeName => new[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "UNIX filesystem (MBR)", - _testFiles[i]); + null, "VolumeLabel", null, null, null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, "VolumeLabel", "VolumeLabel", "VolumeLabel", "" + }; - 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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new FFSPlugin(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "0x63" || - partitions[j].Type == "0xA8" || - partitions[j].Type == "0xA5" || - partitions[j].Type == "0xA9" || - partitions[j].Type == "0x82" || - partitions[j].Type == "0x83" || - partitions[j].Type == "4.2BSD Fast File System" || - partitions[j].Type == "Sun boot") - { - 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(_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]); - } - } + public override string[] _volumeSerial => new string[] + { + null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/UFS/NeXT Floppy.cs b/Aaru.Tests/Filesystems/UFS/NeXT Floppy.cs index 1540c03d8..694dfbf44 100644 --- a/Aaru.Tests/Filesystems/UFS/NeXT Floppy.cs +++ b/Aaru.Tests/Filesystems/UFS/NeXT Floppy.cs @@ -26,21 +26,25 @@ // 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.UFS { [TestFixture] - public class NeXT_Floppy + public class NeXT_Floppy : FilesystemTest { - readonly string[] _testFiles = + public NeXT_Floppy() : base(null) {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "UNIX filesystem (NeXT)"); + public override IFilesystem _plugin => new FFSPlugin(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "nextstep_3.3_mf2dd.img.lz", "nextstep_3.3_mf2hd.img.lz", "openstep_4.0_mf2dd.img.lz", "openstep_4.0_mf2hd.img.lz", "openstep_4.2_mf2dd.img.lz", "openstep_4.2_mf2hd.img.lz", @@ -48,77 +52,52 @@ namespace Aaru.Tests.Filesystems.UFS "rhapsody_dr2_mf2hd.img.lz" }; - readonly ulong[] _sectors = + public override MediaType[] _mediaTypes => new[] + { + MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, + MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, + MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD + }; + public override ulong[] _sectors => new ulong[] { 1440, 2880, 1440, 2880, 1440, 2880, 1440, 2880, 1440, 2880 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512, 512, 512, 512, 512, 512, 512, 512, 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false, false, false, false, false, false, false, false, false + }; + + public override long[] _clusters => new long[] { 624, 1344, 624, 1344, 624, 1344, 624, 1344, 624, 1344 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024 }; + public override string[] _oemId => null; - readonly string[] _volumeName = - { - null, null, null, null, null, null, null, null, null, null - }; - - readonly string[] _volumeSerial = - { - null, null, null, null, null, null, null, null, null, null - }; - - readonly string[] _type = + public override string[] _type => new[] { "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS" }; - [Test] - public void Test() + public override string[] _volumeName => new string[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "UNIX filesystem (NeXT)", - _testFiles[i]); + null, null, null, null, null, null, null, null, null, null + }; - IFilter filter = new LZip(); - filter.Open(location); - IMediaImage image = new ZZZRawImage(); - 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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new FFSPlugin(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "4.3BSD" || - partitions[j].Type == "4.4BSD") - { - 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(_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]); - } - } + public override string[] _volumeSerial => new string[] + { + null, null, null, null, null, null, null, null, null, null + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/UFS/NeXT.cs b/Aaru.Tests/Filesystems/UFS/NeXT.cs index bbbc24214..694c8539e 100644 --- a/Aaru.Tests/Filesystems/UFS/NeXT.cs +++ b/Aaru.Tests/Filesystems/UFS/NeXT.cs @@ -26,96 +26,74 @@ // 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.UFS { [TestFixture] - public class NeXT + public class NeXT : FilesystemTest { - readonly string[] _testFiles = + public NeXT() : base(null) {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "UNIX filesystem (NeXT)"); + public override IFilesystem _plugin => new FFSPlugin(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "nextstep_3.3.aif", "openstep_4.0.aif", "openstep_4.2.aif", "rhapsody_dr1.aif", "rhapsody_dr2.aif" }; - readonly ulong[] _sectors = + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, + MediaType.GENERIC_HDD + }; + public override ulong[] _sectors => new ulong[] { 409600, 409600, 409600, 409600, 409600 }; - 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[] { 204640, 204640, 204640, 204640, 204464 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 1024, 1024, 1024, 1024, 1024 }; + public override string[] _oemId => null; - readonly string[] _volumeName = - { - null, null, null, null, null - }; - - readonly string[] _volumeSerial = - { - null, null, null, null, null - }; - - readonly string[] _type = + public override string[] _type => new[] { "UFS", "UFS", "UFS", "UFS", "UFS" }; - [Test] - public void Test() + public override string[] _volumeName => new string[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "UNIX filesystem (NeXT)", - _testFiles[i]); + null, null, null, null, null + }; - 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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new FFSPlugin(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "4.3BSD" || - partitions[j].Type == "4.4BSD") - { - 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(_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]); - } - } + public override string[] _volumeSerial => new string[] + { + null, null, null, null, null + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/UFS/RDB.cs b/Aaru.Tests/Filesystems/UFS/RDB.cs index 5f6876433..3860c0e1f 100644 --- a/Aaru.Tests/Filesystems/UFS/RDB.cs +++ b/Aaru.Tests/Filesystems/UFS/RDB.cs @@ -26,95 +26,73 @@ // 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.UFS { [TestFixture] - public class RDB + public class RDB : FilesystemTest { - readonly string[] _testFiles = + public RDB() : base(null) {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "UNIX filesystem (RDB)"); + public override IFilesystem _plugin => new FFSPlugin(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "amix.aif" }; - readonly ulong[] _sectors = + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD + }; + public override ulong[] _sectors => new ulong[] { 1024128 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false + }; + + public override long[] _clusters => new long[] { 511424 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 1024 }; + public override string[] _oemId => null; - readonly string[] _volumeName = - { - null - }; - - readonly string[] _volumeSerial = - { - null - }; - - readonly string[] _type = + public override string[] _type => new[] { "UFS" }; - [Test] - public void Test() + public override string[] _volumeName => new string[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "UNIX filesystem (RDB)", - _testFiles[i]); + null + }; - 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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new FFSPlugin(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "\"UNI\\2\"") - { - 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(_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]); - } - } + public override string[] _volumeSerial => new string[] + { + null + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/UFS/Sun i86.cs b/Aaru.Tests/Filesystems/UFS/Sun i86.cs index 6a4a17caa..ca8fade5d 100644 --- a/Aaru.Tests/Filesystems/UFS/Sun i86.cs +++ b/Aaru.Tests/Filesystems/UFS/Sun i86.cs @@ -26,95 +26,73 @@ // 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.UFS { [TestFixture] - public class Sun_i86 + public class Sun_i86 : FilesystemTest { - readonly string[] _testFiles = + public Sun_i86() : base(null) {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "UNIX filesystem (SunOS x86)"); + public override IFilesystem _plugin => new FFSPlugin(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "solaris_7.aif" }; - readonly ulong[] _sectors = + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD + }; + 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[] + { + false + }; + + public override long[] _clusters => new long[] { 2063376 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 1024 }; + public override string[] _oemId => null; - readonly string[] _volumeName = - { - null - }; - - readonly string[] _volumeSerial = - { - null - }; - - readonly string[] _type = + public override string[] _type => new[] { "UFS" }; - [Test] - public void Test() + public override string[] _volumeName => new string[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "UNIX filesystem (SunOS x86)", - _testFiles[i]); + null + }; - 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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new FFSPlugin(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "Replacement sectors") - { - 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(_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]); - } - } + public override string[] _volumeSerial => new string[] + { + null + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/UFS/Whole.cs b/Aaru.Tests/Filesystems/UFS/Whole.cs index 1949f6dfd..12f561a5c 100644 --- a/Aaru.Tests/Filesystems/UFS/Whole.cs +++ b/Aaru.Tests/Filesystems/UFS/Whole.cs @@ -29,94 +29,74 @@ 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.UFS { [TestFixture] - public class Whole + public class Whole : FilesystemTest { - readonly string[] _testFiles = + public Whole() : base(null) {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "UNIX filesystem"); + + public override IFilesystem _plugin => new FFSPlugin(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] { "amix_mf2dd.adf.lz", "netbsd_1.6_mf2hd.img.lz", "att_unix_svr4v2.1_dsdd.img.lz", "att_unix_svr4v2.1_dshd.img.lz", "att_unix_svr4v2.1_mf2dd.img.lz", "att_unix_svr4v2.1_mf2hd.img.lz", "solaris_2.4_mf2dd.img.lz", "solaris_2.4_mf2hd.img.lz" }; - readonly MediaType[] _mediaTypes = + public override MediaType[] _mediaTypes => new[] { MediaType.CBM_AMIGA_35_DD, MediaType.DOS_35_HD, MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 1760, 2880, 720, 2400, 1440, 2880, 1440, 2880 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512, 512, 512, 512, 512, 512, 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false, false, false, false, false, false, false + }; + + public override long[] _clusters => new long[] { 880, 2880, 360, 1200, 720, 1440, 711, 1422 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 1024, 512, 1024, 1024, 1024, 1024, 1024, 1024 }; + public override string[] _oemId => null; - readonly string[] _volumeName = - { - null, null, null, null, null, null, null, null - }; - - readonly string[] _volumeSerial = - { - null, null, null, null, null, null, null, null - }; - - readonly string[] _type = + public override string[] _type => new[] { "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS" }; - [Test] - public void Test() + public override string[] _volumeName => new string[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "UNIX 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 FFSPlugin(); + null, null, null, null, null, null, null, null + }; - 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]); - } - } + public override string[] _volumeSerial => new string[] + { + null, null, null, null, null, null, null, null + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/UNIXBFS/MBR.cs b/Aaru.Tests/Filesystems/UNIXBFS/MBR.cs index e906320bb..0086aef6d 100644 --- a/Aaru.Tests/Filesystems/UNIXBFS/MBR.cs +++ b/Aaru.Tests/Filesystems/UNIXBFS/MBR.cs @@ -26,84 +26,69 @@ // 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.UNIXBFS { [TestFixture] - public class MBR + public class MBR : FilesystemTest { - readonly string[] _testFiles = + public MBR() : base("BFS") {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Boot File System (MBR)"); + public override IFilesystem _plugin => new BFS(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "linux.aif" }; - readonly ulong[] _sectors = + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD + }; + public override ulong[] _sectors => new ulong[] { 262144 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false + }; + + public override long[] _clusters => new long[] { 260096 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 512 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "Label" }; - [Test] - public void Test() + public override string[] _volumeSerial => new string[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Boot File System (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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new BFS(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "0x83") - { - 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("BFS", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - } - } + null + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/UNIXBFS/RDB.cs b/Aaru.Tests/Filesystems/UNIXBFS/RDB.cs index 9e063b9b8..b686e0916 100644 --- a/Aaru.Tests/Filesystems/UNIXBFS/RDB.cs +++ b/Aaru.Tests/Filesystems/UNIXBFS/RDB.cs @@ -26,95 +26,69 @@ // 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.UNIXBFS { [TestFixture] - public class RDB + public class RDB : FilesystemTest { - readonly string[] _testFiles = + public RDB() : base("UFS") {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Boot File System (RDB)"); + public override IFilesystem _plugin => new BFS(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "amix.aif" }; - readonly ulong[] _sectors = + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD + }; + public override ulong[] _sectors => new ulong[] { 1024128 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false + }; + + public override long[] _clusters => new long[] { 65024 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 2048 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new string[] { null }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "UNKNOWN" }; - - readonly string[] _type = - { - "UFS" - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Boot 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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new BFS(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "\"UNI\\0\"") - { - 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(_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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/UNIXBFS/Whole.cs b/Aaru.Tests/Filesystems/UNIXBFS/Whole.cs index ef09c7776..33cbde3ba 100644 --- a/Aaru.Tests/Filesystems/UNIXBFS/Whole.cs +++ b/Aaru.Tests/Filesystems/UNIXBFS/Whole.cs @@ -29,84 +29,69 @@ 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.UNIXBFS { [TestFixture] - public class Whole + public class Whole : FilesystemTest { - readonly string[] _testFiles = + public Whole() : base("BFS") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Boot File System"); + + public override IFilesystem _plugin => new BFS(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] { "amix_mf2dd.adf.lz", "att_unix_svr4v2.1_dsdd.img.lz", "att_unix_svr4v2.1_dshd.img.lz", "att_unix_svr4v2.1_mf2dd.img.lz", "att_unix_svr4v2.1_mf2hd.img.lz" }; - readonly MediaType[] _mediaTypes = + public override MediaType[] _mediaTypes => new[] { MediaType.CBM_AMIGA_35_DD, 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[] { 1760, 720, 2400, 1440, 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[] { 1760, 720, 2400, 1440, 2880 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 512, 512, 512, 512, 512 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "Label", null, null, null, null }; - [Test] - public void Test() + public override string[] _volumeSerial => new string[] { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Boot 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 BFS(); - - 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("BFS", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - } - } + null, null, null, null, null + }; } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/XENIX/MBR.cs b/Aaru.Tests/Filesystems/XENIX/MBR.cs index 56e7b6488..1e34b1dda 100644 --- a/Aaru.Tests/Filesystems/XENIX/MBR.cs +++ b/Aaru.Tests/Filesystems/XENIX/MBR.cs @@ -26,95 +26,70 @@ // 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.XENIX { [TestFixture] - public class MBR + public class MBR : FilesystemTest { - readonly string[] _testFiles = + public MBR() : base("XENIX fs") {} + + public override string _dataFolder => + Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "XENIX filesystem (MBR)"); + public override IFilesystem _plugin => new SysVfs(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "xenix_2.3.2d.aif", "xenix_2.3.4h.aif", "scoopenserver_5.0.7hw.aif" }; - readonly ulong[] _sectors = + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD + }; + public override ulong[] _sectors => new ulong[] { 40960, 40960, 2097152 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512, 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false, false + }; + + public override long[] _clusters => new long[] { 0, 0, 0, 19624, 19624, 19624 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 1024, 1024, 1024 }; + public override string[] _oemId => null; - readonly string[] _volumeName = + public override string[] _type => null; + + public override string[] _volumeName => new[] { "", "", "" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new string[] { null, null, null }; - - readonly string[] _type = - { - "XENIX fs", "XENIX fs", "XENIX fs" - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "XENIX filesystem (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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new SysVfs(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "XENIX") - { - 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(_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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/XENIX/Whole.cs b/Aaru.Tests/Filesystems/XENIX/Whole.cs index 88309e12e..4952b15f6 100644 --- a/Aaru.Tests/Filesystems/XENIX/Whole.cs +++ b/Aaru.Tests/Filesystems/XENIX/Whole.cs @@ -29,95 +29,69 @@ 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.XENIX { [TestFixture] - public class Whole + public class Whole : FilesystemTest { - readonly string[] _testFiles = + public Whole() : base("XENIX fs") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "XENIX filesystem"); + + 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[] { 0, 0, 0, 0, 0, 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 = - { - "XENIX fs", "XENIX fs", "XENIX fs", "XENIX fs", "XENIX fs" - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "XENIX 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]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/XFS.cs b/Aaru.Tests/Filesystems/XFS.cs index 3459c0634..4a9958367 100644 --- a/Aaru.Tests/Filesystems/XFS.cs +++ b/Aaru.Tests/Filesystems/XFS.cs @@ -26,87 +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.Filters; using NUnit.Framework; namespace Aaru.Tests.Filesystems { [TestFixture] - public class XFS + public class XFS : FilesystemTest { - readonly string[] _testFiles = + public XFS() : base("XFS filesystem") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "XFS"); + public override IFilesystem _plugin => new Aaru.Filesystems.XFS(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "linux.aif", "linux_4.19_xfs_flashdrive.aif" }; - readonly ulong[] _sectors = + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD, MediaType.GENERIC_HDD + }; + + public override ulong[] _sectors => new ulong[] { 1048576, 1024000 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false + }; + + public override long[] _clusters => new long[] { 130816, 127744 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 4096, 4096 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "Volume label", "DicSetter" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "230075b7-9834-b44e-a257-982a058311d8", "ed6b4d35-aa66-ce4a-9d8f-c56dbc6d7c8c" }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "XFS", _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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new Aaru.Filesystems.XFS(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "0x83") - { - 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("XFS filesystem", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/Xia.cs b/Aaru.Tests/Filesystems/Xia.cs index 30c480342..504a3995e 100644 --- a/Aaru.Tests/Filesystems/Xia.cs +++ b/Aaru.Tests/Filesystems/Xia.cs @@ -26,87 +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.Filters; using NUnit.Framework; namespace Aaru.Tests.Filesystems { [TestFixture] - public class Xia + public class Xia : FilesystemTest { - readonly string[] _testFiles = + public Xia() : base("Xia filesystem") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Xia filesystem"); + public override IFilesystem _plugin => new Aaru.Filesystems.Xia(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "linux.aif", "linux-files.aif" }; - readonly ulong[] _sectors = + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD, MediaType.GENERIC_HDD + }; + + public override ulong[] _sectors => new ulong[] { 1024000, 2048000 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false + }; + + public override long[] _clusters => new long[] { 511528, 1023088 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 1024, 1024 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new string[] { null, null }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new string[] { null, null }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Xia filesystem", _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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new Aaru.Filesystems.Xia(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "0x83") - { - 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("Xia filesystem", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/ZFS.cs b/Aaru.Tests/Filesystems/ZFS.cs index db81ce2e3..de322b047 100644 --- a/Aaru.Tests/Filesystems/ZFS.cs +++ b/Aaru.Tests/Filesystems/ZFS.cs @@ -29,82 +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 { [TestFixture] - public class Zfs + public class Zfs : FilesystemTest { - readonly string[] _testFiles = + public Zfs() : base("ZFS filesystem") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", + "Zettabyte File System"); + + public override IFilesystem _plugin => new ZFS(); + public override bool _partitions => false; + + public override string[] _testFiles => new[] { "netbsd_7.1.aif" }; - readonly ulong[] _sectors = + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD + }; + + public override ulong[] _sectors => new ulong[] { 33554432 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false + }; + + public override long[] _clusters => new long[] { 0 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 0 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "NetBSD 7.1" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "2639895335654686206" }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Zettabyte File System", - _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]); - IFilesystem fs = new ZFS(); - - 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("ZFS filesystem", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/btrfs.cs b/Aaru.Tests/Filesystems/btrfs.cs index 12c53b31c..52cac1f8d 100644 --- a/Aaru.Tests/Filesystems/btrfs.cs +++ b/Aaru.Tests/Filesystems/btrfs.cs @@ -26,90 +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 Aaru.Partitions; using NUnit.Framework; namespace Aaru.Tests.Filesystems { [TestFixture] - public class Btrfs + public class Btrfs : FilesystemTest { - readonly string[] _testFiles = + public Btrfs() : base("B-tree file system") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "btrfs"); + public override IFilesystem _plugin => new BTRFS(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "linux.aif", "linux_4.19_btrfs_flashdrive.aif" }; - readonly ulong[] _sectors = + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD, MediaType.GENERIC_HDD + }; + public override ulong[] _sectors => new ulong[] { 262144, 1024000 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512 }; - readonly long[] _clusters = + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false + }; + + public override long[] _clusters => new long[] { 32512, 127744 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 4096, 4096 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new[] { "VolumeLabel", "btrfs" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "a4fc5201-85cc-6840-8a68-998cab9ae897", "5af44541-0605-f541-af6d-c229576707ab" }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "btrfs", _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]); - IPartition parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions, 0), _testFiles[i]); - IFilesystem fs = new BTRFS(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "0x83") - { - 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("B-tree file system", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/exFAT/APM.cs b/Aaru.Tests/Filesystems/exFAT/APM.cs index c3acb4fa3..e7c754aaf 100644 --- a/Aaru.Tests/Filesystems/exFAT/APM.cs +++ b/Aaru.Tests/Filesystems/exFAT/APM.cs @@ -26,87 +26,66 @@ // Copyright © 2011-2021 Natalia Portillo // ****************************************************************************/ -using System.Collections.Generic; using System.IO; using Aaru.CommonTypes; using Aaru.CommonTypes.Interfaces; -using Aaru.DiscImages; -using Aaru.Filters; using NUnit.Framework; namespace Aaru.Tests.Filesystems.exFAT { [TestFixture] - public class APM + public class APM : FilesystemTest { - readonly string[] _testFiles = + public APM() : base("exFAT") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "exFAT (APM)"); + public override IFilesystem _plugin => new Aaru.Filesystems.exFAT(); + 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[] { 262144 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512 }; + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false + }; - readonly long[] _clusters = + public override long[] _clusters => new long[] { 32710 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 4096 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new string[] { null }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "595AC82C" }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "exFAT (APM)", _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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new Aaru.Filesystems.exFAT(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "Windows_NTFS") - { - 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("exFAT", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/exFAT/GPT.cs b/Aaru.Tests/Filesystems/exFAT/GPT.cs index 1fd904c51..b3367432b 100644 --- a/Aaru.Tests/Filesystems/exFAT/GPT.cs +++ b/Aaru.Tests/Filesystems/exFAT/GPT.cs @@ -26,87 +26,66 @@ // Copyright © 2011-2021 Natalia Portillo // ****************************************************************************/ -using System.Collections.Generic; using System.IO; using Aaru.CommonTypes; using Aaru.CommonTypes.Interfaces; -using Aaru.DiscImages; -using Aaru.Filters; using NUnit.Framework; namespace Aaru.Tests.Filesystems.exFAT { [TestFixture] - public class GPT + public class GPT : FilesystemTest { - readonly string[] _testFiles = + public GPT() : base("exFAT") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "exFAT (GPT)"); + public override IFilesystem _plugin => new Aaru.Filesystems.exFAT(); + 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[] { 262144 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512 }; + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false + }; - readonly long[] _clusters = + public override long[] _clusters => new long[] { 32208 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 4096 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new string[] { null }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "595ACC39" }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "exFAT (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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new Aaru.Filesystems.exFAT(); - 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("exFAT", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/exFAT/MBR.cs b/Aaru.Tests/Filesystems/exFAT/MBR.cs index e0c0ec00d..b76dce8c6 100644 --- a/Aaru.Tests/Filesystems/exFAT/MBR.cs +++ b/Aaru.Tests/Filesystems/exFAT/MBR.cs @@ -26,87 +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.Filters; using NUnit.Framework; namespace Aaru.Tests.Filesystems.exFAT { [TestFixture] - public class MBR + public class MBR : FilesystemTest { - readonly string[] _testFiles = + public MBR() : base("exFAT") {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "exFAT (MBR)"); + + public override IFilesystem _plugin => new Aaru.Filesystems.exFAT(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "linux.aif", "macosx_10.11.aif", "win10.aif", "winvista.aif", "linux_4.19_exfat_flashdrive.aif" }; + public override MediaType[] _mediaTypes => new[] + { + MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, + MediaType.GENERIC_HDD + }; - readonly ulong[] _sectors = + public override ulong[] _sectors => new ulong[] { 262144, 262144, 262144, 262144, 1024000 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512, 512, 512, 512 }; + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false, false, false, false + }; - readonly long[] _clusters = + public override long[] _clusters => new long[] { 32464, 32712, 32448, 32208, 15964 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 4096, 4096, 4096, 4096, 32768 }; + public override string[] _oemId => null; + public override string[] _type => null; - readonly string[] _volumeName = + public override string[] _volumeName => new string[] { null, null, null, null, null }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "603565AC", "595AC21E", "20126663", "0AC5CA52", "636E083B" }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "exFAT (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 partitions = Core.Partitions.GetAll(image); - IFilesystem fs = new Aaru.Filesystems.exFAT(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "0x07") - { - 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("exFAT", fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file diff --git a/Aaru.Tests/Filesystems/ext2.cs b/Aaru.Tests/Filesystems/ext2.cs index 98d15e01d..16f33222d 100644 --- a/Aaru.Tests/Filesystems/ext2.cs +++ b/Aaru.Tests/Filesystems/ext2.cs @@ -26,100 +26,77 @@ // 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 Aaru.Partitions; using NUnit.Framework; namespace Aaru.Tests.Filesystems { [TestFixture] - public class Ext2 + public class Ext2 : FilesystemTest { - readonly string[] _testFiles = + public Ext2() : base(null) {} + + public override string _dataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "ext2"); + public override IFilesystem _plugin => new ext2FS(); + public override bool _partitions => true; + + public override string[] _testFiles => new[] { "linux_ext2.aif", "linux_ext3.aif", "linux_ext4.aif", "netbsd_7.1.aif", "netbsd_7.1_r0.aif", "linux_4.19_ext2_flashdrive.aif", "linux_4.19_ext3_flashdrive.aif", "linux_4.19_ext4_flashdrive.aif" }; - readonly ulong[] _sectors = + 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 + }; + public override ulong[] _sectors => new ulong[] { 262144, 262144, 262144, 8388608, 2097152, 1024000, 1024000, 1024000 }; - readonly uint[] _sectorSize = + public override uint[] _sectorSize => new uint[] { 512, 512, 512, 512, 512, 512, 512, 512 }; + public override string[] _appId => null; + public override bool[] _bootable => new[] + { + false, false, false, false, false, false, false, false + }; - readonly long[] _clusters = + public override long[] _clusters => new long[] { 130048, 130048, 130048, 1046567, 260135, 510976, 510976, 510976 }; - readonly int[] _clusterSize = + public override uint[] _clusterSize => new uint[] { 1024, 1024, 1024, 4096, 4096, 1024, 1024, 1024 }; + public override string[] _oemId => null; - readonly string[] _volumeName = + public override string[] _type => new[] + { + "ext2", "ext3", "ext4", "ext2", "ext2", "ext2", "ext3", "ext4" + }; + + public override string[] _volumeName => new[] { "VolumeLabel", "VolumeLabel", "VolumeLabel", "Volume label", "Volume label", "DicSetter", "DicSetter", "DicSetter" }; - readonly string[] _volumeSerial = + public override string[] _volumeSerial => new[] { "8e3992cf-7d98-e44a-b753-0591a35913eb", "1b411516-5415-4b42-95e6-1a247056a960", "b2f8f305-770f-ad47-abe4-f0484aa319e9", "e72aee05-627b-11e7-a573-0800272a08ec", "072756f2-627c-11e7-a573-0800272a08ec", "f5b2500f-99fb-764b-a6c4-c4db0b98a653", "a3914b55-260f-7245-8c72-7ccdf45436cb", "10413797-43d1-6545-8fbc-6ebc9d328be9" }; - - readonly string[] _extversion = - { - "ext2", "ext3", "ext4", "ext2", "ext2", "ext2", "ext3", "ext4" - }; - - [Test] - public void Test() - { - for(int i = 0; i < _testFiles.Length; i++) - { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "ext2", _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]); - IPartition parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions, 0), _testFiles[i]); - IFilesystem fs = new ext2FS(); - int part = -1; - - for(int j = 0; j < partitions.Count; j++) - if(partitions[j].Type == "0x83") - { - 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(_extversion[i], fs.XmlFsType.Type, _testFiles[i]); - Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); - Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); - } - } } } \ No newline at end of file