Added tests for 2MG, Anex86, CisCopy, CopyQM, D88, DART and Disk Copy

4.2 disk images.
This commit is contained in:
2017-09-28 15:44:21 +01:00
parent 0d55b070a7
commit 7b0b4053cb
8 changed files with 903 additions and 1 deletions

View File

@@ -179,6 +179,13 @@
<Compile Include="Filesystems\HTFS_MBR.cs" />
<Compile Include="Filesystems\DTFS_MBR.cs" />
<Compile Include="Filesystems\ISO9660.cs" />
<Compile Include="Images\2MG.cs" />
<Compile Include="Images\Anex86.cs" />
<Compile Include="Images\CisCopy.cs" />
<Compile Include="Images\CopyQM.cs" />
<Compile Include="Images\D88.cs" />
<Compile Include="Images\DART.cs" />
<Compile Include="Images\DiskCopy42.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
@@ -221,13 +228,16 @@
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup>
<Folder Include="Images\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<MonoDevelop>
<Properties>
<Policies>
<TextStylePolicy FileWidth="120" TabWidth="4" IndentWidth="4" RemoveTrailingWhitespace="True" NoTabsAfterNonTabs="False" EolMarker="Native" TabsToSpaces="True" 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" 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" NewLineForMembersInObjectInit="True" NewLineForMembersInAnonymousTypes="True" NewLineForClausesInQuery="True" 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" />
<DotNetNamingPolicy DirectoryNamespaceAssociation="PrefixedHierarchical" ResourceNamePolicy="MSBuild" />
</Policies>
</Properties>

View File

@@ -0,0 +1,118 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : AFFS_MBR.cs
// Version : 1.0
// Author(s) : Natalia Portillo
//
// Component : Component
//
// Revision : $Revision$
// Last change by : $Author$
// Date : $Date$
//
// --[ Description ] ----------------------------------------------------------
//
// Description
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/
// //$Id$
using System.IO;
using DiscImageChef.CommonTypes;
using DiscImageChef.Filters;
using DiscImageChef.ImagePlugins;
using NUnit.Framework;
using DiscImageChef.Checksums;
namespace DiscImageChef.Tests.Images
{
[TestFixture]
public class Apple2MG
{
readonly string[] testfiles = {
"blank140.2mg.lz", "dos32.2mg.lz", "dos33-do.2mg.lz", "dos33-nib.2mg.lz",
"dos33-po.2mg.lz", "prodos1440.2mg.lz",
};
readonly ulong[] sectors = {
560, 415, 560, 560,
560, 2880,
};
readonly uint[] sectorsize = {
256, 256, 256, 256,
256, 512
};
readonly MediaType[] mediatypes = {
MediaType.Apple33SS, MediaType.Apple32SS, MediaType.Apple33SS, MediaType.Apple33SS,
MediaType.Apple33SS, MediaType.DOS_35_HD,
};
readonly string[] md5s = {
"7db5d585270ab858043d50e60068d45f", "c62ee4dac8835f9acc999e7531d3b5f8", "86bc7879bb477917aab3976057a6a7b2", "32b8f8163238d4f3ea2a3db95ad1a812",
"a5acba4cbaddd9c53ea0e8210f4aba55", "eb9b60c78b30d2b6541ed0781944b6da",
};
[Test]
public void Test()
{
for(int i = 0; i < testfiles.Length; i++)
{
string location = Path.Combine(Consts.TestFilesRoot, "images", "2mg", testfiles[i]);
Filter filter = new LZip();
filter.Open(location);
ImagePlugin image = new DiscImageChef.ImagePlugins.Apple2MG();
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]);
Assert.AreEqual(mediatypes[i], image.ImageInfo.mediaType, testfiles[i]);
// How many sectors to read at once
const uint sectorsToRead = 256;
ulong doneSectors = 0;
MD5Context ctx = new MD5Context();
ctx.Init();
while(doneSectors < image.ImageInfo.sectors)
{
byte[] sector;
if((image.ImageInfo.sectors - doneSectors) >= sectorsToRead)
{
sector = image.ReadSectors(doneSectors, sectorsToRead);
doneSectors += sectorsToRead;
}
else
{
sector = image.ReadSectors(doneSectors, (uint)(image.ImageInfo.sectors - doneSectors));
doneSectors += (image.ImageInfo.sectors - doneSectors);
}
ctx.Update(sector);
}
Assert.AreEqual(md5s[i], ctx.End(), testfiles[i]);
}
}
}
}

View File

@@ -0,0 +1,123 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : AFFS_MBR.cs
// Version : 1.0
// Author(s) : Natalia Portillo
//
// Component : Component
//
// Revision : $Revision$
// Last change by : $Author$
// Date : $Date$
//
// --[ Description ] ----------------------------------------------------------
//
// Description
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/
// //$Id$
using System.IO;
using DiscImageChef.CommonTypes;
using DiscImageChef.Filters;
using DiscImageChef.ImagePlugins;
using NUnit.Framework;
using DiscImageChef.Checksums;
namespace DiscImageChef.Tests.Images
{
[TestFixture]
public class Anex86
{
readonly string[] testfiles = {
"anex86_10mb.hdi.lz", "anex86_15mb.hdi.lz", "anex86_20mb.hdi.lz", "anex86_30mb.hdi.lz",
"anex86_40mb.hdi.lz", "anex86_5mb.hdi.lz", "blank_md2hd.fdi.lz", "msdos33d_md2hd.fdi.lz",
"msdos50_epson_md2hd.fdi.lz", "msdos50_md2hd.fdi.lz", "msdos62_md2hd.fdi.lz",
};
readonly ulong[] sectors = {
40920, 61380, 81840, 121770,
162360, 20196, 1232, 1232,
1232, 1232, 1232,
};
readonly uint[] sectorsize = {
256, 256, 256, 256,
256, 256, 1024, 1024,
1024, 1024, 1024
};
readonly MediaType[] mediatypes = {
MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD,
MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.NEC_525_HD, MediaType.NEC_525_HD,
MediaType.NEC_525_HD, MediaType.NEC_525_HD, MediaType.NEC_525_HD,
};
readonly string[] md5s = {
"1c5387e38e58165c517c059e5d48905d", "a84366658c1c3bd09af4d0d42fbf716e", "919c9eecf1b65b10870f617cb976668a", "02d35af02581afb2e56792dcaba2c1af",
"b8c3f858f1a9d300d3e74f36eea04354", "c348bbbaf99fcb8c8e66de157aef62f4", "c3587f7020743067cf948c9d5c5edb27", "a23874a4474334b035a24c6924140744",
"bc1ef3236e75cb09575037b884ee9dce", "243036c4617b666a6c886cc23d7274e0", "09bb2ff964a0c5c223a1900f085e3955",
};
[Test]
public void Test()
{
for(int i = 0; i < testfiles.Length; i++)
{
string location = Path.Combine(Consts.TestFilesRoot, "images", "anex86", testfiles[i]);
Filter filter = new LZip();
filter.Open(location);
ImagePlugin image = new DiscImageChef.ImagePlugins.Anex86();
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]);
Assert.AreEqual(mediatypes[i], image.ImageInfo.mediaType, testfiles[i]);
// How many sectors to read at once
const uint sectorsToRead = 256;
ulong doneSectors = 0;
MD5Context ctx = new MD5Context();
ctx.Init();
while(doneSectors < image.ImageInfo.sectors)
{
byte[] sector;
if((image.ImageInfo.sectors - doneSectors) >= sectorsToRead)
{
sector = image.ReadSectors(doneSectors, sectorsToRead);
doneSectors += sectorsToRead;
}
else
{
sector = image.ReadSectors(doneSectors, (uint)(image.ImageInfo.sectors - doneSectors));
doneSectors += (image.ImageInfo.sectors - doneSectors);
}
ctx.Update(sector);
}
Assert.AreEqual(md5s[i], ctx.End(), testfiles[i]);
}
}
}
}

View File

@@ -0,0 +1,139 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : AFFS_MBR.cs
// Version : 1.0
// Author(s) : Natalia Portillo
//
// Component : Component
//
// Revision : $Revision$
// Last change by : $Author$
// Date : $Date$
//
// --[ Description ] ----------------------------------------------------------
//
// Description
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/
// //$Id$
using System.IO;
using DiscImageChef.CommonTypes;
using DiscImageChef.Filters;
using DiscImageChef.ImagePlugins;
using NUnit.Framework;
using DiscImageChef.Checksums;
namespace DiscImageChef.Tests.Images
{
[TestFixture]
public class CisCopy
{
// TODO: Support compression
readonly string[] testfiles = {
"md1dd8_all.dcf.lz", "md1dd8_belelung.dcf.lz", "md1dd8_fat.dcf.lz", "md1dd_all.dcf.lz",
"md1dd_belelung.dcf.lz", "md1dd_fat.dcf.lz", "md2dd8_all.dcf.lz", "md2dd8_belelung.dcf.lz",
"md2dd8_fat.dcf.lz", "md2dd_all.dcf.lz", "md2dd_belelung.dcf.lz", "md2dd_fat.dcf.lz",
"md2hd_all.dcf.lz", "md2hd_belelung.dcf.lz", "md2hd_fat.dcf.lz", "mf2dd_all.dcf.lz",
"mf2dd_belelung.dcf.lz", "mf2dd_fat.dcf.lz", "mf2hd_all.dcf.lz", "mf2hd_belelung.dcf.lz",
"mf2hd_fat.dcf.lz",
};
readonly ulong[] sectors = {
320, 320, 320, 360,
360, 360, 640, 640,
640, 720, 720, 720,
2400, 2400, 2400, 1440,
1440, 1440, 2880, 2880,
2880,
};
readonly uint[] sectorsize = {
512, 512, 512, 512,
512, 512, 512, 512,
512, 512, 512, 512,
512, 512, 512, 512,
512, 512, 512, 512,
512,
};
readonly MediaType[] mediatypes = {
MediaType.DOS_525_SS_DD_8, MediaType.DOS_525_SS_DD_8, MediaType.DOS_525_SS_DD_8, MediaType.DOS_525_SS_DD_9,
MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_DS_DD_8,
MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_DS_DD_9,
MediaType.DOS_525_HD, MediaType.DOS_525_HD, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9,
MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, MediaType.DOS_35_HD,
MediaType.DOS_35_HD,
};
readonly string[] md5s = {
"95c0b76419c1c74db6dbe1d790f97dde", "95c0b76419c1c74db6dbe1d790f97dde", "6f6507e416b7320d583dc347b8e57844", "48b93e8619c4c13f4a3724b550e4b371",
"48b93e8619c4c13f4a3724b550e4b371", "1d060d2e2543e1c2e8569f5451660060", "0c93155bbc5e412f5014e037d08c2745", "0c93155bbc5e412f5014e037d08c2745",
"0c93155bbc5e412f5014e037d08c2745", "d2a33090ec03bfb536e7356deacf4bbc", "d2a33090ec03bfb536e7356deacf4bbc", "d2a33090ec03bfb536e7356deacf4bbc",
"181f3bc62f0b90f74af9d8027ebf7512", "181f3bc62f0b90f74af9d8027ebf7512", "181f3bc62f0b90f74af9d8027ebf7512", "783559ee5e774515d5e7d2feab9c333e",
"783559ee5e774515d5e7d2feab9c333e", "783559ee5e774515d5e7d2feab9c333e", "91f3fde8d56a536cdda4c6758e5dbc93", "91f3fde8d56a536cdda4c6758e5dbc93",
"91f3fde8d56a536cdda4c6758e5dbc93",
};
[Test]
public void Test()
{
for(int i = 0; i < testfiles.Length; i++)
{
string location = Path.Combine(Consts.TestFilesRoot, "images", "ciscopy", testfiles[i]);
Filter filter = new LZip();
filter.Open(location);
ImagePlugin image = new DiscImageChef.ImagePlugins.CisCopy();
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]);
Assert.AreEqual(mediatypes[i], image.ImageInfo.mediaType, testfiles[i]);
// How many sectors to read at once
const uint sectorsToRead = 256;
ulong doneSectors = 0;
MD5Context ctx = new MD5Context();
ctx.Init();
while(doneSectors < image.ImageInfo.sectors)
{
byte[] sector;
if((image.ImageInfo.sectors - doneSectors) >= sectorsToRead)
{
sector = image.ReadSectors(doneSectors, sectorsToRead);
doneSectors += sectorsToRead;
}
else
{
sector = image.ReadSectors(doneSectors, (uint)(image.ImageInfo.sectors - doneSectors));
doneSectors += (image.ImageInfo.sectors - doneSectors);
}
ctx.Update(sector);
}
Assert.AreEqual(md5s[i], ctx.End(), testfiles[i]);
}
}
}
}

View File

@@ -0,0 +1,119 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : AFFS_MBR.cs
// Version : 1.0
// Author(s) : Natalia Portillo
//
// Component : Component
//
// Revision : $Revision$
// Last change by : $Author$
// Date : $Date$
//
// --[ Description ] ----------------------------------------------------------
//
// Description
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/
// //$Id$
using System.IO;
using DiscImageChef.CommonTypes;
using DiscImageChef.Filters;
using DiscImageChef.ImagePlugins;
using NUnit.Framework;
using DiscImageChef.Checksums;
namespace DiscImageChef.Tests.Images
{
[TestFixture]
public class CopyQM
{
readonly string[] testfiles = {
"mf2dd.cqm.lz", "mf2dd_fdformat_800.cqm.lz", "mf2dd_freedos.cqm.lz", "mf2hd_blind.cqm.lz",
"mf2hd.cqm.lz", "mf2hd_fdformat_168.cqm.lz", "mf2hd_freedos.cqm.lz",
};
readonly ulong[] sectors = {
1440, 1600, 1600, 2880,
2880, 3360, 3360,
};
readonly uint[] sectorsize = {
512, 512, 512, 512,
512, 512, 512,
};
// TODO: Add "unknown" media types
readonly MediaType[] mediatypes = {
MediaType.DOS_35_DS_DD_9, MediaType.Unknown, MediaType.Unknown, MediaType.DOS_35_HD,
MediaType.DOS_35_HD, MediaType.DMF, MediaType.DMF,
};
readonly string[] md5s = {
"de3f85896f771b7e5bc4c9e3926d64e4", "c533488a21098a62c85f1649abda2803", "1ff7649b679ba22ff20d39ff717dbec8", "b4a602f67903c46eef62addb0780aa56",
"b4a602f67903c46eef62addb0780aa56", "03c2af6a8ebf4bd6f530335de34ae5dd", "1a9f2eeb3cbeeb057b9a9a5c6e9b0cc6",
};
[Test]
public void Test()
{
for(int i = 0; i < testfiles.Length; i++)
{
string location = Path.Combine(Consts.TestFilesRoot, "images", "copyqm", testfiles[i]);
Filter filter = new LZip();
filter.Open(location);
ImagePlugin image = new DiscImageChef.ImagePlugins.CopyQM();
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]);
Assert.AreEqual(mediatypes[i], image.ImageInfo.mediaType, testfiles[i]);
// How many sectors to read at once
const uint sectorsToRead = 256;
ulong doneSectors = 0;
MD5Context ctx = new MD5Context();
ctx.Init();
while(doneSectors < image.ImageInfo.sectors)
{
byte[] sector;
if((image.ImageInfo.sectors - doneSectors) >= sectorsToRead)
{
sector = image.ReadSectors(doneSectors, sectorsToRead);
doneSectors += sectorsToRead;
}
else
{
sector = image.ReadSectors(doneSectors, (uint)(image.ImageInfo.sectors - doneSectors));
doneSectors += (image.ImageInfo.sectors - doneSectors);
}
ctx.Update(sector);
}
Assert.AreEqual(md5s[i], ctx.End(), testfiles[i]);
}
}
}
}

View File

@@ -0,0 +1,134 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : AFFS_MBR.cs
// Version : 1.0
// Author(s) : Natalia Portillo
//
// Component : Component
//
// Revision : $Revision$
// Last change by : $Author$
// Date : $Date$
//
// --[ Description ] ----------------------------------------------------------
//
// Description
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/
// //$Id$
using System.IO;
using DiscImageChef.CommonTypes;
using DiscImageChef.Filters;
using DiscImageChef.ImagePlugins;
using NUnit.Framework;
using DiscImageChef.Checksums;
namespace DiscImageChef.Tests.Images
{
[TestFixture]
public class D88
{
readonly string[] testfiles = {
"1942 (1987)(ASCII)(JP).d77.lz", "'Ashe (1988)(Quasar)(Disk 4 of 4)(User Disk).d88.lz", "Crimsin (1988)(Xtalsoft)(Disk 3 of 3).d88.lz", "Dragon Slayer (1986)(Falcom - Login)(JP).d88.lz",
"D-Side - Lagrange L-2 Part II (1986)(Compaq)(JP).d88.lz", "File Master FM, The v1.01 (1986)(Kyoto Media)(JP).d77.lz", "Gandhara (1987)(Enix)(JP).d88.lz", "Might & Magic (198x)(Star Craft)(Disk 1 of 3)(Disk A).d88.lz",
"msdos33d_md2dd.d88.lz", "msdos33d_md2hd.d88.lz", "msdos50_epson_md2dd.d88.lz", "msdos50_epson_md2hd.d88.lz",
"msdos50_md2dd.d88.lz", "msdos50_md2hd.d88.lz", "msdos62_md2dd.d88.lz", "msdos62_md2hd.d88.lz",
"R-Type (1988)(Irem)(Disk 1 of 2).d88.lz", "Towns System Software v1.1L30 (1992)(Fujitsu)(JP).d88.lz", "Visual Instrument Player (198x)(Kamiya)(JP)(Disk 1 of 2).d88.lz",
};
readonly ulong[] sectors = {
1280, 1280, 1280, 411,
1440, 1280, 1280, 4033,
1440, 1232, 1440, 1232,
1440, 1232, 1440, 1232,
1284, 1232, 1280
};
readonly uint[] sectorsize = {
256, 256, 256, 256,
256, 256, 256, 128,
512, 1024, 512, 1024,
512, 1024, 512, 1024,
1024, 1024, 256,
};
// TODO: Add "unknown" media types
readonly MediaType[] mediatypes = {
MediaType.NEC_525_SS, MediaType.NEC_525_SS, MediaType.NEC_525_SS, MediaType.Unknown,
MediaType.Unknown, MediaType.NEC_525_SS, MediaType.NEC_525_SS, MediaType.Unknown,
MediaType.Unknown, MediaType.NEC_525_HD, MediaType.Unknown, MediaType.NEC_525_HD,
MediaType.Unknown, MediaType.NEC_525_HD, MediaType.Unknown, MediaType.NEC_525_HD,
MediaType.Unknown, MediaType.NEC_525_HD, MediaType.NEC_525_SS,
};
readonly string[] md5s = {
"a4103c39cd7fd9fc3de8418dfcf22364", "b948048c03e0b3d34d77f5c9dced0b41", "f91152fab791d4dc0677a289d90478a5", "39b01df04a6312b09f1b83c9f3a46b22",
"ef775ec1f41b8b725ea83ec8c5ca04e2", "5c2b22f824524cd6c539aaeb2ecb84cd", "6bddf3dd32877f7b552cbf9da6b89f76", "003cd0292879733b6eab7ca79ab9cfeb",
"acb738a5a945e4e2ba1504a14a529933", "106068dbdf13803979c7bbb63612f43d", "be916f25847b9cfc9776d88cc150ae7e", "ccc7f98e216db35c2b7a08634a9f3e20",
"7a3332e82b0fe8c5673a2615f6c0b9a2", "62f5be96a8b8ccab9ee4aebf557cfcf7", "07fb4c225d4b5a2e2a1046ae66fc153c", "1f73980e45a384bed331eaa33c9ef65b",
"9d675e5147b55cee0b2bc05476eef825", "bb48546ced9c61462e1c89dca4987143", "c7df67f4e66dad658fe856d3c8b36c7a",
};
[Test]
public void Test()
{
for(int i = 0; i < testfiles.Length; i++)
{
string location = Path.Combine(Consts.TestFilesRoot, "images", "d88", testfiles[i]);
Filter filter = new LZip();
filter.Open(location);
ImagePlugin image = new DiscImageChef.ImagePlugins.D88();
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]);
Assert.AreEqual(mediatypes[i], image.ImageInfo.mediaType, testfiles[i]);
// How many sectors to read at once
const uint sectorsToRead = 256;
ulong doneSectors = 0;
MD5Context ctx = new MD5Context();
ctx.Init();
while(doneSectors < image.ImageInfo.sectors)
{
byte[] sector;
if((image.ImageInfo.sectors - doneSectors) >= sectorsToRead)
{
sector = image.ReadSectors(doneSectors, sectorsToRead);
doneSectors += sectorsToRead;
}
else
{
sector = image.ReadSectors(doneSectors, (uint)(image.ImageInfo.sectors - doneSectors));
doneSectors += (image.ImageInfo.sectors - doneSectors);
}
ctx.Update(sector);
}
Assert.AreEqual(md5s[i], ctx.End(), testfiles[i]);
}
}
}
}

View File

@@ -0,0 +1,118 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : AFFS_MBR.cs
// Version : 1.0
// Author(s) : Natalia Portillo
//
// Component : Component
//
// Revision : $Revision$
// Last change by : $Author$
// Date : $Date$
//
// --[ Description ] ----------------------------------------------------------
//
// Description
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/
// //$Id$
using System.IO;
using DiscImageChef.CommonTypes;
using DiscImageChef.Filters;
using DiscImageChef.ImagePlugins;
using NUnit.Framework;
using DiscImageChef.Checksums;
namespace DiscImageChef.Tests.Images
{
[TestFixture]
public class DART
{
readonly string[] testfiles = {
"mf1dd_hfs_best.dart.lz", "mf1dd_hfs_fast.dart.lz", "mf1dd_mfs_best.dart.lz", "mf1dd_mfs_fast.dart.lz",
"mf2dd_hfs_best.dart.lz", "mf2dd_hfs_fast.dart.lz", "mf2dd_mfs_best.dart.lz", "mf2dd_mfs_fast.dart.lz",
};
readonly ulong[] sectors = {
800, 800, 800, 800,
1600, 1600, 1600, 1600,
};
readonly uint[] sectorsize = {
512, 512, 512, 512,
512, 512, 512, 512,
};
readonly MediaType[] mediatypes = {
MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS,
MediaType.AppleSonyDS, MediaType.AppleSonyDS, MediaType.AppleSonyDS, MediaType.AppleSonyDS,
};
readonly string[] md5s = {
"eae3a95671d077deb702b3549a769f56", "eae3a95671d077deb702b3549a769f56", "c5d92544c3e78b7f0a9b4baaa9a64eec", "c5d92544c3e78b7f0a9b4baaa9a64eec",
"a99744348a70b62b57bce2dec9132ced", "a99744348a70b62b57bce2dec9132ced", "93e71b9ecdb39d3ec9245b4f451856d4", "93e71b9ecdb39d3ec9245b4f451856d4",
};
[Test]
public void Test()
{
for(int i = 0; i < testfiles.Length; i++)
{
string location = Path.Combine(Consts.TestFilesRoot, "images", "dart", testfiles[i]);
Filter filter = new LZip();
filter.Open(location);
ImagePlugin image = new DiscImageChef.ImagePlugins.D88();
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]);
Assert.AreEqual(mediatypes[i], image.ImageInfo.mediaType, testfiles[i]);
// How many sectors to read at once
const uint sectorsToRead = 256;
ulong doneSectors = 0;
MD5Context ctx = new MD5Context();
ctx.Init();
while(doneSectors < image.ImageInfo.sectors)
{
byte[] sector;
if((image.ImageInfo.sectors - doneSectors) >= sectorsToRead)
{
sector = image.ReadSectors(doneSectors, sectorsToRead);
doneSectors += sectorsToRead;
}
else
{
sector = image.ReadSectors(doneSectors, (uint)(image.ImageInfo.sectors - doneSectors));
doneSectors += (image.ImageInfo.sectors - doneSectors);
}
ctx.Update(sector);
}
Assert.AreEqual(md5s[i], ctx.End(), testfiles[i]);
}
}
}
}

View File

@@ -0,0 +1,141 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : AFFS_MBR.cs
// Version : 1.0
// Author(s) : Natalia Portillo
//
// Component : Component
//
// Revision : $Revision$
// Last change by : $Author$
// Date : $Date$
//
// --[ Description ] ----------------------------------------------------------
//
// Description
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/
// //$Id$
using System.IO;
using DiscImageChef.CommonTypes;
using DiscImageChef.Filters;
using DiscImageChef.ImagePlugins;
using NUnit.Framework;
using DiscImageChef.Checksums;
namespace DiscImageChef.Tests.Images
{
[TestFixture]
public class DiskCopy42
{
readonly string[] testfiles = {
// Made with DiskCopy 4.2
"dc42/mf1dd_hfs.img.lz", "dc42/mf1dd_mfs.img.lz", "dc42/mf2dd_hfs.img.lz", "dc42/mf2dd_mfs.img.lz",
// Made with ShrinkWrap 3
"shrinkwrap/DiskCopy 4/DC6_RW_HFS_1440.image.lz", "shrinkwrap/DiskCopy 4/DC6_RW_HFS_800.image.lz", "shrinkwrap/DiskCopy 4/DOS1440.image.lz", "shrinkwrap/DiskCopy 4/DOS720.image.lz",
"shrinkwrap/DiskCopy 4/PD1440.image.lz", "shrinkwrap/DiskCopy 4/PD800.image.lz",
// Made with DiskImages.framework
"macosx/DC42/DOS_1440.img.lz", "macosx/DC42/DOS_720.img.lz", "macosx/DC42/HFS_1440.img.lz", "macosx/DC42/HFS_800.img.lz",
"macosx/DC42/ProDOS_1440.img.lz", "macosx/DC42/ProDOS_800.img.lz", "macosx/DC42/UFS_1440.img.lz", "macosx/DC42/UFS_720.img.lz",
"macosx/DC42/UFS_800.img.lz",
};
readonly ulong[] sectors = {
800, 800, 1600, 1600,
2880, 1600, 2880, 1440,
2880, 1600,
2880, 1440, 2880, 1600,
2880, 1600, 2880, 1440,
1600,
};
readonly uint[] sectorsize = {
512, 512, 512, 512,
512, 512, 512, 512,
512, 512,
512, 512, 512, 512,
512, 512, 512, 512,
512,
};
readonly MediaType[] mediatypes = {
MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonyDS, MediaType.AppleSonyDS,
MediaType.DOS_35_HD, MediaType.AppleSonyDS, MediaType.DOS_35_HD, MediaType.DOS_35_DS_DD_9,
MediaType.DOS_35_HD, MediaType.AppleSonyDS,
MediaType.DOS_35_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, MediaType.AppleSonyDS,
MediaType.DOS_35_HD, MediaType.AppleSonyDS, MediaType.DOS_35_HD, MediaType.DOS_35_DS_DD_9,
MediaType.AppleSonyDS,
};
readonly string[] md5s = {
"eae3a95671d077deb702b3549a769f56", "c5d92544c3e78b7f0a9b4baaa9a64eec", "a99744348a70b62b57bce2dec9132ced", "93e71b9ecdb39d3ec9245b4f451856d4",
"3160038ca028ccf52ad7863790072145", "5e255c4bc0f6a26ecd27845b37e65aaa", "ff419213080574056ebd9adf7bab3d32", "c2be571406cf6353269faa59a4a8c0a4",
"7975e8cf7579a6848d6fb4e546d1f682", "a72da7aedadbe194c22a3d71c62e4766",
"ff419213080574056ebd9adf7bab3d32", "c2be571406cf6353269faa59a4a8c0a4", "3160038ca028ccf52ad7863790072145", "5e255c4bc0f6a26ecd27845b37e65aaa",
"7975e8cf7579a6848d6fb4e546d1f682", "a72da7aedadbe194c22a3d71c62e4766", "b37823c7a90d1917f719ba5927b23da8", "4942032f7bf1d115237ea1764424828b",
"85574aebeef03eb355bf8541955d06ea",
};
[Test]
public void Test()
{
for(int i = 0; i < testfiles.Length; i++)
{
string location = Path.Combine(Consts.TestFilesRoot, "images", "", testfiles[i]);
Filter filter = new LZip();
filter.Open(location);
ImagePlugin image = new DiscImageChef.ImagePlugins.DiskCopy42();
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]);
Assert.AreEqual(mediatypes[i], image.ImageInfo.mediaType, testfiles[i]);
// How many sectors to read at once
const uint sectorsToRead = 256;
ulong doneSectors = 0;
MD5Context ctx = new MD5Context();
ctx.Init();
while(doneSectors < image.ImageInfo.sectors)
{
byte[] sector;
if((image.ImageInfo.sectors - doneSectors) >= sectorsToRead)
{
sector = image.ReadSectors(doneSectors, sectorsToRead);
doneSectors += sectorsToRead;
}
else
{
sector = image.ReadSectors(doneSectors, (uint)(image.ImageInfo.sectors - doneSectors));
doneSectors += (image.ImageInfo.sectors - doneSectors);
}
ctx.Update(sector);
}
Assert.AreEqual(md5s[i], ctx.End(), testfiles[i]);
}
}
}
}