From 617bf94988712a5a48a22d680f34f7303dedd8dc Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 16 Jan 2018 18:08:20 +0000 Subject: [PATCH] Add new filesystem tests created from OS/2. --- DiscImageChef.Tests/Filesystems/FAT12.cs | 120 ++++++++-------- DiscImageChef.Tests/Filesystems/FAT16.cs | 172 +++++++++++------------ DiscImageChef.Tests/Filesystems/FAT32.cs | 91 ++++++------ DiscImageChef.Tests/Filesystems/HFS.cs | 131 ++++++++--------- DiscImageChef.Tests/Filesystems/HPFS.cs | 42 +++--- DiscImageChef.Tests/Filesystems/JFS2.cs | 41 +++--- DiscImageChef.Tests/Filesystems/UDF.cs | 82 +++++++++-- 7 files changed, 373 insertions(+), 306 deletions(-) diff --git a/DiscImageChef.Tests/Filesystems/FAT12.cs b/DiscImageChef.Tests/Filesystems/FAT12.cs index dda539ce..b7641c91 100644 --- a/DiscImageChef.Tests/Filesystems/FAT12.cs +++ b/DiscImageChef.Tests/Filesystems/FAT12.cs @@ -205,6 +205,7 @@ namespace DiscImageChef.Tests.Filesystems "os2_9.023_dshd.img.lz", "os2_9.023_mf2dd.img.lz", "os2_9.023_mf2ed.img.lz", "os2_9.023_mf2hd.img.lz", // eComStation "ecs_dshd.img.lz", "ecs_mf2dd.img.lz", "ecs_mf2ed.img.lz", "ecs_mf2hd.img.lz", + "ecs20_mf2hd_fstester.img.lz", // Windows 95 "win95_dsdd8.img.lz", "win95_dsdd.img.lz", "win95_dshd.img.lz", "win95_mf2dd.img.lz", "win95_mf2ed.img.lz", "win95_mf2hd.img.lz", "win95_ssdd8.img.lz", "win95_ssdd.img.lz", @@ -427,6 +428,7 @@ namespace DiscImageChef.Tests.Filesystems MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD, // eComStation MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD, + MediaType.DOS_35_HD, // Windows 95 MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD, MediaType.DOS_525_SS_DD_8, MediaType.DOS_525_SS_DD_9, @@ -609,7 +611,7 @@ namespace DiscImageChef.Tests.Filesystems // OS/2 Warp 4 2400, 1440, 5760, 2880, // eComStation - 2400, 1440, 5760, 2880, + 2400, 1440, 5760, 2880, 2880, // Windows 95 640, 720, 2400, 1440, 5760, 2880, 320, 360, // Windows 95 OSR 2 @@ -781,7 +783,7 @@ namespace DiscImageChef.Tests.Filesystems // OS/2 Warp 4 512, 512, 512, 512, // eComStation - 512, 512, 512, 512, + 512, 512, 512, 512, 512, // Windows 95 512, 512, 512, 512, 512, 512, 512, 512, // Windows 95 OSR 2 @@ -953,7 +955,7 @@ namespace DiscImageChef.Tests.Filesystems // OS/2 Warp 4 2400, 720, 2880, 2880, // eComStation - 2400, 720, 2880, 2880, + 2400, 720, 2880, 2880, 2880, // Windows 95 320, 360, 2400, 720, 2880, 2880, 320, 360, // Windows 95 OSR 2 @@ -1125,7 +1127,7 @@ namespace DiscImageChef.Tests.Filesystems // OS/2 Warp 4 512, 1024, 1024, 512, // eComStation - 512, 1024, 1024, 512, + 512, 1024, 1024, 512, 512, // Windows 95 1024, 1024, 512, 1024, 1024, 512, 512, 512, // Windows 95 OSR 2 @@ -1302,7 +1304,7 @@ namespace DiscImageChef.Tests.Filesystems // OS/2 Warp 4 "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", // eComStation - "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", // Windows 95 null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", null, "VOLUMELABEL", // Windows 95 OSR 2 @@ -1475,7 +1477,7 @@ namespace DiscImageChef.Tests.Filesystems // OS/2 Warp 4 "E6CD9414", "1BFAD414", "E6DFF414", "E6D4C414", // eComStation - "E6CA5814", "E6CBC814", "E6B81814", "1C013814", + "E6CA5814", "E6CBC814", "E6B81814", "1C013814", "9BF37814", // Windows 95 null, "3B360D0D", "24240D0D", "3C260D11", "30050D10", "275A0D11", null, "3B100D0F", // Windows 95 OSR 2 @@ -1647,7 +1649,7 @@ namespace DiscImageChef.Tests.Filesystems // 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", "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 @@ -1709,29 +1711,29 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat12", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "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(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(); - Partition wholePart = new Partition + IFilesystem fs = new FAT(); + Partition wholePart = new Partition { - Name = "Whole device", + Name = "Whole device", Length = image.Info.Sectors, - Size = image.Info.Sectors * image.Info.SectorSize + 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]); + 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]); } } } @@ -1760,17 +1762,17 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat12_apm", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat12_apm", 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(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++) + IFilesystem fs = new FAT(); + int part = -1; + for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "DOS_FAT_12") { part = j; @@ -1780,12 +1782,12 @@ namespace DiscImageChef.Tests.Filesystems 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]); + 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]); } } } @@ -1814,17 +1816,17 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat12_gpt", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat12_gpt", 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(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++) + IFilesystem fs = new FAT(); + int part = -1; + for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "Microsoft Basic data") { part = j; @@ -1834,12 +1836,12 @@ namespace DiscImageChef.Tests.Filesystems 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]); + 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]); } } } @@ -1936,23 +1938,23 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat12_mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat12_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(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(); + 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]); + 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]); } } } diff --git a/DiscImageChef.Tests/Filesystems/FAT16.cs b/DiscImageChef.Tests/Filesystems/FAT16.cs index 1001d5d8..ac9a0379 100644 --- a/DiscImageChef.Tests/Filesystems/FAT16.cs +++ b/DiscImageChef.Tests/Filesystems/FAT16.cs @@ -116,29 +116,29 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat16", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "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(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(); - Partition wholePart = new Partition + IFilesystem fs = new FAT(); + Partition wholePart = new Partition { - Name = "Whole device", + Name = "Whole device", Length = image.Info.Sectors, - Size = image.Info.Sectors * image.Info.SectorSize + 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("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]); + 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]); } } } @@ -167,17 +167,17 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat16_apm", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat16_apm", 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(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++) + IFilesystem fs = new FAT(); + int part = -1; + for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "DOS_FAT_16") { part = j; @@ -187,12 +187,12 @@ namespace DiscImageChef.Tests.Filesystems 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]); + 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]); } } } @@ -221,17 +221,17 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat16_atari", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat16_atari", 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(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++) + 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; @@ -241,12 +241,12 @@ namespace DiscImageChef.Tests.Filesystems 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]); + 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]); } } } @@ -275,17 +275,17 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat16_gpt", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat16_gpt", 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(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++) + IFilesystem fs = new FAT(); + int part = -1; + for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "Microsoft Basic data") { part = j; @@ -295,12 +295,12 @@ namespace DiscImageChef.Tests.Filesystems 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]); + 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]); } } } @@ -322,7 +322,7 @@ namespace DiscImageChef.Tests.Filesystems "winnt_3.10.vdi.lz", "winnt_3.50.vdi.lz", "winnt_3.51.vdi.lz", "winnt_4.00.vdi.lz", "winvista.vdi.lz", "beos_r4.5.vdi.lz", "linux.vdi.lz", "amigaos_3.9.vdi.lz", "aros.vdi.lz", "freebsd_6.1.vdi.lz", "freebsd_7.0.vdi.lz", "freebsd_8.2.vdi.lz", "macos_7.5.3.vdi.lz", "macos_7.5.vdi.lz", "macos_7.6.vdi.lz", - "macos_8.0.vdi.lz" + "macos_8.0.vdi.lz", "ecs20_fstester.vdi.lz" }; readonly ulong[] sectors = @@ -332,14 +332,14 @@ namespace DiscImageChef.Tests.Filesystems 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 262144, 1024128, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, - 1024000 + 1024000, 1024000 }; readonly uint[] sectorsize = { 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, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512 }; readonly long[] clusters = @@ -348,7 +348,7 @@ namespace DiscImageChef.Tests.Filesystems 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63882, 63992, 63864, 63252, 63941, 63941, 63941, 63941, 63998, 63998, 63998, 63941, 63998, 63998, 63941, 63616, 63996, 65024, 63941, 63882, 63998, 63998, 31999, 63941, 63941, 63941, - 63941 + 63941, 63882 }; readonly int[] clustersize = @@ -356,7 +356,7 @@ namespace DiscImageChef.Tests.Filesystems 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, 16384, 8192, 8192, 8192, 8192, 8192 }; readonly string[] volumename = @@ -369,7 +369,7 @@ namespace DiscImageChef.Tests.Filesystems "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VolumeLabel", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", - "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL" + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUME LABE" }; readonly string[] volumeserial = @@ -380,7 +380,7 @@ namespace DiscImageChef.Tests.Filesystems "E6C63414", "1C069414", "1C059414", "1BE5B814", "3EF71EF4", "DAF97911", "305637BD", "275B0DE4", "09650DFC", "38270D18", "2E620D0C", "0B4F0EED", "0E122464", "3B5F0F02", "C84CB6F2", "D0E9AD4E", "C039A2EC", "501F9FA6", "9AAA4216", "00000000", "A132D985", "374D3BD1", "52BEA34A", "3CF10E0D", "C6C30E0D", "44770E0D", "27761816", - "27761816", "27761816", "27761816" + "27761816", "27761816", "27761816", "66AAF014" }; readonly string[] oemid = @@ -391,7 +391,7 @@ namespace DiscImageChef.Tests.Filesystems "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 " + "BSD 4.4", "BSD 4.4", "BSD4.4 ", "PCX 2.0 ", "PCX 2.0 ", "PCX 2.0 ", "PCX 2.0 ", "IBM 4.50" }; [Test] @@ -399,23 +399,23 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat16_mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat16_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(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(); + 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]); + 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]); } } } @@ -444,17 +444,17 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat16_rdb", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat16_rdb", 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(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++) + IFilesystem fs = new FAT(); + int part = -1; + for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "0x06") { part = j; @@ -464,12 +464,12 @@ namespace DiscImageChef.Tests.Filesystems 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]); + 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]); } } } diff --git a/DiscImageChef.Tests/Filesystems/FAT32.cs b/DiscImageChef.Tests/Filesystems/FAT32.cs index b91a9f38..68afebcf 100644 --- a/DiscImageChef.Tests/Filesystems/FAT32.cs +++ b/DiscImageChef.Tests/Filesystems/FAT32.cs @@ -60,17 +60,17 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat32_apm", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat32_apm", 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(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++) + IFilesystem fs = new FAT(); + int part = -1; + for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "DOS_FAT_32") { part = j; @@ -80,12 +80,12 @@ namespace DiscImageChef.Tests.Filesystems 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]); + 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]); } } } @@ -114,17 +114,17 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat32_gpt", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat32_gpt", 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(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++) + IFilesystem fs = new FAT(); + int part = -1; + for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "Microsoft Basic data") { part = j; @@ -134,12 +134,12 @@ namespace DiscImageChef.Tests.Filesystems 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]); + 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]); } } } @@ -152,49 +152,50 @@ namespace DiscImageChef.Tests.Filesystems "drdos_7.03.vdi.lz", "drdos_8.00.vdi.lz", "msdos_7.10.vdi.lz", "macosx_10.11.vdi.lz", "win10.vdi.lz", "win2000.vdi.lz", "win95osr2.1.vdi.lz", "win95osr2.5.vdi.lz", "win95osr2.vdi.lz", "win98se.vdi.lz", "win98.vdi.lz", "winme.vdi.lz", "winvista.vdi.lz", "beos_r4.5.vdi.lz", "linux.vdi.lz", "aros.vdi.lz", - "freebsd_6.1.vdi.lz", "freebsd_7.0.vdi.lz", "freebsd_8.2.vdi.lz", "freedos_1.2.vdi.lz" + "freebsd_6.1.vdi.lz", "freebsd_7.0.vdi.lz", "freebsd_8.2.vdi.lz", "freedos_1.2.vdi.lz", + "ecs20_fstester.vdi.lz" }; readonly ulong[] sectors = { 8388608, 8388608, 8388608, 4194304, 4194304, 8388608, 4194304, 4194304, 4194304, 4194304, 4194304, 4194304, - 4194304, 4194304, 262144, 4194304, 4194304, 4194304, 4194304, 8388608 + 4194304, 4194304, 262144, 4194304, 4194304, 4194304, 4194304, 8388608, 1024000 }; readonly uint[] sectorsize = - {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}; readonly long[] clusters = { 1048233, 1048233, 1048233, 524287, 524016, 1048233, 524152, 524152, 524152, 524112, 524112, 524112, 523520, - 1048560, 260096, 524160, 524112, 524112, 65514, 1048233 + 1048560, 260096, 524160, 524112, 524112, 65514, 1048233, 127744 }; readonly int[] clustersize = { 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 2048, 512, 4096, 4096, 4096, - 32768, 4096 + 32768, 4096, 4096 }; readonly string[] volumename = { "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", - "VolumeLabel", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL" + "VolumeLabel", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "Volume labe" }; readonly string[] volumeserial = { "5955996C", "1BFB1A43", "3B331809", "42D51EF1", "48073346", "EC62E6DE", "2A310DE4", "0C140DFC", "3E310D18", "0D3D0EED", "0E131162", "3F500F02", "82EB4C04", "00000000", "B488C502", "5CAC9B4E", "41540E0E", "4E600E0F", - "26E20E0F", "3E0C1BE8" + "26E20E0F", "3E0C1BE8", "63084BBA" }; 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" + "BSD4.4 ", "FRDOS4.1", "mkfs.fat" }; [Test] @@ -202,23 +203,23 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat32_mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat32_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(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(); + 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]); + 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]); } } } diff --git a/DiscImageChef.Tests/Filesystems/HFS.cs b/DiscImageChef.Tests/Filesystems/HFS.cs index bc1de15a..8ab73c43 100644 --- a/DiscImageChef.Tests/Filesystems/HFS.cs +++ b/DiscImageChef.Tests/Filesystems/HFS.cs @@ -42,57 +42,58 @@ namespace DiscImageChef.Tests.Filesystems readonly string[] testfiles = { "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" + "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 = { 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, MediaType.DOS_35_HD, MediaType.DOS_35_HD, MediaType.DOS_35_HD }; - readonly ulong[] sectors = {1600, 1600, 1600, 2880, 2880, 2880, 2880}; + readonly ulong[] sectors = {1600, 1600, 1600, 2880, 2880, 2880, 2880, 2880}; - readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512, 512}; + readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512, 512, 512}; - readonly long[] clusters = {1594, 1594, 1594, 2874, 2874, 2874, 2874}; + readonly long[] clusters = {1594, 1594, 1594, 2874, 2874, 2874, 2874, 2874}; - readonly int[] clustersize = {512, 512, 512, 512, 512, 512, 512}; + readonly int[] clustersize = {512, 512, 512, 512, 512, 512, 512, 512}; readonly string[] volumename = { "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", - "Volume label" + "Volume label", "VOLUME LABEL" }; - readonly string[] volumeserial = {null, null, null, null, null, null, null}; + readonly string[] volumeserial = {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.TestFilesRoot, "filesystems", "hfs", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "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(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(); - Partition wholePart = new Partition + IFilesystem fs = new AppleHFS(); + Partition wholePart = new Partition { - Name = "Whole device", + Name = "Whole device", Length = image.Info.Sectors, - Size = image.Info.Sectors * image.Info.SectorSize + 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(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]); } } @@ -161,17 +162,17 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfs_apm", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfs_apm", 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(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++) + IFilesystem fs = new AppleHFS(); + int part = -1; + for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "Apple_HFS") { part = j; @@ -181,10 +182,10 @@ namespace DiscImageChef.Tests.Filesystems 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(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]); } } @@ -218,17 +219,17 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfs_cdrom", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfs_cdrom", testfiles[i]); + 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(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++) + IFilesystem fs = new AppleHFS(); + int part = -1; + for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "Apple_HFS") { part = j; @@ -238,10 +239,10 @@ namespace DiscImageChef.Tests.Filesystems 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(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]); } } @@ -272,17 +273,17 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfs_mbr", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfs_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(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++) + IFilesystem fs = new AppleHFS(); + int part = -1; + for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "0xAF") { part = j; @@ -292,10 +293,10 @@ namespace DiscImageChef.Tests.Filesystems 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(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]); } } @@ -323,17 +324,17 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfs_rdb", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfs_rdb", 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(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++) + IFilesystem fs = new AppleHFS(); + int part = -1; + for(int j = 0; j < partitions.Count; j++) if(partitions[j].Type == "\"RES\\86\"") { part = j; @@ -343,10 +344,10 @@ namespace DiscImageChef.Tests.Filesystems 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(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]); } } diff --git a/DiscImageChef.Tests/Filesystems/HPFS.cs b/DiscImageChef.Tests/Filesystems/HPFS.cs index f86998d8..dbeaaabb 100644 --- a/DiscImageChef.Tests/Filesystems/HPFS.cs +++ b/DiscImageChef.Tests/Filesystems/HPFS.cs @@ -43,35 +43,39 @@ namespace DiscImageChef.Tests.Filesystems { "ecs.vdi.lz", "msos2_1.21.vdi.lz", "msos2_1.30.1.vdi.lz", "os2_1.20.vdi.lz", "os2_1.30.vdi.lz", "os2_6.307.vdi.lz", "os2_6.514.vdi.lz", "os2_6.617.vdi.lz", "os2_8.162.vdi.lz", "os2_9.023.vdi.lz", - "winnt_3.10.vdi.lz", "winnt_3.50.vdi.lz" + "winnt_3.10.vdi.lz", "winnt_3.50.vdi.lz", "ecs20_fstester.vdi.lz" }; readonly ulong[] sectors = - {262144, 1024000, 1024000, 1024000, 1024000, 1024000, 262144, 262144, 262144, 262144, 262144, 262144}; + { + 262144, 1024000, 1024000, 1024000, 1024000, 1024000, 262144, 262144, 262144, 262144, 262144, 262144, 1024000 + }; - readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512}; + readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512}; readonly long[] clusters = - {261072, 1023056, 1023056, 1023056, 1023056, 1023056, 262016, 262016, 262016, 262016, 262016, 262112}; + { + 261072, 1023056, 1023056, 1023056, 1023056, 1023056, 262016, 262016, 262016, 262016, 262016, 262112, 1022112 + }; - readonly int[] clustersize = {512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512}; + readonly int[] clustersize = {512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512}; readonly string[] volumename = { "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", - "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL" + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUME LABE" }; readonly string[] volumeserial = { "2BBBD814", "AC0DDC15", "ABEB2C15", "6C4EE015", "6C406015", "6C49B015", "2BCEB414", "2C157414", "2BF55414", - "2BE31414", "E851CB14", "A4EDC29C" + "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" + "OS2 20.0", "MSDOS5.0", "MSDOS5.0", "IBM 4.50" }; [Test] @@ -79,23 +83,23 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hpfs", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hpfs", 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(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(); + 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]); + 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]); } } } diff --git a/DiscImageChef.Tests/Filesystems/JFS2.cs b/DiscImageChef.Tests/Filesystems/JFS2.cs index 1fe382f1..5049d508 100644 --- a/DiscImageChef.Tests/Filesystems/JFS2.cs +++ b/DiscImageChef.Tests/Filesystems/JFS2.cs @@ -39,37 +39,40 @@ namespace DiscImageChef.Tests.Filesystems [TestFixture] public class Jfs2 { - readonly string[] testfiles = {"linux.vdi.lz", "linux_caseinsensitive.vdi.lz"}; + readonly string[] testfiles = {"linux.vdi.lz", "linux_caseinsensitive.vdi.lz", "ecs20_fstester.vdi.lz"}; - readonly ulong[] sectors = {262144, 262144}; + readonly ulong[] sectors = {262144, 262144, 1024000}; - readonly uint[] sectorsize = {512, 512}; + readonly uint[] sectorsize = {512, 512, 512}; - readonly long[] clusters = {257632, 257632}; + readonly long[] clusters = {257632, 257632, 1017512}; - readonly int[] clustersize = {4096, 4096}; + readonly int[] clustersize = {4096, 4096, 4096}; - readonly string[] volumename = {"Volume labe", "Volume labe"}; + readonly string[] volumename = {"Volume labe", "Volume labe", "Volume labe"}; readonly string[] volumeserial = - {"8033b783-0cd1-1645-8ecc-f8f113ad6a47", "d6cd91e9-3899-7e40-8468-baab688ee2e2"}; + { + "8033b783-0cd1-1645-8ecc-f8f113ad6a47", "d6cd91e9-3899-7e40-8468-baab688ee2e2", + "f4077ce9-0000-0000-0000-000000007c10" + }; [Test] public void Test() { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "jfs2", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "jfs2", 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(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++) + 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; @@ -79,11 +82,11 @@ namespace DiscImageChef.Tests.Filesystems 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]); + 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]); } } } diff --git a/DiscImageChef.Tests/Filesystems/UDF.cs b/DiscImageChef.Tests/Filesystems/UDF.cs index 2f723f0a..6bafe3fe 100644 --- a/DiscImageChef.Tests/Filesystems/UDF.cs +++ b/DiscImageChef.Tests/Filesystems/UDF.cs @@ -98,28 +98,84 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "udf", testfiles[i]); - IFilter filter = new LZip(); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "udf", 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(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 UDF(); - Partition wholePart = new Partition + IFilesystem fs = new UDF(); + Partition wholePart = new Partition { - Name = "Whole device", + Name = "Whole device", Length = image.Info.Sectors, - Size = image.Info.Sectors * image.Info.SectorSize + 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(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]); + Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); + } + } + } + + [TestFixture] + public class UdfOptical + { + readonly string[] testfiles = + {"1.50/ecs20.iso.lz", "2.00/ecs20.iso.lz", "2.01/ecs20.iso.lz", "2.01/ecs20_cdrw.iso.lz"}; + + readonly ulong[] sectors = {2295104, 2295104, 2295104, 295264}; + + readonly uint[] sectorsize = {2048, 2048, 2048, 2048}; + + readonly long[] clusters = {2295104, 2295104, 2295104, 295264}; + + readonly int[] clustersize = {2048, 2048, 2048, 2048}; + + readonly string[] udfversion = {"UDF v2.01", "UDF v2.01", "UDF v2.01", "UDF v2.01"}; + + readonly string[] volumename = {"Volume label", "UDF5A5DEF48", "VolLabel", "UDF5A5DFF10"}; + + readonly string[] volumeserial = + { + "Volume Set ID not specified", "Volume Set ID not specified", "VolumeSetId", "Volume Set ID not specified" + }; + + readonly string[] oemid = {"*ExpressUDF", "*ExpressUDF", "*ExpressUDF", "*ExpressUDF"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "udf", testfiles[i]); + 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]); + IFilesystem fs = new UDF(); + Partition 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]); } } }