Added tests for device types.

This commit is contained in:
2017-07-10 21:37:03 +01:00
parent 4c5d978f9f
commit 3fcfa7f10d
4 changed files with 26 additions and 55 deletions

View File

@@ -2,7 +2,7 @@
// The Disc Image Chef // The Disc Image Chef
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// //
// Filename : MFS.cs // Filename : IomegaJaz.cs
// Version : 1.0 // Version : 1.0
// Author(s) : Natalia Portillo // Author(s) : Natalia Portillo
// //
@@ -37,54 +37,29 @@
// //$Id$ // //$Id$
using System.IO; using System.IO;
using DiscImageChef.CommonTypes; using DiscImageChef.CommonTypes;
using DiscImageChef.Filesystems;
using DiscImageChef.Filters; using DiscImageChef.Filters;
using DiscImageChef.ImagePlugins; using DiscImageChef.ImagePlugins;
using NUnit.Framework; using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Devices
{ {
[TestFixture] [TestFixture]
public class MFS public class IomegaJaz
{ {
readonly string[] testfiles = { readonly string[] testfiles = {
"macos_0.1_mf1dd.img.lz","macos_0.5_mf1dd.img.lz","macos_1.1_mf1dd.img.lz","macos_2.0_mf1dd.img.lz", "jaz1.bin.lz",
"macos_6.0.7_mf1dd.img.lz",
}; };
readonly MediaType[] mediatypes = { readonly MediaType[] mediatypes = {
MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.Jaz,
MediaType.AppleSonySS
}; };
readonly ulong[] sectors = { readonly ulong[] sectors = {
800, 800, 800, 800, 2091050,
800,
}; };
readonly uint[] sectorsize = { readonly uint[] sectorsize = {
512, 512, 512, 512, 512,
512, 512, 512,
};
readonly long[] clusters = {
391, 391, 391, 391,
391,
};
readonly int[] clustersize = {
1024, 1024, 1024, 1024,
1024,
};
readonly string[] volumename = {
"Volume label","Volume label","Volume label","Volume label",
"Volume label",
};
readonly string[] volumeserial = {
null, null, null, null,
null, null, null,
}; };
[Test] [Test]
@@ -92,7 +67,7 @@ namespace DiscImageChef.Tests.Filesystems
{ {
for(int i = 0; i < testfiles.Length; i++) for(int i = 0; i < testfiles.Length; i++)
{ {
string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "mfs", testfiles[i]); string location = Path.Combine(Consts.TestFilesRoot, "devices", "jaz", testfiles[i]);
Filter filter = new LZip(); Filter filter = new LZip();
filter.Open(location); filter.Open(location);
ImagePlugin image = new ZZZRawImage(); ImagePlugin image = new ZZZRawImage();
@@ -100,14 +75,6 @@ namespace DiscImageChef.Tests.Filesystems
Assert.AreEqual(mediatypes[i], image.ImageInfo.mediaType, testfiles[i]); Assert.AreEqual(mediatypes[i], image.ImageInfo.mediaType, testfiles[i]);
Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]);
Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]);
Filesystem fs = new DiscImageChef.Filesystems.AppleMFS.AppleMFS();
Assert.AreEqual(true, fs.Identify(image, 0, image.ImageInfo.sectors - 1), testfiles[i]);
fs.GetInformation(image, 0, image.ImageInfo.sectors - 1, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("MFS", fs.XmlFSType.Type, testfiles[i]);
Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]);
Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]);
} }
} }
} }

View File

@@ -2,7 +2,7 @@
// The Disc Image Chef // The Disc Image Chef
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// //
// Filename : IomegaJaz.cs // Filename : LS120.cs
// Version : 1.0 // Version : 1.0
// Author(s) : Natalia Portillo // Author(s) : Natalia Portillo
// //
@@ -44,22 +44,22 @@ using NUnit.Framework;
namespace DiscImageChef.Tests.Devices namespace DiscImageChef.Tests.Devices
{ {
[TestFixture] [TestFixture]
public class IomegaJaz public class LS120
{ {
readonly string[] testfiles = { readonly string[] testfiles = {
"jaz1.bin.lz", "ls120.bin.lz","mf2dd.bin.lz","mf2hd.bin.lz",
}; };
readonly MediaType[] mediatypes = { readonly MediaType[] mediatypes = {
MediaType.Jaz, MediaType.LS120,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_HD,
}; };
readonly ulong[] sectors = { readonly ulong[] sectors = {
2091050, 246528,1440,2880,
}; };
readonly uint[] sectorsize = { readonly uint[] sectorsize = {
512, 512,512,512
}; };
[Test] [Test]
@@ -67,7 +67,7 @@ namespace DiscImageChef.Tests.Devices
{ {
for(int i = 0; i < testfiles.Length; i++) for(int i = 0; i < testfiles.Length; i++)
{ {
string location = Path.Combine(Consts.TestFilesRoot, "devices", "jaz", testfiles[i]); string location = Path.Combine(Consts.TestFilesRoot, "devices", "ls120", testfiles[i]);
Filter filter = new LZip(); Filter filter = new LZip();
filter.Open(location); filter.Open(location);
ImagePlugin image = new ZZZRawImage(); ImagePlugin image = new ZZZRawImage();

View File

@@ -2,7 +2,7 @@
// The Disc Image Chef // The Disc Image Chef
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// //
// Filename : IomegaJaz.cs // Filename : PocketZip.cs
// Version : 1.0 // Version : 1.0
// Author(s) : Natalia Portillo // Author(s) : Natalia Portillo
// //
@@ -44,22 +44,22 @@ using NUnit.Framework;
namespace DiscImageChef.Tests.Devices namespace DiscImageChef.Tests.Devices
{ {
[TestFixture] [TestFixture]
public class IomegaJaz public class PocketZip
{ {
readonly string[] testfiles = { readonly string[] testfiles = {
"jaz1.bin.lz", "clik!.bin.lz","pocketzip.bin.lz",
}; };
readonly MediaType[] mediatypes = { readonly MediaType[] mediatypes = {
MediaType.Jaz, MediaType.PocketZip,MediaType.PocketZip,
}; };
readonly ulong[] sectors = { readonly ulong[] sectors = {
2091050, 78882,78882,
}; };
readonly uint[] sectorsize = { readonly uint[] sectorsize = {
512, 512,512,
}; };
[Test] [Test]
@@ -67,7 +67,7 @@ namespace DiscImageChef.Tests.Devices
{ {
for(int i = 0; i < testfiles.Length; i++) for(int i = 0; i < testfiles.Length; i++)
{ {
string location = Path.Combine(Consts.TestFilesRoot, "devices", "jaz", testfiles[i]); string location = Path.Combine(Consts.TestFilesRoot, "devices", "pocketzip", testfiles[i]);
Filter filter = new LZip(); Filter filter = new LZip();
filter.Open(location); filter.Open(location);
ImagePlugin image = new ZZZRawImage(); ImagePlugin image = new ZZZRawImage();

View File

@@ -139,6 +139,9 @@
<Compile Include="Filesystems\UNIXBFS_RDB.cs" /> <Compile Include="Filesystems\UNIXBFS_RDB.cs" />
<Compile Include="Filesystems\UNIXBFS_MBR.cs" /> <Compile Include="Filesystems\UNIXBFS_MBR.cs" />
<Compile Include="Filesystems\ZFS.cs" /> <Compile Include="Filesystems\ZFS.cs" />
<Compile Include="Devices\IomegaJaz.cs" />
<Compile Include="Devices\LS120.cs" />
<Compile Include="Devices\PocketZip.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="packages.config" /> <None Include="packages.config" />
@@ -147,6 +150,7 @@
<Folder Include="Checksums\" /> <Folder Include="Checksums\" />
<Folder Include="Filters\" /> <Folder Include="Filters\" />
<Folder Include="Filesystems\" /> <Folder Include="Filesystems\" />
<Folder Include="Devices\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\DiscImageChef.Checksums\DiscImageChef.Checksums.csproj"> <ProjectReference Include="..\DiscImageChef.Checksums\DiscImageChef.Checksums.csproj">