Added more tests.

This commit is contained in:
2017-07-05 06:55:25 +01:00
parent ec7b077327
commit dab93a2bad
40 changed files with 1125 additions and 3131 deletions

View File

@@ -68,6 +68,42 @@
<Compile Include="Filesystems\FAT16_MBR.cs" /> <Compile Include="Filesystems\FAT16_MBR.cs" />
<Compile Include="Filesystems\FAT32_MBR.cs" /> <Compile Include="Filesystems\FAT32_MBR.cs" />
<Compile Include="Filesystems\HPFS.cs" /> <Compile Include="Filesystems\HPFS.cs" />
<Compile Include="Filesystems\BeFS.cs" />
<Compile Include="Filesystems\BeFS_APM.cs" />
<Compile Include="Filesystems\BeFS_MBR.cs" />
<Compile Include="Filesystems\FAT16_APM.cs" />
<Compile Include="Filesystems\FAT16_GPT.cs" />
<Compile Include="Filesystems\FAT32_APM.cs" />
<Compile Include="Filesystems\FAT32_GPT.cs" />
<Compile Include="Filesystems\PFS3_RDB.cs" />
<Compile Include="Filesystems\SFS_RDB.cs" />
<Compile Include="Filesystems\HFSPlus_MBR.cs" />
<Compile Include="Filesystems\HFSPlus_APM.cs" />
<Compile Include="Filesystems\HFSPlus_GPT.cs" />
<Compile Include="Filesystems\HFSX_APM.cs" />
<Compile Include="Filesystems\HFSX_GPT.cs" />
<Compile Include="Filesystems\HFSX_MBR.cs" />
<Compile Include="Filesystems\LisaFS.cs" />
<Compile Include="Filesystems\Locus.cs" />
<Compile Include="Filesystems\NTFS_MBR.cs" />
<Compile Include="Filesystems\ReFS_MBR.cs" />
<Compile Include="Filesystems\UDF.cs" />
<Compile Include="Filesystems\btrfs.cs" />
<Compile Include="Filesystems\exFAT_APM.cs" />
<Compile Include="Filesystems\exFAT_GPT.cs" />
<Compile Include="Filesystems\exFAT_MBR.cs" />
<Compile Include="Filesystems\ext2.cs" />
<Compile Include="Filesystems\F2FS.cs" />
<Compile Include="Filesystems\FAT12_APM.cs" />
<Compile Include="Filesystems\FAT12_GPT.cs" />
<Compile Include="Filesystems\HFS_MBR.cs" />
<Compile Include="Filesystems\JFS2.cs" />
<Compile Include="Filesystems\MINIX.cs" />
<Compile Include="Filesystems\NILFS2.cs" />
<Compile Include="Filesystems\Reiser3.cs" />
<Compile Include="Filesystems\Reiser4.cs" />
<Compile Include="Filesystems\UNIXBFS.cs" />
<Compile Include="Filesystems\UFS_MBR.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="packages.config" /> <None Include="packages.config" />
@@ -116,7 +152,7 @@
<inheritsSet /> <inheritsSet />
<inheritsScope /> <inheritsScope />
</TextStylePolicy> </TextStylePolicy>
<CSharpFormattingPolicy IndentBlock="True" IndentBraces="False" IndentSwitchSection="True" IndentSwitchCaseSection="True" LabelPositioning="OneLess" NewLinesForBracesInTypes="True" NewLinesForBracesInMethods="True" NewLinesForBracesInProperties="True" NewLinesForBracesInAccessors="True" NewLinesForBracesInAnonymousMethods="True" NewLinesForBracesInControlBlocks="True" NewLinesForBracesInAnonymousTypes="True" NewLinesForBracesInObjectCollectionArrayInitializers="True" NewLinesForBracesInLambdaExpressionBody="True" NewLineForElse="True" NewLineForCatch="True" NewLineForFinally="True" NewLineForMembersInObjectInit="True" NewLineForMembersInAnonymousTypes="True" NewLineForClausesInQuery="True" SpacingAfterMethodDeclarationName="False" SpaceWithinMethodDeclarationParenthesis="False" SpaceBetweenEmptyMethodDeclarationParentheses="False" SpaceAfterMethodCallName="False" SpaceWithinMethodCallParentheses="False" SpaceBetweenEmptyMethodCallParentheses="False" SpaceWithinExpressionParentheses="False" SpaceWithinCastParentheses="False" SpaceWithinOtherParentheses="False" SpaceAfterCast="False" SpacesIgnoreAroundVariableDeclaration="False" SpaceBeforeOpenSquareBracket="False" SpaceBetweenEmptySquareBrackets="False" SpaceWithinSquareBrackets="False" SpaceAfterColonInBaseTypeDeclaration="True" SpaceAfterComma="True" SpaceAfterDot="False" SpaceAfterSemicolonsInForStatement="True" SpaceBeforeColonInBaseTypeDeclaration="True" SpaceBeforeComma="False" SpaceBeforeDot="False" SpaceBeforeSemicolonsInForStatement="False" SpacingAroundBinaryOperator="Single" WrappingPreserveSingleLine="True" WrappingKeepStatementsOnSingleLine="True" PlaceSystemDirectiveFirst="True" SpaceAfterControlFlowStatementKeyword="False" scope="text/x-csharp"> <CSharpFormattingPolicy IndentBlock="True" IndentBraces="False" IndentSwitchSection="True" IndentSwitchCaseSection="True" LabelPositioning="OneLess" NewLinesForBracesInTypes="True" NewLinesForBracesInMethods="True" NewLinesForBracesInProperties="True" NewLinesForBracesInAccessors="True" NewLinesForBracesInAnonymousMethods="True" NewLinesForBracesInControlBlocks="True" NewLinesForBracesInAnonymousTypes="True" NewLinesForBracesInObjectCollectionArrayInitializers="True" NewLinesForBracesInLambdaExpressionBody="True" NewLineForElse="True" NewLineForCatch="True" NewLineForFinally="True" NewLineForMembersInObjectInit="True" NewLineForMembersInAnonymousTypes="True" NewLineForClausesInQuery="True" SpacingAfterMethodDeclarationName="False" SpaceWithinMethodDeclarationParenthesis="False" SpaceBetweenEmptyMethodDeclarationParentheses="False" SpaceAfterMethodCallName="False" SpaceWithinMethodCallParentheses="False" SpaceBetweenEmptyMethodCallParentheses="False" SpaceAfterControlFlowStatementKeyword="False" SpaceWithinExpressionParentheses="False" SpaceWithinCastParentheses="False" SpaceWithinOtherParentheses="False" SpaceAfterCast="False" SpacesIgnoreAroundVariableDeclaration="False" SpaceBeforeOpenSquareBracket="False" SpaceBetweenEmptySquareBrackets="False" SpaceWithinSquareBrackets="False" SpaceAfterColonInBaseTypeDeclaration="True" SpaceAfterComma="True" SpaceAfterDot="False" SpaceAfterSemicolonsInForStatement="True" SpaceBeforeColonInBaseTypeDeclaration="True" SpaceBeforeComma="False" SpaceBeforeDot="False" SpaceBeforeSemicolonsInForStatement="False" SpacingAroundBinaryOperator="Single" WrappingPreserveSingleLine="True" WrappingKeepStatementsOnSingleLine="True" PlaceSystemDirectiveFirst="True" scope="text/x-csharp">
<inheritsSet /> <inheritsSet />
<inheritsScope /> <inheritsScope />
</CSharpFormattingPolicy> </CSharpFormattingPolicy>

View File

@@ -35,13 +35,77 @@
// Copyright (C) 2011-2015 Claunia.com // Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/ // ****************************************************************************/
// //$Id$ // //$Id$
using System; using System.IO;
using DiscImageChef.CommonTypes;
using DiscImageChef.Filesystems;
using DiscImageChef.Filters;
using DiscImageChef.ImagePlugins;
using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture]
public class BeFS public class BeFS
{ {
public BeFS() readonly string[] testfiles = {
"beos_r3.1.img.lz", "beos_r4.5.img.lz",
};
readonly MediaType[] mediatypes = {
MediaType.DOS_35_HD, MediaType.DOS_35_HD,
};
readonly ulong[] sectors = {
2880, 2880,
};
readonly uint[] sectorsize = {
512, 512,
};
readonly long[] clusters = {
1440, 1440,
};
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", 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 DiscImageChef.Filesystems.BeFS();
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("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]);
}
} }
} }
} }

View File

@@ -35,13 +35,87 @@
// Copyright (C) 2011-2015 Claunia.com // Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/ // ****************************************************************************/
// //$Id$ // //$Id$
using System; using System.Collections.Generic;
using System.IO;
using DiscImageChef.CommonTypes;
using DiscImageChef.DiscImages;
using DiscImageChef.Filesystems;
using DiscImageChef.Filters;
using DiscImageChef.ImagePlugins;
using DiscImageChef.PartPlugins;
using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture]
public class BeFS_APM public class BeFS_APM
{ {
public BeFS_APM() 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 = {
786400, 785232,
};
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]);
PartPlugin parts = new AppleMap();
Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]);
Filesystem fs = new DiscImageChef.Filesystems.BeFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
{
if(partitions[j].PartitionType == "Be_BFS")
{
part = j;
break;
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
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]);
}
} }
} }
} }

View File

@@ -35,13 +35,87 @@
// Copyright (C) 2011-2015 Claunia.com // Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/ // ****************************************************************************/
// //$Id$ // //$Id$
using System; using System.Collections.Generic;
using System.IO;
using DiscImageChef.CommonTypes;
using DiscImageChef.DiscImages;
using DiscImageChef.Filesystems;
using DiscImageChef.Filters;
using DiscImageChef.ImagePlugins;
using DiscImageChef.PartPlugins;
using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture]
public class BeFS_MBR public class BeFS_MBR
{ {
public BeFS_MBR() 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 = {
786400, 785232,
};
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_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]);
PartPlugin parts = new MBR();
Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]);
Filesystem fs = new DiscImageChef.Filesystems.BeFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
{
if(partitions[j].PartitionType == "0xEB")
{
part = j;
break;
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
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]);
}
} }
} }
} }

View File

@@ -2,7 +2,7 @@
// The Disc Image Chef // The Disc Image Chef
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// //
// Filename : btrfs.cs // Filename : F2FS.cs
// Version : 1.0 // Version : 1.0
// Author(s) : Natalia Portillo // Author(s) : Natalia Portillo
// //
@@ -48,7 +48,7 @@ using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture] [TestFixture]
public class btrfs public class F2FS
{ {
readonly string[] testfiles = { readonly string[] testfiles = {
"linux.vdi.lz", "linux.vdi.lz",
@@ -75,7 +75,7 @@ namespace DiscImageChef.Tests.Filesystems
}; };
readonly string[] volumeserial = { readonly string[] volumeserial = {
"a4fc5201-85cc-6840-8a68-998cab9ae897", "81bd3a4e-de0c-484c-becc-aaa479b2070a",
}; };
[Test] [Test]
@@ -83,7 +83,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", "btrfs", testfiles[i]); string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "f2fs", testfiles[i]);
Filter filter = new LZip(); Filter filter = new LZip();
filter.Open(location); filter.Open(location);
ImagePlugin image = new VDI(); ImagePlugin image = new VDI();
@@ -92,7 +92,7 @@ namespace DiscImageChef.Tests.Filesystems
Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]);
PartPlugin parts = new MBR(); PartPlugin parts = new MBR();
Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]); Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]);
Filesystem fs = new DiscImageChef.Filesystems.BTRFS(); Filesystem fs = new DiscImageChef.Filesystems.F2FS();
int part = -1; int part = -1;
for(int j = 0; j < partitions.Count; j++) for(int j = 0; j < partitions.Count; j++)
{ {
@@ -107,7 +107,7 @@ namespace DiscImageChef.Tests.Filesystems
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("B-tree file system", fs.XmlFSType.Type, testfiles[i]); Assert.AreEqual("F2FS filesystem", fs.XmlFSType.Type, testfiles[i]);
Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]); Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]);
Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, 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 : FAT16_APM.cs // Filename : FAT12_APM.cs
// Version : 1.0 // Version : 1.0
// Author(s) : Natalia Portillo // Author(s) : Natalia Portillo
// //
@@ -48,14 +48,14 @@ using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture] [TestFixture]
public class FAT16_APM public class FAT12_APM
{ {
readonly string[] testfiles = { readonly string[] testfiles = {
"macosx.vdi.lz", "macosx.vdi.lz",
}; };
readonly ulong[] sectors = { readonly ulong[] sectors = {
1024000, 16384,
}; };
readonly uint[] sectorsize = { readonly uint[] sectorsize = {
@@ -63,11 +63,11 @@ namespace DiscImageChef.Tests.Filesystems
}; };
readonly long[] clusters = { readonly long[] clusters = {
63995, 4076,
}; };
readonly int[] clustersize = { readonly int[] clustersize = {
8192, 2048,
}; };
readonly string[] volumename = { readonly string[] volumename = {
@@ -75,7 +75,7 @@ namespace DiscImageChef.Tests.Filesystems
}; };
readonly string[] volumeserial = { readonly string[] volumeserial = {
"063D1F09", "32181F09",
}; };
readonly string[] oemid = { readonly string[] oemid = {
@@ -87,7 +87,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", "fat16_apm", testfiles[i]); string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat12_apm", testfiles[i]);
Filter filter = new LZip(); Filter filter = new LZip();
filter.Open(location); filter.Open(location);
ImagePlugin image = new VDI(); ImagePlugin image = new VDI();
@@ -100,7 +100,7 @@ namespace DiscImageChef.Tests.Filesystems
int part = -1; int part = -1;
for(int j = 0; j < partitions.Count; j++) for(int j = 0; j < partitions.Count; j++)
{ {
if(partitions[j].PartitionType == "DOS_FAT_16") if(partitions[j].PartitionType == "DOS_FAT_12")
{ {
part = j; part = j;
break; break;
@@ -111,7 +111,7 @@ namespace DiscImageChef.Tests.Filesystems
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("FAT16", fs.XmlFSType.Type, testfiles[i]); Assert.AreEqual("FAT12", fs.XmlFSType.Type, testfiles[i]);
Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]); Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]);
Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]);
Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]); Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]);

View File

@@ -2,7 +2,7 @@
// The Disc Image Chef // The Disc Image Chef
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// //
// Filename : FAT16_GPT.cs // Filename : FAT12_GPT.cs
// Version : 1.0 // Version : 1.0
// Author(s) : Natalia Portillo // Author(s) : Natalia Portillo
// //
@@ -48,14 +48,14 @@ using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture] [TestFixture]
public class FAT16_GPT public class FAT12_GPT
{ {
readonly string[] testfiles = { readonly string[] testfiles = {
"macosx.vdi.lz", "macosx.vdi.lz",
}; };
readonly ulong[] sectors = { readonly ulong[] sectors = {
1024000, 16384,
}; };
readonly uint[] sectorsize = { readonly uint[] sectorsize = {
@@ -63,11 +63,11 @@ namespace DiscImageChef.Tests.Filesystems
}; };
readonly long[] clusters = { readonly long[] clusters = {
63995, 4076,
}; };
readonly int[] clustersize = { readonly int[] clustersize = {
8192, 2048,
}; };
readonly string[] volumename = { readonly string[] volumename = {
@@ -75,7 +75,7 @@ namespace DiscImageChef.Tests.Filesystems
}; };
readonly string[] volumeserial = { readonly string[] volumeserial = {
"2E8A1F1B", "66901F1B",
}; };
readonly string[] oemid = { readonly string[] oemid = {
@@ -87,7 +87,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", "fat16_gpt", testfiles[i]); string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat12_gpt", testfiles[i]);
Filter filter = new LZip(); Filter filter = new LZip();
filter.Open(location); filter.Open(location);
ImagePlugin image = new VDI(); ImagePlugin image = new VDI();
@@ -111,7 +111,7 @@ namespace DiscImageChef.Tests.Filesystems
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("FAT16", fs.XmlFSType.Type, testfiles[i]); Assert.AreEqual("FAT12", fs.XmlFSType.Type, testfiles[i]);
Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]); Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]);
Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]);
Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]); Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]);

View File

@@ -65,7 +65,7 @@ namespace DiscImageChef.Tests.Filesystems
"win10.vdi.lz", "win2000.vdi.lz","win95.vdi.lz","win95osr2.1.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", "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", "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", "winnt_4.00.vdi.lz","winvista.vdi.lz","beos_r4.5.vdi.lz","linux.vdi.lz",
}; };
readonly ulong[] sectors = { readonly ulong[] sectors = {
@@ -83,7 +83,7 @@ namespace DiscImageChef.Tests.Filesystems
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 = { readonly uint[] sectorsize = {
@@ -101,7 +101,7 @@ namespace DiscImageChef.Tests.Filesystems
512, 512, 512, 512, 512, 512, 512, 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 = { readonly long[] clusters = {
@@ -119,7 +119,7 @@ namespace DiscImageChef.Tests.Filesystems
3552, 4088, 2008, 2008, 3552, 4088, 2008, 2008,
2008, 2008, 2044, 2044, 2008, 2008, 2044, 2044,
2044, 4016, 2044, 2044, 2044, 4016, 2044, 2044,
4016, 3072, 2040, 4016, 3072, 2040, 3584,
}; };
readonly int[] clustersize = { readonly int[] clustersize = {
@@ -137,7 +137,7 @@ namespace DiscImageChef.Tests.Filesystems
2048, 2048, 4096, 4096, 2048, 2048, 4096, 4096,
4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096,
4096, 2048, 4096, 4096, 4096, 2048, 4096, 4096,
2048, 2048, 4096, 2048, 2048, 4096, 2048,
}; };
readonly string[] volumename = { readonly string[] volumename = {
@@ -155,7 +155,7 @@ namespace DiscImageChef.Tests.Filesystems
"NO NAME ","NO NAME ","VOLUMELABEL","VOLUMELABEL", "NO NAME ","NO NAME ","VOLUMELABEL","VOLUMELABEL",
"VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL",
"VOLUMELABEL","NO NAME ","NO NAME ","NO NAME ", "VOLUMELABEL","NO NAME ","NO NAME ","NO NAME ",
"NO NAME ","NO NAME ","NO NAME ", "NO NAME ","NO NAME ","NO NAME ","VolumeLabel",
}; };
readonly string[] volumeserial = { readonly string[] volumeserial = {
@@ -173,7 +173,7 @@ namespace DiscImageChef.Tests.Filesystems
"74F4921D","C4B64D11","29200D0C","234F0DE4", "74F4921D","C4B64D11","29200D0C","234F0DE4",
"074C0DFC","33640D18","0E121460","094C0EED", "074C0DFC","33640D18","0E121460","094C0EED",
"38310F02","50489A1B","2CE52101","94313E7E", "38310F02","50489A1B","2CE52101","94313E7E",
"BC184FE6","BAD08A1E","00000000" "BC184FE6","BAD08A1E","00000000","8D418102",
}; };
readonly string[] oemid = { readonly string[] oemid = {
@@ -191,7 +191,7 @@ namespace DiscImageChef.Tests.Filesystems
"MSDOS5.0", "MSDOS5.0", "MSWIN4.0", "MSWIN4.1", "MSDOS5.0", "MSDOS5.0", "MSWIN4.0", "MSWIN4.1",
"MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1",
"MSWIN4.1", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSWIN4.1", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0",
"MSDOS5.0", "MSDOS5.0", "BeOS ", "MSDOS5.0", "MSDOS5.0", "BeOS ", "mkfs.fat",
}; };
[Test] [Test]

View File

@@ -35,13 +35,87 @@
// Copyright (C) 2011-2015 Claunia.com // Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/ // ****************************************************************************/
// //$Id$ // //$Id$
using System; using System.Collections.Generic;
using System.IO;
using DiscImageChef.CommonTypes;
using DiscImageChef.DiscImages;
using DiscImageChef.Filesystems;
using DiscImageChef.Filters;
using DiscImageChef.ImagePlugins;
using DiscImageChef.PartPlugins;
using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture]
public class FAT16_APM public class FAT16_APM
{ {
public FAT16_APM() readonly string[] testfiles = {
"macosx.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]);
PartPlugin parts = new AppleMap();
Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]);
Filesystem fs = new DiscImageChef.Filesystems.FAT();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
{
if(partitions[j].PartitionType == "DOS_FAT_16")
{
part = j;
break;
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
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]);
}
} }
} }
} }

View File

@@ -2,7 +2,7 @@
// The Disc Image Chef // The Disc Image Chef
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// //
// Filename : FAT16_APM.cs // Filename : FAT16_GPT.cs
// Version : 1.0 // Version : 1.0
// Author(s) : Natalia Portillo // Author(s) : Natalia Portillo
// //
@@ -48,7 +48,7 @@ using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture] [TestFixture]
public class FAT16_APM public class FAT16_GPT
{ {
readonly string[] testfiles = { readonly string[] testfiles = {
"macosx.vdi.lz", "macosx.vdi.lz",
@@ -75,7 +75,7 @@ namespace DiscImageChef.Tests.Filesystems
}; };
readonly string[] volumeserial = { readonly string[] volumeserial = {
"063D1F09", "2E8A1F1B",
}; };
readonly string[] oemid = { readonly string[] oemid = {
@@ -87,20 +87,20 @@ 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", "fat16_apm", testfiles[i]); string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat16_gpt", testfiles[i]);
Filter filter = new LZip(); Filter filter = new LZip();
filter.Open(location); filter.Open(location);
ImagePlugin image = new VDI(); ImagePlugin image = new VDI();
Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(true, image.OpenImage(filter), 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]);
PartPlugin parts = new AppleMap(); PartPlugin parts = new GuidPartitionTable();
Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]); Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]);
Filesystem fs = new DiscImageChef.Filesystems.FAT(); Filesystem fs = new DiscImageChef.Filesystems.FAT();
int part = -1; int part = -1;
for(int j = 0; j < partitions.Count; j++) for(int j = 0; j < partitions.Count; j++)
{ {
if(partitions[j].PartitionType == "DOS_FAT_16") if(partitions[j].PartitionType == "Microsoft Basic data")
{ {
part = j; part = j;
break; break;

View File

@@ -63,7 +63,7 @@ namespace DiscImageChef.Tests.Filesystems
"win10.vdi.lz", "win2000.vdi.lz", "win95osr2.1.vdi.lz", "win95osr2.5.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", "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", "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" "winnt_4.00.vdi.lz", "winvista.vdi.lz", "beos_r4.5.vdi.lz", "linux.vdi.lz",
}; };
readonly ulong[] sectors = { readonly ulong[] sectors = {
@@ -79,7 +79,7 @@ namespace DiscImageChef.Tests.Filesystems
1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000,
1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000,
1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000,
1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 262144,
}; };
readonly uint[] sectorsize = { readonly uint[] sectorsize = {
@@ -95,7 +95,7 @@ namespace DiscImageChef.Tests.Filesystems
512, 512, 512, 512, 512, 512, 512, 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 = { readonly long[] clusters = {
@@ -111,7 +111,7 @@ namespace DiscImageChef.Tests.Filesystems
63864, 63252, 63941, 63941, 63864, 63252, 63941, 63941,
63941, 63941, 63998, 63998, 63941, 63941, 63998, 63998,
63998, 63941, 63998, 63998, 63998, 63941, 63998, 63998,
63941, 63616, 63996, 63941, 63616, 63996, 65024,
}; };
readonly int[] clustersize = { readonly int[] clustersize = {
@@ -127,11 +127,7 @@ namespace DiscImageChef.Tests.Filesystems
8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
8192, 8192, 8192, 8192, 8192, 8192, 8192, 2048,
8192, 8192, 8192, 8192,
8192, 8192, 8192, 8192,
8192, 8192, 8192, 8192,
8192, 8192, 8192,
}; };
readonly string[] volumename = { readonly string[] volumename = {
@@ -147,7 +143,7 @@ namespace DiscImageChef.Tests.Filesystems
"NO NAME ","NO NAME ","VOLUMELABEL","VOLUMELABEL", "NO NAME ","NO NAME ","VOLUMELABEL","VOLUMELABEL",
"VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL",
"VOLUMELABEL","NO NAME ","NO NAME ","NO NAME ", "VOLUMELABEL","NO NAME ","NO NAME ","NO NAME ",
"NO NAME ","NO NAME ","NO NAME ", "NO NAME ","NO NAME ","NO NAME ","VolumeLabel",
}; };
readonly string[] volumeserial = { readonly string[] volumeserial = {
@@ -163,7 +159,7 @@ namespace DiscImageChef.Tests.Filesystems
"DAF97911","305637BD","275B0DE4","09650DFC", "DAF97911","305637BD","275B0DE4","09650DFC",
"38270D18","2E620D0C","0B4F0EED","0E122464", "38270D18","2E620D0C","0B4F0EED","0E122464",
"3B5F0F02","C84CB6F2","D0E9AD4E","C039A2EC", "3B5F0F02","C84CB6F2","D0E9AD4E","C039A2EC",
"501F9FA6","9AAA4216","00000000", "501F9FA6","9AAA4216","00000000","A132D985",
}; };
readonly string[] oemid = { readonly string[] oemid = {
@@ -179,7 +175,7 @@ namespace DiscImageChef.Tests.Filesystems
"MSDOS5.0", "MSDOS5.0", "MSWIN4.1", "MSWIN4.1", "MSDOS5.0", "MSDOS5.0", "MSWIN4.1", "MSWIN4.1",
"MSWIN4.1", "MSWIN4.0", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.0", "MSWIN4.1", "MSWIN4.1",
"MSWIN4.1", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSWIN4.1", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0",
"MSDOS5.0", "MSDOS5.0", "BeOS ", "MSDOS5.0", "MSDOS5.0", "BeOS ", "mkfs.fat",
}; };
[Test] [Test]

View File

@@ -2,7 +2,7 @@
// The Disc Image Chef // The Disc Image Chef
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// //
// Filename : FAT16_APM.cs // Filename : FAT32_APM.cs
// Version : 1.0 // Version : 1.0
// Author(s) : Natalia Portillo // Author(s) : Natalia Portillo
// //
@@ -48,14 +48,14 @@ using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture] [TestFixture]
public class FAT16_APM public class FAT32_APM
{ {
readonly string[] testfiles = { readonly string[] testfiles = {
"macosx.vdi.lz", "macosx.vdi.lz",
}; };
readonly ulong[] sectors = { readonly ulong[] sectors = {
1024000, 4194304,
}; };
readonly uint[] sectorsize = { readonly uint[] sectorsize = {
@@ -63,19 +63,19 @@ namespace DiscImageChef.Tests.Filesystems
}; };
readonly long[] clusters = { readonly long[] clusters = {
63995, 524278,
}; };
readonly int[] clustersize = { readonly int[] clustersize = {
8192, 4096,
}; };
readonly string[] volumename = { readonly string[] volumename = {
"VOLUMELABEL", null,
}; };
readonly string[] volumeserial = { readonly string[] volumeserial = {
"063D1F09", "35BD1F0A",
}; };
readonly string[] oemid = { readonly string[] oemid = {
@@ -87,7 +87,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", "fat16_apm", testfiles[i]); string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat32_apm", testfiles[i]);
Filter filter = new LZip(); Filter filter = new LZip();
filter.Open(location); filter.Open(location);
ImagePlugin image = new VDI(); ImagePlugin image = new VDI();
@@ -100,7 +100,7 @@ namespace DiscImageChef.Tests.Filesystems
int part = -1; int part = -1;
for(int j = 0; j < partitions.Count; j++) for(int j = 0; j < partitions.Count; j++)
{ {
if(partitions[j].PartitionType == "DOS_FAT_16") if(partitions[j].PartitionType == "DOS_FAT_32")
{ {
part = j; part = j;
break; break;
@@ -111,7 +111,7 @@ namespace DiscImageChef.Tests.Filesystems
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("FAT16", fs.XmlFSType.Type, testfiles[i]); Assert.AreEqual("FAT32", fs.XmlFSType.Type, testfiles[i]);
Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]); Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]);
Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]);
Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]); Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]);

View File

@@ -2,7 +2,7 @@
// The Disc Image Chef // The Disc Image Chef
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// //
// Filename : FAT16_GPT.cs // Filename : FAT32_GPT.cs
// Version : 1.0 // Version : 1.0
// Author(s) : Natalia Portillo // Author(s) : Natalia Portillo
// //
@@ -48,14 +48,14 @@ using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture] [TestFixture]
public class FAT16_GPT public class FAT32_GPT
{ {
readonly string[] testfiles = { readonly string[] testfiles = {
"macosx.vdi.lz", "macosx.vdi.lz",
}; };
readonly ulong[] sectors = { readonly ulong[] sectors = {
1024000, 4194304,
}; };
readonly uint[] sectorsize = { readonly uint[] sectorsize = {
@@ -63,19 +63,19 @@ namespace DiscImageChef.Tests.Filesystems
}; };
readonly long[] clusters = { readonly long[] clusters = {
63995, 523775,
}; };
readonly int[] clustersize = { readonly int[] clustersize = {
8192, 4096,
}; };
readonly string[] volumename = { readonly string[] volumename = {
"VOLUMELABEL", null,
}; };
readonly string[] volumeserial = { readonly string[] volumeserial = {
"2E8A1F1B", "7ABE1F1B",
}; };
readonly string[] oemid = { readonly string[] oemid = {
@@ -87,7 +87,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", "fat16_gpt", testfiles[i]); string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat32_gpt", testfiles[i]);
Filter filter = new LZip(); Filter filter = new LZip();
filter.Open(location); filter.Open(location);
ImagePlugin image = new VDI(); ImagePlugin image = new VDI();
@@ -111,7 +111,7 @@ namespace DiscImageChef.Tests.Filesystems
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("FAT16", fs.XmlFSType.Type, testfiles[i]); Assert.AreEqual("FAT32", fs.XmlFSType.Type, testfiles[i]);
Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]); Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]);
Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]);
Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]); Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]);

View File

@@ -54,56 +54,56 @@ namespace DiscImageChef.Tests.Filesystems
"drdos_7.03.vdi.lz", "drdos_8.00.vdi.lz", "msdos_7.10.vdi.lz", "macosx.vdi.lz", "drdos_7.03.vdi.lz", "drdos_8.00.vdi.lz", "msdos_7.10.vdi.lz", "macosx.vdi.lz",
"win10.vdi.lz", "win2000.vdi.lz", "win95osr2.1.vdi.lz", "win95osr2.5.vdi.lz", "win10.vdi.lz", "win2000.vdi.lz", "win95osr2.1.vdi.lz", "win95osr2.5.vdi.lz",
"win95osr2.vdi.lz", "win98se.vdi.lz", "win98.vdi.lz", "winme.vdi.lz", "win95osr2.vdi.lz", "win98se.vdi.lz", "win98.vdi.lz", "winme.vdi.lz",
"winvista.vdi.lz", "beos_r4.5.vdi.lz" "winvista.vdi.lz", "beos_r4.5.vdi.lz", "linux.vdi.lz",
}; };
readonly ulong[] sectors = { readonly ulong[] sectors = {
8388608, 8388608, 8388608, 4194304, 8388608, 8388608, 8388608, 4194304,
4194304, 8388608, 4194304, 4194304, 4194304, 8388608, 4194304, 4194304,
4194304, 4194304, 4194304, 4194304, 4194304, 4194304, 4194304, 4194304,
4194304, 4194304, 4194304, 4194304, 262144,
}; };
readonly uint[] sectorsize = { 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 = { readonly long[] clusters = {
1048233, 1048233, 1048233, 524287, 1048233, 1048233, 1048233, 524287,
524016, 1048233, 524152, 524152, 524016, 1048233, 524152, 524152,
524152, 524112, 524112, 524112, 524152, 524112, 524112, 524112,
523520, 1048560, 523520, 1048560, 260096,
}; };
readonly int[] clustersize = { 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, 2048, 4096, 2048, 512
}; };
readonly string[] volumename = { readonly string[] volumename = {
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[] volumeserial = { readonly string[] volumeserial = {
"5955996C","1BFB1A43","3B331809","42D51EF1", "5955996C","1BFB1A43","3B331809","42D51EF1",
"48073346","EC62E6DE","2A310DE4","0C140DFC", "48073346","EC62E6DE","2A310DE4","0C140DFC",
"3E310D18","0D3D0EED","0E131162","3F500F02", "3E310D18","0D3D0EED","0E131162","3F500F02",
"82EB4C04","00000000", "82EB4C04","00000000","B488C502"
}; };
readonly string[] oemid = { readonly string[] oemid = {
"DRDOS7.X", "IBM 7.1", "MSWIN4.1", "BSD 4.4", "DRDOS7.X", "IBM 7.1", "MSWIN4.1", "BSD 4.4",
"MSDOS5.0", "MSDOS5.0", "MSWIN4.1", "MSWIN4.1", "MSDOS5.0", "MSDOS5.0", "MSWIN4.1", "MSWIN4.1",
"MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1",
"MSDOS5.0", "BeOS ", "MSDOS5.0", "BeOS ", "mkfs.fat",
}; };
[Test] [Test]

View File

@@ -35,13 +35,87 @@
// Copyright (C) 2011-2015 Claunia.com // Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/ // ****************************************************************************/
// //$Id$ // //$Id$
using System; using System.Collections.Generic;
using System.IO;
using DiscImageChef.CommonTypes;
using DiscImageChef.DiscImages;
using DiscImageChef.Filesystems;
using DiscImageChef.Filters;
using DiscImageChef.ImagePlugins;
using DiscImageChef.PartPlugins;
using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture]
public class HFSPlus_APM public class HFSPlus_APM
{ {
public HFSPlus_APM() readonly string[] testfiles = {
"macosx.vdi.lz", "macosx_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 = {
"Volume label","Volume label",
};
readonly string[] volumeserial = {
"UNKNOWN","UNKNOWN",
};
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_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]);
PartPlugin parts = new AppleMap();
Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]);
Filesystem fs = new DiscImageChef.Filesystems.AppleHFSPlus();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
{
if(partitions[j].PartitionType == "Apple_HFS")
{
part = j;
break;
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
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]);
}
} }
} }
} }

View File

@@ -35,13 +35,87 @@
// Copyright (C) 2011-2015 Claunia.com // Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/ // ****************************************************************************/
// //$Id$ // //$Id$
using System; using System.Collections.Generic;
using System.IO;
using DiscImageChef.CommonTypes;
using DiscImageChef.DiscImages;
using DiscImageChef.Filesystems;
using DiscImageChef.Filters;
using DiscImageChef.ImagePlugins;
using DiscImageChef.PartPlugins;
using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture]
public class HFSPlus_GPT public class HFSPlus_GPT
{ {
public HFSPlus_GPT() readonly string[] testfiles = {
"macosx.vdi.lz", "macosx_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 = {
"Volume label","Volume label",
};
readonly string[] volumeserial = {
"UNKNOWN","UNKNOWN",
};
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]);
PartPlugin parts = new GuidPartitionTable();
Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]);
Filesystem fs = new DiscImageChef.Filesystems.AppleHFSPlus();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
{
if(partitions[j].PartitionType == "Apple HFS")
{
part = j;
break;
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
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]);
}
} }
} }
} }

View File

@@ -2,7 +2,7 @@
// The Disc Image Chef // The Disc Image Chef
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// //
// Filename : BeFS_MBR.cs // Filename : HFSPlus_MBR.cs
// Version : 1.0 // Version : 1.0
// Author(s) : Natalia Portillo // Author(s) : Natalia Portillo
// //
@@ -48,38 +48,38 @@ using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture] [TestFixture]
public class BeFS_MBR public class HFSPlus_MBR
{ {
readonly string[] testfiles = { readonly string[] testfiles = {
"beos_r3.1.vdi.lz", "beos_r4.5.vdi.lz", "macosx.vdi.lz", "macosx_journal.vdi.lz", "linux.vdi.lz", "linux_journal.vdi.lz",
}; };
readonly ulong[] sectors = { readonly ulong[] sectors = {
1572864, 1572864, 303104, 352256, 262144, 262144,
}; };
readonly uint[] sectorsize = { readonly uint[] sectorsize = {
512, 512, 512, 512, 512, 512,
}; };
readonly long[] clusters = { readonly long[] clusters = {
786400, 785232, 37878, 44021, 32512, 32512,
}; };
readonly int[] clustersize = { readonly int[] clustersize = {
1024, 1024, 4096, 4096, 4096, 4096,
}; };
readonly string[] volumename = { readonly string[] volumename = {
"Volume label","Volume label", "Volume label","Volume label","Volume label","Volume label",
}; };
readonly string[] volumeserial = { readonly string[] volumeserial = {
null,null, "UNKNOWN","UNKNOWN","0000000000000000","0000000000000000",
}; };
readonly string[] oemid = { readonly string[] oemid = {
null,null, "10.0","HFSJ","10.0","10.0",
}; };
[Test] [Test]
@@ -87,7 +87,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", "befs_mbr", testfiles[i]); string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfsplus_mbr", testfiles[i]);
Filter filter = new LZip(); Filter filter = new LZip();
filter.Open(location); filter.Open(location);
ImagePlugin image = new VDI(); ImagePlugin image = new VDI();
@@ -96,11 +96,11 @@ namespace DiscImageChef.Tests.Filesystems
Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]);
PartPlugin parts = new MBR(); PartPlugin parts = new MBR();
Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]); Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]);
Filesystem fs = new DiscImageChef.Filesystems.BeFS(); Filesystem fs = new DiscImageChef.Filesystems.AppleHFSPlus();
int part = -1; int part = -1;
for(int j = 0; j < partitions.Count; j++) for(int j = 0; j < partitions.Count; j++)
{ {
if(partitions[j].PartitionType == "0xEB") if(partitions[j].PartitionType == "0xAF")
{ {
part = j; part = j;
break; break;
@@ -111,7 +111,7 @@ namespace DiscImageChef.Tests.Filesystems
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("BeFS", fs.XmlFSType.Type, testfiles[i]); Assert.AreEqual("HFS+", fs.XmlFSType.Type, testfiles[i]);
Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]); Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]);
Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]);
Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]); Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]);

View File

@@ -2,7 +2,7 @@
// The Disc Image Chef // The Disc Image Chef
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// //
// Filename : HFSPlus_APM.cs // Filename : HFSX_APM.cs
// Version : 1.0 // Version : 1.0
// Author(s) : Natalia Portillo // Author(s) : Natalia Portillo
// //
@@ -48,14 +48,14 @@ using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture] [TestFixture]
public class HFSPlus_APM public class HFSX_APM
{ {
readonly string[] testfiles = { readonly string[] testfiles = {
"macosx.vdi.lz", "macosx_journal.vdi.lz", "macosx.vdi.lz", "macosx_journal.vdi.lz",
}; };
readonly ulong[] sectors = { readonly ulong[] sectors = {
1572864, 1024000, 819200, 1228800,
}; };
readonly uint[] sectorsize = { readonly uint[] sectorsize = {
@@ -63,7 +63,7 @@ namespace DiscImageChef.Tests.Filesystems
}; };
readonly long[] clusters = { readonly long[] clusters = {
51190, 76790, 102390, 153590,
}; };
readonly int[] clustersize = { readonly int[] clustersize = {
@@ -87,7 +87,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", "hfsplus_apm", testfiles[i]); string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfsx_apm", testfiles[i]);
Filter filter = new LZip(); Filter filter = new LZip();
filter.Open(location); filter.Open(location);
ImagePlugin image = new VDI(); ImagePlugin image = new VDI();
@@ -100,7 +100,7 @@ namespace DiscImageChef.Tests.Filesystems
int part = -1; int part = -1;
for(int j = 0; j < partitions.Count; j++) for(int j = 0; j < partitions.Count; j++)
{ {
if(partitions[j].PartitionType == "Apple_HFS") if(partitions[j].PartitionType == "Apple_HFSX")
{ {
part = j; part = j;
break; break;
@@ -111,7 +111,7 @@ namespace DiscImageChef.Tests.Filesystems
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("HFS+", fs.XmlFSType.Type, testfiles[i]); Assert.AreEqual("HFSX", fs.XmlFSType.Type, testfiles[i]);
Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]); Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]);
Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]);
Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]); Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]);

View File

@@ -2,7 +2,7 @@
// The Disc Image Chef // The Disc Image Chef
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// //
// Filename : HFSPlus_GPT.cs // Filename : HFSX_GPT.cs
// Version : 1.0 // Version : 1.0
// Author(s) : Natalia Portillo // Author(s) : Natalia Portillo
// //
@@ -48,14 +48,14 @@ using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture] [TestFixture]
public class HFSPlus_GPT public class HFSX_GPT
{ {
readonly string[] testfiles = { readonly string[] testfiles = {
"macosx.vdi.lz", "macosx_journal.vdi.lz", "macosx.vdi.lz", "macosx_journal.vdi.lz",
}; };
readonly ulong[] sectors = { readonly ulong[] sectors = {
1572864, 1024000, 819200, 1228800,
}; };
readonly uint[] sectorsize = { readonly uint[] sectorsize = {
@@ -63,7 +63,7 @@ namespace DiscImageChef.Tests.Filesystems
}; };
readonly long[] clusters = { readonly long[] clusters = {
51190, 76790, 102390, 153590,
}; };
readonly int[] clustersize = { readonly int[] clustersize = {
@@ -87,7 +87,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", "hfsplus_apm", testfiles[i]); string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfsx_apm", testfiles[i]);
Filter filter = new LZip(); Filter filter = new LZip();
filter.Open(location); filter.Open(location);
ImagePlugin image = new VDI(); ImagePlugin image = new VDI();
@@ -111,7 +111,7 @@ namespace DiscImageChef.Tests.Filesystems
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("HFS+", fs.XmlFSType.Type, testfiles[i]); Assert.AreEqual("HFSX", fs.XmlFSType.Type, testfiles[i]);
Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]); Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]);
Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]);
Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]); Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]);

View File

@@ -2,7 +2,7 @@
// The Disc Image Chef // The Disc Image Chef
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// //
// Filename : BeFS_MBR.cs // Filename : HFSX_MBR.cs
// Version : 1.0 // Version : 1.0
// Author(s) : Natalia Portillo // Author(s) : Natalia Portillo
// //
@@ -48,38 +48,38 @@ using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture] [TestFixture]
public class HFSPlus_MBR public class HFSX_MBR
{ {
readonly string[] testfiles = { readonly string[] testfiles = {
"macosx.vdi.lz", "macosx_journal.vdi.lz", "macosx.vdi.lz", "macosx_journal.vdi.lz", "linux.vdi.lz", "linux_journal.vdi.lz",
}; };
readonly ulong[] sectors = { readonly ulong[] sectors = {
1572864, 1572864, 393216, 409600, 262144, 262144,
}; };
readonly uint[] sectorsize = { readonly uint[] sectorsize = {
512, 512, 512, 512, 512, 512,
}; };
readonly long[] clusters = { readonly long[] clusters = {
37878, 44021, 102390, 153590, 32512, 32512,
}; };
readonly int[] clustersize = { readonly int[] clustersize = {
4096, 4096, 4096, 4096, 4096, 4096
}; };
readonly string[] volumename = { readonly string[] volumename = {
"Volume label","Volume label", "Volume label", "Volume label", "Volume label", "Volume label",
}; };
readonly string[] volumeserial = { readonly string[] volumeserial = {
"UNKNOWN","UNKNOWN", "UNKNOWN","UNKNOWN","0000000000000000","0000000000000000"
}; };
readonly string[] oemid = { readonly string[] oemid = {
"10.0","HFSJ", "10.0","HFSJ","10.0","10.0"
}; };
[Test] [Test]
@@ -87,7 +87,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", "hfsplus_mbr", testfiles[i]); string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfsx_mbr", testfiles[i]);
Filter filter = new LZip(); Filter filter = new LZip();
filter.Open(location); filter.Open(location);
ImagePlugin image = new VDI(); ImagePlugin image = new VDI();
@@ -111,7 +111,7 @@ namespace DiscImageChef.Tests.Filesystems
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("HFS+", fs.XmlFSType.Type, testfiles[i]); Assert.AreEqual("HFSX", fs.XmlFSType.Type, testfiles[i]);
Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]); Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]);
Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]);
Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]); Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]);

View File

@@ -2,7 +2,7 @@
// The Disc Image Chef // The Disc Image Chef
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// //
// Filename : HFSPlus_MBR.cs // Filename : HFS_MBR.cs
// Version : 1.0 // Version : 1.0
// Author(s) : Natalia Portillo // Author(s) : Natalia Portillo
// //
@@ -48,38 +48,34 @@ using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture] [TestFixture]
public class HFSPlus_MBR public class HFS_MBR
{ {
readonly string[] testfiles = { readonly string[] testfiles = {
"macosx.vdi.lz", "macosx_journal.vdi.lz", "linux.vdi.lz",
}; };
readonly ulong[] sectors = { readonly ulong[] sectors = {
303104, 352256, 262144,
}; };
readonly uint[] sectorsize = { readonly uint[] sectorsize = {
512, 512, 512,
}; };
readonly long[] clusters = { readonly long[] clusters = {
37878, 44021, 65018,
}; };
readonly int[] clustersize = { readonly int[] clustersize = {
4096, 4096, 2048,
}; };
readonly string[] volumename = { readonly string[] volumename = {
"Volume label","Volume label", "Volume label",
}; };
readonly string[] volumeserial = { readonly string[] volumeserial = {
"UNKNOWN","UNKNOWN", "0000000000000000",
};
readonly string[] oemid = {
"10.0","HFSJ",
}; };
[Test] [Test]
@@ -96,7 +92,7 @@ namespace DiscImageChef.Tests.Filesystems
Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]);
PartPlugin parts = new MBR(); PartPlugin parts = new MBR();
Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]); Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]);
Filesystem fs = new DiscImageChef.Filesystems.AppleHFSPlus(); Filesystem fs = new DiscImageChef.Filesystems.AppleHFS();
int part = -1; int part = -1;
for(int j = 0; j < partitions.Count; j++) for(int j = 0; j < partitions.Count; j++)
{ {
@@ -111,10 +107,9 @@ namespace DiscImageChef.Tests.Filesystems
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("HFS+", fs.XmlFSType.Type, testfiles[i]); Assert.AreEqual("HFS", fs.XmlFSType.Type, testfiles[i]);
Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]); Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]);
Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]);
Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]);
} }
} }
} }

View File

@@ -2,7 +2,7 @@
// The Disc Image Chef // The Disc Image Chef
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// //
// Filename : btrfs.cs // Filename : JFS2.cs
// Version : 1.0 // Version : 1.0
// Author(s) : Natalia Portillo // Author(s) : Natalia Portillo
// //
@@ -48,34 +48,34 @@ using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture] [TestFixture]
public class btrfs public class JFS2
{ {
readonly string[] testfiles = { readonly string[] testfiles = {
"linux.vdi.lz", "linux.vdi.lz","linux_caseinsensitive.vdi.lz",
}; };
readonly ulong[] sectors = { readonly ulong[] sectors = {
262144, 262144, 262144,
}; };
readonly uint[] sectorsize = { readonly uint[] sectorsize = {
512, 512, 512,
}; };
readonly long[] clusters = { readonly long[] clusters = {
32512, 257632, 257632,
}; };
readonly int[] clustersize = { readonly int[] clustersize = {
4096, 4096, 4096,
}; };
readonly string[] volumename = { readonly string[] volumename = {
"VolumeLabel", "Volume labe", "Volume labe",
}; };
readonly string[] volumeserial = { readonly string[] volumeserial = {
"a4fc5201-85cc-6840-8a68-998cab9ae897", "8033b783-0cd1-1645-8ecc-f8f113ad6a47", "d6cd91e9-3899-7e40-8468-baab688ee2e2",
}; };
[Test] [Test]
@@ -83,7 +83,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", "btrfs", testfiles[i]); string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "jfs2", testfiles[i]);
Filter filter = new LZip(); Filter filter = new LZip();
filter.Open(location); filter.Open(location);
ImagePlugin image = new VDI(); ImagePlugin image = new VDI();
@@ -92,11 +92,11 @@ namespace DiscImageChef.Tests.Filesystems
Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]);
PartPlugin parts = new MBR(); PartPlugin parts = new MBR();
Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]); Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]);
Filesystem fs = new DiscImageChef.Filesystems.BTRFS(); Filesystem fs = new DiscImageChef.Filesystems.JFS();
int part = -1; int part = -1;
for(int j = 0; j < partitions.Count; j++) for(int j = 0; j < partitions.Count; j++)
{ {
if(partitions[j].PartitionType == "0x83") if(partitions[j].PartitionType == "0x83" || partitions[j].PartitionType == "0x07")
{ {
part = j; part = j;
break; break;
@@ -107,7 +107,7 @@ namespace DiscImageChef.Tests.Filesystems
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("B-tree file system", fs.XmlFSType.Type, testfiles[i]); Assert.AreEqual("JFS filesystem", fs.XmlFSType.Type, testfiles[i]);
Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]); Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]);
Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]);
} }

View File

@@ -35,13 +35,88 @@
// Copyright (C) 2011-2015 Claunia.com // Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/ // ****************************************************************************/
// //$Id$ // //$Id$
using System; using System.IO;
using DiscImageChef.CommonTypes;
using DiscImageChef.Filesystems;
using DiscImageChef.Filters;
using DiscImageChef.ImagePlugins;
using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture]
public class LisaFS public class LisaFS
{ {
public LisaFS() readonly string[] testfiles = {
"166files.dc42.lz", "222files.dc42.lz", "blank2.0.dc42.lz", "blank-disk.dc42.lz", "file-with-a-password.dc42.lz",
"tfwdndrc-has-been-erased.dc42.lz", "tfwdndrc-has-been-restored.dc42.lz", "three-empty-folders.dc42.lz",
"three-folders-with-differently-named-docs.dc42.lz",
"three-folders-with-differently-named-docs-root-alphabetical.dc42.lz",
"three-folders-with-differently-named-docs-root-chronological.dc42.lz",
"three-folders-with-identically-named-docs.dc42.lz",
};
readonly MediaType[] mediatypes = {
MediaType.AppleSonySS,MediaType.AppleSonySS,MediaType.AppleSonySS,MediaType.AppleSonySS,
MediaType.AppleSonySS,MediaType.AppleSonySS,MediaType.AppleSonySS,MediaType.AppleSonySS,
MediaType.AppleSonySS,MediaType.AppleSonySS,MediaType.AppleSonySS,MediaType.AppleSonySS,
};
readonly ulong[] sectors = {
800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800,
};
readonly uint[] sectorsize = {
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512,
};
readonly long[] clusters = {
800, 800, 792, 800, 800, 800, 800, 800, 800, 800, 800, 800,
};
readonly int[] clustersize = {
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512,
};
readonly string[] volumename = {
"166Files", "222Files", "AOS 4:59 pm 10/02/87", "AOS 3.0",
"AOS 3.0", "AOS 3.0", "AOS 3.0", "AOS 3.0",
"AOS 3.0", "AOS 3.0", "AOS 3.0", "AOS 3.0",
};
readonly string[] volumeserial = {
"A23703A202010663", "A23703A201010663", "A32D261301010663", "A22CB48D01010663",
"A22CC3A702010663", "A22CB48D14010663", "A22CB48D14010663", "A22CB48D01010663",
"A22CB48D01010663", "A22CB48D01010663", "A22CB48D01010663", "A22CB48D01010663",
};
readonly string[] oemid = {
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", "lisafs", testfiles[i]);
Filter filter = new LZip();
filter.Open(location);
ImagePlugin image = new DiskCopy42();
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 DiscImageChef.Filesystems.LisaFS.LisaFS();
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("LisaFS", fs.XmlFSType.Type, testfiles[i]);
Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]);
Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]);
Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]);
}
} }
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
// The Disc Image Chef // The Disc Image Chef
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// //
// Filename : JFS2.cs // Filename : MINIX.cs
// Version : 1.0 // Version : 1.0
// Author(s) : Natalia Portillo // Author(s) : Natalia Portillo
// //
@@ -48,34 +48,26 @@ using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture] [TestFixture]
public class JFS2 public class MINIX
{ {
readonly string[] testfiles = { readonly string[] testfiles = {
"linux.vdi.lz","linux_caseinsensitive.vdi.lz", "linux_v1.vdi.lz",
}; };
readonly ulong[] sectors = { readonly ulong[] sectors = {
262144, 262144, 262144,
}; };
readonly uint[] sectorsize = { readonly uint[] sectorsize = {
512, 512, 512,
}; };
readonly long[] clusters = { readonly long[] clusters = {
257632, 257632, 65535,
}; };
readonly int[] clustersize = { readonly int[] clustersize = {
4096, 4096, 1024,
};
readonly string[] volumename = {
"Volume labe", "Volume labe",
};
readonly string[] volumeserial = {
"8033b783-0cd1-1645-8ecc-f8f113ad6a47", "d6cd91e9-3899-7e40-8468-baab688ee2e2",
}; };
[Test] [Test]
@@ -83,7 +75,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", "jfs2", testfiles[i]); string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minix", testfiles[i]);
Filter filter = new LZip(); Filter filter = new LZip();
filter.Open(location); filter.Open(location);
ImagePlugin image = new VDI(); ImagePlugin image = new VDI();
@@ -92,11 +84,11 @@ namespace DiscImageChef.Tests.Filesystems
Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]);
PartPlugin parts = new MBR(); PartPlugin parts = new MBR();
Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]); Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]);
Filesystem fs = new DiscImageChef.Filesystems.JFS(); Filesystem fs = new DiscImageChef.Filesystems.MinixFS();
int part = -1; int part = -1;
for(int j = 0; j < partitions.Count; j++) for(int j = 0; j < partitions.Count; j++)
{ {
if(partitions[j].PartitionType == "0x83" || partitions[j].PartitionType == "0x07") if(partitions[j].PartitionType == "0x81")
{ {
part = j; part = j;
break; break;
@@ -107,9 +99,7 @@ namespace DiscImageChef.Tests.Filesystems
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("JFS filesystem", fs.XmlFSType.Type, testfiles[i]); Assert.AreEqual("Minix V1", 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 : btrfs.cs // Filename : NILFS2.cs
// Version : 1.0 // Version : 1.0
// Author(s) : Natalia Portillo // Author(s) : Natalia Portillo
// //
@@ -48,7 +48,7 @@ using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture] [TestFixture]
public class btrfs public class NILFS2
{ {
readonly string[] testfiles = { readonly string[] testfiles = {
"linux.vdi.lz", "linux.vdi.lz",
@@ -71,11 +71,11 @@ namespace DiscImageChef.Tests.Filesystems
}; };
readonly string[] volumename = { readonly string[] volumename = {
"VolumeLabel", "Volume label",
}; };
readonly string[] volumeserial = { readonly string[] volumeserial = {
"a4fc5201-85cc-6840-8a68-998cab9ae897", "6b1ca79e-7048-a748-93a0-89c74b02cb5a",
}; };
[Test] [Test]
@@ -83,7 +83,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", "btrfs", testfiles[i]); string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "nilfs2", testfiles[i]);
Filter filter = new LZip(); Filter filter = new LZip();
filter.Open(location); filter.Open(location);
ImagePlugin image = new VDI(); ImagePlugin image = new VDI();
@@ -92,7 +92,7 @@ namespace DiscImageChef.Tests.Filesystems
Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]);
PartPlugin parts = new MBR(); PartPlugin parts = new MBR();
Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]); Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]);
Filesystem fs = new DiscImageChef.Filesystems.BTRFS(); Filesystem fs = new DiscImageChef.Filesystems.NILFS2();
int part = -1; int part = -1;
for(int j = 0; j < partitions.Count; j++) for(int j = 0; j < partitions.Count; j++)
{ {
@@ -107,7 +107,7 @@ namespace DiscImageChef.Tests.Filesystems
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("B-tree file system", fs.XmlFSType.Type, testfiles[i]); Assert.AreEqual("NILFS2 filesystem", fs.XmlFSType.Type, testfiles[i]);
Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]); Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]);
Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, 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 : BeFS_MBR.cs // Filename : NTFS_MBR.cs
// Version : 1.0 // Version : 1.0
// Author(s) : Natalia Portillo // Author(s) : Natalia Portillo
// //
@@ -48,38 +48,47 @@ using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture] [TestFixture]
public class HFSX_MBR public class NTFS_MBR
{ {
readonly string[] testfiles = { readonly string[] testfiles = {
/*"macosx.vdi.lz", */"macosx_journal.vdi.lz", "win10.vdi.lz", "win2000.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", "linux.vdi.lz",
}; };
readonly ulong[] sectors = { readonly ulong[] sectors = {
393216, 409600, 524288, 2097152, 1024000, 524288,
524288, 524288, 524288, 262144,
}; };
readonly uint[] sectorsize = { readonly uint[] sectorsize = {
512, 512, 512, 512, 512, 512,
512, 512, 512, 512,
}; };
readonly long[] clusters = { readonly long[] clusters = {
102390, 153590, 65263, 1046511, 1023057, 524256,
524256, 524096, 64767, 32512,
}; };
readonly int[] clustersize = { readonly int[] clustersize = {
4096, 4096, 4096, 1024, 512, 512,
512, 512, 4096, 4096,
}; };
readonly string[] volumename = { readonly string[] volumename = {
"Volume label","Volume label", null, null, null, null,
null, null, null, null,
}; };
readonly string[] volumeserial = { readonly string[] volumeserial = {
"UNKNOWN","UNKNOWN", "C46C1B3C6C1B28A6","8070C8EC70C8E9CC","10CC6AC6CC6AA5A6","7A14F50014F4BFE5",
"24884447884419A6","822C288D2C287E73","E20AF54B0AF51D6B","065BB96B7C1BCFDA",
}; };
readonly string[] oemid = { readonly string[] oemid = {
"10.0","HFSJ", null, null, null, null,
null, null, null, null,
}; };
[Test] [Test]
@@ -87,7 +96,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", "hfsx_mbr", testfiles[i]); string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ntfs_mbr", testfiles[i]);
Filter filter = new LZip(); Filter filter = new LZip();
filter.Open(location); filter.Open(location);
ImagePlugin image = new VDI(); ImagePlugin image = new VDI();
@@ -96,11 +105,11 @@ namespace DiscImageChef.Tests.Filesystems
Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]);
PartPlugin parts = new MBR(); PartPlugin parts = new MBR();
Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]); Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]);
Filesystem fs = new DiscImageChef.Filesystems.AppleHFSPlus(); Filesystem fs = new DiscImageChef.Filesystems.NTFS();
int part = -1; int part = -1;
for(int j = 0; j < partitions.Count; j++) for(int j = 0; j < partitions.Count; j++)
{ {
if(partitions[j].PartitionType == "0xAF") if(partitions[j].PartitionType == "0x07")
{ {
part = j; part = j;
break; break;
@@ -111,7 +120,7 @@ namespace DiscImageChef.Tests.Filesystems
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("HFSX", fs.XmlFSType.Type, testfiles[i]); Assert.AreEqual("NTFS", fs.XmlFSType.Type, testfiles[i]);
Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]); Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]);
Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]);
Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]); Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]);

View File

@@ -35,13 +35,88 @@
// Copyright (C) 2011-2015 Claunia.com // Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/ // ****************************************************************************/
// //$Id$ // //$Id$
using System; using System.Collections.Generic;
using System.IO;
using DiscImageChef.CommonTypes;
using DiscImageChef.DiscImages;
using DiscImageChef.Filesystems;
using DiscImageChef.Filters;
using DiscImageChef.ImagePlugins;
using DiscImageChef.PartPlugins;
using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture]
public class PFS3_RDB public class PFS3_RDB
{ {
public PFS3_RDB() readonly string[] testfiles = {
"uae.vdi.lz",
};
readonly ulong[] sectors = {
1024128,
};
readonly uint[] sectorsize = {
512,
};
readonly long[] clusters = {
1023552,
};
readonly int[] clustersize = {
512,
};
readonly string[] volumename = {
"PFS",
};
readonly string[] volumeserial = {
null,
};
readonly string[] oemid = {
null,
};
[Test]
public void Test()
{ {
for(int i = 0; i < testfiles.Length; i++)
{
string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "pfs3", 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]);
PartPlugin parts = new AmigaRigidDiskBlock();
Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]);
Filesystem fs = new DiscImageChef.Filesystems.PFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
{
System.Console.WriteLine("{0}", partitions[j].PartitionType);
if(partitions[j].PartitionType == "\"PFS\\1\"")
{
part = j;
break;
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("PFS v3", fs.XmlFSType.Type, testfiles[i]);
Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]);
Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]);
Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]);
}
} }
} }
} }

View File

@@ -2,7 +2,7 @@
// The Disc Image Chef // The Disc Image Chef
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// //
// Filename : NTFS_MBR.cs // Filename : ReFS_MBR.cs
// Version : 1.0 // Version : 1.0
// Author(s) : Natalia Portillo // Author(s) : Natalia Portillo
// //
@@ -35,6 +35,7 @@
// Copyright (C) 2011-2015 Claunia.com // Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/ // ****************************************************************************/
// //$Id$ // //$Id$
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using DiscImageChef.CommonTypes; using DiscImageChef.CommonTypes;
@@ -48,47 +49,39 @@ using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture] [TestFixture]
public class NTFS_MBR public class ReFS_MBR
{ {
readonly string[] testfiles = { readonly string[] testfiles = {
"win10.vdi.lz", "win2000.vdi.lz", "winnt_3.10.vdi.lz", "winnt_3.50.vdi.lz", "win10.vdi.lz",
"winnt_3.51.vdi.lz", "winnt_4.00.vdi.lz", "winvista.vdi.lz",
}; };
readonly ulong[] sectors = { readonly ulong[] sectors = {
524288, 2097152, 1024000, 524288, 67108864,
524288, 524288, 524288,
}; };
readonly uint[] sectorsize = { readonly uint[] sectorsize = {
512, 512, 512, 512, 512,
512, 512, 512
}; };
readonly long[] clusters = { readonly long[] clusters = {
65263, 1046511, 1023057, 524256, 8388096,
524256, 524096, 64767,
}; };
readonly int[] clustersize = { readonly int[] clustersize = {
4096, 1024, 512, 512, 4096,
512, 512, 4096,
}; };
readonly string[] volumename = { readonly string[] volumename = {
null, null, null, null, null,
null, null, null,
}; };
readonly string[] volumeserial = { readonly string[] volumeserial = {
"C46C1B3C6C1B28A6","8070C8EC70C8E9CC","10CC6AC6CC6AA5A6","7A14F50014F4BFE5", "UNKNOWN",
"24884447884419A6","822C288D2C287E73","E20AF54B0AF51D6B",
}; };
readonly string[] oemid = { readonly string[] oemid = {
null, null, null, null, null,
null, null, null,
}; };
[Test] [Test]
@@ -96,7 +89,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", "ntfs_mbr", testfiles[i]); string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "refs_mbr", testfiles[i]);
Filter filter = new LZip(); Filter filter = new LZip();
filter.Open(location); filter.Open(location);
ImagePlugin image = new VDI(); ImagePlugin image = new VDI();
@@ -105,7 +98,6 @@ namespace DiscImageChef.Tests.Filesystems
Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]);
PartPlugin parts = new MBR(); PartPlugin parts = new MBR();
Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]); Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]);
Filesystem fs = new DiscImageChef.Filesystems.NTFS();
int part = -1; int part = -1;
for(int j = 0; j < partitions.Count; j++) for(int j = 0; j < partitions.Count; j++)
{ {
@@ -116,14 +108,17 @@ namespace DiscImageChef.Tests.Filesystems
} }
} }
Assert.AreNotEqual(-1, part, "Partition not found"); Assert.AreNotEqual(-1, part, "Partition not found");
throw new NotImplementedException("ReFS is not yet implemented");
/*
Filesystem fs = new DiscImageChef.Filesystems.ReFS();
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]); Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("NTFS", fs.XmlFSType.Type, testfiles[i]); Assert.AreEqual("ReFS", fs.XmlFSType.Type, testfiles[i]);
Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]); Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]);
Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]);
Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]); Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]);*/
} }
} }
} }

View File

@@ -2,7 +2,7 @@
// The Disc Image Chef // The Disc Image Chef
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// //
// Filename : btrfs.cs // Filename : Reiser3.cs
// Version : 1.0 // Version : 1.0
// Author(s) : Natalia Portillo // Author(s) : Natalia Portillo
// //
@@ -48,34 +48,30 @@ using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture] [TestFixture]
public class btrfs public class Reiser3
{ {
readonly string[] testfiles = { readonly string[] testfiles = {
"linux.vdi.lz", "linux_r3.5.vdi.lz", "linux_r3.6.vdi.lz"
}; };
readonly ulong[] sectors = { readonly ulong[] sectors = {
262144, 262144, 262144,
}; };
readonly uint[] sectorsize = { readonly uint[] sectorsize = {
512, 512, 512,
}; };
readonly long[] clusters = { readonly long[] clusters = {
32512, 32512, 32512,
}; };
readonly int[] clustersize = { readonly int[] clustersize = {
4096, 4096, 4096,
}; };
readonly string[] volumename = { readonly string[] reiserversion = {
"VolumeLabel", "Reiser 3.5 filesystem", "Reiser 3.6 filesystem"
};
readonly string[] volumeserial = {
"a4fc5201-85cc-6840-8a68-998cab9ae897",
}; };
[Test] [Test]
@@ -83,7 +79,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", "btrfs", testfiles[i]); string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "reiser3", testfiles[i]);
Filter filter = new LZip(); Filter filter = new LZip();
filter.Open(location); filter.Open(location);
ImagePlugin image = new VDI(); ImagePlugin image = new VDI();
@@ -92,7 +88,7 @@ namespace DiscImageChef.Tests.Filesystems
Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]);
PartPlugin parts = new MBR(); PartPlugin parts = new MBR();
Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]); Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]);
Filesystem fs = new DiscImageChef.Filesystems.BTRFS(); Filesystem fs = new DiscImageChef.Filesystems.Reiser();
int part = -1; int part = -1;
for(int j = 0; j < partitions.Count; j++) for(int j = 0; j < partitions.Count; j++)
{ {
@@ -107,9 +103,7 @@ namespace DiscImageChef.Tests.Filesystems
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("B-tree file system", fs.XmlFSType.Type, testfiles[i]); Assert.AreEqual(reiserversion[i], 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 : btrfs.cs // Filename : Reiser4.cs
// Version : 1.0 // Version : 1.0
// Author(s) : Natalia Portillo // Author(s) : Natalia Portillo
// //
@@ -48,7 +48,7 @@ using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture] [TestFixture]
public class btrfs public class Reiser4
{ {
readonly string[] testfiles = { readonly string[] testfiles = {
"linux.vdi.lz", "linux.vdi.lz",
@@ -63,7 +63,7 @@ namespace DiscImageChef.Tests.Filesystems
}; };
readonly long[] clusters = { readonly long[] clusters = {
32512, 32511,
}; };
readonly int[] clustersize = { readonly int[] clustersize = {
@@ -71,11 +71,11 @@ namespace DiscImageChef.Tests.Filesystems
}; };
readonly string[] volumename = { readonly string[] volumename = {
"VolumeLabel", "Volume label",
}; };
readonly string[] volumeserial = { readonly string[] volumeserial = {
"a4fc5201-85cc-6840-8a68-998cab9ae897", "b0c1924e-6f10-8c42-b6c5-66a457896460",
}; };
[Test] [Test]
@@ -83,7 +83,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", "btrfs", testfiles[i]); string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "reiser4", testfiles[i]);
Filter filter = new LZip(); Filter filter = new LZip();
filter.Open(location); filter.Open(location);
ImagePlugin image = new VDI(); ImagePlugin image = new VDI();
@@ -92,7 +92,7 @@ namespace DiscImageChef.Tests.Filesystems
Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]);
PartPlugin parts = new MBR(); PartPlugin parts = new MBR();
Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]); Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]);
Filesystem fs = new DiscImageChef.Filesystems.BTRFS(); Filesystem fs = new DiscImageChef.Filesystems.Reiser4();
int part = -1; int part = -1;
for(int j = 0; j < partitions.Count; j++) for(int j = 0; j < partitions.Count; j++)
{ {
@@ -107,7 +107,7 @@ namespace DiscImageChef.Tests.Filesystems
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("B-tree file system", fs.XmlFSType.Type, testfiles[i]); Assert.AreEqual("Reiser 4 filesystem", fs.XmlFSType.Type, testfiles[i]);
Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]); Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]);
Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]);
} }

View File

@@ -35,13 +35,88 @@
// Copyright (C) 2011-2015 Claunia.com // Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/ // ****************************************************************************/
// //$Id$ // //$Id$
using System; using System.Collections.Generic;
using System.IO;
using DiscImageChef.CommonTypes;
using DiscImageChef.DiscImages;
using DiscImageChef.Filesystems;
using DiscImageChef.Filters;
using DiscImageChef.ImagePlugins;
using DiscImageChef.PartPlugins;
using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture]
public class SFS_RDB public class SFS_RDB
{ {
public SFS_RDB() readonly string[] testfiles = {
"uae.vdi.lz",
};
readonly ulong[] sectors = {
1024128,
};
readonly uint[] sectorsize = {
512,
};
readonly long[] clusters = {
127000,
};
readonly int[] clustersize = {
2048,
};
readonly string[] volumename = {
null,
};
readonly string[] volumeserial = {
null,
};
readonly string[] oemid = {
null,
};
[Test]
public void Test()
{ {
for(int i = 0; i < testfiles.Length; i++)
{
string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "sfs", 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]);
PartPlugin parts = new AmigaRigidDiskBlock();
Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]);
Filesystem fs = new DiscImageChef.Filesystems.SFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
{
System.Console.WriteLine("{0}", partitions[j].PartitionType);
if(partitions[j].PartitionType == "\"SFS\\0\"")
{
part = j;
break;
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
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]);
Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]);
}
} }
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
// The Disc Image Chef // The Disc Image Chef
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// //
// Filename : HFS_MBR.cs // Filename : UFS_MBR.cs
// Version : 1.0 // Version : 1.0
// Author(s) : Natalia Portillo // Author(s) : Natalia Portillo
// //
@@ -48,34 +48,34 @@ using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture] [TestFixture]
public class HFS_MBR public class UFS_MBR
{ {
readonly string[] testfiles = { readonly string[] testfiles = {
"linux.vdi.lz", "ufs1/linux.vdi.lz", "ufs2/linux.vdi.lz",
}; };
readonly ulong[] sectors = { readonly ulong[] sectors = {
262144, 262144, 262144,
}; };
readonly uint[] sectorsize = { readonly uint[] sectorsize = {
512, 512, 512,
}; };
readonly long[] clusters = { readonly long[] clusters = {
65018, 65024, 65018,
}; };
readonly int[] clustersize = { readonly int[] clustersize = {
2048, 2048, 2048
}; };
readonly string[] volumename = { readonly string[] volumename = {
"Volume label", "Volume label", "Volume label",
}; };
readonly string[] volumeserial = { readonly string[] volumeserial = {
"0000000000000000", "59588B778E9ACDEF", "UNKNOWN",
}; };
[Test] [Test]
@@ -83,7 +83,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", "hfsplus_mbr", testfiles[i]); string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ufs_mbr", testfiles[i]);
Filter filter = new LZip(); Filter filter = new LZip();
filter.Open(location); filter.Open(location);
ImagePlugin image = new VDI(); ImagePlugin image = new VDI();
@@ -92,11 +92,11 @@ namespace DiscImageChef.Tests.Filesystems
Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]);
PartPlugin parts = new MBR(); PartPlugin parts = new MBR();
Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]); Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]);
Filesystem fs = new DiscImageChef.Filesystems.AppleHFS(); Filesystem fs = new DiscImageChef.Filesystems.FFSPlugin();
int part = -1; int part = -1;
for(int j = 0; j < partitions.Count; j++) for(int j = 0; j < partitions.Count; j++)
{ {
if(partitions[j].PartitionType == "0xAF") if(partitions[j].PartitionType == "0x83")
{ {
part = j; part = j;
break; break;
@@ -107,7 +107,7 @@ namespace DiscImageChef.Tests.Filesystems
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("HFS", fs.XmlFSType.Type, testfiles[i]); Assert.AreEqual("UFS", fs.XmlFSType.Type, testfiles[i]);
Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]); Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]);
Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, 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 : btrfs.cs // Filename : unixbfs.cs
// Version : 1.0 // Version : 1.0
// Author(s) : Natalia Portillo // Author(s) : Natalia Portillo
// //
@@ -48,7 +48,7 @@ using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture] [TestFixture]
public class btrfs public class unixbfs
{ {
readonly string[] testfiles = { readonly string[] testfiles = {
"linux.vdi.lz", "linux.vdi.lz",
@@ -63,19 +63,15 @@ namespace DiscImageChef.Tests.Filesystems
}; };
readonly long[] clusters = { readonly long[] clusters = {
32512, 260096,
}; };
readonly int[] clustersize = { readonly int[] clustersize = {
4096, 512,
}; };
readonly string[] volumename = { readonly string[] volumename = {
"VolumeLabel", "Label",
};
readonly string[] volumeserial = {
"a4fc5201-85cc-6840-8a68-998cab9ae897",
}; };
[Test] [Test]
@@ -83,7 +79,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", "btrfs", testfiles[i]); string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "unixbfs", testfiles[i]);
Filter filter = new LZip(); Filter filter = new LZip();
filter.Open(location); filter.Open(location);
ImagePlugin image = new VDI(); ImagePlugin image = new VDI();
@@ -92,7 +88,7 @@ namespace DiscImageChef.Tests.Filesystems
Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]);
PartPlugin parts = new MBR(); PartPlugin parts = new MBR();
Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]); Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]);
Filesystem fs = new DiscImageChef.Filesystems.BTRFS(); Filesystem fs = new DiscImageChef.Filesystems.BFS();
int part = -1; int part = -1;
for(int j = 0; j < partitions.Count; j++) for(int j = 0; j < partitions.Count; j++)
{ {
@@ -107,9 +103,8 @@ namespace DiscImageChef.Tests.Filesystems
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("B-tree file system", fs.XmlFSType.Type, testfiles[i]); Assert.AreEqual("BFS", fs.XmlFSType.Type, testfiles[i]);
Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, 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 : BeFS_MBR.cs // Filename : btrfs.cs
// Version : 1.0 // Version : 1.0
// Author(s) : Natalia Portillo // Author(s) : Natalia Portillo
// //
@@ -48,38 +48,34 @@ using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture] [TestFixture]
public class BeFS_MBR public class btrfs
{ {
readonly string[] testfiles = { readonly string[] testfiles = {
"beos_r3.1.vdi.lz", "beos_r4.5.vdi.lz", "linux.vdi.lz",
}; };
readonly ulong[] sectors = { readonly ulong[] sectors = {
1572864, 1572864, 262144,
}; };
readonly uint[] sectorsize = { readonly uint[] sectorsize = {
512, 512, 512,
}; };
readonly long[] clusters = { readonly long[] clusters = {
786400, 785232, 32512,
}; };
readonly int[] clustersize = { readonly int[] clustersize = {
1024, 1024, 4096,
}; };
readonly string[] volumename = { readonly string[] volumename = {
"Volume label","Volume label", "VolumeLabel",
}; };
readonly string[] volumeserial = { readonly string[] volumeserial = {
null,null, "a4fc5201-85cc-6840-8a68-998cab9ae897",
};
readonly string[] oemid = {
null,null,
}; };
[Test] [Test]
@@ -87,7 +83,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", "befs_mbr", testfiles[i]); string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "btrfs", testfiles[i]);
Filter filter = new LZip(); Filter filter = new LZip();
filter.Open(location); filter.Open(location);
ImagePlugin image = new VDI(); ImagePlugin image = new VDI();
@@ -96,11 +92,11 @@ namespace DiscImageChef.Tests.Filesystems
Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]);
PartPlugin parts = new MBR(); PartPlugin parts = new MBR();
Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]); Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]);
Filesystem fs = new DiscImageChef.Filesystems.BeFS(); Filesystem fs = new DiscImageChef.Filesystems.BTRFS();
int part = -1; int part = -1;
for(int j = 0; j < partitions.Count; j++) for(int j = 0; j < partitions.Count; j++)
{ {
if(partitions[j].PartitionType == "0xEB") if(partitions[j].PartitionType == "0x83")
{ {
part = j; part = j;
break; break;
@@ -111,10 +107,9 @@ namespace DiscImageChef.Tests.Filesystems
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("BeFS", fs.XmlFSType.Type, testfiles[i]); Assert.AreEqual("B-tree file system", fs.XmlFSType.Type, testfiles[i]);
Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]); Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]);
Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]);
Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]);
} }
} }
} }

View File

@@ -2,7 +2,7 @@
// The Disc Image Chef // The Disc Image Chef
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// //
// Filename : FAT16_APM.cs // Filename : exFAT_APM.cs
// Version : 1.0 // Version : 1.0
// Author(s) : Natalia Portillo // Author(s) : Natalia Portillo
// //
@@ -48,14 +48,14 @@ using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture] [TestFixture]
public class FAT16_APM public class exFAT_APM
{ {
readonly string[] testfiles = { readonly string[] testfiles = {
"macosx.vdi.lz", "macosx.vdi.lz",
}; };
readonly ulong[] sectors = { readonly ulong[] sectors = {
1024000, 262144,
}; };
readonly uint[] sectorsize = { readonly uint[] sectorsize = {
@@ -63,23 +63,19 @@ namespace DiscImageChef.Tests.Filesystems
}; };
readonly long[] clusters = { readonly long[] clusters = {
63995, 32710,
}; };
readonly int[] clustersize = { readonly int[] clustersize = {
8192, 4096,
}; };
readonly string[] volumename = { readonly string[] volumename = {
"VOLUMELABEL", null,
}; };
readonly string[] volumeserial = { readonly string[] volumeserial = {
"063D1F09", "595AC82C",
};
readonly string[] oemid = {
"BSD 4.4",
}; };
[Test] [Test]
@@ -87,7 +83,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", "fat16_apm", testfiles[i]); string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "exfat_apm", testfiles[i]);
Filter filter = new LZip(); Filter filter = new LZip();
filter.Open(location); filter.Open(location);
ImagePlugin image = new VDI(); ImagePlugin image = new VDI();
@@ -96,11 +92,11 @@ namespace DiscImageChef.Tests.Filesystems
Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]);
PartPlugin parts = new AppleMap(); PartPlugin parts = new AppleMap();
Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]); Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]);
Filesystem fs = new DiscImageChef.Filesystems.FAT(); Filesystem fs = new DiscImageChef.Filesystems.exFAT();
int part = -1; int part = -1;
for(int j = 0; j < partitions.Count; j++) for(int j = 0; j < partitions.Count; j++)
{ {
if(partitions[j].PartitionType == "DOS_FAT_16") if(partitions[j].PartitionType == "Windows_NTFS")
{ {
part = j; part = j;
break; break;
@@ -111,10 +107,9 @@ namespace DiscImageChef.Tests.Filesystems
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("FAT16", fs.XmlFSType.Type, testfiles[i]); Assert.AreEqual("exFAT", fs.XmlFSType.Type, testfiles[i]);
Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]); Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]);
Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]);
Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]);
} }
} }
} }

View File

@@ -2,7 +2,7 @@
// The Disc Image Chef // The Disc Image Chef
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// //
// Filename : FAT16_GPT.cs // Filename : exFAT_GPT.cs
// Version : 1.0 // Version : 1.0
// Author(s) : Natalia Portillo // Author(s) : Natalia Portillo
// //
@@ -48,14 +48,14 @@ using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture] [TestFixture]
public class FAT16_GPT public class exFAT_GPT
{ {
readonly string[] testfiles = { readonly string[] testfiles = {
"macosx.vdi.lz", "macosx.vdi.lz",
}; };
readonly ulong[] sectors = { readonly ulong[] sectors = {
1024000, 262144,
}; };
readonly uint[] sectorsize = { readonly uint[] sectorsize = {
@@ -63,23 +63,19 @@ namespace DiscImageChef.Tests.Filesystems
}; };
readonly long[] clusters = { readonly long[] clusters = {
63995, 32208,
}; };
readonly int[] clustersize = { readonly int[] clustersize = {
8192, 4096,
}; };
readonly string[] volumename = { readonly string[] volumename = {
"VOLUMELABEL", null,
}; };
readonly string[] volumeserial = { readonly string[] volumeserial = {
"2E8A1F1B", "595ACC39",
};
readonly string[] oemid = {
"BSD 4.4",
}; };
[Test] [Test]
@@ -87,7 +83,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", "fat16_gpt", testfiles[i]); string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "exfat_gpt", testfiles[i]);
Filter filter = new LZip(); Filter filter = new LZip();
filter.Open(location); filter.Open(location);
ImagePlugin image = new VDI(); ImagePlugin image = new VDI();
@@ -96,7 +92,7 @@ namespace DiscImageChef.Tests.Filesystems
Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]);
PartPlugin parts = new GuidPartitionTable(); PartPlugin parts = new GuidPartitionTable();
Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]); Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]);
Filesystem fs = new DiscImageChef.Filesystems.FAT(); Filesystem fs = new DiscImageChef.Filesystems.exFAT();
int part = -1; int part = -1;
for(int j = 0; j < partitions.Count; j++) for(int j = 0; j < partitions.Count; j++)
{ {
@@ -111,10 +107,9 @@ namespace DiscImageChef.Tests.Filesystems
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("FAT16", fs.XmlFSType.Type, testfiles[i]); Assert.AreEqual("exFAT", fs.XmlFSType.Type, testfiles[i]);
Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]); Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]);
Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]);
Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]);
} }
} }
} }

View File

@@ -2,7 +2,7 @@
// The Disc Image Chef // The Disc Image Chef
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// //
// Filename : HFSPlus_MBR.cs // Filename : exFAT_MBR.cs
// Version : 1.0 // Version : 1.0
// Author(s) : Natalia Portillo // Author(s) : Natalia Portillo
// //
@@ -48,38 +48,34 @@ using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture] [TestFixture]
public class HFSPlus_MBR public class exFAT_MBR
{ {
readonly string[] testfiles = { readonly string[] testfiles = {
"macosx.vdi.lz", "macosx_journal.vdi.lz", "linux.vdi.lz", "macosx.vdi.lz", "win10.vdi.lz", "winvista.vdi.lz",
}; };
readonly ulong[] sectors = { readonly ulong[] sectors = {
303104, 352256, 262144, 262144, 262144, 262144,
}; };
readonly uint[] sectorsize = { readonly uint[] sectorsize = {
512, 512, 512, 512, 512, 512,
}; };
readonly long[] clusters = { readonly long[] clusters = {
37878, 44021, 32464, 32712, 32448, 32208,
}; };
readonly int[] clustersize = { readonly int[] clustersize = {
4096, 4096, 4096, 4096, 4096, 4096,
}; };
readonly string[] volumename = { readonly string[] volumename = {
"Volume label","Volume label", null, null, null, null,
}; };
readonly string[] volumeserial = { readonly string[] volumeserial = {
"UNKNOWN","UNKNOWN", "603565AC", "595AC21E", "20126663", "0AC5CA52"
};
readonly string[] oemid = {
"10.0","HFSJ",
}; };
[Test] [Test]
@@ -87,7 +83,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", "hfsplus_mbr", testfiles[i]); string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "exfat_mbr", testfiles[i]);
Filter filter = new LZip(); Filter filter = new LZip();
filter.Open(location); filter.Open(location);
ImagePlugin image = new VDI(); ImagePlugin image = new VDI();
@@ -96,11 +92,11 @@ namespace DiscImageChef.Tests.Filesystems
Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]);
PartPlugin parts = new MBR(); PartPlugin parts = new MBR();
Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]); Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]);
Filesystem fs = new DiscImageChef.Filesystems.AppleHFSPlus(); Filesystem fs = new DiscImageChef.Filesystems.exFAT();
int part = -1; int part = -1;
for(int j = 0; j < partitions.Count; j++) for(int j = 0; j < partitions.Count; j++)
{ {
if(partitions[j].PartitionType == "0xAF") if(partitions[j].PartitionType == "0x07")
{ {
part = j; part = j;
break; break;
@@ -111,10 +107,9 @@ namespace DiscImageChef.Tests.Filesystems
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("HFS+", fs.XmlFSType.Type, testfiles[i]); Assert.AreEqual("exFAT", fs.XmlFSType.Type, testfiles[i]);
Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]); Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]);
Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]);
Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]);
} }
} }
} }

View File

@@ -35,13 +35,86 @@
// Copyright (C) 2011-2015 Claunia.com // Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/ // ****************************************************************************/
// //$Id$ // //$Id$
using System; using System.Collections.Generic;
using System.IO;
using DiscImageChef.CommonTypes;
using DiscImageChef.DiscImages;
using DiscImageChef.Filesystems;
using DiscImageChef.Filters;
using DiscImageChef.ImagePlugins;
using DiscImageChef.PartPlugins;
using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems namespace DiscImageChef.Tests.Filesystems
{ {
[TestFixture]
public class ext2 public class ext2
{ {
public ext2() readonly string[] testfiles = {
"linux_ext2.vdi.lz", "linux_ext3.vdi.lz","linux_ext4.vdi.lz",
};
readonly ulong[] sectors = {
262144, 262144, 262144,
};
readonly uint[] sectorsize = {
512, 512, 512,
};
readonly long[] clusters = {
130048, 130048, 130048,
};
readonly int[] clustersize = {
1024, 1024, 1024,
};
readonly string[] volumename = {
"VolumeLabel", "VolumeLabel", "VolumeLabel",
};
readonly string[] volumeserial = {
"cf92398e-987d-4ae4-b753-0591a35913eb", "1615411b-1554-424b-95e6-1a247056a960", "05f3f8b2-0f77-47ad-abe4-f0484aa319e9",
};
readonly string[] extversion = {
"ext2", "ext3", "ext4",
};
[Test]
public void Test()
{ {
for(int i = 0; i < testfiles.Length; i++)
{
string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ext2", 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]);
PartPlugin parts = new MBR();
Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]);
Filesystem fs = new DiscImageChef.Filesystems.ext2FS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
{
if(partitions[j].PartitionType == "0x83")
{
part = j;
break;
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual(extversion[i], fs.XmlFSType.Type, testfiles[i]);
Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]);
Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]);
}
} }
} }
} }