mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Added tests for MacBinary, AppleSingle and AppleDouble.
This commit is contained in:
@@ -51,6 +51,17 @@
|
||||
<Compile Include="Filters\LZip.cs" />
|
||||
<Compile Include="Filters\BZip2.cs" />
|
||||
<Compile Include="Filters\PCExchange.cs" />
|
||||
<Compile Include="Filters\AppleDoubleOsX.cs" />
|
||||
<Compile Include="Filters\AppleDoubleUnix.cs" />
|
||||
<Compile Include="Filters\AppleDoubleProDos.cs" />
|
||||
<Compile Include="Filters\AppleDoubleDave.cs" />
|
||||
<Compile Include="Filters\AppleDoubleNetatalk.cs" />
|
||||
<Compile Include="Filters\AppleDoubleDos.cs" />
|
||||
<Compile Include="Filters\AppleDoubleUnAr.cs" />
|
||||
<Compile Include="Filters\AppleSingle.cs" />
|
||||
<Compile Include="Filters\MacBinary1.cs" />
|
||||
<Compile Include="Filters\MacBinary3.cs" />
|
||||
<Compile Include="Filters\MacBinary2.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
||||
130
DiscImageChef.Tests/Filters/AppleDoubleDave.cs
Normal file
130
DiscImageChef.Tests/Filters/AppleDoubleDave.cs
Normal file
@@ -0,0 +1,130 @@
|
||||
// /***************************************************************************
|
||||
// The Disc Image Chef
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : AppleDoubleOsX.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.Checksums;
|
||||
using DiscImageChef.Filters;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
[TestFixture]
|
||||
public class AppleDoubleDave
|
||||
{
|
||||
const string ExpectedFile = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string ExpectedSidecar = "7b0c25bf8cb70f6fb1a15eca31585250";
|
||||
const string ExpectedContents = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string ExpectedResource = "a972d27c44193a7587b21416c0953cc3";
|
||||
readonly string location;
|
||||
readonly string sidecar;
|
||||
|
||||
public AppleDoubleDave()
|
||||
{
|
||||
location = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "dave", "DOS_720.dmg");
|
||||
sidecar = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "dave", "resource.frk", "DOS_720.dmg");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedFile, result);
|
||||
|
||||
ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
result = ctx.File(sidecar, out tmp);
|
||||
Assert.AreEqual(ExpectedSidecar, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckFilterId()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleDouble();
|
||||
Assert.AreEqual(true, filter.Identify(location));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleDouble();
|
||||
filter.Open(location);
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(737280, filter.GetDataForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
||||
Assert.AreEqual(286, filter.GetResourceForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetResourceForkStream());
|
||||
Assert.AreEqual(true, filter.HasResourceFork());
|
||||
filter.Close();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckContents()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleDouble();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetDataForkStream();
|
||||
byte[] data = new byte[737280];
|
||||
str.Read(data, 0, 737280);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedContents, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckResource()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleDouble();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
byte[] data = new byte[286];
|
||||
str.Read(data, 0, 286);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedResource, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
130
DiscImageChef.Tests/Filters/AppleDoubleDos.cs
Normal file
130
DiscImageChef.Tests/Filters/AppleDoubleDos.cs
Normal file
@@ -0,0 +1,130 @@
|
||||
// /***************************************************************************
|
||||
// The Disc Image Chef
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : AppleDoubleOsX.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.Checksums;
|
||||
using DiscImageChef.Filters;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
[TestFixture]
|
||||
public class AppleDoubleDos
|
||||
{
|
||||
const string ExpectedFile = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string ExpectedSidecar = "7b0c25bf8cb70f6fb1a15eca31585250";
|
||||
const string ExpectedContents = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string ExpectedResource = "a972d27c44193a7587b21416c0953cc3";
|
||||
readonly string location;
|
||||
readonly string sidecar;
|
||||
|
||||
public AppleDoubleDos()
|
||||
{
|
||||
location = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "dos", "DOS_720.dmg");
|
||||
sidecar = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "dos", "DOS_720.adf");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedFile, result);
|
||||
|
||||
ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
result = ctx.File(sidecar, out tmp);
|
||||
Assert.AreEqual(ExpectedSidecar, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckFilterId()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleDouble();
|
||||
Assert.AreEqual(true, filter.Identify(location));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleDouble();
|
||||
filter.Open(location);
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(737280, filter.GetDataForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
||||
Assert.AreEqual(286, filter.GetResourceForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetResourceForkStream());
|
||||
Assert.AreEqual(true, filter.HasResourceFork());
|
||||
filter.Close();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckContents()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleDouble();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetDataForkStream();
|
||||
byte[] data = new byte[737280];
|
||||
str.Read(data, 0, 737280);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedContents, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckResource()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleDouble();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
byte[] data = new byte[286];
|
||||
str.Read(data, 0, 286);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedResource, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
130
DiscImageChef.Tests/Filters/AppleDoubleNetatalk.cs
Normal file
130
DiscImageChef.Tests/Filters/AppleDoubleNetatalk.cs
Normal file
@@ -0,0 +1,130 @@
|
||||
// /***************************************************************************
|
||||
// The Disc Image Chef
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : AppleDoubleOsX.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.Checksums;
|
||||
using DiscImageChef.Filters;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
[TestFixture]
|
||||
public class AppleDoubleNetatalk
|
||||
{
|
||||
const string ExpectedFile = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string ExpectedSidecar = "7b0c25bf8cb70f6fb1a15eca31585250";
|
||||
const string ExpectedContents = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string ExpectedResource = "a972d27c44193a7587b21416c0953cc3";
|
||||
readonly string location;
|
||||
readonly string sidecar;
|
||||
|
||||
public AppleDoubleNetatalk()
|
||||
{
|
||||
location = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "netatalk", "DOS_720.dmg");
|
||||
sidecar = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "netatalk", ".AppleDouble", "DOS_720.dmg");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedFile, result);
|
||||
|
||||
ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
result = ctx.File(sidecar, out tmp);
|
||||
Assert.AreEqual(ExpectedSidecar, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckFilterId()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleDouble();
|
||||
Assert.AreEqual(true, filter.Identify(location));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleDouble();
|
||||
filter.Open(location);
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(737280, filter.GetDataForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
||||
Assert.AreEqual(286, filter.GetResourceForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetResourceForkStream());
|
||||
Assert.AreEqual(true, filter.HasResourceFork());
|
||||
filter.Close();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckContents()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleDouble();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetDataForkStream();
|
||||
byte[] data = new byte[737280];
|
||||
str.Read(data, 0, 737280);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedContents, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckResource()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleDouble();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
byte[] data = new byte[286];
|
||||
str.Read(data, 0, 286);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedResource, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
130
DiscImageChef.Tests/Filters/AppleDoubleOsX.cs
Normal file
130
DiscImageChef.Tests/Filters/AppleDoubleOsX.cs
Normal file
@@ -0,0 +1,130 @@
|
||||
// /***************************************************************************
|
||||
// The Disc Image Chef
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : AppleDoubleOsX.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.Checksums;
|
||||
using DiscImageChef.Filters;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
[TestFixture]
|
||||
public class AppleDoubleOsX
|
||||
{
|
||||
const string ExpectedFile = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string ExpectedSidecar = "7b0c25bf8cb70f6fb1a15eca31585250";
|
||||
const string ExpectedContents = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string ExpectedResource = "a972d27c44193a7587b21416c0953cc3";
|
||||
readonly string location;
|
||||
readonly string sidecar;
|
||||
|
||||
public AppleDoubleOsX()
|
||||
{
|
||||
location = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "osx", "DOS_720.dmg");
|
||||
sidecar = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "osx", "._DOS_720.dmg");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedFile, result);
|
||||
|
||||
ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
result = ctx.File(sidecar, out tmp);
|
||||
Assert.AreEqual(ExpectedSidecar, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckFilterId()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleDouble();
|
||||
Assert.AreEqual(true, filter.Identify(location));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleDouble();
|
||||
filter.Open(location);
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(737280, filter.GetDataForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
||||
Assert.AreEqual(286, filter.GetResourceForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetResourceForkStream());
|
||||
Assert.AreEqual(true, filter.HasResourceFork());
|
||||
filter.Close();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckContents()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleDouble();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetDataForkStream();
|
||||
byte[] data = new byte[737280];
|
||||
str.Read(data, 0, 737280);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedContents, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckResource()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleDouble();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
byte[] data = new byte[286];
|
||||
str.Read(data, 0, 286);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedResource, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
130
DiscImageChef.Tests/Filters/AppleDoubleProDos.cs
Normal file
130
DiscImageChef.Tests/Filters/AppleDoubleProDos.cs
Normal file
@@ -0,0 +1,130 @@
|
||||
// /***************************************************************************
|
||||
// The Disc Image Chef
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : AppleDoubleOsX.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.Checksums;
|
||||
using DiscImageChef.Filters;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
[TestFixture]
|
||||
public class AppleDoubleProDos
|
||||
{
|
||||
const string ExpectedFile = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string ExpectedSidecar = "7b0c25bf8cb70f6fb1a15eca31585250";
|
||||
const string ExpectedContents = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string ExpectedResource = "a972d27c44193a7587b21416c0953cc3";
|
||||
readonly string location;
|
||||
readonly string sidecar;
|
||||
|
||||
public AppleDoubleProDos()
|
||||
{
|
||||
location = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "prodos", "DOS_720.dmg");
|
||||
sidecar = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "prodos", "R.DOS_720.dmg");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedFile, result);
|
||||
|
||||
ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
result = ctx.File(sidecar, out tmp);
|
||||
Assert.AreEqual(ExpectedSidecar, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckFilterId()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleDouble();
|
||||
Assert.AreEqual(true, filter.Identify(location));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleDouble();
|
||||
filter.Open(location);
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(737280, filter.GetDataForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
||||
Assert.AreEqual(286, filter.GetResourceForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetResourceForkStream());
|
||||
Assert.AreEqual(true, filter.HasResourceFork());
|
||||
filter.Close();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckContents()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleDouble();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetDataForkStream();
|
||||
byte[] data = new byte[737280];
|
||||
str.Read(data, 0, 737280);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedContents, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckResource()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleDouble();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
byte[] data = new byte[286];
|
||||
str.Read(data, 0, 286);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedResource, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
130
DiscImageChef.Tests/Filters/AppleDoubleUnAr.cs
Normal file
130
DiscImageChef.Tests/Filters/AppleDoubleUnAr.cs
Normal file
@@ -0,0 +1,130 @@
|
||||
// /***************************************************************************
|
||||
// The Disc Image Chef
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : AppleDoubleOsX.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.Checksums;
|
||||
using DiscImageChef.Filters;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
[TestFixture]
|
||||
public class AppleDoubleUnAr
|
||||
{
|
||||
const string ExpectedFile = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string ExpectedSidecar = "7b0c25bf8cb70f6fb1a15eca31585250";
|
||||
const string ExpectedContents = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string ExpectedResource = "a972d27c44193a7587b21416c0953cc3";
|
||||
readonly string location;
|
||||
readonly string sidecar;
|
||||
|
||||
public AppleDoubleUnAr()
|
||||
{
|
||||
location = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "unar", "DOS_720.dmg");
|
||||
sidecar = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "unar", "DOS_720.dmg.rsrc");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedFile, result);
|
||||
|
||||
ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
result = ctx.File(sidecar, out tmp);
|
||||
Assert.AreEqual(ExpectedSidecar, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckFilterId()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleDouble();
|
||||
Assert.AreEqual(true, filter.Identify(location));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleDouble();
|
||||
filter.Open(location);
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(737280, filter.GetDataForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
||||
Assert.AreEqual(286, filter.GetResourceForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetResourceForkStream());
|
||||
Assert.AreEqual(true, filter.HasResourceFork());
|
||||
filter.Close();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckContents()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleDouble();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetDataForkStream();
|
||||
byte[] data = new byte[737280];
|
||||
str.Read(data, 0, 737280);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedContents, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckResource()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleDouble();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
byte[] data = new byte[286];
|
||||
str.Read(data, 0, 286);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedResource, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
130
DiscImageChef.Tests/Filters/AppleDoubleUnix.cs
Normal file
130
DiscImageChef.Tests/Filters/AppleDoubleUnix.cs
Normal file
@@ -0,0 +1,130 @@
|
||||
// /***************************************************************************
|
||||
// The Disc Image Chef
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : AppleDoubleOsX.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.Checksums;
|
||||
using DiscImageChef.Filters;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
[TestFixture]
|
||||
public class AppleDoubleUnix
|
||||
{
|
||||
const string ExpectedFile = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string ExpectedSidecar = "7b0c25bf8cb70f6fb1a15eca31585250";
|
||||
const string ExpectedContents = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string ExpectedResource = "a972d27c44193a7587b21416c0953cc3";
|
||||
readonly string location;
|
||||
readonly string sidecar;
|
||||
|
||||
public AppleDoubleUnix()
|
||||
{
|
||||
location = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "unix", "DOS_720.dmg");
|
||||
sidecar = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "unix", "%DOS_720.dmg");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedFile, result);
|
||||
|
||||
ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
result = ctx.File(sidecar, out tmp);
|
||||
Assert.AreEqual(ExpectedSidecar, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckFilterId()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleDouble();
|
||||
Assert.AreEqual(true, filter.Identify(location));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleDouble();
|
||||
filter.Open(location);
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(737280, filter.GetDataForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
||||
Assert.AreEqual(286, filter.GetResourceForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetResourceForkStream());
|
||||
Assert.AreEqual(true, filter.HasResourceFork());
|
||||
filter.Close();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckContents()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleDouble();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetDataForkStream();
|
||||
byte[] data = new byte[737280];
|
||||
str.Read(data, 0, 737280);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedContents, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckResource()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleDouble();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
byte[] data = new byte[286];
|
||||
str.Read(data, 0, 286);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedResource, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
122
DiscImageChef.Tests/Filters/AppleSingle.cs
Normal file
122
DiscImageChef.Tests/Filters/AppleSingle.cs
Normal file
@@ -0,0 +1,122 @@
|
||||
// /***************************************************************************
|
||||
// The Disc Image Chef
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : AppleDoubleOsX.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.Checksums;
|
||||
using DiscImageChef.Filters;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
[TestFixture]
|
||||
public class AppleSingle
|
||||
{
|
||||
const string ExpectedFile = "7497a3b156dcd0c1046a1ab12e188ab7";
|
||||
const string ExpectedContents = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string ExpectedResource = "a972d27c44193a7587b21416c0953cc3";
|
||||
readonly string location;
|
||||
|
||||
public AppleSingle()
|
||||
{
|
||||
location = Path.Combine(Consts.TestFilesRoot, "filters", "applesingle", "DOS_720.ASF");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedFile, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckFilterId()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleSingle();
|
||||
Assert.AreEqual(true, filter.Identify(location));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleSingle();
|
||||
filter.Open(location);
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(737280, filter.GetDataForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
||||
Assert.AreEqual(286, filter.GetResourceForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetResourceForkStream());
|
||||
Assert.AreEqual(true, filter.HasResourceFork());
|
||||
filter.Close();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckContents()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleSingle();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetDataForkStream();
|
||||
byte[] data = new byte[737280];
|
||||
str.Read(data, 0, 737280);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedContents, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckResource()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleSingle();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
byte[] data = new byte[286];
|
||||
str.Read(data, 0, 286);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedResource, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
122
DiscImageChef.Tests/Filters/MacBinary1.cs
Normal file
122
DiscImageChef.Tests/Filters/MacBinary1.cs
Normal file
@@ -0,0 +1,122 @@
|
||||
// /***************************************************************************
|
||||
// The Disc Image Chef
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : MacBinary1.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.Checksums;
|
||||
using DiscImageChef.Filters;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
[TestFixture]
|
||||
public class MacBinary1
|
||||
{
|
||||
const string ExpectedFile = "596c38555bc7ba284648d1ce57700884";
|
||||
const string ExpectedContents = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string ExpectedResource = "a972d27c44193a7587b21416c0953cc3";
|
||||
readonly string location;
|
||||
|
||||
public MacBinary1()
|
||||
{
|
||||
location = Path.Combine(Consts.TestFilesRoot, "filters", "macbinary", "macbinary1.bin");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedFile, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckFilterId()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleSingle();
|
||||
Assert.AreEqual(true, filter.Identify(location));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleSingle();
|
||||
filter.Open(location);
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(737280, filter.GetDataForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
||||
Assert.AreEqual(286, filter.GetResourceForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetResourceForkStream());
|
||||
Assert.AreEqual(true, filter.HasResourceFork());
|
||||
filter.Close();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckContents()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleSingle();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetDataForkStream();
|
||||
byte[] data = new byte[737280];
|
||||
str.Read(data, 0, 737280);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedContents, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckResource()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.AppleSingle();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
byte[] data = new byte[286];
|
||||
str.Read(data, 0, 286);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedResource, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
122
DiscImageChef.Tests/Filters/MacBinary2.cs
Normal file
122
DiscImageChef.Tests/Filters/MacBinary2.cs
Normal file
@@ -0,0 +1,122 @@
|
||||
// /***************************************************************************
|
||||
// The Disc Image Chef
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : MacBinary1.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.Checksums;
|
||||
using DiscImageChef.Filters;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
[TestFixture]
|
||||
public class MacBinary2
|
||||
{
|
||||
const string ExpectedFile = "a8daa55a65432353e95dc4c61d42660f";
|
||||
const string ExpectedContents = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string ExpectedResource = "a972d27c44193a7587b21416c0953cc3";
|
||||
readonly string location;
|
||||
|
||||
public MacBinary2()
|
||||
{
|
||||
location = Path.Combine(Consts.TestFilesRoot, "filters", "macbinary", "macbinary2.bin");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedFile, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckFilterId()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.MacBinary();
|
||||
Assert.AreEqual(true, filter.Identify(location));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.MacBinary();
|
||||
filter.Open(location);
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(737280, filter.GetDataForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
||||
Assert.AreEqual(286, filter.GetResourceForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetResourceForkStream());
|
||||
Assert.AreEqual(true, filter.HasResourceFork());
|
||||
filter.Close();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckContents()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.MacBinary();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetDataForkStream();
|
||||
byte[] data = new byte[737280];
|
||||
str.Read(data, 0, 737280);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedContents, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckResource()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.MacBinary();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
byte[] data = new byte[286];
|
||||
str.Read(data, 0, 286);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedResource, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
122
DiscImageChef.Tests/Filters/MacBinary3.cs
Normal file
122
DiscImageChef.Tests/Filters/MacBinary3.cs
Normal file
@@ -0,0 +1,122 @@
|
||||
// /***************************************************************************
|
||||
// The Disc Image Chef
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : MacBinary1.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.Checksums;
|
||||
using DiscImageChef.Filters;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
[TestFixture]
|
||||
public class MacBinary3
|
||||
{
|
||||
const string ExpectedFile = "3a7363a6109fb52a264b0b45dfa16694";
|
||||
const string ExpectedContents = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string ExpectedResource = "a972d27c44193a7587b21416c0953cc3";
|
||||
readonly string location;
|
||||
|
||||
public MacBinary3()
|
||||
{
|
||||
location = Path.Combine(Consts.TestFilesRoot, "filters", "macbinary", "macbinary3.bin");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedFile, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckFilterId()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.MacBinary();
|
||||
Assert.AreEqual(true, filter.Identify(location));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.MacBinary();
|
||||
filter.Open(location);
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(737280, filter.GetDataForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
||||
Assert.AreEqual(286, filter.GetResourceForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetResourceForkStream());
|
||||
Assert.AreEqual(true, filter.HasResourceFork());
|
||||
filter.Close();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckContents()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.MacBinary();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetDataForkStream();
|
||||
byte[] data = new byte[737280];
|
||||
str.Read(data, 0, 737280);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedContents, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckResource()
|
||||
{
|
||||
Filter filter = new DiscImageChef.Filters.MacBinary();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
byte[] data = new byte[286];
|
||||
str.Read(data, 0, 286);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
MD5Context ctx = new MD5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out byte[] tmp);
|
||||
Assert.AreEqual(ExpectedResource, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user