mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Add new filesystem tests created from OS/2.
This commit is contained in:
@@ -42,57 +42,58 @@ namespace DiscImageChef.Tests.Filesystems
|
||||
readonly string[] testfiles =
|
||||
{
|
||||
"macos_1.1_mf2dd.img.lz", "macos_2.0_mf2dd.img.lz", "macos_6.0.7_mf2dd.img.lz", "nextstep_3.3_mf2hd.img.lz",
|
||||
"openstep_4.0_mf2hd.img.lz", "openstep_4.2_mf2hd.img.lz", "rhapsody_dr1_mf2hd.img.lz"
|
||||
"openstep_4.0_mf2hd.img.lz", "openstep_4.2_mf2hd.img.lz", "rhapsody_dr1_mf2hd.img.lz",
|
||||
"ecs20_mf2hd_fstester.img.lz"
|
||||
};
|
||||
|
||||
readonly MediaType[] mediatypes =
|
||||
{
|
||||
MediaType.AppleSonyDS, MediaType.AppleSonyDS, MediaType.AppleSonyDS, MediaType.DOS_35_HD,
|
||||
MediaType.DOS_35_HD, MediaType.DOS_35_HD, MediaType.DOS_35_HD
|
||||
MediaType.DOS_35_HD, MediaType.DOS_35_HD, MediaType.DOS_35_HD, MediaType.DOS_35_HD
|
||||
};
|
||||
|
||||
readonly ulong[] sectors = {1600, 1600, 1600, 2880, 2880, 2880, 2880};
|
||||
readonly ulong[] sectors = {1600, 1600, 1600, 2880, 2880, 2880, 2880, 2880};
|
||||
|
||||
readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512, 512};
|
||||
readonly uint[] sectorsize = {512, 512, 512, 512, 512, 512, 512, 512};
|
||||
|
||||
readonly long[] clusters = {1594, 1594, 1594, 2874, 2874, 2874, 2874};
|
||||
readonly long[] clusters = {1594, 1594, 1594, 2874, 2874, 2874, 2874, 2874};
|
||||
|
||||
readonly int[] clustersize = {512, 512, 512, 512, 512, 512, 512};
|
||||
readonly int[] clustersize = {512, 512, 512, 512, 512, 512, 512, 512};
|
||||
|
||||
readonly string[] volumename =
|
||||
{
|
||||
"Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label",
|
||||
"Volume label"
|
||||
"Volume label", "VOLUME LABEL"
|
||||
};
|
||||
|
||||
readonly string[] volumeserial = {null, null, null, null, null, null, null};
|
||||
readonly string[] volumeserial = {null, null, null, null, null, null, null, null};
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
for(int i = 0; i < testfiles.Length; i++)
|
||||
{
|
||||
string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfs", testfiles[i]);
|
||||
IFilter filter = new LZip();
|
||||
string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfs", testfiles[i]);
|
||||
IFilter filter = new LZip();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new ZZZRawImage();
|
||||
Assert.AreEqual(true, image.Open(filter), testfiles[i]);
|
||||
Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]);
|
||||
Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
|
||||
Assert.AreEqual(true, image.Open(filter), testfiles[i]);
|
||||
Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]);
|
||||
Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
|
||||
Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]);
|
||||
IFilesystem fs = new AppleHFS();
|
||||
Partition wholePart = new Partition
|
||||
IFilesystem fs = new AppleHFS();
|
||||
Partition wholePart = new Partition
|
||||
{
|
||||
Name = "Whole device",
|
||||
Name = "Whole device",
|
||||
Length = image.Info.Sectors,
|
||||
Size = image.Info.Sectors * image.Info.SectorSize
|
||||
Size = image.Info.Sectors * image.Info.SectorSize
|
||||
};
|
||||
Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]);
|
||||
fs.GetInformation(image, wholePart, out _, null);
|
||||
Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]);
|
||||
Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]);
|
||||
Assert.AreEqual("HFS", fs.XmlFsType.Type, testfiles[i]);
|
||||
Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]);
|
||||
Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]);
|
||||
Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]);
|
||||
Assert.AreEqual("HFS", fs.XmlFsType.Type, testfiles[i]);
|
||||
Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]);
|
||||
Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]);
|
||||
}
|
||||
}
|
||||
@@ -161,17 +162,17 @@ namespace DiscImageChef.Tests.Filesystems
|
||||
{
|
||||
for(int i = 0; i < testfiles.Length; i++)
|
||||
{
|
||||
string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfs_apm", testfiles[i]);
|
||||
IFilter filter = new LZip();
|
||||
string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfs_apm", testfiles[i]);
|
||||
IFilter filter = new LZip();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new Vdi();
|
||||
Assert.AreEqual(true, image.Open(filter), testfiles[i]);
|
||||
Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
|
||||
Assert.AreEqual(true, image.Open(filter), testfiles[i]);
|
||||
Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
|
||||
Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]);
|
||||
List<Partition> partitions = Core.Partitions.GetAll(image);
|
||||
IFilesystem fs = new AppleHFS();
|
||||
int part = -1;
|
||||
for(int j = 0; j < partitions.Count; j++)
|
||||
IFilesystem fs = new AppleHFS();
|
||||
int part = -1;
|
||||
for(int j = 0; j < partitions.Count; j++)
|
||||
if(partitions[j].Type == "Apple_HFS")
|
||||
{
|
||||
part = j;
|
||||
@@ -181,10 +182,10 @@ namespace DiscImageChef.Tests.Filesystems
|
||||
Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}");
|
||||
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
|
||||
fs.GetInformation(image, partitions[part], out _, null);
|
||||
Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]);
|
||||
Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]);
|
||||
Assert.AreEqual("HFS", fs.XmlFsType.Type, testfiles[i]);
|
||||
Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]);
|
||||
Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]);
|
||||
Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]);
|
||||
Assert.AreEqual("HFS", fs.XmlFsType.Type, testfiles[i]);
|
||||
Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]);
|
||||
Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]);
|
||||
}
|
||||
}
|
||||
@@ -218,17 +219,17 @@ namespace DiscImageChef.Tests.Filesystems
|
||||
{
|
||||
for(int i = 0; i < testfiles.Length; i++)
|
||||
{
|
||||
string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfs_cdrom", testfiles[i]);
|
||||
IFilter filter = new LZip();
|
||||
string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfs_cdrom", testfiles[i]);
|
||||
IFilter filter = new LZip();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new ZZZRawImage();
|
||||
Assert.AreEqual(true, image.Open(filter), testfiles[i]);
|
||||
Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
|
||||
Assert.AreEqual(true, image.Open(filter), testfiles[i]);
|
||||
Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
|
||||
Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]);
|
||||
List<Partition> partitions = Core.Partitions.GetAll(image);
|
||||
IFilesystem fs = new AppleHFS();
|
||||
int part = -1;
|
||||
for(int j = 0; j < partitions.Count; j++)
|
||||
IFilesystem fs = new AppleHFS();
|
||||
int part = -1;
|
||||
for(int j = 0; j < partitions.Count; j++)
|
||||
if(partitions[j].Type == "Apple_HFS")
|
||||
{
|
||||
part = j;
|
||||
@@ -238,10 +239,10 @@ namespace DiscImageChef.Tests.Filesystems
|
||||
Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}");
|
||||
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
|
||||
fs.GetInformation(image, partitions[part], out _, null);
|
||||
Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]);
|
||||
Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]);
|
||||
Assert.AreEqual("HFS", fs.XmlFsType.Type, testfiles[i]);
|
||||
Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]);
|
||||
Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]);
|
||||
Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]);
|
||||
Assert.AreEqual("HFS", fs.XmlFsType.Type, testfiles[i]);
|
||||
Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]);
|
||||
Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]);
|
||||
}
|
||||
}
|
||||
@@ -272,17 +273,17 @@ namespace DiscImageChef.Tests.Filesystems
|
||||
{
|
||||
for(int i = 0; i < testfiles.Length; i++)
|
||||
{
|
||||
string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfs_mbr", testfiles[i]);
|
||||
IFilter filter = new LZip();
|
||||
string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfs_mbr", testfiles[i]);
|
||||
IFilter filter = new LZip();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new Vdi();
|
||||
Assert.AreEqual(true, image.Open(filter), testfiles[i]);
|
||||
Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
|
||||
Assert.AreEqual(true, image.Open(filter), testfiles[i]);
|
||||
Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
|
||||
Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]);
|
||||
List<Partition> partitions = Core.Partitions.GetAll(image);
|
||||
IFilesystem fs = new AppleHFS();
|
||||
int part = -1;
|
||||
for(int j = 0; j < partitions.Count; j++)
|
||||
IFilesystem fs = new AppleHFS();
|
||||
int part = -1;
|
||||
for(int j = 0; j < partitions.Count; j++)
|
||||
if(partitions[j].Type == "0xAF")
|
||||
{
|
||||
part = j;
|
||||
@@ -292,10 +293,10 @@ namespace DiscImageChef.Tests.Filesystems
|
||||
Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}");
|
||||
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
|
||||
fs.GetInformation(image, partitions[part], out _, null);
|
||||
Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]);
|
||||
Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]);
|
||||
Assert.AreEqual("HFS", fs.XmlFsType.Type, testfiles[i]);
|
||||
Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]);
|
||||
Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]);
|
||||
Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]);
|
||||
Assert.AreEqual("HFS", fs.XmlFsType.Type, testfiles[i]);
|
||||
Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]);
|
||||
Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]);
|
||||
}
|
||||
}
|
||||
@@ -323,17 +324,17 @@ namespace DiscImageChef.Tests.Filesystems
|
||||
{
|
||||
for(int i = 0; i < testfiles.Length; i++)
|
||||
{
|
||||
string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfs_rdb", testfiles[i]);
|
||||
IFilter filter = new LZip();
|
||||
string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfs_rdb", testfiles[i]);
|
||||
IFilter filter = new LZip();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new Vdi();
|
||||
Assert.AreEqual(true, image.Open(filter), testfiles[i]);
|
||||
Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
|
||||
Assert.AreEqual(true, image.Open(filter), testfiles[i]);
|
||||
Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
|
||||
Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]);
|
||||
List<Partition> partitions = Core.Partitions.GetAll(image);
|
||||
IFilesystem fs = new AppleHFS();
|
||||
int part = -1;
|
||||
for(int j = 0; j < partitions.Count; j++)
|
||||
IFilesystem fs = new AppleHFS();
|
||||
int part = -1;
|
||||
for(int j = 0; j < partitions.Count; j++)
|
||||
if(partitions[j].Type == "\"RES\\86\"")
|
||||
{
|
||||
part = j;
|
||||
@@ -343,10 +344,10 @@ namespace DiscImageChef.Tests.Filesystems
|
||||
Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}");
|
||||
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
|
||||
fs.GetInformation(image, partitions[part], out _, null);
|
||||
Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]);
|
||||
Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]);
|
||||
Assert.AreEqual("HFS", fs.XmlFsType.Type, testfiles[i]);
|
||||
Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]);
|
||||
Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]);
|
||||
Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]);
|
||||
Assert.AreEqual("HFS", fs.XmlFsType.Type, testfiles[i]);
|
||||
Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]);
|
||||
Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user