diff --git a/DiscImageChef.Tests/DiscImageChef.Tests.csproj b/DiscImageChef.Tests/DiscImageChef.Tests.csproj index 2d03ea9b3..e423b0100 100644 --- a/DiscImageChef.Tests/DiscImageChef.Tests.csproj +++ b/DiscImageChef.Tests/DiscImageChef.Tests.csproj @@ -70,96 +70,48 @@ - - - - - - - - - - - - - - - - - + + + + - - + - - - + - - - - - - - - + - - - - - - - - + - - - + - + - + - - - - + - - - - - - - + - - - - - - + - - - + @@ -178,12 +130,6 @@ - - - - - - diff --git a/DiscImageChef.Tests/Filesystems/AFFS.cs b/DiscImageChef.Tests/Filesystems/AFFS.cs index 07df391ad..56dcb10eb 100644 --- a/DiscImageChef.Tests/Filesystems/AFFS.cs +++ b/DiscImageChef.Tests/Filesystems/AFFS.cs @@ -26,6 +26,7 @@ // Copyright © 2011-2018 Natalia Portillo // ****************************************************************************/ +using System.Collections.Generic; using System.IO; using DiscImageChef.CommonTypes; using DiscImageChef.DiscImages; @@ -84,4 +85,167 @@ namespace DiscImageChef.Tests.Filesystems } } } + + [TestFixture] + public class AffsMbr + { + readonly string[] testfiles = {"aros.vdi.lz", "aros_intl.vdi.lz"}; + + readonly ulong[] sectors = {409600, 409600}; + + readonly uint[] sectorsize = {512, 512}; + + readonly long[] clusters = {408240, 408240}; + + readonly int[] clustersize = {512, 512}; + + readonly string[] volumename = {"Volume label", "Volume label"}; + + readonly string[] volumeserial = {"A582DCA4", "A582BC91"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "affs_mbr", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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]); + } + } + } + + [TestFixture] + public class AffsMbrRdb + { + readonly string[] testfiles = {"aros.vdi.lz", "aros_intl.vdi.lz"}; + + readonly ulong[] sectors = {409600, 409600}; + + readonly uint[] sectorsize = {512, 512}; + + readonly long[] clusters = {406224, 406224}; + + readonly int[] clustersize = {512, 512}; + + readonly string[] volumename = {"Volume label", "Volume label"}; + + readonly string[] volumeserial = {"A58348CE", "A5833CD0"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "affs_mbr_rdb", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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]); + } + } + } + + [TestFixture] + public class AffsRdb + { + readonly string[] testfiles = + { + "amigaos_3.9.vdi.lz", "amigaos_3.9_intl.vdi.lz", "aros.vdi.lz", "aros_intl.vdi.lz", "amigaos_4.0.vdi.lz", + "amigaos_4.0_intl.vdi.lz", "amigaos_4.0_cache.vdi.lz" + }; + + readonly ulong[] sectors = {1024128, 1024128, 409600, 409600, 1024128, 1024128, 1024128}; + + readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512, 512}; + + readonly long[] clusters = {510032, 510032, 407232, 407232, 511040, 511040, 511040}; + + readonly int[] clustersize = {1024, 1024, 512, 512, 1024, 1024, 1024}; + + readonly string[] volumename = + { + "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", + "Volume label" + }; + + readonly string[] volumeserial = + {"A56D0F5C", "A56D049C", "A58307A9", "A58304BE", "A56CC7EE", "A56CDDC4", "A56CC133"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "affs_rdb", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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/DiscImageChef.Tests/Filesystems/AFFS2_RDB.cs b/DiscImageChef.Tests/Filesystems/AFFS2.cs similarity index 99% rename from DiscImageChef.Tests/Filesystems/AFFS2_RDB.cs rename to DiscImageChef.Tests/Filesystems/AFFS2.cs index 8695d3f02..124253192 100644 --- a/DiscImageChef.Tests/Filesystems/AFFS2_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/AFFS2.cs @@ -2,7 +2,7 @@ // The Disc Image Chef // ---------------------------------------------------------------------------- // -// Filename : AFFS2_RDB.cs +// Filename : AFFS2.cs // Author(s) : Natalia Portillo // // Component : DiscImageChef unit testing. diff --git a/DiscImageChef.Tests/Filesystems/AFFS_MBR.cs b/DiscImageChef.Tests/Filesystems/AFFS_MBR.cs deleted file mode 100644 index b1074732f..000000000 --- a/DiscImageChef.Tests/Filesystems/AFFS_MBR.cs +++ /dev/null @@ -1,89 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : AFFS_MBR.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class AffsMbr - { - readonly string[] testfiles = {"aros.vdi.lz", "aros_intl.vdi.lz"}; - - readonly ulong[] sectors = {409600, 409600}; - - readonly uint[] sectorsize = {512, 512}; - - readonly long[] clusters = {408240, 408240}; - - readonly int[] clustersize = {512, 512}; - - readonly string[] volumename = {"Volume label", "Volume label"}; - - readonly string[] volumeserial = {"A582DCA4", "A582BC91"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "affs_mbr", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/AFFS_MBR_RDB.cs b/DiscImageChef.Tests/Filesystems/AFFS_MBR_RDB.cs deleted file mode 100644 index 37b6a504d..000000000 --- a/DiscImageChef.Tests/Filesystems/AFFS_MBR_RDB.cs +++ /dev/null @@ -1,89 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : AFFS_MBR_RD.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class AffsMbrRdb - { - readonly string[] testfiles = {"aros.vdi.lz", "aros_intl.vdi.lz"}; - - readonly ulong[] sectors = {409600, 409600}; - - readonly uint[] sectorsize = {512, 512}; - - readonly long[] clusters = {406224, 406224}; - - readonly int[] clustersize = {512, 512}; - - readonly string[] volumename = {"Volume label", "Volume label"}; - - readonly string[] volumeserial = {"A58348CE", "A5833CD0"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "affs_mbr_rdb", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/AFFS_RDB.cs b/DiscImageChef.Tests/Filesystems/AFFS_RDB.cs deleted file mode 100644 index 34bfe27d0..000000000 --- a/DiscImageChef.Tests/Filesystems/AFFS_RDB.cs +++ /dev/null @@ -1,99 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : AFFS_RDB.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class AffsRdb - { - readonly string[] testfiles = - { - "amigaos_3.9.vdi.lz", "amigaos_3.9_intl.vdi.lz", "aros.vdi.lz", "aros_intl.vdi.lz", "amigaos_4.0.vdi.lz", - "amigaos_4.0_intl.vdi.lz", "amigaos_4.0_cache.vdi.lz" - }; - - readonly ulong[] sectors = {1024128, 1024128, 409600, 409600, 1024128, 1024128, 1024128}; - - readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512, 512}; - - readonly long[] clusters = {510032, 510032, 407232, 407232, 511040, 511040, 511040}; - - readonly int[] clustersize = {1024, 1024, 512, 512, 1024, 1024, 1024}; - - readonly string[] volumename = - { - "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", - "Volume label" - }; - - readonly string[] volumeserial = - {"A56D0F5C", "A56D049C", "A58307A9", "A58304BE", "A56CC7EE", "A56CDDC4", "A56CC133"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "affs_rdb", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/AFS.cs b/DiscImageChef.Tests/Filesystems/AFS.cs index 700da2206..847666ea4 100644 --- a/DiscImageChef.Tests/Filesystems/AFS.cs +++ b/DiscImageChef.Tests/Filesystems/AFS.cs @@ -26,6 +26,7 @@ // Copyright © 2011-2018 Natalia Portillo // ****************************************************************************/ +using System.Collections.Generic; using System.IO; using DiscImageChef.CommonTypes; using DiscImageChef.DiscImages; @@ -96,4 +97,57 @@ namespace DiscImageChef.Tests.Filesystems } } } + + [TestFixture] + public class AfsMbr + { + readonly string[] testfiles = {"scoopenserver_5.0.7hw.vdi.lz"}; + + readonly ulong[] sectors = {1024000}; + + readonly uint[] sectorsize = {512}; + + readonly long[] clusters = {510048}; + + readonly int[] clustersize = {1024}; + + readonly string[] volumename = {"Volume label"}; + + readonly string[] volumeserial = {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.TestFilesRoot, "filesystems", "afs_mbr", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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/DiscImageChef.Tests/Filesystems/AFS_MBR.cs b/DiscImageChef.Tests/Filesystems/AFS_MBR.cs deleted file mode 100644 index f2f5d8c82..000000000 --- a/DiscImageChef.Tests/Filesystems/AFS_MBR.cs +++ /dev/null @@ -1,91 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : AFS_MBR.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class AfsMbr - { - readonly string[] testfiles = {"scoopenserver_5.0.7hw.vdi.lz"}; - - readonly ulong[] sectors = {1024000}; - - readonly uint[] sectorsize = {512}; - - readonly long[] clusters = {510048}; - - readonly int[] clustersize = {1024}; - - readonly string[] volumename = {"Volume label"}; - - readonly string[] volumeserial = {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.TestFilesRoot, "filesystems", "afs_mbr", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/AOFS.cs b/DiscImageChef.Tests/Filesystems/AOFS.cs index 5700a2e81..a4e247ed2 100644 --- a/DiscImageChef.Tests/Filesystems/AOFS.cs +++ b/DiscImageChef.Tests/Filesystems/AOFS.cs @@ -26,6 +26,7 @@ // Copyright © 2011-2018 Natalia Portillo // ****************************************************************************/ +using System.Collections.Generic; using System.IO; using DiscImageChef.CommonTypes; using DiscImageChef.DiscImages; @@ -84,4 +85,159 @@ namespace DiscImageChef.Tests.Filesystems } } } + + [TestFixture] + public class AofsMbr + { + readonly string[] testfiles = {"aros.vdi.lz", "aros_intl.vdi.lz"}; + + readonly ulong[] sectors = {409600, 409600}; + + readonly uint[] sectorsize = {512, 512}; + + readonly long[] clusters = {408240, 408240}; + + readonly int[] clustersize = {512, 512}; + + readonly string[] volumename = {"Volume label", "Volume label"}; + + readonly string[] volumeserial = {"A582C90C", "A582CE0D"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "aofs_mbr", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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]); + } + } + } + + [TestFixture] + public class AofsMbrRdb + { + readonly string[] testfiles = {"aros.vdi.lz", "aros_intl.vdi.lz"}; + + readonly ulong[] sectors = {409600, 409600}; + + readonly uint[] sectorsize = {512, 512}; + + readonly long[] clusters = {406224, 406224}; + + readonly int[] clustersize = {512, 512}; + + readonly string[] volumename = {"Volume label", "Volume label"}; + + readonly string[] volumeserial = {"A5833C5B", "A5833085"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "aofs_mbr_rdb", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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]); + } + } + } + + [TestFixture] + public class AofsRdb + { + readonly string[] testfiles = + {"amigaos_3.9.vdi.lz", "amigaos_3.9_intl.vdi.lz", "aros.vdi.lz", "aros_intl.vdi.lz"}; + + readonly ulong[] sectors = {1024128, 1024128, 409600, 409600}; + + readonly uint[] sectorsize = {512, 512, 512, 512}; + + readonly long[] clusters = {510032, 510032, 407232, 407232}; + + readonly int[] clustersize = {1024, 1024, 512, 512}; + + readonly string[] volumename = {"Volume label", "Volume label", "Volume label", "Volume label"}; + + readonly string[] volumeserial = {"A56D13BB", "A56D0415", "A582F3A0", "A5830B06"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "aofs_rdb", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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/DiscImageChef.Tests/Filesystems/AOFS_MBR.cs b/DiscImageChef.Tests/Filesystems/AOFS_MBR.cs deleted file mode 100644 index 0a3f3aa57..000000000 --- a/DiscImageChef.Tests/Filesystems/AOFS_MBR.cs +++ /dev/null @@ -1,89 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : Settings.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class AofsMbr - { - readonly string[] testfiles = {"aros.vdi.lz", "aros_intl.vdi.lz"}; - - readonly ulong[] sectors = {409600, 409600}; - - readonly uint[] sectorsize = {512, 512}; - - readonly long[] clusters = {408240, 408240}; - - readonly int[] clustersize = {512, 512}; - - readonly string[] volumename = {"Volume label", "Volume label"}; - - readonly string[] volumeserial = {"A582C90C", "A582CE0D"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "aofs_mbr", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/AOFS_MBR_RDB.cs b/DiscImageChef.Tests/Filesystems/AOFS_MBR_RDB.cs deleted file mode 100644 index 08d71ab1b..000000000 --- a/DiscImageChef.Tests/Filesystems/AOFS_MBR_RDB.cs +++ /dev/null @@ -1,89 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : AOFS_MBR_RDB.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class AofsMbrRdb - { - readonly string[] testfiles = {"aros.vdi.lz", "aros_intl.vdi.lz"}; - - readonly ulong[] sectors = {409600, 409600}; - - readonly uint[] sectorsize = {512, 512}; - - readonly long[] clusters = {406224, 406224}; - - readonly int[] clustersize = {512, 512}; - - readonly string[] volumename = {"Volume label", "Volume label"}; - - readonly string[] volumeserial = {"A5833C5B", "A5833085"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "aofs_mbr_rdb", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/AOFS_RDB.cs b/DiscImageChef.Tests/Filesystems/AOFS_RDB.cs deleted file mode 100644 index e9362662f..000000000 --- a/DiscImageChef.Tests/Filesystems/AOFS_RDB.cs +++ /dev/null @@ -1,91 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : AOFS_RDB.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class AofsRdb - { - readonly string[] testfiles = - {"amigaos_3.9.vdi.lz", "amigaos_3.9_intl.vdi.lz", "aros.vdi.lz", "aros_intl.vdi.lz"}; - - readonly ulong[] sectors = {1024128, 1024128, 409600, 409600}; - - readonly uint[] sectorsize = {512, 512, 512, 512}; - - readonly long[] clusters = {510032, 510032, 407232, 407232}; - - readonly int[] clustersize = {1024, 1024, 512, 512}; - - readonly string[] volumename = {"Volume label", "Volume label", "Volume label", "Volume label"}; - - readonly string[] volumeserial = {"A56D13BB", "A56D0415", "A582F3A0", "A5830B06"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "aofs_rdb", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/Atheos_MBR.cs b/DiscImageChef.Tests/Filesystems/Atheos.cs similarity index 99% rename from DiscImageChef.Tests/Filesystems/Atheos_MBR.cs rename to DiscImageChef.Tests/Filesystems/Atheos.cs index 06a7f1798..fe7d92b82 100644 --- a/DiscImageChef.Tests/Filesystems/Atheos_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/Atheos.cs @@ -2,7 +2,7 @@ // The Disc Image Chef // ---------------------------------------------------------------------------- // -// Filename : Atheos_MBR.cs +// Filename : Atheos.cs // Author(s) : Natalia Portillo // // Component : DiscImageChef unit testing. diff --git a/DiscImageChef.Tests/Filesystems/BeFS.cs b/DiscImageChef.Tests/Filesystems/BeFS.cs index 230ae9f5d..d22bdfca7 100644 --- a/DiscImageChef.Tests/Filesystems/BeFS.cs +++ b/DiscImageChef.Tests/Filesystems/BeFS.cs @@ -26,6 +26,7 @@ // Copyright © 2011-2018 Natalia Portillo // ****************************************************************************/ +using System.Collections.Generic; using System.IO; using DiscImageChef.CommonTypes; using DiscImageChef.DiscImages; @@ -87,4 +88,159 @@ namespace DiscImageChef.Tests.Filesystems } } } + + [TestFixture] + public class BeFsApm + { + readonly string[] testfiles = {"beos_r3.1.vdi.lz", "beos_r4.5.vdi.lz"}; + + readonly ulong[] sectors = {1572864, 1572864}; + + readonly uint[] sectorsize = {512, 512}; + + readonly long[] clusters = {786336, 786336}; + + readonly int[] clustersize = {1024, 1024}; + + readonly string[] volumename = {"Volume label", "Volume label"}; + + readonly string[] volumeserial = {null, null}; + + readonly string[] oemid = {null, null}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "befs_apm", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem fs = new 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 _); + 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]); + } + } + } + [TestFixture] + public class BeFsGpt + { + readonly string[] testfiles = {"haiku_hrev51259.vdi.lz"}; + + readonly ulong[] sectors = {8388608}; + + readonly uint[] sectorsize = {512}; + + readonly long[] clusters = {2096640}; + + readonly int[] clustersize = {2048}; + + readonly string[] volumename = {"Volume label"}; + + readonly string[] volumeserial = {null, null}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "befs_gpt", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem fs = new 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 _); + 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]); + } + } + } + [TestFixture] + public class BeFsMbr + { + readonly string[] testfiles = + {"beos_r3.1.vdi.lz", "beos_r4.5.vdi.lz", "haiku_hrev51259.vdi.lz", "syllable_0.6.7.vdi.lz"}; + + readonly ulong[] sectors = {1572864, 1572864, 8388608, 2097152}; + + readonly uint[] sectorsize = {512, 512, 512, 512}; + + readonly long[] clusters = {786400, 785232, 2096640, 524272}; + + readonly int[] clustersize = {1024, 1024, 2048, 2048}; + + readonly string[] volumename = {"Volume label", "Volume label", "Volume label", "Volume label"}; + + readonly string[] volumeserial = {null, null, null, null}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "befs_mbr", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem fs = new 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 _); + 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/DiscImageChef.Tests/Filesystems/BeFS_APM.cs b/DiscImageChef.Tests/Filesystems/BeFS_APM.cs deleted file mode 100644 index 37991ce73..000000000 --- a/DiscImageChef.Tests/Filesystems/BeFS_APM.cs +++ /dev/null @@ -1,92 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : BeFS_APM.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class BeFsApm - { - readonly string[] testfiles = {"beos_r3.1.vdi.lz", "beos_r4.5.vdi.lz"}; - - readonly ulong[] sectors = {1572864, 1572864}; - - readonly uint[] sectorsize = {512, 512}; - - readonly long[] clusters = {786336, 786336}; - - readonly int[] clustersize = {1024, 1024}; - - readonly string[] volumename = {"Volume label", "Volume label"}; - - readonly string[] volumeserial = {null, null}; - - readonly string[] oemid = {null, null}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "befs_apm", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem fs = new 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 _); - 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/DiscImageChef.Tests/Filesystems/BeFS_GPT.cs b/DiscImageChef.Tests/Filesystems/BeFS_GPT.cs deleted file mode 100644 index 6a18df249..000000000 --- a/DiscImageChef.Tests/Filesystems/BeFS_GPT.cs +++ /dev/null @@ -1,89 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : BeFS_GPT.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class BeFsGpt - { - readonly string[] testfiles = {"haiku_hrev51259.vdi.lz"}; - - readonly ulong[] sectors = {8388608}; - - readonly uint[] sectorsize = {512}; - - readonly long[] clusters = {2096640}; - - readonly int[] clustersize = {2048}; - - readonly string[] volumename = {"Volume label"}; - - readonly string[] volumeserial = {null, null}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "befs_gpt", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem fs = new 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 _); - 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/DiscImageChef.Tests/Filesystems/BeFS_MBR.cs b/DiscImageChef.Tests/Filesystems/BeFS_MBR.cs deleted file mode 100644 index 1db931337..000000000 --- a/DiscImageChef.Tests/Filesystems/BeFS_MBR.cs +++ /dev/null @@ -1,90 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : BeFS_MBR.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class BeFsMbr - { - readonly string[] testfiles = - {"beos_r3.1.vdi.lz", "beos_r4.5.vdi.lz", "haiku_hrev51259.vdi.lz", "syllable_0.6.7.vdi.lz"}; - - readonly ulong[] sectors = {1572864, 1572864, 8388608, 2097152}; - - readonly uint[] sectorsize = {512, 512, 512, 512}; - - readonly long[] clusters = {786400, 785232, 2096640, 524272}; - - readonly int[] clustersize = {1024, 1024, 2048, 2048}; - - readonly string[] volumename = {"Volume label", "Volume label", "Volume label", "Volume label"}; - - readonly string[] volumeserial = {null, null, null, null}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "befs_mbr", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem fs = new 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 _); - 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/DiscImageChef.Tests/Filesystems/COHERENT.cs b/DiscImageChef.Tests/Filesystems/COHERENT.cs index 9b82f2439..2793aacaf 100644 --- a/DiscImageChef.Tests/Filesystems/COHERENT.cs +++ b/DiscImageChef.Tests/Filesystems/COHERENT.cs @@ -26,6 +26,7 @@ // Copyright © 2011-2018 Natalia Portillo // ****************************************************************************/ +using System.Collections.Generic; using System.IO; using DiscImageChef.CommonTypes; using DiscImageChef.DiscImages; @@ -91,4 +92,56 @@ namespace DiscImageChef.Tests.Filesystems } } } + [TestFixture] + public class CoherentMbr + { + readonly string[] testfiles = {"coherentunix_4.2.10.vdi.lz"}; + + readonly ulong[] sectors = {1024000}; + + readonly uint[] sectorsize = {512}; + + readonly long[] clusters = {510048}; + + readonly int[] clustersize = {1024}; + + readonly string[] volumename = {"Volume label"}; + + readonly string[] volumeserial = {null}; + + readonly string[] type = {"Coherent fs"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "coherent_mbr", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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/DiscImageChef.Tests/Filesystems/COHERENT_MBR.cs b/DiscImageChef.Tests/Filesystems/COHERENT_MBR.cs deleted file mode 100644 index f53f9c124..000000000 --- a/DiscImageChef.Tests/Filesystems/COHERENT_MBR.cs +++ /dev/null @@ -1,91 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : COHERENT_MBR.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class CoherentMbr - { - readonly string[] testfiles = {"coherentunix_4.2.10.vdi.lz"}; - - readonly ulong[] sectors = {1024000}; - - readonly uint[] sectorsize = {512}; - - readonly long[] clusters = {510048}; - - readonly int[] clustersize = {1024}; - - readonly string[] volumename = {"Volume label"}; - - readonly string[] volumeserial = {null}; - - readonly string[] type = {"Coherent fs"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "coherent_mbr", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/DTFS.cs b/DiscImageChef.Tests/Filesystems/DTFS.cs index 6a630e208..55939cb59 100644 --- a/DiscImageChef.Tests/Filesystems/DTFS.cs +++ b/DiscImageChef.Tests/Filesystems/DTFS.cs @@ -26,6 +26,7 @@ // Copyright © 2011-2018 Natalia Portillo // ****************************************************************************/ +using System.Collections.Generic; using System.IO; using DiscImageChef.CommonTypes; using DiscImageChef.DiscImages; @@ -92,4 +93,56 @@ namespace DiscImageChef.Tests.Filesystems } } } + [TestFixture] + public class DtfsMbr + { + readonly string[] testfiles = {"scoopenserver_5.0.7hw.vdi.lz"}; + + readonly ulong[] sectors = {1024000}; + + readonly uint[] sectorsize = {512}; + + readonly long[] clusters = {510048}; + + readonly int[] clustersize = {1024}; + + readonly string[] volumename = {"Volume label"}; + + readonly string[] volumeserial = {null}; + + readonly string[] type = {"DTFS"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "dtfs_mbr", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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/DiscImageChef.Tests/Filesystems/DTFS_MBR.cs b/DiscImageChef.Tests/Filesystems/DTFS_MBR.cs deleted file mode 100644 index 81c34d44a..000000000 --- a/DiscImageChef.Tests/Filesystems/DTFS_MBR.cs +++ /dev/null @@ -1,91 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : DTFS_MBR.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class DtfsMbr - { - readonly string[] testfiles = {"scoopenserver_5.0.7hw.vdi.lz"}; - - readonly ulong[] sectors = {1024000}; - - readonly uint[] sectorsize = {512}; - - readonly long[] clusters = {510048}; - - readonly int[] clustersize = {1024}; - - readonly string[] volumename = {"Volume label"}; - - readonly string[] volumeserial = {null}; - - readonly string[] type = {"DTFS"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "dtfs_mbr", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/EAFS.cs b/DiscImageChef.Tests/Filesystems/EAFS.cs index 5d1ebd537..1fbf0763a 100644 --- a/DiscImageChef.Tests/Filesystems/EAFS.cs +++ b/DiscImageChef.Tests/Filesystems/EAFS.cs @@ -26,6 +26,7 @@ // Copyright © 2011-2018 Natalia Portillo // ****************************************************************************/ +using System.Collections.Generic; using System.IO; using DiscImageChef.CommonTypes; using DiscImageChef.DiscImages; @@ -96,4 +97,56 @@ namespace DiscImageChef.Tests.Filesystems } } } + [TestFixture] + public class EafsMbr + { + readonly string[] testfiles = {"scoopenserver_5.0.7hw.vdi.lz"}; + + readonly ulong[] sectors = {1024000}; + + readonly uint[] sectorsize = {512}; + + readonly long[] clusters = {510048}; + + readonly int[] clustersize = {1024}; + + readonly string[] volumename = {"Volume label"}; + + readonly string[] volumeserial = {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.TestFilesRoot, "filesystems", "eafs_mbr", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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/DiscImageChef.Tests/Filesystems/EAFS_MBR.cs b/DiscImageChef.Tests/Filesystems/EAFS_MBR.cs deleted file mode 100644 index 5c49b8cda..000000000 --- a/DiscImageChef.Tests/Filesystems/EAFS_MBR.cs +++ /dev/null @@ -1,91 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : EAFS_MBR.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class EafsMbr - { - readonly string[] testfiles = {"scoopenserver_5.0.7hw.vdi.lz"}; - - readonly ulong[] sectors = {1024000}; - - readonly uint[] sectorsize = {512}; - - readonly long[] clusters = {510048}; - - readonly int[] clustersize = {1024}; - - readonly string[] volumename = {"Volume label"}; - - readonly string[] volumeserial = {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.TestFilesRoot, "filesystems", "eafs_mbr", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/FAT12.cs b/DiscImageChef.Tests/Filesystems/FAT12.cs index 7efeb7147..acb75ecf0 100644 --- a/DiscImageChef.Tests/Filesystems/FAT12.cs +++ b/DiscImageChef.Tests/Filesystems/FAT12.cs @@ -26,6 +26,7 @@ // Copyright © 2011-2018 Natalia Portillo // ****************************************************************************/ +using System.Collections.Generic; using System.IO; using DiscImageChef.CommonTypes; using DiscImageChef.DiscImages; @@ -1734,4 +1735,222 @@ namespace DiscImageChef.Tests.Filesystems } } } + [TestFixture] + public class Fat12Apm + { + readonly string[] testfiles = {"macosx_10.11.vdi.lz"}; + + readonly ulong[] sectors = {16384}; + + readonly uint[] sectorsize = {512}; + + readonly long[] clusters = {4076}; + + readonly int[] clustersize = {2048}; + + readonly string[] volumename = {"VOLUMELABEL"}; + + readonly string[] volumeserial = {"32181F09"}; + + readonly string[] oemid = {"BSD 4.4"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat12_apm", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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]); + } + } + } + [TestFixture] + public class Fat12Gpt + { + readonly string[] testfiles = {"macosx_10.11.vdi.lz"}; + + readonly ulong[] sectors = {16384}; + + readonly uint[] sectorsize = {512}; + + readonly long[] clusters = {4076}; + + readonly int[] clustersize = {2048}; + + readonly string[] volumename = {"VOLUMELABEL"}; + + readonly string[] volumeserial = {"66901F1B"}; + + readonly string[] oemid = {"BSD 4.4"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat12_gpt", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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]); + } + } + } + [TestFixture] + public class Fat12Mbr + { + readonly string[] testfiles = + { + "compaqmsdos331.vdi.lz", "drdos_3.40.vdi.lz", "drdos_3.41.vdi.lz", "drdos_5.00.vdi.lz", "drdos_6.00.vdi.lz", + "drdos_7.02.vdi.lz", "drdos_7.03.vdi.lz", "drdos_8.00.vdi.lz", "msdos331.vdi.lz", "msdos401.vdi.lz", + "msdos500.vdi.lz", "msdos600.vdi.lz", "msdos620rc1.vdi.lz", "msdos620.vdi.lz", "msdos621.vdi.lz", + "msdos622.vdi.lz", "msdos710.vdi.lz", "novelldos_7.00.vdi.lz", "opendos_7.01.vdi.lz", "pcdos2000.vdi.lz", + "pcdos200.vdi.lz", "pcdos210.vdi.lz", "pcdos300.vdi.lz", "pcdos310.vdi.lz", "pcdos330.vdi.lz", + "pcdos400.vdi.lz", "pcdos500.vdi.lz", "pcdos502.vdi.lz", "pcdos610.vdi.lz", "pcdos630.vdi.lz", + "toshibamsdos330.vdi.lz", "toshibamsdos401.vdi.lz", "msos2_1.21.vdi.lz", "msos2_1.30.1.vdi.lz", + "multiuserdos_7.22r4.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", "ecs.vdi.lz", "macosx_10.11.vdi.lz", + "win10.vdi.lz", "win2000.vdi.lz", "win95.vdi.lz", "win95osr2.1.vdi.lz", "win95osr2.5.vdi.lz", + "win95osr2.vdi.lz", "win98.vdi.lz", "win98se.vdi.lz", "winme.vdi.lz", "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", "freebsd_6.1.vdi.lz", "freebsd_7.0.vdi.lz", "freebsd_8.2.vdi.lz" + }; + + readonly ulong[] sectors = + { + 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, + 8192, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, + 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, + 16384, 16384 + }; + + 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 + }; + + readonly long[] clusters = + { + 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, + 2008, 2008, 2008, 2008, 2008, 2008, 1890, 4079, 3552, 4088, 2008, 2008, 2008, 2008, 2044, 2044, 2044, 4016, + 2044, 2044, 4016, 3072, 2040, 3584, 2044, 2044, 2044 + }; + + readonly int[] clustersize = + { + 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, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 2048, 2048, 2048, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 2048, + 4096, 4096, 2048, 2048, 4096, 2048, 4096, 4096, 4096 + }; + + readonly string[] volumename = + { + null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", null, null, null, + null, null, "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", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + "VolumeLabel", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL" + }; + + readonly string[] volumeserial = + { + 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, + "0F340FE4", "1A5E0FF9", "1D2F0FFE", "076C1004", "2C481009", null, "3C2319E8", "66CC3C15", "66A54C15", null, + "5C578015", "5B845015", "5C4BF015", "E6B5F414", "E6B15414", "E6A41414", "E6A39414", "E6B0B814", "26A21EF4", + "74F4921D", "C4B64D11", "29200D0C", "234F0DE4", "074C0DFC", "33640D18", "0E121460", "094C0EED", "38310F02", + "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.TestFilesRoot, "filesystems", "fat12_mbr", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem fs = new FAT(); + Assert.AreEqual(true, fs.Identify(image, partitions[0]), testfiles[i]); + fs.GetInformation(image, partitions[0], out _); + 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/DiscImageChef.Tests/Filesystems/FAT12_APM.cs b/DiscImageChef.Tests/Filesystems/FAT12_APM.cs deleted file mode 100644 index 37cc3243f..000000000 --- a/DiscImageChef.Tests/Filesystems/FAT12_APM.cs +++ /dev/null @@ -1,92 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : FAT12_APM.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class Fat12Apm - { - readonly string[] testfiles = {"macosx_10.11.vdi.lz"}; - - readonly ulong[] sectors = {16384}; - - readonly uint[] sectorsize = {512}; - - readonly long[] clusters = {4076}; - - readonly int[] clustersize = {2048}; - - readonly string[] volumename = {"VOLUMELABEL"}; - - readonly string[] volumeserial = {"32181F09"}; - - readonly string[] oemid = {"BSD 4.4"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat12_apm", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/FAT12_GPT.cs b/DiscImageChef.Tests/Filesystems/FAT12_GPT.cs deleted file mode 100644 index ffe10178d..000000000 --- a/DiscImageChef.Tests/Filesystems/FAT12_GPT.cs +++ /dev/null @@ -1,92 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : FAT12_GPM.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class Fat12Gpt - { - readonly string[] testfiles = {"macosx_10.11.vdi.lz"}; - - readonly ulong[] sectors = {16384}; - - readonly uint[] sectorsize = {512}; - - readonly long[] clusters = {4076}; - - readonly int[] clustersize = {2048}; - - readonly string[] volumename = {"VOLUMELABEL"}; - - readonly string[] volumeserial = {"66901F1B"}; - - readonly string[] oemid = {"BSD 4.4"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat12_gpt", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/FAT12_MBR.cs b/DiscImageChef.Tests/Filesystems/FAT12_MBR.cs deleted file mode 100644 index c12763b3f..000000000 --- a/DiscImageChef.Tests/Filesystems/FAT12_MBR.cs +++ /dev/null @@ -1,151 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : FAT12_MBR.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class Fat12Mbr - { - readonly string[] testfiles = - { - "compaqmsdos331.vdi.lz", "drdos_3.40.vdi.lz", "drdos_3.41.vdi.lz", "drdos_5.00.vdi.lz", "drdos_6.00.vdi.lz", - "drdos_7.02.vdi.lz", "drdos_7.03.vdi.lz", "drdos_8.00.vdi.lz", "msdos331.vdi.lz", "msdos401.vdi.lz", - "msdos500.vdi.lz", "msdos600.vdi.lz", "msdos620rc1.vdi.lz", "msdos620.vdi.lz", "msdos621.vdi.lz", - "msdos622.vdi.lz", "msdos710.vdi.lz", "novelldos_7.00.vdi.lz", "opendos_7.01.vdi.lz", "pcdos2000.vdi.lz", - "pcdos200.vdi.lz", "pcdos210.vdi.lz", "pcdos300.vdi.lz", "pcdos310.vdi.lz", "pcdos330.vdi.lz", - "pcdos400.vdi.lz", "pcdos500.vdi.lz", "pcdos502.vdi.lz", "pcdos610.vdi.lz", "pcdos630.vdi.lz", - "toshibamsdos330.vdi.lz", "toshibamsdos401.vdi.lz", "msos2_1.21.vdi.lz", "msos2_1.30.1.vdi.lz", - "multiuserdos_7.22r4.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", "ecs.vdi.lz", "macosx_10.11.vdi.lz", - "win10.vdi.lz", "win2000.vdi.lz", "win95.vdi.lz", "win95osr2.1.vdi.lz", "win95osr2.5.vdi.lz", - "win95osr2.vdi.lz", "win98.vdi.lz", "win98se.vdi.lz", "winme.vdi.lz", "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", "freebsd_6.1.vdi.lz", "freebsd_7.0.vdi.lz", "freebsd_8.2.vdi.lz" - }; - - readonly ulong[] sectors = - { - 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, - 8192, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, - 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, - 16384, 16384 - }; - - 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 - }; - - readonly long[] clusters = - { - 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, - 2008, 2008, 2008, 2008, 2008, 2008, 1890, 4079, 3552, 4088, 2008, 2008, 2008, 2008, 2044, 2044, 2044, 4016, - 2044, 2044, 4016, 3072, 2040, 3584, 2044, 2044, 2044 - }; - - readonly int[] clustersize = - { - 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, - 4096, 4096, 4096, 4096, 4096, 4096, 4096, 2048, 2048, 2048, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 2048, - 4096, 4096, 2048, 2048, 4096, 2048, 4096, 4096, 4096 - }; - - readonly string[] volumename = - { - null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", - "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", - "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", null, null, null, - null, null, "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", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", - "VolumeLabel", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL" - }; - - readonly string[] volumeserial = - { - 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, - "0F340FE4", "1A5E0FF9", "1D2F0FFE", "076C1004", "2C481009", null, "3C2319E8", "66CC3C15", "66A54C15", null, - "5C578015", "5B845015", "5C4BF015", "E6B5F414", "E6B15414", "E6A41414", "E6A39414", "E6B0B814", "26A21EF4", - "74F4921D", "C4B64D11", "29200D0C", "234F0DE4", "074C0DFC", "33640D18", "0E121460", "094C0EED", "38310F02", - "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.TestFilesRoot, "filesystems", "fat12_mbr", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem fs = new FAT(); - Assert.AreEqual(true, fs.Identify(image, partitions[0]), testfiles[i]); - fs.GetInformation(image, partitions[0], out _); - 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/DiscImageChef.Tests/Filesystems/FAT16.cs b/DiscImageChef.Tests/Filesystems/FAT16.cs index 344765cfb..1995dfcf3 100644 --- a/DiscImageChef.Tests/Filesystems/FAT16.cs +++ b/DiscImageChef.Tests/Filesystems/FAT16.cs @@ -26,6 +26,7 @@ // Copyright © 2011-2018 Natalia Portillo // ****************************************************************************/ +using System.Collections.Generic; using System.IO; using DiscImageChef.CommonTypes; using DiscImageChef.DiscImages; @@ -141,4 +142,330 @@ namespace DiscImageChef.Tests.Filesystems } } } + [TestFixture] + public class Fat16Apm + { + readonly string[] testfiles = {"macosx_10.11.vdi.lz"}; + + readonly ulong[] sectors = {1024000}; + + readonly uint[] sectorsize = {512}; + + readonly long[] clusters = {63995}; + + readonly int[] clustersize = {8192}; + + readonly string[] volumename = {"VOLUMELABEL"}; + + readonly string[] volumeserial = {"063D1F09"}; + + readonly string[] oemid = {"BSD 4.4"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat16_apm", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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]); + } + } + } + [TestFixture] + public class Fat16Atari + { + readonly string[] testfiles = {"tos_1.04.vdi.lz", "tos_1.04_small.vdi.lz"}; + + readonly ulong[] sectors = {81920, 16384}; + + readonly uint[] sectorsize = {512, 512}; + + readonly long[] clusters = {10239, 8191}; + + readonly int[] clustersize = {4096, 1024}; + + readonly string[] volumename = {null, null}; + + readonly string[] volumeserial = {"BA9831", "2019E1"}; + + readonly string[] oemid = {null, null}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat16_atari", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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]); + } + } + } + [TestFixture] + public class Fat16Gpt + { + readonly string[] testfiles = {"macosx_10.11.vdi.lz"}; + + readonly ulong[] sectors = {1024000}; + + readonly uint[] sectorsize = {512}; + + readonly long[] clusters = {63995}; + + readonly int[] clustersize = {8192}; + + readonly string[] volumename = {"VOLUMELABEL"}; + + readonly string[] volumeserial = {"2E8A1F1B"}; + + readonly string[] oemid = {"BSD 4.4"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat16_gpt", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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]); + } + } + } + [TestFixture] + public class Fat16Mbr + { + readonly string[] testfiles = + { + "drdos_3.40.vdi.lz", "drdos_3.41.vdi.lz", "drdos_5.00.vdi.lz", "drdos_6.00.vdi.lz", "drdos_7.02.vdi.lz", + "drdos_7.03.vdi.lz", "drdos_8.00.vdi.lz", "msdos331.vdi.lz", "msdos401.vdi.lz", "msdos500.vdi.lz", + "msdos600.vdi.lz", "msdos620rc1.vdi.lz", "msdos620.vdi.lz", "msdos621.vdi.lz", "msdos622.vdi.lz", + "msdos710.vdi.lz", "novelldos_7.00.vdi.lz", "opendos_7.01.vdi.lz", "pcdos2000.vdi.lz", "pcdos400.vdi.lz", + "pcdos500.vdi.lz", "pcdos502.vdi.lz", "pcdos610.vdi.lz", "pcdos630.vdi.lz", "msos2_1.21.vdi.lz", + "msos2_1.30.1.vdi.lz", "multiuserdos_7.22r4.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", + "ecs.vdi.lz", "macosx_10.11.vdi.lz", "win10.vdi.lz", "win2000.vdi.lz", "win95osr2.1.vdi.lz", + "win95osr2.5.vdi.lz", "win95osr2.vdi.lz", "win95.vdi.lz", "win98se.vdi.lz", "win98.vdi.lz", "winme.vdi.lz", + "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" + }; + + readonly ulong[] sectors = + { + 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, 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 + }; + + 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 + }; + + readonly long[] clusters = + { + 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, + 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 + }; + + readonly int[] clustersize = + { + 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 + }; + + readonly string[] volumename = + { + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "NO NAME ", "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", "VolumeLabel", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", + "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL" + }; + + readonly string[] volumeserial = + { + null, null, null, null, null, null, "1BFB0748", null, "217B1909", "0C6D18FC", "382B18F4", "3E2018E9", + "0D2418EF", "195A181B", "27761816", "356B1809", null, null, "2272100F", "07280FE1", "1F630FF9", "18340FFE", + "3F3F1003", "273D1009", "9C162C15", "9C1E2C15", null, "5BE66015", "5BE43015", "5BEAC015", "E6B18414", + "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" + }; + + 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 " + }; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat16_mbr", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem fs = new FAT(); + Assert.AreEqual(true, fs.Identify(image, partitions[0]), testfiles[i]); + fs.GetInformation(image, partitions[0], out _); + 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]); + } + } + } + [TestFixture] + public class Fat16Rdb + { + readonly string[] testfiles = {"amigaos_3.9.vdi.lz"}; + + readonly ulong[] sectors = {1024128}; + + readonly uint[] sectorsize = {512}; + + readonly long[] clusters = {63689}; + + readonly int[] clustersize = {8192}; + + readonly string[] volumename = {"VOLUMELABEL"}; + + readonly string[] volumeserial = {"374D40D1"}; + + readonly string[] oemid = {"CDP 5.0"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat16_rdb", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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/DiscImageChef.Tests/Filesystems/FAT16_APM.cs b/DiscImageChef.Tests/Filesystems/FAT16_APM.cs deleted file mode 100644 index 2ace96db8..000000000 --- a/DiscImageChef.Tests/Filesystems/FAT16_APM.cs +++ /dev/null @@ -1,92 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : FAT16_APM.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class Fat16Apm - { - readonly string[] testfiles = {"macosx_10.11.vdi.lz"}; - - readonly ulong[] sectors = {1024000}; - - readonly uint[] sectorsize = {512}; - - readonly long[] clusters = {63995}; - - readonly int[] clustersize = {8192}; - - readonly string[] volumename = {"VOLUMELABEL"}; - - readonly string[] volumeserial = {"063D1F09"}; - - readonly string[] oemid = {"BSD 4.4"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat16_apm", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/FAT16_Atari.cs b/DiscImageChef.Tests/Filesystems/FAT16_Atari.cs deleted file mode 100644 index 8b68da213..000000000 --- a/DiscImageChef.Tests/Filesystems/FAT16_Atari.cs +++ /dev/null @@ -1,92 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : FAT16_Atari.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class Fat16Atari - { - readonly string[] testfiles = {"tos_1.04.vdi.lz", "tos_1.04_small.vdi.lz"}; - - readonly ulong[] sectors = {81920, 16384}; - - readonly uint[] sectorsize = {512, 512}; - - readonly long[] clusters = {10239, 8191}; - - readonly int[] clustersize = {4096, 1024}; - - readonly string[] volumename = {null, null}; - - readonly string[] volumeserial = {"BA9831", "2019E1"}; - - readonly string[] oemid = {null, null}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat16_atari", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/FAT16_GPT.cs b/DiscImageChef.Tests/Filesystems/FAT16_GPT.cs deleted file mode 100644 index ef357f9e9..000000000 --- a/DiscImageChef.Tests/Filesystems/FAT16_GPT.cs +++ /dev/null @@ -1,92 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : FAT16_GPT.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class Fat16Gpt - { - readonly string[] testfiles = {"macosx_10.11.vdi.lz"}; - - readonly ulong[] sectors = {1024000}; - - readonly uint[] sectorsize = {512}; - - readonly long[] clusters = {63995}; - - readonly int[] clustersize = {8192}; - - readonly string[] volumename = {"VOLUMELABEL"}; - - readonly string[] volumeserial = {"2E8A1F1B"}; - - readonly string[] oemid = {"BSD 4.4"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat16_gpt", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/FAT16_MBR.cs b/DiscImageChef.Tests/Filesystems/FAT16_MBR.cs deleted file mode 100644 index 8d7241d28..000000000 --- a/DiscImageChef.Tests/Filesystems/FAT16_MBR.cs +++ /dev/null @@ -1,153 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : FAT16_MBR.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class Fat16Mbr - { - readonly string[] testfiles = - { - "drdos_3.40.vdi.lz", "drdos_3.41.vdi.lz", "drdos_5.00.vdi.lz", "drdos_6.00.vdi.lz", "drdos_7.02.vdi.lz", - "drdos_7.03.vdi.lz", "drdos_8.00.vdi.lz", "msdos331.vdi.lz", "msdos401.vdi.lz", "msdos500.vdi.lz", - "msdos600.vdi.lz", "msdos620rc1.vdi.lz", "msdos620.vdi.lz", "msdos621.vdi.lz", "msdos622.vdi.lz", - "msdos710.vdi.lz", "novelldos_7.00.vdi.lz", "opendos_7.01.vdi.lz", "pcdos2000.vdi.lz", "pcdos400.vdi.lz", - "pcdos500.vdi.lz", "pcdos502.vdi.lz", "pcdos610.vdi.lz", "pcdos630.vdi.lz", "msos2_1.21.vdi.lz", - "msos2_1.30.1.vdi.lz", "multiuserdos_7.22r4.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", - "ecs.vdi.lz", "macosx_10.11.vdi.lz", "win10.vdi.lz", "win2000.vdi.lz", "win95osr2.1.vdi.lz", - "win95osr2.5.vdi.lz", "win95osr2.vdi.lz", "win95.vdi.lz", "win98se.vdi.lz", "win98.vdi.lz", "winme.vdi.lz", - "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" - }; - - readonly ulong[] sectors = - { - 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, 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 - }; - - 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 - }; - - readonly long[] clusters = - { - 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, - 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 - }; - - readonly int[] clustersize = - { - 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 - }; - - readonly string[] volumename = - { - "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", - null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", - "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "NO NAME ", "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", "VolumeLabel", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", - "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL" - }; - - readonly string[] volumeserial = - { - null, null, null, null, null, null, "1BFB0748", null, "217B1909", "0C6D18FC", "382B18F4", "3E2018E9", - "0D2418EF", "195A181B", "27761816", "356B1809", null, null, "2272100F", "07280FE1", "1F630FF9", "18340FFE", - "3F3F1003", "273D1009", "9C162C15", "9C1E2C15", null, "5BE66015", "5BE43015", "5BEAC015", "E6B18414", - "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" - }; - - 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 " - }; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat16_mbr", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem fs = new FAT(); - Assert.AreEqual(true, fs.Identify(image, partitions[0]), testfiles[i]); - fs.GetInformation(image, partitions[0], out _); - 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/DiscImageChef.Tests/Filesystems/FAT16_RDB.cs b/DiscImageChef.Tests/Filesystems/FAT16_RDB.cs deleted file mode 100644 index 07021775b..000000000 --- a/DiscImageChef.Tests/Filesystems/FAT16_RDB.cs +++ /dev/null @@ -1,92 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : FAT16_RDB.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class Fat16Rdb - { - readonly string[] testfiles = {"amigaos_3.9.vdi.lz"}; - - readonly ulong[] sectors = {1024128}; - - readonly uint[] sectorsize = {512}; - - readonly long[] clusters = {63689}; - - readonly int[] clustersize = {8192}; - - readonly string[] volumename = {"VOLUMELABEL"}; - - readonly string[] volumeserial = {"374D40D1"}; - - readonly string[] oemid = {"CDP 5.0"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat16_rdb", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/FAT32_MBR.cs b/DiscImageChef.Tests/Filesystems/FAT32.cs similarity index 54% rename from DiscImageChef.Tests/Filesystems/FAT32_MBR.cs rename to DiscImageChef.Tests/Filesystems/FAT32.cs index e0e1e5a6c..9094d7b2f 100644 --- a/DiscImageChef.Tests/Filesystems/FAT32_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/FAT32.cs @@ -2,7 +2,7 @@ // The Disc Image Chef // ---------------------------------------------------------------------------- // -// Filename : FAT32_MBR.cs +// Filename : FAT32.cs // Author(s) : Natalia Portillo // // Component : DiscImageChef unit testing. @@ -36,6 +36,112 @@ using NUnit.Framework; namespace DiscImageChef.Tests.Filesystems { + [TestFixture] + public class Fat32Apm + { + readonly string[] testfiles = {"macosx_10.11.vdi.lz"}; + + readonly ulong[] sectors = {4194304}; + + readonly uint[] sectorsize = {512}; + + readonly long[] clusters = {524278}; + + readonly int[] clustersize = {4096}; + + readonly string[] volumename = {"VOLUMELABEL"}; + + readonly string[] volumeserial = {"35BD1F0A"}; + + readonly string[] oemid = {"BSD 4.4"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat32_apm", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem fs = new FAT(); + int part = -1; + 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 _); + 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]); + } + } + } + [TestFixture] + public class Fat32Gpt + { + readonly string[] testfiles = {"macosx_10.11.vdi.lz"}; + + readonly ulong[] sectors = {4194304}; + + readonly uint[] sectorsize = {512}; + + readonly long[] clusters = {523775}; + + readonly int[] clustersize = {4096}; + + readonly string[] volumename = {"VOLUMELABEL"}; + + readonly string[] volumeserial = {"7ABE1F1B"}; + + readonly string[] oemid = {"BSD 4.4"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat32_gpt", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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]); + } + } + } [TestFixture] public class Fat32Mbr { diff --git a/DiscImageChef.Tests/Filesystems/FAT32_APM.cs b/DiscImageChef.Tests/Filesystems/FAT32_APM.cs deleted file mode 100644 index cb6e37972..000000000 --- a/DiscImageChef.Tests/Filesystems/FAT32_APM.cs +++ /dev/null @@ -1,92 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : FAT32_APM.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class Fat32Apm - { - readonly string[] testfiles = {"macosx_10.11.vdi.lz"}; - - readonly ulong[] sectors = {4194304}; - - readonly uint[] sectorsize = {512}; - - readonly long[] clusters = {524278}; - - readonly int[] clustersize = {4096}; - - readonly string[] volumename = {"VOLUMELABEL"}; - - readonly string[] volumeserial = {"35BD1F0A"}; - - readonly string[] oemid = {"BSD 4.4"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat32_apm", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem fs = new FAT(); - int part = -1; - 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 _); - 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/DiscImageChef.Tests/Filesystems/FAT32_GPT.cs b/DiscImageChef.Tests/Filesystems/FAT32_GPT.cs deleted file mode 100644 index dbd0327f3..000000000 --- a/DiscImageChef.Tests/Filesystems/FAT32_GPT.cs +++ /dev/null @@ -1,92 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : FAT32_GPT.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class Fat32Gpt - { - readonly string[] testfiles = {"macosx_10.11.vdi.lz"}; - - readonly ulong[] sectors = {4194304}; - - readonly uint[] sectorsize = {512}; - - readonly long[] clusters = {523775}; - - readonly int[] clustersize = {4096}; - - readonly string[] volumename = {"VOLUMELABEL"}; - - readonly string[] volumeserial = {"7ABE1F1B"}; - - readonly string[] oemid = {"BSD 4.4"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat32_gpt", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/HAMMER_MBR.cs b/DiscImageChef.Tests/Filesystems/HAMMER.cs similarity index 99% rename from DiscImageChef.Tests/Filesystems/HAMMER_MBR.cs rename to DiscImageChef.Tests/Filesystems/HAMMER.cs index 57e1f5fd0..18332d2b5 100644 --- a/DiscImageChef.Tests/Filesystems/HAMMER_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/HAMMER.cs @@ -2,7 +2,7 @@ // The Disc Image Chef // ---------------------------------------------------------------------------- // -// Filename : HAMMER_MBR.cs +// Filename : HAMMER.cs // Author(s) : Natalia Portillo // // Component : DiscImageChef unit testing. diff --git a/DiscImageChef.Tests/Filesystems/HFS.cs b/DiscImageChef.Tests/Filesystems/HFS.cs index b802b647e..07fe016e3 100644 --- a/DiscImageChef.Tests/Filesystems/HFS.cs +++ b/DiscImageChef.Tests/Filesystems/HFS.cs @@ -26,6 +26,7 @@ // Copyright © 2011-2018 Natalia Portillo // ****************************************************************************/ +using System.Collections.Generic; using System.IO; using DiscImageChef.CommonTypes; using DiscImageChef.DiscImages; @@ -96,4 +97,255 @@ namespace DiscImageChef.Tests.Filesystems } } } + [TestFixture] + public class HfsApm + { + readonly string[] testfiles = + { + "amigaos_3.9.vdi.lz", "darwin_1.3.1.vdi.lz", "darwin_1.4.1.vdi.lz", "darwin_6.0.2.vdi.lz", + "darwin_8.0.1.vdi.lz", "macos_1.1.vdi.lz", "macos_2.0.vdi.lz", "macos_6.0.7.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.1.vdi.lz", "macos_9.0.4.vdi.lz", + "macos_9.1.vdi.lz", "macos_9.2.1.vdi.lz", "macos_9.2.2.vdi.lz", "macosx_10.2.vdi.lz", "macosx_10.3.vdi.lz", + "macosx_10.4.vdi.lz", "rhapsody_dr1.vdi.lz", "d2_driver.vdi.lz", "hdt_1.8.vdi.lz", "macos_4.2.vdi.lz", + "macos_4.3.vdi.lz", "macos_6.0.2.vdi.lz", "macos_6.0.3.vdi.lz", "macos_6.0.4.vdi.lz", "macos_6.0.5.vdi.lz", + "macos_6.0.8.vdi.lz", "macos_6.0.vdi.lz", "macos_7.0.vdi.lz", "macos_7.1.1.vdi.lz", "parted.vdi.lz", + "silverlining_2.2.1.vdi.lz", "speedtools_3.6.vdi.lz", "vcpformatter_2.1.1.vdi.lz" + }; + + readonly ulong[] sectors = + { + 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 = + { + 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 = + { + 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 = + { + 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 + }; + + readonly string[] volumename = + { + "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", + "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", + "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", + "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", + "Volume label", "Volume label", "Volume label", "Test disk", "Volume label", "Volume label", "Volume label", + "Volume label", "Volume label", "Untitled", "Untitled #1", "24 MB Disk", "Volume label" + }; + + readonly string[] volumeserial = + { + 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.TestFilesRoot, "filesystems", "hfs_apm", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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]); + } + } + } + [TestFixture] + public class HfsCdrom + { + readonly string[] testfiles = + { + "toast_3.5.7_hfs_from_volume.iso.lz", "toast_3.5.7_iso9660_hfs.iso.lz", + "toast_4.1.3_hfs_from_volume.iso.lz", "toast_4.1.3_iso9660_hfs.iso.lz", "toast_3.5.7_hfs_from_files.iso.lz", + "toast_4.1.3_hfs_from_files.iso.lz" + }; + + readonly ulong[] sectors = {942, 1880, 943, 1882, 1509, 1529}; + + readonly uint[] sectorsize = {2048, 2048, 2048, 2048, 2048, 2048}; + + readonly long[] clusters = {3724, 931, 931, 931, 249, 249}; + + readonly int[] clustersize = {512, 2048, 2048, 2048, 12288, 12288}; + + readonly string[] volumename = + {"Disk utils", "Disk utils", "Disk utils", "Disk utils", "Disk utils", "Disk utils"}; + + readonly string[] volumeserial = {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_cdrom", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new ZZZRawImage(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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]); + } + } + } + [TestFixture] + public class HfsMbr + { + readonly string[] testfiles = + { + "linux.vdi.lz", "darwin_1.3.1.vdi.lz", "darwin_1.4.1.vdi.lz", "darwin_6.0.2.vdi.lz", "darwin_8.0.1.vdi.lz" + }; + + readonly ulong[] sectors = {262144, 409600, 409600, 409600, 409600}; + + readonly uint[] sectorsize = {512, 512, 512, 512, 512}; + + readonly long[] clusters = {65018, 51145, 51145, 58452, 58502}; + + readonly int[] clustersize = {2048, 4096, 4096, 3584, 3584}; + + readonly string[] volumename = + {"Volume label", "Volume label", "Volume label", "Volume label", "Volume label"}; + + readonly string[] volumeserial = {null, null, null, null, "81FE805D61458753"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfs_mbr", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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]); + } + } + } + [TestFixture] + public class HfsRdb + { + readonly string[] testfiles = {"amigaos_3.9.vdi.lz"}; + + readonly ulong[] sectors = {1024128}; + + readonly uint[] sectorsize = {512}; + + readonly long[] clusters = {63752}; + + readonly int[] clustersize = {8192}; + + readonly string[] volumename = {"Volume label"}; + + readonly string[] volumeserial = {null}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfs_rdb", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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/DiscImageChef.Tests/Filesystems/HFSPlus_APM.cs b/DiscImageChef.Tests/Filesystems/HFSPlus.cs similarity index 50% rename from DiscImageChef.Tests/Filesystems/HFSPlus_APM.cs rename to DiscImageChef.Tests/Filesystems/HFSPlus.cs index 7c5565ef5..5241dd906 100644 --- a/DiscImageChef.Tests/Filesystems/HFSPlus_APM.cs +++ b/DiscImageChef.Tests/Filesystems/HFSPlus.cs @@ -2,7 +2,7 @@ // The Disc Image Chef // ---------------------------------------------------------------------------- // -// Filename : HFSPlus_APM.cs +// Filename : HFSPlus.cs // Author(s) : Natalia Portillo // // Component : DiscImageChef unit testing. @@ -123,4 +123,123 @@ namespace DiscImageChef.Tests.Filesystems } } } + [TestFixture] + public class HfsPlusGpt + { + readonly string[] testfiles = {"macosx_10.11.vdi.lz", "macosx_10.11_journal.vdi.lz"}; + + readonly ulong[] sectors = {409600, 614400}; + + readonly uint[] sectorsize = {512, 512}; + + readonly long[] clusters = {51190, 76790}; + + readonly int[] clustersize = {4096, 4096}; + + readonly string[] volumename = {null, null}; + + readonly string[] volumeserial = {"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.TestFilesRoot, "filesystems", "hfsplus_gpt", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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]); + } + } + } + // Mising Darwin 6.0.2 wrapped + [TestFixture] + public class HfsPlusMbr + { + readonly string[] testfiles = + { + "macosx_10.11.vdi.lz", "macosx_10.11_journal.vdi.lz", "linux.vdi.lz", "linux_journal.vdi.lz", + "darwin_1.3.1.vdi.lz", "darwin_1.3.1_wrapped.vdi.lz", "darwin_1.4.1.vdi.lz", "darwin_1.4.1_wrapped.vdi.lz", + "darwin_6.0.2.vdi.lz", "darwin_8.0.1_journal.vdi.lz", "darwin_8.0.1.vdi.lz", "darwin_8.0.1_wrapped.vdi.lz" + }; + + readonly ulong[] sectors = + {303104, 352256, 262144, 262144, 819200, 614400, 819200, 614400, 819200, 1228800, 819200, 614400}; + + readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512}; + + readonly long[] clusters = + {37878, 44021, 32512, 32512, 102178, 76708, 102178, 76708, 102178, 153592, 102392, 76774}; + + readonly int[] clustersize = {4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096}; + + readonly string[] volumename = {null, null, null, null, null, null, null, null, null, null, null, null}; + + readonly string[] volumeserial = + { + "C84F550907D13F50", "016599F88029F73D", null, null, null, null, null, null, null, "F92964F9B3F64ABB", + "A8FAC484A0A2B177", "D5D5BF1346AD2B8D" + }; + + 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"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfsplus_mbr", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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/DiscImageChef.Tests/Filesystems/HFSPlus_GPT.cs b/DiscImageChef.Tests/Filesystems/HFSPlus_GPT.cs deleted file mode 100644 index 86ac16d8e..000000000 --- a/DiscImageChef.Tests/Filesystems/HFSPlus_GPT.cs +++ /dev/null @@ -1,92 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : HFSPlus_GPT.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class HfsPlusGpt - { - readonly string[] testfiles = {"macosx_10.11.vdi.lz", "macosx_10.11_journal.vdi.lz"}; - - readonly ulong[] sectors = {409600, 614400}; - - readonly uint[] sectorsize = {512, 512}; - - readonly long[] clusters = {51190, 76790}; - - readonly int[] clustersize = {4096, 4096}; - - readonly string[] volumename = {null, null}; - - readonly string[] volumeserial = {"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.TestFilesRoot, "filesystems", "hfsplus_gpt", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/HFSPlus_MBR.cs b/DiscImageChef.Tests/Filesystems/HFSPlus_MBR.cs deleted file mode 100644 index f23fe4215..000000000 --- a/DiscImageChef.Tests/Filesystems/HFSPlus_MBR.cs +++ /dev/null @@ -1,105 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : HFSPlus_MBR.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - // Mising Darwin 6.0.2 wrapped - [TestFixture] - public class HfsPlusMbr - { - readonly string[] testfiles = - { - "macosx_10.11.vdi.lz", "macosx_10.11_journal.vdi.lz", "linux.vdi.lz", "linux_journal.vdi.lz", - "darwin_1.3.1.vdi.lz", "darwin_1.3.1_wrapped.vdi.lz", "darwin_1.4.1.vdi.lz", "darwin_1.4.1_wrapped.vdi.lz", - "darwin_6.0.2.vdi.lz", "darwin_8.0.1_journal.vdi.lz", "darwin_8.0.1.vdi.lz", "darwin_8.0.1_wrapped.vdi.lz" - }; - - readonly ulong[] sectors = - {303104, 352256, 262144, 262144, 819200, 614400, 819200, 614400, 819200, 1228800, 819200, 614400}; - - readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512}; - - readonly long[] clusters = - {37878, 44021, 32512, 32512, 102178, 76708, 102178, 76708, 102178, 153592, 102392, 76774}; - - readonly int[] clustersize = {4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096}; - - readonly string[] volumename = {null, null, null, null, null, null, null, null, null, null, null, null}; - - readonly string[] volumeserial = - { - "C84F550907D13F50", "016599F88029F73D", null, null, null, null, null, null, null, "F92964F9B3F64ABB", - "A8FAC484A0A2B177", "D5D5BF1346AD2B8D" - }; - - 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"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfsplus_mbr", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/HFSX.cs b/DiscImageChef.Tests/Filesystems/HFSX.cs new file mode 100644 index 000000000..7e17cace6 --- /dev/null +++ b/DiscImageChef.Tests/Filesystems/HFSX.cs @@ -0,0 +1,212 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : HFSX.cs +// Author(s) : Natalia Portillo +// +// Component : DiscImageChef unit testing. +// +// --[ License ] -------------------------------------------------------------- +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2018 Natalia Portillo +// ****************************************************************************/ + +using System.Collections.Generic; +using System.IO; +using DiscImageChef.CommonTypes; +using DiscImageChef.DiscImages; +using DiscImageChef.Filesystems; +using DiscImageChef.Filters; +using NUnit.Framework; + +namespace DiscImageChef.Tests.Filesystems +{ + [TestFixture] + public class HfsxApm + { + readonly string[] testfiles = + { + "macosx_10.11.vdi.lz", "macosx_10.11_journal.vdi.lz", "darwin_8.0.1_journal.vdi.lz", "darwin_8.0.1.vdi.lz", + "macosx_10.4_journal.vdi.lz", "macosx_10.4.vdi.lz" + }; + + readonly ulong[] sectors = {819200, 1228800, 1638400, 1433600, 4194304, 1024000}; + + readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512}; + + readonly long[] clusters = {102390, 153590, 204792, 179192, 491290, 127770}; + + readonly int[] clustersize = {4096, 4096, 4096, 4096, 4096, 4096}; + + readonly string[] volumename = {null, null, null, null, null, null}; + + readonly string[] volumeserial = + { + "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.TestFilesRoot, "filesystems", "hfsx_apm", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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]); + } + } + } + [TestFixture] + public class HfsxGpt + { + readonly string[] testfiles = {"macosx_10.11.vdi.lz", "macosx_10.11_journal.vdi.lz"}; + + readonly ulong[] sectors = {819200, 1228800}; + + readonly uint[] sectorsize = {512, 512}; + + readonly long[] clusters = {102390, 153590}; + + readonly int[] clustersize = {4096, 4096}; + + readonly string[] volumename = {null, null}; + + readonly string[] volumeserial = {"328343989312AE9F", "FB98504073464C5C"}; + + readonly string[] oemid = {"10.0", "HFSJ"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfsx_gpt", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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]); + } + } + } + [TestFixture] + public class HfsxMbr + { + readonly string[] testfiles = + { + "macosx_10.11.vdi.lz", "macosx_10.11_journal.vdi.lz", "linux.vdi.lz", "linux_journal.vdi.lz", + "darwin_8.0.1_journal.vdi.lz", "darwin_8.0.1.vdi.lz" + }; + + readonly ulong[] sectors = {393216, 409600, 262144, 262144, 1638400, 1433600}; + + readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512}; + + readonly long[] clusters = {49140, 51187, 32512, 32512, 204792, 179192}; + + readonly int[] clustersize = {4096, 4096, 4096, 4096, 4096, 4096}; + + readonly string[] volumename = {null, null, null, null, null, null}; + + readonly string[] volumeserial = + {"C2BCCCE6DE5BC98D", "AC54CD78C75CC30F", null, null, "7559DD01BCFADD9A", "AEA39CFBBF14C0FF"}; + + readonly string[] oemid = {"10.0", "HFSJ", "10.0", "10.0", "10.0", "10.0"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfsx_mbr", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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/DiscImageChef.Tests/Filesystems/HFSX_APM.cs b/DiscImageChef.Tests/Filesystems/HFSX_APM.cs deleted file mode 100644 index 39c3ab6c4..000000000 --- a/DiscImageChef.Tests/Filesystems/HFSX_APM.cs +++ /dev/null @@ -1,100 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : HFSX_APM.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class HfsxApm - { - readonly string[] testfiles = - { - "macosx_10.11.vdi.lz", "macosx_10.11_journal.vdi.lz", "darwin_8.0.1_journal.vdi.lz", "darwin_8.0.1.vdi.lz", - "macosx_10.4_journal.vdi.lz", "macosx_10.4.vdi.lz" - }; - - readonly ulong[] sectors = {819200, 1228800, 1638400, 1433600, 4194304, 1024000}; - - readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512}; - - readonly long[] clusters = {102390, 153590, 204792, 179192, 491290, 127770}; - - readonly int[] clustersize = {4096, 4096, 4096, 4096, 4096, 4096}; - - readonly string[] volumename = {null, null, null, null, null, null}; - - readonly string[] volumeserial = - { - "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.TestFilesRoot, "filesystems", "hfsx_apm", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/HFSX_GPT.cs b/DiscImageChef.Tests/Filesystems/HFSX_GPT.cs deleted file mode 100644 index 7a0170fbd..000000000 --- a/DiscImageChef.Tests/Filesystems/HFSX_GPT.cs +++ /dev/null @@ -1,92 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : HFSX_GPT.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class HfsxGpt - { - readonly string[] testfiles = {"macosx_10.11.vdi.lz", "macosx_10.11_journal.vdi.lz"}; - - readonly ulong[] sectors = {819200, 1228800}; - - readonly uint[] sectorsize = {512, 512}; - - readonly long[] clusters = {102390, 153590}; - - readonly int[] clustersize = {4096, 4096}; - - readonly string[] volumename = {null, null}; - - readonly string[] volumeserial = {"328343989312AE9F", "FB98504073464C5C"}; - - readonly string[] oemid = {"10.0", "HFSJ"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfsx_gpt", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/HFSX_MBR.cs b/DiscImageChef.Tests/Filesystems/HFSX_MBR.cs deleted file mode 100644 index 0e7907c34..000000000 --- a/DiscImageChef.Tests/Filesystems/HFSX_MBR.cs +++ /dev/null @@ -1,97 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : HFSX_MBR.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class HfsxMbr - { - readonly string[] testfiles = - { - "macosx_10.11.vdi.lz", "macosx_10.11_journal.vdi.lz", "linux.vdi.lz", "linux_journal.vdi.lz", - "darwin_8.0.1_journal.vdi.lz", "darwin_8.0.1.vdi.lz" - }; - - readonly ulong[] sectors = {393216, 409600, 262144, 262144, 1638400, 1433600}; - - readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512}; - - readonly long[] clusters = {49140, 51187, 32512, 32512, 204792, 179192}; - - readonly int[] clustersize = {4096, 4096, 4096, 4096, 4096, 4096}; - - readonly string[] volumename = {null, null, null, null, null, null}; - - readonly string[] volumeserial = - {"C2BCCCE6DE5BC98D", "AC54CD78C75CC30F", null, null, "7559DD01BCFADD9A", "AEA39CFBBF14C0FF"}; - - readonly string[] oemid = {"10.0", "HFSJ", "10.0", "10.0", "10.0", "10.0"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfsx_mbr", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/HFS_APM.cs b/DiscImageChef.Tests/Filesystems/HFS_APM.cs deleted file mode 100644 index 32ceaeda2..000000000 --- a/DiscImageChef.Tests/Filesystems/HFS_APM.cs +++ /dev/null @@ -1,130 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : HFS_APM.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class HfsApm - { - readonly string[] testfiles = - { - "amigaos_3.9.vdi.lz", "darwin_1.3.1.vdi.lz", "darwin_1.4.1.vdi.lz", "darwin_6.0.2.vdi.lz", - "darwin_8.0.1.vdi.lz", "macos_1.1.vdi.lz", "macos_2.0.vdi.lz", "macos_6.0.7.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.1.vdi.lz", "macos_9.0.4.vdi.lz", - "macos_9.1.vdi.lz", "macos_9.2.1.vdi.lz", "macos_9.2.2.vdi.lz", "macosx_10.2.vdi.lz", "macosx_10.3.vdi.lz", - "macosx_10.4.vdi.lz", "rhapsody_dr1.vdi.lz", "d2_driver.vdi.lz", "hdt_1.8.vdi.lz", "macos_4.2.vdi.lz", - "macos_4.3.vdi.lz", "macos_6.0.2.vdi.lz", "macos_6.0.3.vdi.lz", "macos_6.0.4.vdi.lz", "macos_6.0.5.vdi.lz", - "macos_6.0.8.vdi.lz", "macos_6.0.vdi.lz", "macos_7.0.vdi.lz", "macos_7.1.1.vdi.lz", "parted.vdi.lz", - "silverlining_2.2.1.vdi.lz", "speedtools_3.6.vdi.lz", "vcpformatter_2.1.1.vdi.lz" - }; - - readonly ulong[] sectors = - { - 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 = - { - 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 = - { - 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 = - { - 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 - }; - - readonly string[] volumename = - { - "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", - "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", - "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", - "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", - "Volume label", "Volume label", "Volume label", "Test disk", "Volume label", "Volume label", "Volume label", - "Volume label", "Volume label", "Untitled", "Untitled #1", "24 MB Disk", "Volume label" - }; - - readonly string[] volumeserial = - { - 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.TestFilesRoot, "filesystems", "hfs_apm", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/HFS_CDROM.cs b/DiscImageChef.Tests/Filesystems/HFS_CDROM.cs deleted file mode 100644 index 7fdb250ad..000000000 --- a/DiscImageChef.Tests/Filesystems/HFS_CDROM.cs +++ /dev/null @@ -1,95 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : HFS_CDROM.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class HfsCdrom - { - readonly string[] testfiles = - { - "toast_3.5.7_hfs_from_volume.iso.lz", "toast_3.5.7_iso9660_hfs.iso.lz", - "toast_4.1.3_hfs_from_volume.iso.lz", "toast_4.1.3_iso9660_hfs.iso.lz", "toast_3.5.7_hfs_from_files.iso.lz", - "toast_4.1.3_hfs_from_files.iso.lz" - }; - - readonly ulong[] sectors = {942, 1880, 943, 1882, 1509, 1529}; - - readonly uint[] sectorsize = {2048, 2048, 2048, 2048, 2048, 2048}; - - readonly long[] clusters = {3724, 931, 931, 931, 249, 249}; - - readonly int[] clustersize = {512, 2048, 2048, 2048, 12288, 12288}; - - readonly string[] volumename = - {"Disk utils", "Disk utils", "Disk utils", "Disk utils", "Disk utils", "Disk utils"}; - - readonly string[] volumeserial = {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_cdrom", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new ZZZRawImage(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/HFS_MBR.cs b/DiscImageChef.Tests/Filesystems/HFS_MBR.cs deleted file mode 100644 index a3cb7ad02..000000000 --- a/DiscImageChef.Tests/Filesystems/HFS_MBR.cs +++ /dev/null @@ -1,93 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : HFS_MBR.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class HfsMbr - { - readonly string[] testfiles = - { - "linux.vdi.lz", "darwin_1.3.1.vdi.lz", "darwin_1.4.1.vdi.lz", "darwin_6.0.2.vdi.lz", "darwin_8.0.1.vdi.lz" - }; - - readonly ulong[] sectors = {262144, 409600, 409600, 409600, 409600}; - - readonly uint[] sectorsize = {512, 512, 512, 512, 512}; - - readonly long[] clusters = {65018, 51145, 51145, 58452, 58502}; - - readonly int[] clustersize = {2048, 4096, 4096, 3584, 3584}; - - readonly string[] volumename = - {"Volume label", "Volume label", "Volume label", "Volume label", "Volume label"}; - - readonly string[] volumeserial = {null, null, null, null, "81FE805D61458753"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfs_mbr", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/HFS_RDB.cs b/DiscImageChef.Tests/Filesystems/HFS_RDB.cs deleted file mode 100644 index 5376d410f..000000000 --- a/DiscImageChef.Tests/Filesystems/HFS_RDB.cs +++ /dev/null @@ -1,89 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : HFS_RDB.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class HfsRdb - { - readonly string[] testfiles = {"amigaos_3.9.vdi.lz"}; - - readonly ulong[] sectors = {1024128}; - - readonly uint[] sectorsize = {512}; - - readonly long[] clusters = {63752}; - - readonly int[] clustersize = {8192}; - - readonly string[] volumename = {"Volume label"}; - - readonly string[] volumeserial = {null}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfs_rdb", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/HTFS.cs b/DiscImageChef.Tests/Filesystems/HTFS.cs index aa83dc5a5..7c5d578ff 100644 --- a/DiscImageChef.Tests/Filesystems/HTFS.cs +++ b/DiscImageChef.Tests/Filesystems/HTFS.cs @@ -26,6 +26,7 @@ // Copyright © 2011-2018 Natalia Portillo // ****************************************************************************/ +using System.Collections.Generic; using System.IO; using DiscImageChef.CommonTypes; using DiscImageChef.DiscImages; @@ -92,4 +93,56 @@ namespace DiscImageChef.Tests.Filesystems } } } + [TestFixture] + public class HtfsMbr + { + readonly string[] testfiles = {"scoopenserver_5.0.7hw.vdi.lz"}; + + readonly ulong[] sectors = {2097152}; + + readonly uint[] sectorsize = {512}; + + readonly long[] clusters = {1020096}; + + readonly int[] clustersize = {1024}; + + readonly string[] volumename = {"Volume label"}; + + readonly string[] volumeserial = {null}; + + readonly string[] type = {"HTFS"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "htfs_mbr", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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/DiscImageChef.Tests/Filesystems/HTFS_MBR.cs b/DiscImageChef.Tests/Filesystems/HTFS_MBR.cs deleted file mode 100644 index 8bd837bcd..000000000 --- a/DiscImageChef.Tests/Filesystems/HTFS_MBR.cs +++ /dev/null @@ -1,91 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : HTFS_MBR.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class HtfsMbr - { - readonly string[] testfiles = {"scoopenserver_5.0.7hw.vdi.lz"}; - - readonly ulong[] sectors = {2097152}; - - readonly uint[] sectorsize = {512}; - - readonly long[] clusters = {1020096}; - - readonly int[] clustersize = {1024}; - - readonly string[] volumename = {"Volume label"}; - - readonly string[] volumeserial = {null}; - - readonly string[] type = {"HTFS"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "htfs_mbr", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/LFS_MBR.cs b/DiscImageChef.Tests/Filesystems/LFS.cs similarity index 99% rename from DiscImageChef.Tests/Filesystems/LFS_MBR.cs rename to DiscImageChef.Tests/Filesystems/LFS.cs index aa8b41a59..14df9ad62 100644 --- a/DiscImageChef.Tests/Filesystems/LFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/LFS.cs @@ -2,7 +2,7 @@ // The Disc Image Chef // ---------------------------------------------------------------------------- // -// Filename : LFS_MBR.cs +// Filename : LFS.cs // Author(s) : Natalia Portillo // // Component : DiscImageChef unit testing. diff --git a/DiscImageChef.Tests/Filesystems/MINIX.cs b/DiscImageChef.Tests/Filesystems/MINIX.cs new file mode 100644 index 000000000..83338623a --- /dev/null +++ b/DiscImageChef.Tests/Filesystems/MINIX.cs @@ -0,0 +1,327 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : MINIX.cs +// Author(s) : Natalia Portillo +// +// Component : DiscImageChef unit testing. +// +// --[ License ] -------------------------------------------------------------- +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2018 Natalia Portillo +// ****************************************************************************/ + +using System.Collections.Generic; +using System.IO; +using DiscImageChef.CommonTypes; +using DiscImageChef.DiscImages; +using DiscImageChef.Filesystems; +using DiscImageChef.Filters; +using NUnit.Framework; + +namespace DiscImageChef.Tests.Filesystems +{ + [TestFixture] + public class MinixV1 + { + readonly string[] testfiles = + { + "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 = + {MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD}; + + readonly ulong[] sectors = {720, 2400, 1440, 2880}; + + readonly uint[] sectorsize = {512, 512, 512, 512}; + + readonly long[] clusters = {360, 1200, 720, 1440}; + + readonly int[] clustersize = {1024, 1024, 1024, 1024}; + + readonly string[] types = {"Minix 3 v1", "Minix 3 v1", "Minix 3 v1", "Minix 3 v1"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv1", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new ZZZRawImage(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.ImageInfo.MediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + Filesystem fs = new MinixFS(); + Partition wholePart = new Partition + { + Name = "Whole device", + Length = image.ImageInfo.Sectors, + Size = image.ImageInfo.Sectors * image.ImageInfo.SectorSize + }; + Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); + fs.GetInformation(image, wholePart, out _); + 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]); + } + } + } + [TestFixture] + public class MinixV1Mbr + { + readonly string[] testfiles = {"linux.vdi.lz", "minix_3.1.2a.vdi.lz"}; + + readonly ulong[] sectors = {262144, 102400}; + + readonly uint[] sectorsize = {512, 512}; + + readonly long[] clusters = {65535, 50399}; + + readonly int[] clustersize = {1024, 1024}; + + readonly string[] types = {"Minix v1", "Minix 3 v1"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv1_mbr", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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]); + } + } + } + [TestFixture] + public class MinixV2 + { + readonly string[] testfiles = + { + "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 = + {MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD}; + + readonly ulong[] sectors = {720, 2400, 1440, 2880}; + + readonly uint[] sectorsize = {512, 512, 512, 512}; + + readonly long[] clusters = {360, 1200, 720, 1440}; + + readonly int[] clustersize = {1024, 1024, 1024, 1024}; + + readonly string[] types = {"Minix 3 v2", "Minix 3 v2", "Minix 3 v2", "Minix 3 v2"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv2", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new ZZZRawImage(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.ImageInfo.MediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + Filesystem fs = new MinixFS(); + Partition wholePart = new Partition + { + Name = "Whole device", + Length = image.ImageInfo.Sectors, + Size = image.ImageInfo.Sectors * image.ImageInfo.SectorSize + }; + Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); + fs.GetInformation(image, wholePart, out _); + 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]); + } + } + } + [TestFixture] + public class MinixV2Mbr + { + readonly string[] testfiles = {"minix_3.1.2a.vdi.lz"}; + + readonly ulong[] sectors = {1024000}; + + readonly uint[] sectorsize = {512}; + + readonly long[] clusters = {511055}; + + readonly int[] clustersize = {1024}; + + readonly string[] types = {"Minix 3 v2"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv2_mbr", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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]); + } + } + } + [TestFixture] + public class MinixV3 + { + readonly string[] testfiles = + { + "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 = + {MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD}; + + readonly ulong[] sectors = {720, 2400, 1440, 2880}; + + readonly uint[] sectorsize = {512, 512, 512, 512}; + + readonly long[] clusters = {90, 300, 180, 360}; + + readonly int[] clustersize = {4096, 4096, 4096, 4096}; + + readonly string[] types = {"Minix v3", "Minix v3", "Minix v3", "Minix v3"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv3", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new ZZZRawImage(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.ImageInfo.MediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + Filesystem fs = new MinixFS(); + Partition wholePart = new Partition + { + Name = "Whole device", + Length = image.ImageInfo.Sectors, + Size = image.ImageInfo.Sectors * image.ImageInfo.SectorSize + }; + Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); + fs.GetInformation(image, wholePart, out _); + 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]); + } + } + } + [TestFixture] + public class MinixV3Mbr + { + readonly string[] testfiles = {"minix_3.1.2a.vdi.lz"}; + + readonly ulong[] sectors = {4194304}; + + readonly uint[] sectorsize = {512}; + + readonly long[] clusters = {523151}; + + readonly int[] clustersize = {4096}; + + readonly string[] types = {"Minix v3"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv3_mbr", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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]); + } + } + } +} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/MINIXv1.cs b/DiscImageChef.Tests/Filesystems/MINIXv1.cs deleted file mode 100644 index eee1bc930..000000000 --- a/DiscImageChef.Tests/Filesystems/MINIXv1.cs +++ /dev/null @@ -1,88 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : MINIXv1.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class MinixV1 - { - readonly string[] testfiles = - { - "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 = - {MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD}; - - readonly ulong[] sectors = {720, 2400, 1440, 2880}; - - readonly uint[] sectorsize = {512, 512, 512, 512}; - - readonly long[] clusters = {360, 1200, 720, 1440}; - - readonly int[] clustersize = {1024, 1024, 1024, 1024}; - - readonly string[] types = {"Minix 3 v1", "Minix 3 v1", "Minix 3 v1", "Minix 3 v1"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv1", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new ZZZRawImage(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(mediatypes[i], image.ImageInfo.MediaType, testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - Filesystem fs = new MinixFS(); - Partition wholePart = new Partition - { - Name = "Whole device", - Length = image.ImageInfo.Sectors, - Size = image.ImageInfo.Sectors * image.ImageInfo.SectorSize - }; - Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); - fs.GetInformation(image, wholePart, out _); - 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]); - } - } - } -} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/MINIXv1_MBR.cs b/DiscImageChef.Tests/Filesystems/MINIXv1_MBR.cs deleted file mode 100644 index 0b3a3107b..000000000 --- a/DiscImageChef.Tests/Filesystems/MINIXv1_MBR.cs +++ /dev/null @@ -1,85 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : MINIXv1_MBR.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class MinixV1Mbr - { - readonly string[] testfiles = {"linux.vdi.lz", "minix_3.1.2a.vdi.lz"}; - - readonly ulong[] sectors = {262144, 102400}; - - readonly uint[] sectorsize = {512, 512}; - - readonly long[] clusters = {65535, 50399}; - - readonly int[] clustersize = {1024, 1024}; - - readonly string[] types = {"Minix v1", "Minix 3 v1"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv1_mbr", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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]); - } - } - } -} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/MINIXv2.cs b/DiscImageChef.Tests/Filesystems/MINIXv2.cs deleted file mode 100644 index 969a66f29..000000000 --- a/DiscImageChef.Tests/Filesystems/MINIXv2.cs +++ /dev/null @@ -1,88 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : MINIXv2.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class MinixV2 - { - readonly string[] testfiles = - { - "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 = - {MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD}; - - readonly ulong[] sectors = {720, 2400, 1440, 2880}; - - readonly uint[] sectorsize = {512, 512, 512, 512}; - - readonly long[] clusters = {360, 1200, 720, 1440}; - - readonly int[] clustersize = {1024, 1024, 1024, 1024}; - - readonly string[] types = {"Minix 3 v2", "Minix 3 v2", "Minix 3 v2", "Minix 3 v2"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv2", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new ZZZRawImage(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(mediatypes[i], image.ImageInfo.MediaType, testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - Filesystem fs = new MinixFS(); - Partition wholePart = new Partition - { - Name = "Whole device", - Length = image.ImageInfo.Sectors, - Size = image.ImageInfo.Sectors * image.ImageInfo.SectorSize - }; - Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); - fs.GetInformation(image, wholePart, out _); - 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]); - } - } - } -} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/MINIXv2_MBR.cs b/DiscImageChef.Tests/Filesystems/MINIXv2_MBR.cs deleted file mode 100644 index 9e378c3d6..000000000 --- a/DiscImageChef.Tests/Filesystems/MINIXv2_MBR.cs +++ /dev/null @@ -1,85 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : MINIXv2_MBR.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class MinixV2Mbr - { - readonly string[] testfiles = {"minix_3.1.2a.vdi.lz"}; - - readonly ulong[] sectors = {1024000}; - - readonly uint[] sectorsize = {512}; - - readonly long[] clusters = {511055}; - - readonly int[] clustersize = {1024}; - - readonly string[] types = {"Minix 3 v2"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv2_mbr", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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]); - } - } - } -} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/MINIXv3.cs b/DiscImageChef.Tests/Filesystems/MINIXv3.cs deleted file mode 100644 index fea0feb36..000000000 --- a/DiscImageChef.Tests/Filesystems/MINIXv3.cs +++ /dev/null @@ -1,88 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : MINIXv3.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class MinixV3 - { - readonly string[] testfiles = - { - "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 = - {MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD}; - - readonly ulong[] sectors = {720, 2400, 1440, 2880}; - - readonly uint[] sectorsize = {512, 512, 512, 512}; - - readonly long[] clusters = {90, 300, 180, 360}; - - readonly int[] clustersize = {4096, 4096, 4096, 4096}; - - readonly string[] types = {"Minix v3", "Minix v3", "Minix v3", "Minix v3"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv3", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new ZZZRawImage(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(mediatypes[i], image.ImageInfo.MediaType, testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - Filesystem fs = new MinixFS(); - Partition wholePart = new Partition - { - Name = "Whole device", - Length = image.ImageInfo.Sectors, - Size = image.ImageInfo.Sectors * image.ImageInfo.SectorSize - }; - Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); - fs.GetInformation(image, wholePart, out _); - 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]); - } - } - } -} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/MINIXv3_MBR.cs b/DiscImageChef.Tests/Filesystems/MINIXv3_MBR.cs deleted file mode 100644 index 5a3f72998..000000000 --- a/DiscImageChef.Tests/Filesystems/MINIXv3_MBR.cs +++ /dev/null @@ -1,85 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : MINIXv3_MBR.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class MinixV3Mbr - { - readonly string[] testfiles = {"minix_3.1.2a.vdi.lz"}; - - readonly ulong[] sectors = {4194304}; - - readonly uint[] sectorsize = {512}; - - readonly long[] clusters = {523151}; - - readonly int[] clustersize = {4096}; - - readonly string[] types = {"Minix v3"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv3_mbr", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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]); - } - } - } -} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/NTFS_MBR.cs b/DiscImageChef.Tests/Filesystems/NTFS.cs similarity index 66% rename from DiscImageChef.Tests/Filesystems/NTFS_MBR.cs rename to DiscImageChef.Tests/Filesystems/NTFS.cs index b5f88917f..274f42e48 100644 --- a/DiscImageChef.Tests/Filesystems/NTFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/NTFS.cs @@ -2,7 +2,7 @@ // The Disc Image Chef // ---------------------------------------------------------------------------- // -// Filename : NTFS_MBR.cs +// Filename : NTFS.cs // Author(s) : Natalia Portillo // // Component : DiscImageChef unit testing. @@ -36,6 +36,59 @@ using NUnit.Framework; namespace DiscImageChef.Tests.Filesystems { + [TestFixture] + public class NtfsGpt + { + readonly string[] testfiles = {"haiku_hrev51259.vdi.lz"}; + + readonly ulong[] sectors = {2097152}; + + readonly uint[] sectorsize = {512}; + + readonly long[] clusters = {261887}; + + readonly int[] clustersize = {4096}; + + readonly string[] volumename = {null, null, null, null, null, null, null, null}; + + readonly string[] volumeserial = {"106DA7693F7F6B3F"}; + + readonly string[] oemid = {null}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ntfs_gpt", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem fs = new 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 _); + 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]); + } + } + } [TestFixture] public class NtfsMbr { diff --git a/DiscImageChef.Tests/Filesystems/NTFS_GPT.cs b/DiscImageChef.Tests/Filesystems/NTFS_GPT.cs deleted file mode 100644 index b1457fc61..000000000 --- a/DiscImageChef.Tests/Filesystems/NTFS_GPT.cs +++ /dev/null @@ -1,92 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : NTFS_GPT.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class NtfsGpt - { - readonly string[] testfiles = {"haiku_hrev51259.vdi.lz"}; - - readonly ulong[] sectors = {2097152}; - - readonly uint[] sectorsize = {512}; - - readonly long[] clusters = {261887}; - - readonly int[] clustersize = {4096}; - - readonly string[] volumename = {null, null, null, null, null, null, null, null}; - - readonly string[] volumeserial = {"106DA7693F7F6B3F"}; - - readonly string[] oemid = {null}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ntfs_gpt", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem fs = new 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 _); - 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/DiscImageChef.Tests/Filesystems/PFS3_RDB.cs b/DiscImageChef.Tests/Filesystems/PFS3.cs similarity index 99% rename from DiscImageChef.Tests/Filesystems/PFS3_RDB.cs rename to DiscImageChef.Tests/Filesystems/PFS3.cs index 7d1665d26..33b2038e8 100644 --- a/DiscImageChef.Tests/Filesystems/PFS3_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/PFS3.cs @@ -2,7 +2,7 @@ // The Disc Image Chef // ---------------------------------------------------------------------------- // -// Filename : PFS3_RDB.cs +// Filename : PFS3.cs // Author(s) : Natalia Portillo // // Component : DiscImageChef unit testing. diff --git a/DiscImageChef.Tests/Filesystems/ProDOS_APM.cs b/DiscImageChef.Tests/Filesystems/ProDOS.cs similarity index 99% rename from DiscImageChef.Tests/Filesystems/ProDOS_APM.cs rename to DiscImageChef.Tests/Filesystems/ProDOS.cs index a9028bc29..6e3a67b17 100644 --- a/DiscImageChef.Tests/Filesystems/ProDOS_APM.cs +++ b/DiscImageChef.Tests/Filesystems/ProDOS.cs @@ -2,7 +2,7 @@ // The Disc Image Chef // ---------------------------------------------------------------------------- // -// Filename : ProDOS_APM.cs +// Filename : ProDOS.cs // Author(s) : Natalia Portillo // // Component : DiscImageChef unit testing. diff --git a/DiscImageChef.Tests/Filesystems/QNX4.cs b/DiscImageChef.Tests/Filesystems/QNX4.cs index 2fcbdf54e..999d0edaf 100644 --- a/DiscImageChef.Tests/Filesystems/QNX4.cs +++ b/DiscImageChef.Tests/Filesystems/QNX4.cs @@ -26,6 +26,7 @@ // Copyright © 2011-2018 Natalia Portillo // ****************************************************************************/ +using System.Collections.Generic; using System.IO; using DiscImageChef.CommonTypes; using DiscImageChef.DiscImages; @@ -80,4 +81,49 @@ namespace DiscImageChef.Tests.Filesystems } } } + + [TestFixture] + public class Qnx4Mbr + { + readonly string[] testfiles = {"qnx_4.24.vdi.lz"}; + + readonly ulong[] sectors = {1024000}; + + readonly uint[] sectorsize = {512}; + + readonly long[] clusters = {1023104}; + + readonly int[] clustersize = {512}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "qnx4_mbr", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem fs = new 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 _); + 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]); + } + } + } } \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/QNX4_MBR.cs b/DiscImageChef.Tests/Filesystems/QNX4_MBR.cs deleted file mode 100644 index cdc008284..000000000 --- a/DiscImageChef.Tests/Filesystems/QNX4_MBR.cs +++ /dev/null @@ -1,83 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : QNX4_MBR.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class Qnx4Mbr - { - readonly string[] testfiles = {"qnx_4.24.vdi.lz"}; - - readonly ulong[] sectors = {1024000}; - - readonly uint[] sectorsize = {512}; - - readonly long[] clusters = {1023104}; - - readonly int[] clustersize = {512}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "qnx4_mbr", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem fs = new 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 _); - 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]); - } - } - } -} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/ReFS_MBR.cs b/DiscImageChef.Tests/Filesystems/ReFS.cs similarity index 100% rename from DiscImageChef.Tests/Filesystems/ReFS_MBR.cs rename to DiscImageChef.Tests/Filesystems/ReFS.cs diff --git a/DiscImageChef.Tests/Filesystems/SFS.cs b/DiscImageChef.Tests/Filesystems/SFS.cs new file mode 100644 index 000000000..adefca5ee --- /dev/null +++ b/DiscImageChef.Tests/Filesystems/SFS.cs @@ -0,0 +1,189 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : SFS_MBR.cs +// Author(s) : Natalia Portillo +// +// Component : DiscImageChef unit testing. +// +// --[ License ] -------------------------------------------------------------- +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2018 Natalia Portillo +// ****************************************************************************/ + +using System.Collections.Generic; +using System.IO; +using DiscImageChef.CommonTypes; +using DiscImageChef.DiscImages; +using DiscImageChef.Filesystems; +using DiscImageChef.Filters; +using NUnit.Framework; + +namespace DiscImageChef.Tests.Filesystems +{ + [TestFixture] + public class SfsMbr + { + readonly string[] testfiles = {"aros.vdi.lz"}; + + readonly ulong[] sectors = {409600}; + + readonly uint[] sectorsize = {512}; + + readonly long[] clusters = {408240}; + + readonly int[] clustersize = {512}; + + readonly string[] volumename = {null}; + + readonly string[] volumeserial = {null}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "sfs_mbr", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem fs = new 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 _); + 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]); + } + } + } + [TestFixture] + public class SfsMbrRdb + { + readonly string[] testfiles = {"aros.vdi.lz"}; + + readonly ulong[] sectors = {409600}; + + readonly uint[] sectorsize = {512}; + + readonly long[] clusters = {406224}; + + readonly int[] clustersize = {512}; + + readonly string[] volumename = {null}; + + readonly string[] volumeserial = {null}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "sfs_mbr_rdb", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem fs = new 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 _); + 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]); + } + } + } + [TestFixture] + public class SfsRdb + { + readonly string[] testfiles = {"uae.vdi.lz", "aros.vdi.lz", "amigaos_4.0.vdi.lz", "amigaos_4.0_sfs2.vdi.lz"}; + + readonly ulong[] sectors = {1024128, 409600, 1024128, 1024128}; + + readonly uint[] sectorsize = {512, 512, 512, 512}; + + readonly long[] clusters = {127000, 407232, 511040, 511040}; + + readonly int[] clustersize = {2048, 512, 1024, 1024}; + + readonly string[] volumename = {null, null, null, null}; + + readonly string[] volumeserial = {null, null, null, null}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "sfs_rdb", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem fs = new 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 _); + 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/DiscImageChef.Tests/Filesystems/SFS_MBR.cs b/DiscImageChef.Tests/Filesystems/SFS_MBR.cs deleted file mode 100644 index edc7ee81e..000000000 --- a/DiscImageChef.Tests/Filesystems/SFS_MBR.cs +++ /dev/null @@ -1,89 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : SFS_MBR.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class SfsMbr - { - readonly string[] testfiles = {"aros.vdi.lz"}; - - readonly ulong[] sectors = {409600}; - - readonly uint[] sectorsize = {512}; - - readonly long[] clusters = {408240}; - - readonly int[] clustersize = {512}; - - readonly string[] volumename = {null}; - - readonly string[] volumeserial = {null}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "sfs_mbr", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem fs = new 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 _); - 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/DiscImageChef.Tests/Filesystems/SFS_MBR_RDB.cs b/DiscImageChef.Tests/Filesystems/SFS_MBR_RDB.cs deleted file mode 100644 index a1f9c3d6c..000000000 --- a/DiscImageChef.Tests/Filesystems/SFS_MBR_RDB.cs +++ /dev/null @@ -1,89 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : SFS_MBR_RDB.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class SfsMbrRdb - { - readonly string[] testfiles = {"aros.vdi.lz"}; - - readonly ulong[] sectors = {409600}; - - readonly uint[] sectorsize = {512}; - - readonly long[] clusters = {406224}; - - readonly int[] clustersize = {512}; - - readonly string[] volumename = {null}; - - readonly string[] volumeserial = {null}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "sfs_mbr_rdb", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem fs = new 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 _); - 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/DiscImageChef.Tests/Filesystems/SFS_RDB.cs b/DiscImageChef.Tests/Filesystems/SFS_RDB.cs deleted file mode 100644 index 6f8ce6c91..000000000 --- a/DiscImageChef.Tests/Filesystems/SFS_RDB.cs +++ /dev/null @@ -1,89 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : SFS_RDB.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class SfsRdb - { - readonly string[] testfiles = {"uae.vdi.lz", "aros.vdi.lz", "amigaos_4.0.vdi.lz", "amigaos_4.0_sfs2.vdi.lz"}; - - readonly ulong[] sectors = {1024128, 409600, 1024128, 1024128}; - - readonly uint[] sectorsize = {512, 512, 512, 512}; - - readonly long[] clusters = {127000, 407232, 511040, 511040}; - - readonly int[] clustersize = {2048, 512, 1024, 1024}; - - readonly string[] volumename = {null, null, null, null}; - - readonly string[] volumeserial = {null, null, null, null}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "sfs_rdb", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem fs = new 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 _); - 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/DiscImageChef.Tests/Filesystems/SysV.cs b/DiscImageChef.Tests/Filesystems/SysV.cs index a90ebb977..f81c56599 100644 --- a/DiscImageChef.Tests/Filesystems/SysV.cs +++ b/DiscImageChef.Tests/Filesystems/SysV.cs @@ -26,6 +26,7 @@ // Copyright © 2011-2018 Natalia Portillo // ****************************************************************************/ +using System.Collections.Generic; using System.IO; using DiscImageChef.CommonTypes; using DiscImageChef.DiscImages; @@ -97,4 +98,109 @@ namespace DiscImageChef.Tests.Filesystems } } } + [TestFixture] + public class SysVMbr + { + readonly string[] testfiles = + {"att_unix_svr4v2.1.vdi.lz", "att_unix_svr4v2.1_2k.vdi.lz", "scoopenserver_5.0.7hw.vdi.lz"}; + + readonly ulong[] sectors = {1024000, 1024000, 2097152}; + + readonly uint[] sectorsize = {512, 512, 512}; + + readonly long[] clusters = {511056, 255528, 1020096}; + + readonly int[] clustersize = {1024, 2048, 1024}; + + readonly string[] volumename = {"/usr3", "/usr3", "Volume label"}; + + readonly string[] volumeserial = {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.TestFilesRoot, "filesystems", "s5fs_mbr", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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]); + } + } + } + [TestFixture] + public class SysVRdb + { + readonly string[] testfiles = {"amix.vdi.lz"}; + + readonly ulong[] sectors = {1024128}; + + readonly uint[] sectorsize = {512}; + + readonly long[] clusters = {511424}; + + readonly int[] clustersize = {1024}; + + readonly string[] volumename = {""}; + + readonly string[] volumeserial = {null}; + + readonly string[] type = {"SVR4 fs"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "s5fs_rdb", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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/DiscImageChef.Tests/Filesystems/SysV_MBR.cs b/DiscImageChef.Tests/Filesystems/SysV_MBR.cs deleted file mode 100644 index bb1157137..000000000 --- a/DiscImageChef.Tests/Filesystems/SysV_MBR.cs +++ /dev/null @@ -1,92 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : SysV_MBR.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class SysVMbr - { - readonly string[] testfiles = - {"att_unix_svr4v2.1.vdi.lz", "att_unix_svr4v2.1_2k.vdi.lz", "scoopenserver_5.0.7hw.vdi.lz"}; - - readonly ulong[] sectors = {1024000, 1024000, 2097152}; - - readonly uint[] sectorsize = {512, 512, 512}; - - readonly long[] clusters = {511056, 255528, 1020096}; - - readonly int[] clustersize = {1024, 2048, 1024}; - - readonly string[] volumename = {"/usr3", "/usr3", "Volume label"}; - - readonly string[] volumeserial = {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.TestFilesRoot, "filesystems", "s5fs_mbr", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/SysV_RDB.cs b/DiscImageChef.Tests/Filesystems/SysV_RDB.cs deleted file mode 100644 index 6fa26e256..000000000 --- a/DiscImageChef.Tests/Filesystems/SysV_RDB.cs +++ /dev/null @@ -1,91 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : SysV_RDB.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class SysVRdb - { - readonly string[] testfiles = {"amix.vdi.lz"}; - - readonly ulong[] sectors = {1024128}; - - readonly uint[] sectorsize = {512}; - - readonly long[] clusters = {511424}; - - readonly int[] clustersize = {1024}; - - readonly string[] volumename = {""}; - - readonly string[] volumeserial = {null}; - - readonly string[] type = {"SVR4 fs"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "s5fs_rdb", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/UFS.cs b/DiscImageChef.Tests/Filesystems/UFS.cs index a98809860..d119862de 100644 --- a/DiscImageChef.Tests/Filesystems/UFS.cs +++ b/DiscImageChef.Tests/Filesystems/UFS.cs @@ -26,6 +26,7 @@ // Copyright © 2011-2018 Natalia Portillo // ****************************************************************************/ +using System.Collections.Generic; using System.IO; using DiscImageChef.CommonTypes; using DiscImageChef.DiscImages; @@ -95,4 +96,377 @@ namespace DiscImageChef.Tests.Filesystems } } } + [TestFixture] + public class UfsApm + { + readonly string[] testfiles = + { + "ffs43/darwin_1.3.1.vdi.lz", "ffs43/darwin_1.4.1.vdi.lz", "ffs43/darwin_6.0.2.vdi.lz", + "ffs43/darwin_8.0.1.vdi.lz", "ufs1/darwin_1.3.1.vdi.lz", "ufs1/darwin_1.4.1.vdi.lz", + "ufs1/darwin_6.0.2.vdi.lz", "ufs1/darwin_8.0.1.vdi.lz", "ufs1/macosx_10.2.vdi.lz", + "ufs1/macosx_10.3.vdi.lz", "ufs1/macosx_10.4.vdi.lz" + }; + + readonly ulong[] sectors = + {1024000, 1024000, 1024000, 1024000, 204800, 204800, 204800, 204800, 2097152, 2097152, 2097152}; + + readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512}; + + readonly long[] clusters = + {511488, 511488, 511488, 511488, 102368, 102368, 102368, 102368, 1047660, 1038952, 1038952}; + + readonly int[] clustersize = {1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024}; + + 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 = {"UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ufs_apm", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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]); + } + } + } + [TestFixture] + public class UfsMbr + { + readonly string[] testfiles = + { + "ufs1/linux.vdi.lz", "ufs2/linux.vdi.lz", "ffs43/darwin_1.3.1.vdi.lz", "ffs43/darwin_1.4.1.vdi.lz", + "ffs43/darwin_6.0.2.vdi.lz", "ffs43/darwin_8.0.1.vdi.lz", "ffs43/dflybsd_1.2.0.vdi.lz", + "ffs43/dflybsd_3.6.1.vdi.lz", "ffs43/dflybsd_4.0.5.vdi.lz", "ffs43/netbsd_1.6.vdi.lz", + "ffs43/netbsd_7.1.vdi.lz", "ufs1/darwin_1.3.1.vdi.lz", "ufs1/darwin_1.4.1.vdi.lz", + "ufs1/darwin_6.0.2.vdi.lz", "ufs1/darwin_8.0.1.vdi.lz", "ufs1/dflybsd_1.2.0.vdi.lz", + "ufs1/dflybsd_3.6.1.vdi.lz", "ufs1/dflybsd_4.0.5.vdi.lz", "ufs1/freebsd_6.1.vdi.lz", + "ufs1/freebsd_7.0.vdi.lz", "ufs1/freebsd_8.2.vdi.lz", "ufs1/netbsd_1.6.vdi.lz", "ufs1/netbsd_7.1.vdi.lz", + "ufs1/solaris_7.vdi.lz", "ufs1/solaris_9.vdi.lz", "ufs2/freebsd_6.1.vdi.lz", "ufs2/freebsd_7.0.vdi.lz", + "ufs2/freebsd_8.2.vdi.lz", "ufs2/netbsd_7.1.vdi.lz" + }; + + readonly ulong[] sectors = + { + 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 = + { + 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 = + { + 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 = + { + 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 + }; + + 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 = + { + "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() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ufs_mbr", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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]); + } + } + } + [TestFixture] + public class UfsNeXt + { + readonly string[] testfiles = + { + "nextstep_3.3.vdi.lz", "openstep_4.0.vdi.lz", "openstep_4.2.vdi.lz", "rhapsody_dr1.vdi.lz", + "rhapsody_dr2.vdi.lz" + }; + + readonly ulong[] sectors = {409600, 409600, 409600, 409600, 409600}; + + readonly uint[] sectorsize = {512, 512, 512, 512, 512}; + + readonly long[] clusters = {204640, 204640, 204640, 204640, 204464}; + + readonly int[] clustersize = {1024, 1024, 1024, 1024, 1024}; + + readonly string[] volumename = {null, null, null, null, null}; + + readonly string[] volumeserial = {null, null, null, null, null}; + + readonly string[] type = {"UFS", "UFS", "UFS", "UFS", "UFS"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ufs_next", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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]); + } + } + } + [TestFixture] + public class UfsNeXtFloppy + { + readonly string[] testfiles = + { + "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", + "rhapsody_dr1_mf2dd.img.lz", "rhapsody_dr1_mf2hd.img.lz", "rhapsody_dr2_mf2dd.img.lz", + "rhapsody_dr2_mf2hd.img.lz" + }; + + readonly ulong[] sectors = {1440, 2880, 1440, 2880, 1440, 2880, 1440, 2880, 1440, 2880}; + + readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512, 512, 512, 512, 512}; + + readonly long[] clusters = {624, 1344, 624, 1344, 624, 1344, 624, 1344, 624, 1344}; + + readonly int[] clustersize = {1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024}; + + 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 = {"UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ufs_next", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new ZZZRawImage(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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]); + } + } + } + [TestFixture] + public class UfsRdb + { + readonly string[] testfiles = {"amix.vdi.lz"}; + + readonly ulong[] sectors = {1024128}; + + readonly uint[] sectorsize = {512}; + + readonly long[] clusters = {511424}; + + readonly int[] clustersize = {1024}; + + readonly string[] volumename = {null}; + + readonly string[] volumeserial = {null}; + + readonly string[] type = {"UFS"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ufs_rdb", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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]); + } + } + } + [TestFixture] + public class UfsSuni86 + { + readonly string[] testfiles = {"solaris_7.vdi.lz"}; + + readonly ulong[] sectors = {4194304}; + + readonly uint[] sectorsize = {512}; + + readonly long[] clusters = {2063376}; + + readonly int[] clustersize = {1024}; + + readonly string[] volumename = {null}; + + readonly string[] volumeserial = {null}; + + readonly string[] type = {"UFS"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ufs_suni86", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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/DiscImageChef.Tests/Filesystems/UFS_APM.cs b/DiscImageChef.Tests/Filesystems/UFS_APM.cs deleted file mode 100644 index 4967a3f33..000000000 --- a/DiscImageChef.Tests/Filesystems/UFS_APM.cs +++ /dev/null @@ -1,99 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : UFS_APM.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class UfsApm - { - readonly string[] testfiles = - { - "ffs43/darwin_1.3.1.vdi.lz", "ffs43/darwin_1.4.1.vdi.lz", "ffs43/darwin_6.0.2.vdi.lz", - "ffs43/darwin_8.0.1.vdi.lz", "ufs1/darwin_1.3.1.vdi.lz", "ufs1/darwin_1.4.1.vdi.lz", - "ufs1/darwin_6.0.2.vdi.lz", "ufs1/darwin_8.0.1.vdi.lz", "ufs1/macosx_10.2.vdi.lz", - "ufs1/macosx_10.3.vdi.lz", "ufs1/macosx_10.4.vdi.lz" - }; - - readonly ulong[] sectors = - {1024000, 1024000, 1024000, 1024000, 204800, 204800, 204800, 204800, 2097152, 2097152, 2097152}; - - readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512}; - - readonly long[] clusters = - {511488, 511488, 511488, 511488, 102368, 102368, 102368, 102368, 1047660, 1038952, 1038952}; - - readonly int[] clustersize = {1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024}; - - 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 = {"UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ufs_apm", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/UFS_MBR.cs b/DiscImageChef.Tests/Filesystems/UFS_MBR.cs deleted file mode 100644 index b3765d6e7..000000000 --- a/DiscImageChef.Tests/Filesystems/UFS_MBR.cs +++ /dev/null @@ -1,134 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : UFS_MBR.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class UfsMbr - { - readonly string[] testfiles = - { - "ufs1/linux.vdi.lz", "ufs2/linux.vdi.lz", "ffs43/darwin_1.3.1.vdi.lz", "ffs43/darwin_1.4.1.vdi.lz", - "ffs43/darwin_6.0.2.vdi.lz", "ffs43/darwin_8.0.1.vdi.lz", "ffs43/dflybsd_1.2.0.vdi.lz", - "ffs43/dflybsd_3.6.1.vdi.lz", "ffs43/dflybsd_4.0.5.vdi.lz", "ffs43/netbsd_1.6.vdi.lz", - "ffs43/netbsd_7.1.vdi.lz", "ufs1/darwin_1.3.1.vdi.lz", "ufs1/darwin_1.4.1.vdi.lz", - "ufs1/darwin_6.0.2.vdi.lz", "ufs1/darwin_8.0.1.vdi.lz", "ufs1/dflybsd_1.2.0.vdi.lz", - "ufs1/dflybsd_3.6.1.vdi.lz", "ufs1/dflybsd_4.0.5.vdi.lz", "ufs1/freebsd_6.1.vdi.lz", - "ufs1/freebsd_7.0.vdi.lz", "ufs1/freebsd_8.2.vdi.lz", "ufs1/netbsd_1.6.vdi.lz", "ufs1/netbsd_7.1.vdi.lz", - "ufs1/solaris_7.vdi.lz", "ufs1/solaris_9.vdi.lz", "ufs2/freebsd_6.1.vdi.lz", "ufs2/freebsd_7.0.vdi.lz", - "ufs2/freebsd_8.2.vdi.lz", "ufs2/netbsd_7.1.vdi.lz" - }; - - readonly ulong[] sectors = - { - 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 = - { - 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 = - { - 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 = - { - 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 - }; - - 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 = - { - "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() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ufs_mbr", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/UFS_NeXT.cs b/DiscImageChef.Tests/Filesystems/UFS_NeXT.cs deleted file mode 100644 index 44018718a..000000000 --- a/DiscImageChef.Tests/Filesystems/UFS_NeXT.cs +++ /dev/null @@ -1,95 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : UFS_NeXT.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class UfsNeXt - { - readonly string[] testfiles = - { - "nextstep_3.3.vdi.lz", "openstep_4.0.vdi.lz", "openstep_4.2.vdi.lz", "rhapsody_dr1.vdi.lz", - "rhapsody_dr2.vdi.lz" - }; - - readonly ulong[] sectors = {409600, 409600, 409600, 409600, 409600}; - - readonly uint[] sectorsize = {512, 512, 512, 512, 512}; - - readonly long[] clusters = {204640, 204640, 204640, 204640, 204464}; - - readonly int[] clustersize = {1024, 1024, 1024, 1024, 1024}; - - readonly string[] volumename = {null, null, null, null, null}; - - readonly string[] volumeserial = {null, null, null, null, null}; - - readonly string[] type = {"UFS", "UFS", "UFS", "UFS", "UFS"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ufs_next", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/UFS_NeXT_Floppy.cs b/DiscImageChef.Tests/Filesystems/UFS_NeXT_Floppy.cs deleted file mode 100644 index c26ccb453..000000000 --- a/DiscImageChef.Tests/Filesystems/UFS_NeXT_Floppy.cs +++ /dev/null @@ -1,97 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : UFS_NeXT_Floppy.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class UfsNeXtFloppy - { - readonly string[] testfiles = - { - "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", - "rhapsody_dr1_mf2dd.img.lz", "rhapsody_dr1_mf2hd.img.lz", "rhapsody_dr2_mf2dd.img.lz", - "rhapsody_dr2_mf2hd.img.lz" - }; - - readonly ulong[] sectors = {1440, 2880, 1440, 2880, 1440, 2880, 1440, 2880, 1440, 2880}; - - readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512, 512, 512, 512, 512}; - - readonly long[] clusters = {624, 1344, 624, 1344, 624, 1344, 624, 1344, 624, 1344}; - - readonly int[] clustersize = {1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024}; - - 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 = {"UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ufs_next", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new ZZZRawImage(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/UFS_RDB.cs b/DiscImageChef.Tests/Filesystems/UFS_RDB.cs deleted file mode 100644 index 16864f88b..000000000 --- a/DiscImageChef.Tests/Filesystems/UFS_RDB.cs +++ /dev/null @@ -1,91 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : UFS_RDB.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class UfsRdb - { - readonly string[] testfiles = {"amix.vdi.lz"}; - - readonly ulong[] sectors = {1024128}; - - readonly uint[] sectorsize = {512}; - - readonly long[] clusters = {511424}; - - readonly int[] clustersize = {1024}; - - readonly string[] volumename = {null}; - - readonly string[] volumeserial = {null}; - - readonly string[] type = {"UFS"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ufs_rdb", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/UFS_Suni86.cs b/DiscImageChef.Tests/Filesystems/UFS_Suni86.cs deleted file mode 100644 index 0ddd8a97d..000000000 --- a/DiscImageChef.Tests/Filesystems/UFS_Suni86.cs +++ /dev/null @@ -1,91 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : UFS_Suni86.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class UfsSuni86 - { - readonly string[] testfiles = {"solaris_7.vdi.lz"}; - - readonly ulong[] sectors = {4194304}; - - readonly uint[] sectorsize = {512}; - - readonly long[] clusters = {2063376}; - - readonly int[] clustersize = {1024}; - - readonly string[] volumename = {null}; - - readonly string[] volumeserial = {null}; - - readonly string[] type = {"UFS"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ufs_suni86", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/UNIXBFS.cs b/DiscImageChef.Tests/Filesystems/UNIXBFS.cs index 46821e921..b5c6266cc 100644 --- a/DiscImageChef.Tests/Filesystems/UNIXBFS.cs +++ b/DiscImageChef.Tests/Filesystems/UNIXBFS.cs @@ -26,6 +26,7 @@ // Copyright © 2011-2018 Natalia Portillo // ****************************************************************************/ +using System.Collections.Generic; using System.IO; using DiscImageChef.CommonTypes; using DiscImageChef.DiscImages; @@ -89,4 +90,103 @@ namespace DiscImageChef.Tests.Filesystems } } } + [TestFixture] + public class UnixbfsMbr + { + readonly string[] testfiles = {"linux.vdi.lz"}; + + readonly ulong[] sectors = {262144}; + + readonly uint[] sectorsize = {512}; + + readonly long[] clusters = {260096}; + + readonly int[] clustersize = {512}; + + readonly string[] volumename = {"Label"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "unixbfs_mbr", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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]); + } + } + } + [TestFixture] + public class UnixbfsRdb + { + readonly string[] testfiles = {"amix.vdi.lz"}; + + readonly ulong[] sectors = {1024128}; + + readonly uint[] sectorsize = {512}; + + readonly long[] clusters = {65024}; + + readonly int[] clustersize = {2048}; + + readonly string[] volumename = {null}; + + readonly string[] volumeserial = {"UNKNOWN"}; + + readonly string[] type = {"UFS"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "unixbfs_rdb", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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/DiscImageChef.Tests/Filesystems/UNIXBFS_MBR.cs b/DiscImageChef.Tests/Filesystems/UNIXBFS_MBR.cs deleted file mode 100644 index f4861fb4c..000000000 --- a/DiscImageChef.Tests/Filesystems/UNIXBFS_MBR.cs +++ /dev/null @@ -1,86 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : UNIXBFS_MBR.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class UnixbfsMbr - { - readonly string[] testfiles = {"linux.vdi.lz"}; - - readonly ulong[] sectors = {262144}; - - readonly uint[] sectorsize = {512}; - - readonly long[] clusters = {260096}; - - readonly int[] clustersize = {512}; - - readonly string[] volumename = {"Label"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "unixbfs_mbr", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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]); - } - } - } -} \ No newline at end of file diff --git a/DiscImageChef.Tests/Filesystems/UNIXBFS_RDB.cs b/DiscImageChef.Tests/Filesystems/UNIXBFS_RDB.cs deleted file mode 100644 index c3626fa07..000000000 --- a/DiscImageChef.Tests/Filesystems/UNIXBFS_RDB.cs +++ /dev/null @@ -1,91 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : UNIXBFS_RDB.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class UnixbfsRdb - { - readonly string[] testfiles = {"amix.vdi.lz"}; - - readonly ulong[] sectors = {1024128}; - - readonly uint[] sectorsize = {512}; - - readonly long[] clusters = {65024}; - - readonly int[] clustersize = {2048}; - - readonly string[] volumename = {null}; - - readonly string[] volumeserial = {"UNKNOWN"}; - - readonly string[] type = {"UFS"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "unixbfs_rdb", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/XENIX.cs b/DiscImageChef.Tests/Filesystems/XENIX.cs index 7f9e34b0c..62b3026f8 100644 --- a/DiscImageChef.Tests/Filesystems/XENIX.cs +++ b/DiscImageChef.Tests/Filesystems/XENIX.cs @@ -26,6 +26,7 @@ // Copyright © 2011-2018 Natalia Portillo // ****************************************************************************/ +using System.Collections.Generic; using System.IO; using DiscImageChef.CommonTypes; using DiscImageChef.DiscImages; @@ -92,4 +93,56 @@ namespace DiscImageChef.Tests.Filesystems } } } + [TestFixture] + public class XenixMbr + { + readonly string[] testfiles = {"xenix_2.3.2d.vdi.lz", "xenix_2.3.4h.vdi.lz", "scoopenserver_5.0.7hw.vdi.lz"}; + + readonly ulong[] sectors = {40960, 40960, 2097152}; + + readonly uint[] sectorsize = {512, 512, 512}; + + readonly long[] clusters = {0, 0, 0, 19624, 19624, 19624}; + + readonly int[] clustersize = {1024, 1024, 1024}; + + readonly string[] volumename = {"", "", ""}; + + readonly string[] volumeserial = {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.TestFilesRoot, "filesystems", "xenix_mbr", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem 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 _); + 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/DiscImageChef.Tests/Filesystems/XENIX_MBR.cs b/DiscImageChef.Tests/Filesystems/XENIX_MBR.cs deleted file mode 100644 index 732baf632..000000000 --- a/DiscImageChef.Tests/Filesystems/XENIX_MBR.cs +++ /dev/null @@ -1,91 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : XENIX_MBR.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class XenixMbr - { - readonly string[] testfiles = {"xenix_2.3.2d.vdi.lz", "xenix_2.3.4h.vdi.lz", "scoopenserver_5.0.7hw.vdi.lz"}; - - readonly ulong[] sectors = {40960, 40960, 2097152}; - - readonly uint[] sectorsize = {512, 512, 512}; - - readonly long[] clusters = {0, 0, 0, 19624, 19624, 19624}; - - readonly int[] clustersize = {1024, 1024, 1024}; - - readonly string[] volumename = {"", "", ""}; - - readonly string[] volumeserial = {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.TestFilesRoot, "filesystems", "xenix_mbr", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem 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 _); - 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/DiscImageChef.Tests/Filesystems/XFS_MBR.cs b/DiscImageChef.Tests/Filesystems/XFS.cs similarity index 99% rename from DiscImageChef.Tests/Filesystems/XFS_MBR.cs rename to DiscImageChef.Tests/Filesystems/XFS.cs index 99de81b16..2edcd1a91 100644 --- a/DiscImageChef.Tests/Filesystems/XFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/XFS.cs @@ -2,7 +2,7 @@ // The Disc Image Chef // ---------------------------------------------------------------------------- // -// Filename : XFS_MBR.cs +// Filename : XFS.cs // Author(s) : Natalia Portillo // // Component : DiscImageChef unit testing. diff --git a/DiscImageChef.Tests/Filesystems/exFAT.cs b/DiscImageChef.Tests/Filesystems/exFAT.cs new file mode 100644 index 000000000..de067362c --- /dev/null +++ b/DiscImageChef.Tests/Filesystems/exFAT.cs @@ -0,0 +1,189 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : exFAT.cs +// Author(s) : Natalia Portillo +// +// Component : DiscImageChef unit testing. +// +// --[ License ] -------------------------------------------------------------- +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2018 Natalia Portillo +// ****************************************************************************/ + +using System.Collections.Generic; +using System.IO; +using DiscImageChef.CommonTypes; +using DiscImageChef.DiscImages; +using DiscImageChef.Filesystems; +using DiscImageChef.Filters; +using NUnit.Framework; + +namespace DiscImageChef.Tests.Filesystems +{ + [TestFixture] + public class ExFatApm + { + readonly string[] testfiles = {"macosx_10.11.vdi.lz"}; + + readonly ulong[] sectors = {262144}; + + readonly uint[] sectorsize = {512}; + + readonly long[] clusters = {32710}; + + readonly int[] clustersize = {4096}; + + readonly string[] volumename = {null}; + + readonly string[] volumeserial = {"595AC82C"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "exfat_apm", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem fs = new 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 _); + 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]); + } + } + } + [TestFixture] + public class ExFatGpt + { + readonly string[] testfiles = {"macosx_10.11.vdi.lz"}; + + readonly ulong[] sectors = {262144}; + + readonly uint[] sectorsize = {512}; + + readonly long[] clusters = {32208}; + + readonly int[] clustersize = {4096}; + + readonly string[] volumename = {null}; + + readonly string[] volumeserial = {"595ACC39"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "exfat_gpt", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem fs = new 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 _); + 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]); + } + } + } + [TestFixture] + public class ExFatMbr + { + readonly string[] testfiles = {"linux.vdi.lz", "macosx_10.11.vdi.lz", "win10.vdi.lz", "winvista.vdi.lz"}; + + readonly ulong[] sectors = {262144, 262144, 262144, 262144}; + + readonly uint[] sectorsize = {512, 512, 512, 512}; + + readonly long[] clusters = {32464, 32712, 32448, 32208}; + + readonly int[] clustersize = {4096, 4096, 4096, 4096}; + + readonly string[] volumename = {null, null, null, null}; + + readonly string[] volumeserial = {"603565AC", "595AC21E", "20126663", "0AC5CA52"}; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "exfat_mbr", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new Vdi(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem fs = new 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 _); + 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/DiscImageChef.Tests/Filesystems/exFAT_APM.cs b/DiscImageChef.Tests/Filesystems/exFAT_APM.cs deleted file mode 100644 index a7b34e510..000000000 --- a/DiscImageChef.Tests/Filesystems/exFAT_APM.cs +++ /dev/null @@ -1,89 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : exFAT_APM.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class ExFatApm - { - readonly string[] testfiles = {"macosx_10.11.vdi.lz"}; - - readonly ulong[] sectors = {262144}; - - readonly uint[] sectorsize = {512}; - - readonly long[] clusters = {32710}; - - readonly int[] clustersize = {4096}; - - readonly string[] volumename = {null}; - - readonly string[] volumeserial = {"595AC82C"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "exfat_apm", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem fs = new 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 _); - 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/DiscImageChef.Tests/Filesystems/exFAT_GPT.cs b/DiscImageChef.Tests/Filesystems/exFAT_GPT.cs deleted file mode 100644 index 64365db16..000000000 --- a/DiscImageChef.Tests/Filesystems/exFAT_GPT.cs +++ /dev/null @@ -1,89 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : exFAT_GPT.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class ExFatGpt - { - readonly string[] testfiles = {"macosx_10.11.vdi.lz"}; - - readonly ulong[] sectors = {262144}; - - readonly uint[] sectorsize = {512}; - - readonly long[] clusters = {32208}; - - readonly int[] clustersize = {4096}; - - readonly string[] volumename = {null}; - - readonly string[] volumeserial = {"595ACC39"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "exfat_gpt", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem fs = new 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 _); - 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/DiscImageChef.Tests/Filesystems/exFAT_MBR.cs b/DiscImageChef.Tests/Filesystems/exFAT_MBR.cs deleted file mode 100644 index bf4e69ac5..000000000 --- a/DiscImageChef.Tests/Filesystems/exFAT_MBR.cs +++ /dev/null @@ -1,89 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : exFAT_MBR.cs -// Author(s) : Natalia Portillo -// -// Component : DiscImageChef unit testing. -// -// --[ License ] -------------------------------------------------------------- -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2018 Natalia Portillo -// ****************************************************************************/ - -using System.Collections.Generic; -using System.IO; -using DiscImageChef.CommonTypes; -using DiscImageChef.DiscImages; -using DiscImageChef.Filesystems; -using DiscImageChef.Filters; -using NUnit.Framework; - -namespace DiscImageChef.Tests.Filesystems -{ - [TestFixture] - public class ExFatMbr - { - readonly string[] testfiles = {"linux.vdi.lz", "macosx_10.11.vdi.lz", "win10.vdi.lz", "winvista.vdi.lz"}; - - readonly ulong[] sectors = {262144, 262144, 262144, 262144}; - - readonly uint[] sectorsize = {512, 512, 512, 512}; - - readonly long[] clusters = {32464, 32712, 32448, 32208}; - - readonly int[] clustersize = {4096, 4096, 4096, 4096}; - - readonly string[] volumename = {null, null, null, null}; - - readonly string[] volumeserial = {"603565AC", "595AC21E", "20126663", "0AC5CA52"}; - - [Test] - public void Test() - { - for(int i = 0; i < testfiles.Length; i++) - { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "exfat_mbr", testfiles[i]); - Filter filter = new LZip(); - filter.Open(location); - ImagePlugin image = new Vdi(); - Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]); - Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]); - List partitions = Core.Partitions.GetAll(image); - Filesystem fs = new 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 _); - 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