mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Add unit tests for UDIF images created by DiskCopy 6.5.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Aaru" type="DotNetProject" factoryName=".NET Project">
|
||||
<option name="EXE_PATH" value="$PROJECT_DIR$/Aaru/bin/Debug/netcoreapp3.1/aaru.dll" />
|
||||
<option name="PROGRAM_PARAMETERS" value="media info /dev/sr0" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/Aaru/bin/Debug/netcoreapp3.1" />
|
||||
<option name="PROGRAM_PARAMETERS" value="image convert "Nonstop-UX System V Release 4 B32 (Boot Tape).cptp.lz" "Nonstop-UX System V Release 4 B32 (Boot Tape).aif"" />
|
||||
<option name="WORKING_DIRECTORY" value="/mnt/DiscImageChef/Media image formats/copytape" />
|
||||
<option name="PASS_PARENT_ENVS" value="1" />
|
||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||
<option name="USE_MONO" value="0" />
|
||||
@@ -10,7 +10,7 @@
|
||||
<option name="PROJECT_PATH" value="$PROJECT_DIR$/Aaru/Aaru.csproj" />
|
||||
<option name="PROJECT_EXE_PATH_TRACKING" value="1" />
|
||||
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
|
||||
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="1" />
|
||||
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="0" />
|
||||
<option name="PROJECT_KIND" value="DotNetCore" />
|
||||
<option name="PROJECT_TFM" value=".NETCoreApp,Version=v3.1" />
|
||||
<method v="2">
|
||||
|
||||
248
Aaru.Tests/Images/DiskCopy65/UDCO.cs
Normal file
248
Aaru.Tests/Images/DiskCopy65/UDCO.cs
Normal file
@@ -0,0 +1,248 @@
|
||||
// /***************************************************************************
|
||||
// Aaru Data Preservation Suite
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : UDCO.cs
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Component : Aaru unit testing.
|
||||
//
|
||||
// --[ 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 © 2011-2021 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.DiscImages;
|
||||
using Aaru.Filters;
|
||||
using FluentAssertions.Execution;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Images.DiskCopy65
|
||||
{
|
||||
[TestFixture]
|
||||
public class UDCO
|
||||
{
|
||||
readonly string[] _testFiles =
|
||||
{
|
||||
"DC6_UDCO_DOS_1440.img.lz", "DC6_UDCO_DOS_720.img.lz", "DC6_UDCO_DOS_DMF.img.lz",
|
||||
"DC6_UDCO_HFS_1440.img.lz", "DC6_UDCO_HFS_800.img.lz", "DC6_UDCO_HFS_DMF.img.lz", "DC6_UDCO_PD_1440.img.lz",
|
||||
"DC6_UDCO_PD_800.img.lz", "DC6_UDCO_PD_DMF.img.lz"
|
||||
};
|
||||
|
||||
readonly ulong[] _sectors =
|
||||
{
|
||||
// DC6_UDCO_DOS_1440.img.lz
|
||||
2880,
|
||||
|
||||
// DC6_UDCO_DOS_720.img.lz
|
||||
1440,
|
||||
|
||||
// DC6_UDCO_DOS_DMF.img.lz
|
||||
3360,
|
||||
|
||||
// DC6_UDCO_HFS_1440.img.lz
|
||||
2880,
|
||||
|
||||
// DC6_UDCO_HFS_800.img.lz
|
||||
1600,
|
||||
|
||||
// DC6_UDCO_HFS_DMF.img.lz
|
||||
3360,
|
||||
|
||||
// DC6_UDCO_PD_1440.img.lz
|
||||
2880,
|
||||
|
||||
// DC6_UDCO_PD_800.img.lz
|
||||
1600,
|
||||
|
||||
// DC6_UDCO_PD_DMF.img.lz
|
||||
3360
|
||||
};
|
||||
|
||||
readonly uint[] _sectorSize =
|
||||
{
|
||||
// DC6_UDCO_DOS_1440.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDCO_DOS_720.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDCO_DOS_DMF.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDCO_HFS_1440.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDCO_HFS_800.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDCO_HFS_DMF.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDCO_PD_1440.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDCO_PD_800.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDCO_PD_DMF.img.lz
|
||||
512
|
||||
};
|
||||
|
||||
readonly MediaType[] _mediaTypes =
|
||||
{
|
||||
// DC6_UDCO_DOS_1440.img.lz
|
||||
MediaType.DOS_35_HD,
|
||||
|
||||
// DC6_UDCO_DOS_720.img.lz
|
||||
MediaType.DOS_35_DS_DD_9,
|
||||
|
||||
// DC6_UDCO_DOS_DMF.img.lz
|
||||
MediaType.DMF,
|
||||
|
||||
// DC6_UDCO_HFS_1440.img.lz
|
||||
MediaType.DOS_35_HD,
|
||||
|
||||
// DC6_UDCO_HFS_800.img.lz
|
||||
MediaType.AppleSonyDS,
|
||||
|
||||
// DC6_UDCO_HFS_DMF.img.lz
|
||||
MediaType.DMF,
|
||||
|
||||
// DC6_UDCO_PD_1440.img.lz
|
||||
MediaType.DOS_35_HD,
|
||||
|
||||
// DC6_UDCO_PD_800.img.lz
|
||||
MediaType.AppleSonyDS,
|
||||
|
||||
// DC6_UDCO_PD_DMF.img.lz
|
||||
MediaType.DMF
|
||||
};
|
||||
|
||||
readonly string[] _md5S =
|
||||
{
|
||||
// DC6_UDCO_DOS_1440.img.lz
|
||||
"ff419213080574056ebd9adf7bab3d32",
|
||||
|
||||
// DC6_UDCO_DOS_720.img.lz
|
||||
"c2be571406cf6353269faa59a4a8c0a4",
|
||||
|
||||
// DC6_UDCO_DOS_DMF.img.lz
|
||||
"92ea7a359957012a682ba126cfdef0ce",
|
||||
|
||||
// DC6_UDCO_HFS_1440.img.lz
|
||||
"3160038ca028ccf52ad7863790072145",
|
||||
|
||||
// DC6_UDCO_HFS_800.img.lz
|
||||
"5e255c4bc0f6a26ecd27845b37e65aaa",
|
||||
|
||||
// DC6_UDCO_HFS_DMF.img.lz
|
||||
"652dc979c177f2d8e846587158b38478",
|
||||
|
||||
// DC6_UDCO_PD_1440.img.lz
|
||||
"7975e8cf7579a6848d6fb4e546d1f682",
|
||||
|
||||
// DC6_UDCO_PD_800.img.lz
|
||||
"a72da7aedadbe194c22a3d71c62e4766",
|
||||
|
||||
// DC6_UDCO_PD_DMF.img.lz
|
||||
"7fbf0251a93cb36d98e68b7d19624de5"
|
||||
};
|
||||
|
||||
readonly string _dataFolder =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "DiskCopy 6.5", "UDIF", "UDCO");
|
||||
|
||||
[Test]
|
||||
public void Info()
|
||||
{
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
var image = new Udif();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
|
||||
using(new AssertionScope())
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, $"Sector size: {_testFiles[i]}");
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
{
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
var image = new Udif();
|
||||
bool opened = image.Open(filter);
|
||||
ulong doneSectors = 0;
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
var ctx = new Md5Context();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
}
|
||||
|
||||
ctx.Update(sector);
|
||||
}
|
||||
|
||||
Assert.AreEqual(_md5S[i], ctx.End(), $"Hash: {_testFiles[i]}");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
248
Aaru.Tests/Images/DiskCopy65/UDCo_obsolete.cs
Normal file
248
Aaru.Tests/Images/DiskCopy65/UDCo_obsolete.cs
Normal file
@@ -0,0 +1,248 @@
|
||||
// /***************************************************************************
|
||||
// Aaru Data Preservation Suite
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : UDCo_obsolete.cs
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Component : Aaru unit testing.
|
||||
//
|
||||
// --[ 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 © 2011-2021 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.DiscImages;
|
||||
using Aaru.Filters;
|
||||
using FluentAssertions.Execution;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Images.DiskCopy65
|
||||
{
|
||||
[TestFixture]
|
||||
public class UDCo_obsolete
|
||||
{
|
||||
readonly string[] _testFiles =
|
||||
{
|
||||
"DC6_UDCo_DOS_1440.img.lz", "DC6_UDCo_DOS_720.img.lz", "DC6_UDCo_DOS_DMF.img.lz",
|
||||
"DC6_UDCo_HFS_1440.img.lz", "DC6_UDCo_HFS_800.img.lz", "DC6_UDCo_HFS_DMF.img.lz", "DC6_UDCo_PD_1440.img.lz",
|
||||
"DC6_UDCo_PD_800.img.lz", "DC6_UDCo_PD_DMF.img.lz"
|
||||
};
|
||||
|
||||
readonly ulong[] _sectors =
|
||||
{
|
||||
// DC6_UDCo_DOS_1440.img.lz
|
||||
2880,
|
||||
|
||||
// DC6_UDCo_DOS_720.img.lz
|
||||
1440,
|
||||
|
||||
// DC6_UDCo_DOS_DMF.img.lz
|
||||
3360,
|
||||
|
||||
// DC6_UDCo_HFS_1440.img.lz
|
||||
2880,
|
||||
|
||||
// DC6_UDCo_HFS_800.img.lz
|
||||
1600,
|
||||
|
||||
// DC6_UDCo_HFS_DMF.img.lz
|
||||
3360,
|
||||
|
||||
// DC6_UDCo_PD_1440.img.lz
|
||||
2880,
|
||||
|
||||
// DC6_UDCo_PD_800.img.lz
|
||||
1600,
|
||||
|
||||
// DC6_UDCo_PD_DMF.img.lz
|
||||
3360
|
||||
};
|
||||
|
||||
readonly uint[] _sectorSize =
|
||||
{
|
||||
// DC6_UDCo_DOS_1440.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDCo_DOS_720.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDCo_DOS_DMF.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDCo_HFS_1440.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDCo_HFS_800.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDCo_HFS_DMF.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDCo_PD_1440.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDCo_PD_800.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDCo_PD_DMF.img.lz
|
||||
512
|
||||
};
|
||||
|
||||
readonly MediaType[] _mediaTypes =
|
||||
{
|
||||
// DC6_UDCo_DOS_1440.img.lz
|
||||
MediaType.DOS_35_HD,
|
||||
|
||||
// DC6_UDCo_DOS_720.img.lz
|
||||
MediaType.DOS_35_DS_DD_9,
|
||||
|
||||
// DC6_UDCo_DOS_DMF.img.lz
|
||||
MediaType.DMF,
|
||||
|
||||
// DC6_UDCo_HFS_1440.img.lz
|
||||
MediaType.DOS_35_HD,
|
||||
|
||||
// DC6_UDCo_HFS_800.img.lz
|
||||
MediaType.AppleSonyDS,
|
||||
|
||||
// DC6_UDCo_HFS_DMF.img.lz
|
||||
MediaType.DMF,
|
||||
|
||||
// DC6_UDCo_PD_1440.img.lz
|
||||
MediaType.DOS_35_HD,
|
||||
|
||||
// DC6_UDCo_PD_800.img.lz
|
||||
MediaType.AppleSonyDS,
|
||||
|
||||
// DC6_UDCo_PD_DMF.img.lz
|
||||
MediaType.DMF
|
||||
};
|
||||
|
||||
readonly string[] _md5S =
|
||||
{
|
||||
// DC6_UDCo_DOS_1440.img.lz
|
||||
"ff419213080574056ebd9adf7bab3d32",
|
||||
|
||||
// DC6_UDCo_DOS_720.img.lz
|
||||
"c2be571406cf6353269faa59a4a8c0a4",
|
||||
|
||||
// DC6_UDCo_DOS_DMF.img.lz
|
||||
"92ea7a359957012a682ba126cfdef0ce",
|
||||
|
||||
// DC6_UDCo_HFS_1440.img.lz
|
||||
"3160038ca028ccf52ad7863790072145",
|
||||
|
||||
// DC6_UDCo_HFS_800.img.lz
|
||||
"5e255c4bc0f6a26ecd27845b37e65aaa",
|
||||
|
||||
// DC6_UDCo_HFS_DMF.img.lz
|
||||
"652dc979c177f2d8e846587158b38478",
|
||||
|
||||
// DC6_UDCo_PD_1440.img.lz
|
||||
"7975e8cf7579a6848d6fb4e546d1f682",
|
||||
|
||||
// DC6_UDCo_PD_800.img.lz
|
||||
"a72da7aedadbe194c22a3d71c62e4766",
|
||||
|
||||
// DC6_UDCo_PD_DMF.img.lz
|
||||
"7fbf0251a93cb36d98e68b7d19624de5"
|
||||
};
|
||||
|
||||
readonly string _dataFolder =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "DiskCopy 6.5", "UDIF", "UDCo_OBS");
|
||||
|
||||
[Test]
|
||||
public void Info()
|
||||
{
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
var image = new Udif();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
|
||||
using(new AssertionScope())
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, $"Sector size: {_testFiles[i]}");
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
{
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
var image = new Udif();
|
||||
bool opened = image.Open(filter);
|
||||
ulong doneSectors = 0;
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
var ctx = new Md5Context();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
}
|
||||
|
||||
ctx.Update(sector);
|
||||
}
|
||||
|
||||
Assert.AreEqual(_md5S[i], ctx.End(), $"Hash: {_testFiles[i]}");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
248
Aaru.Tests/Images/DiskCopy65/UDRO.cs
Normal file
248
Aaru.Tests/Images/DiskCopy65/UDRO.cs
Normal file
@@ -0,0 +1,248 @@
|
||||
// /***************************************************************************
|
||||
// Aaru Data Preservation Suite
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : UDRO.cs
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Component : Aaru unit testing.
|
||||
//
|
||||
// --[ 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 © 2011-2021 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.DiscImages;
|
||||
using Aaru.Filters;
|
||||
using FluentAssertions.Execution;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Images.DiskCopy65
|
||||
{
|
||||
[TestFixture]
|
||||
public class UDRO
|
||||
{
|
||||
readonly string[] _testFiles =
|
||||
{
|
||||
"DC6_UDRO_DOS_1440.img.lz", "DC6_UDRO_DOS_720.img.lz", "DC6_UDRO_DOS_DMF.img.lz",
|
||||
"DC6_UDRO_HFS_1440.img.lz", "DC6_UDRO_HFS_800.img.lz", "DC6_UDRO_HFS_DMF.img.lz", "DC6_UDRO_PD_1440.img.lz",
|
||||
"DC6_UDRO_PD_800.img.lz", "DC6_UDRO_PD_DMF.img.lz"
|
||||
};
|
||||
|
||||
readonly ulong[] _sectors =
|
||||
{
|
||||
// DC6_UDRO_DOS_1440.img.lz
|
||||
2880,
|
||||
|
||||
// DC6_UDRO_DOS_720.img.lz
|
||||
1440,
|
||||
|
||||
// DC6_UDRO_DOS_DMF.img.lz
|
||||
3360,
|
||||
|
||||
// DC6_UDRO_HFS_1440.img.lz
|
||||
2880,
|
||||
|
||||
// DC6_UDRO_HFS_800.img.lz
|
||||
1600,
|
||||
|
||||
// DC6_UDRO_HFS_DMF.img.lz
|
||||
3360,
|
||||
|
||||
// DC6_UDRO_PD_1440.img.lz
|
||||
2880,
|
||||
|
||||
// DC6_UDRO_PD_800.img.lz
|
||||
1600,
|
||||
|
||||
// DC6_UDRO_PD_DMF.img.lz
|
||||
3360
|
||||
};
|
||||
|
||||
readonly uint[] _sectorSize =
|
||||
{
|
||||
// DC6_UDRO_DOS_1440.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDRO_DOS_720.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDRO_DOS_DMF.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDRO_HFS_1440.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDRO_HFS_800.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDRO_HFS_DMF.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDRO_PD_1440.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDRO_PD_800.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDRO_PD_DMF.img.lz
|
||||
512
|
||||
};
|
||||
|
||||
readonly MediaType[] _mediaTypes =
|
||||
{
|
||||
// DC6_UDRO_DOS_1440.img.lz
|
||||
MediaType.DOS_35_HD,
|
||||
|
||||
// DC6_UDRO_DOS_720.img.lz
|
||||
MediaType.DOS_35_DS_DD_9,
|
||||
|
||||
// DC6_UDRO_DOS_DMF.img.lz
|
||||
MediaType.DMF,
|
||||
|
||||
// DC6_UDRO_HFS_1440.img.lz
|
||||
MediaType.DOS_35_HD,
|
||||
|
||||
// DC6_UDRO_HFS_800.img.lz
|
||||
MediaType.AppleSonyDS,
|
||||
|
||||
// DC6_UDRO_HFS_DMF.img.lz
|
||||
MediaType.DMF,
|
||||
|
||||
// DC6_UDRO_PD_1440.img.lz
|
||||
MediaType.DOS_35_HD,
|
||||
|
||||
// DC6_UDRO_PD_800.img.lz
|
||||
MediaType.AppleSonyDS,
|
||||
|
||||
// DC6_UDRO_PD_DMF.img.lz
|
||||
MediaType.DMF
|
||||
};
|
||||
|
||||
readonly string[] _md5S =
|
||||
{
|
||||
// DC6_UDRO_DOS_1440.img.lz
|
||||
"ff419213080574056ebd9adf7bab3d32",
|
||||
|
||||
// DC6_UDRO_DOS_720.img.lz
|
||||
"c2be571406cf6353269faa59a4a8c0a4",
|
||||
|
||||
// DC6_UDRO_DOS_DMF.img.lz
|
||||
"92ea7a359957012a682ba126cfdef0ce",
|
||||
|
||||
// DC6_UDRO_HFS_1440.img.lz
|
||||
"3160038ca028ccf52ad7863790072145",
|
||||
|
||||
// DC6_UDRO_HFS_800.img.lz
|
||||
"5e255c4bc0f6a26ecd27845b37e65aaa",
|
||||
|
||||
// DC6_UDRO_HFS_DMF.img.lz
|
||||
"652dc979c177f2d8e846587158b38478",
|
||||
|
||||
// DC6_UDRO_PD_1440.img.lz
|
||||
"7975e8cf7579a6848d6fb4e546d1f682",
|
||||
|
||||
// DC6_UDRO_PD_800.img.lz
|
||||
"a72da7aedadbe194c22a3d71c62e4766",
|
||||
|
||||
// DC6_UDRO_PD_DMF.img.lz
|
||||
"7fbf0251a93cb36d98e68b7d19624de5"
|
||||
};
|
||||
|
||||
readonly string _dataFolder =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "DiskCopy 6.5", "UDIF", "UDRO");
|
||||
|
||||
[Test]
|
||||
public void Info()
|
||||
{
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
var image = new Udif();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
|
||||
using(new AssertionScope())
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, $"Sector size: {_testFiles[i]}");
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
{
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
var image = new Udif();
|
||||
bool opened = image.Open(filter);
|
||||
ulong doneSectors = 0;
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
var ctx = new Md5Context();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
}
|
||||
|
||||
ctx.Update(sector);
|
||||
}
|
||||
|
||||
Assert.AreEqual(_md5S[i], ctx.End(), $"Hash: {_testFiles[i]}");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
248
Aaru.Tests/Images/DiskCopy65/UDRo_obsolete.cs
Normal file
248
Aaru.Tests/Images/DiskCopy65/UDRo_obsolete.cs
Normal file
@@ -0,0 +1,248 @@
|
||||
// /***************************************************************************
|
||||
// Aaru Data Preservation Suite
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : UDRo_obsolete.cs
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Component : Aaru unit testing.
|
||||
//
|
||||
// --[ 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 © 2011-2021 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.DiscImages;
|
||||
using Aaru.Filters;
|
||||
using FluentAssertions.Execution;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Images.DiskCopy65
|
||||
{
|
||||
[TestFixture]
|
||||
public class UDRo_obsolete
|
||||
{
|
||||
readonly string[] _testFiles =
|
||||
{
|
||||
"DC6_UDRo_DOS_1440.img.lz", "DC6_UDRo_DOS_720.img.lz", "DC6_UDRo_DOS_DMF.img.lz",
|
||||
"DC6_UDRo_HFS_1440.img.lz", "DC6_UDRo_HFS_800.img.lz", "DC6_UDRo_HFS_DMF.img.lz", "DC6_UDRo_PD_1440.img.lz",
|
||||
"DC6_UDRo_PD_800.img.lz", "DC6_UDRo_PD_DMF.img.lz"
|
||||
};
|
||||
|
||||
readonly ulong[] _sectors =
|
||||
{
|
||||
// DC6_UDRo_DOS_1440.img.lz
|
||||
2880,
|
||||
|
||||
// DC6_UDRo_DOS_720.img.lz
|
||||
1440,
|
||||
|
||||
// DC6_UDRo_DOS_DMF.img.lz
|
||||
3360,
|
||||
|
||||
// DC6_UDRo_HFS_1440.img.lz
|
||||
2880,
|
||||
|
||||
// DC6_UDRo_HFS_800.img.lz
|
||||
1600,
|
||||
|
||||
// DC6_UDRo_HFS_DMF.img.lz
|
||||
3360,
|
||||
|
||||
// DC6_UDRo_PD_1440.img.lz
|
||||
2880,
|
||||
|
||||
// DC6_UDRo_PD_800.img.lz
|
||||
1600,
|
||||
|
||||
// DC6_UDRo_PD_DMF.img.lz
|
||||
3360
|
||||
};
|
||||
|
||||
readonly uint[] _sectorSize =
|
||||
{
|
||||
// DC6_UDRo_DOS_1440.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDRo_DOS_720.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDRo_DOS_DMF.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDRo_HFS_1440.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDRo_HFS_800.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDRo_HFS_DMF.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDRo_PD_1440.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDRo_PD_800.img.lz
|
||||
512,
|
||||
|
||||
// DC6_UDRo_PD_DMF.img.lz
|
||||
512
|
||||
};
|
||||
|
||||
readonly MediaType[] _mediaTypes =
|
||||
{
|
||||
// DC6_UDRo_DOS_1440.img.lz
|
||||
MediaType.DOS_35_HD,
|
||||
|
||||
// DC6_UDRo_DOS_720.img.lz
|
||||
MediaType.DOS_35_DS_DD_9,
|
||||
|
||||
// DC6_UDRo_DOS_DMF.img.lz
|
||||
MediaType.DMF,
|
||||
|
||||
// DC6_UDRo_HFS_1440.img.lz
|
||||
MediaType.DOS_35_HD,
|
||||
|
||||
// DC6_UDRo_HFS_800.img.lz
|
||||
MediaType.AppleSonyDS,
|
||||
|
||||
// DC6_UDRo_HFS_DMF.img.lz
|
||||
MediaType.DMF,
|
||||
|
||||
// DC6_UDRo_PD_1440.img.lz
|
||||
MediaType.DOS_35_HD,
|
||||
|
||||
// DC6_UDRo_PD_800.img.lz
|
||||
MediaType.AppleSonyDS,
|
||||
|
||||
// DC6_UDRo_PD_DMF.img.lz
|
||||
MediaType.DMF
|
||||
};
|
||||
|
||||
readonly string[] _md5S =
|
||||
{
|
||||
// DC6_UDRo_DOS_1440.img.lz
|
||||
"ff419213080574056ebd9adf7bab3d32",
|
||||
|
||||
// DC6_UDRo_DOS_720.img.lz
|
||||
"c2be571406cf6353269faa59a4a8c0a4",
|
||||
|
||||
// DC6_UDRo_DOS_DMF.img.lz
|
||||
"92ea7a359957012a682ba126cfdef0ce",
|
||||
|
||||
// DC6_UDRo_HFS_1440.img.lz
|
||||
"3160038ca028ccf52ad7863790072145",
|
||||
|
||||
// DC6_UDRo_HFS_800.img.lz
|
||||
"5e255c4bc0f6a26ecd27845b37e65aaa",
|
||||
|
||||
// DC6_UDRo_HFS_DMF.img.lz
|
||||
"652dc979c177f2d8e846587158b38478",
|
||||
|
||||
// DC6_UDRo_PD_1440.img.lz
|
||||
"7975e8cf7579a6848d6fb4e546d1f682",
|
||||
|
||||
// DC6_UDRo_PD_800.img.lz
|
||||
"a72da7aedadbe194c22a3d71c62e4766",
|
||||
|
||||
// DC6_UDRo_PD_DMF.img.lz
|
||||
"7fbf0251a93cb36d98e68b7d19624de5"
|
||||
};
|
||||
|
||||
readonly string _dataFolder =
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "DiskCopy 6.5", "UDIF", "UDRo_OBS");
|
||||
|
||||
[Test]
|
||||
public void Info()
|
||||
{
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
var image = new Udif();
|
||||
bool opened = image.Open(filter);
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
|
||||
using(new AssertionScope())
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.AreEqual(_sectors[i], image.Info.Sectors, $"Sectors: {_testFiles[i]}");
|
||||
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, $"Sector size: {_testFiles[i]}");
|
||||
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, $"Media type: {_testFiles[i]}");
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint _sectorsToRead = 256;
|
||||
|
||||
[Test]
|
||||
public void Hashes()
|
||||
{
|
||||
Environment.CurrentDirectory = _dataFolder;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
var filter = new LZip();
|
||||
filter.Open(_testFiles[i]);
|
||||
|
||||
var image = new Udif();
|
||||
bool opened = image.Open(filter);
|
||||
ulong doneSectors = 0;
|
||||
|
||||
Assert.AreEqual(true, opened, $"Open: {_testFiles[i]}");
|
||||
var ctx = new Md5Context();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= _sectorsToRead)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, _sectorsToRead);
|
||||
doneSectors += _sectorsToRead;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
}
|
||||
|
||||
ctx.Update(sector);
|
||||
}
|
||||
|
||||
Assert.AreEqual(_md5S[i], ctx.End(), $"Hash: {_testFiles[i]}");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user