mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Make partitioning scheme tests inherit a single class.
This commit is contained in:
@@ -26,25 +26,23 @@
|
||||
// Copyright © 2011-2021 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.DiscImages;
|
||||
using Aaru.Filters;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Partitions
|
||||
{
|
||||
[TestFixture]
|
||||
public class Acorn
|
||||
public class Acorn : PartitionSchemeTest
|
||||
{
|
||||
readonly string[] _testFiles =
|
||||
public override string DataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Acorn");
|
||||
|
||||
public override string[] TestFiles => new[]
|
||||
{
|
||||
"linux_ics.aif"
|
||||
};
|
||||
|
||||
readonly Partition[][] _wanted =
|
||||
public override Partition[][] Wanted => new[]
|
||||
{
|
||||
// Linux (ICS)
|
||||
// TODO: Values are incorrect
|
||||
@@ -96,33 +94,5 @@ namespace Aaru.Tests.Partitions
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Acorn", _testFiles[i]);
|
||||
IFilter filter = new ZZZNoFilter();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new AaruFormat();
|
||||
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
|
||||
List<Partition> partitions = Core.Partitions.GetAll(image);
|
||||
Assert.AreEqual(_wanted[i].Length, partitions.Count, _testFiles[i]);
|
||||
|
||||
for(int j = 0; j < partitions.Count; j++)
|
||||
{
|
||||
// Too chatty
|
||||
//Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Size, partitions[j].Size, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Name, partitions[j].Name, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Offset, partitions[j].Offset, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testFiles[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,20 +26,19 @@
|
||||
// Copyright © 2011-2021 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.DiscImages;
|
||||
using Aaru.Filters;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Partitions
|
||||
{
|
||||
[TestFixture]
|
||||
public class AppleMap
|
||||
public class AppleMap : PartitionSchemeTest
|
||||
{
|
||||
readonly string[] _testFiles =
|
||||
public override string DataFolder =>
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Apple Partition Map");
|
||||
|
||||
public override string[] TestFiles => new[]
|
||||
{
|
||||
"d2_driver.aif", "hdt_1.8_encrypted1.aif", "hdt_1.8_encrypted2.aif", "hdt_1.8_password.aif", "hdt_1.8.aif",
|
||||
"linux.aif", "macos_1.1.aif", "macos_2.0.aif", "macos_4.2.aif", "macos_4.3.aif", "macos_6.0.2.aif",
|
||||
@@ -48,7 +47,7 @@ namespace Aaru.Tests.Partitions
|
||||
"silverlining_2.2.1.aif", "speedtools_3.6.aif", "vcpformatter_2.1.1.aif"
|
||||
};
|
||||
|
||||
readonly Partition[][] _wanted =
|
||||
public override Partition[][] Wanted => new[]
|
||||
{
|
||||
// D2
|
||||
new[]
|
||||
@@ -2020,35 +2019,5 @@ namespace Aaru.Tests.Partitions
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Apple Partition Map",
|
||||
_testFiles[i]);
|
||||
|
||||
IFilter filter = new ZZZNoFilter();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new AaruFormat();
|
||||
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
|
||||
List<Partition> partitions = Core.Partitions.GetAll(image);
|
||||
Assert.AreEqual(_wanted[i].Length, partitions.Count, _testFiles[i]);
|
||||
|
||||
for(int j = 0; j < partitions.Count; j++)
|
||||
{
|
||||
// Too chatty
|
||||
//Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Size, partitions[j].Size, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Name, partitions[j].Name, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Offset, partitions[j].Offset, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testFiles[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,25 +26,23 @@
|
||||
// Copyright © 2011-2021 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.DiscImages;
|
||||
using Aaru.Filters;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Partitions
|
||||
{
|
||||
[TestFixture]
|
||||
public class Atari
|
||||
public class Atari : PartitionSchemeTest
|
||||
{
|
||||
readonly string[] _testFiles =
|
||||
public override string DataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Atari ST");
|
||||
|
||||
public override string[] TestFiles => new[]
|
||||
{
|
||||
"linux_ahdi.aif", "linux_icd.aif", "tos_1.04.aif"
|
||||
};
|
||||
|
||||
readonly Partition[][] _wanted =
|
||||
public override Partition[][] Wanted => new[]
|
||||
{
|
||||
// Linux (AHDI)
|
||||
new[]
|
||||
@@ -314,35 +312,5 @@ namespace Aaru.Tests.Partitions
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Atari ST",
|
||||
_testFiles[i]);
|
||||
|
||||
IFilter filter = new ZZZNoFilter();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new AaruFormat();
|
||||
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
|
||||
List<Partition> partitions = Core.Partitions.GetAll(image);
|
||||
Assert.AreEqual(_wanted[i].Length, partitions.Count, _testFiles[i]);
|
||||
|
||||
for(int j = 0; j < partitions.Count; j++)
|
||||
{
|
||||
// Too chatty
|
||||
//Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Size, partitions[j].Size, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Name, partitions[j].Name, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Offset, partitions[j].Offset, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testFiles[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,25 +26,23 @@
|
||||
// Copyright © 2011-2021 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.DiscImages;
|
||||
using Aaru.Filters;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Partitions
|
||||
{
|
||||
[TestFixture]
|
||||
public class Bsd
|
||||
public class Bsd : PartitionSchemeTest
|
||||
{
|
||||
readonly string[] _testFiles =
|
||||
public override string DataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "BSD slices");
|
||||
|
||||
public override string[] TestFiles => new[]
|
||||
{
|
||||
"parted.aif", "netbsd_1.6.aif", "netbsd_6.1.5.aif", "netbsd_7.1.aif"
|
||||
};
|
||||
|
||||
readonly Partition[][] _wanted =
|
||||
public override Partition[][] Wanted => new[]
|
||||
{
|
||||
// Parted
|
||||
new[]
|
||||
@@ -393,35 +391,5 @@ namespace Aaru.Tests.Partitions
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "BSD slices",
|
||||
_testFiles[i]);
|
||||
|
||||
IFilter filter = new ZZZNoFilter();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new AaruFormat();
|
||||
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
|
||||
List<Partition> partitions = Core.Partitions.GetAll(image);
|
||||
Assert.AreEqual(_wanted[i].Length, partitions.Count, _testFiles[i]);
|
||||
|
||||
for(int j = 0; j < partitions.Count; j++)
|
||||
{
|
||||
// Too chatty
|
||||
//Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Size, partitions[j].Size, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Name, partitions[j].Name, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Offset, partitions[j].Offset, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testFiles[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,25 +26,24 @@
|
||||
// Copyright © 2011-2021 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.DiscImages;
|
||||
using Aaru.Filters;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Partitions
|
||||
{
|
||||
[TestFixture]
|
||||
public class Gpt
|
||||
public class Gpt : PartitionSchemeTest
|
||||
{
|
||||
readonly string[] _testFiles =
|
||||
public override string DataFolder =>
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "GUID Partition Table");
|
||||
|
||||
public override string[] TestFiles => new[]
|
||||
{
|
||||
"linux.aif", "parted.aif"
|
||||
};
|
||||
|
||||
readonly Partition[][] _wanted =
|
||||
public override Partition[][] Wanted => new[]
|
||||
{
|
||||
// Linux
|
||||
new[]
|
||||
@@ -155,35 +154,5 @@ namespace Aaru.Tests.Partitions
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "GUID Partition Table",
|
||||
_testFiles[i]);
|
||||
|
||||
IFilter filter = new ZZZNoFilter();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new AaruFormat();
|
||||
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
|
||||
List<Partition> partitions = Core.Partitions.GetAll(image);
|
||||
Assert.AreEqual(_wanted[i].Length, partitions.Count, _testFiles[i]);
|
||||
|
||||
for(int j = 0; j < partitions.Count; j++)
|
||||
{
|
||||
// Too chatty
|
||||
//Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Size, partitions[j].Size, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Name, partitions[j].Name, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Offset, partitions[j].Offset, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testFiles[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,20 +26,19 @@
|
||||
// Copyright © 2011-2021 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.DiscImages;
|
||||
using Aaru.Filters;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Partitions
|
||||
{
|
||||
[TestFixture]
|
||||
public class Mbr
|
||||
public class Mbr : PartitionSchemeTest
|
||||
{
|
||||
readonly string[] _testFiles =
|
||||
public override string DataFolder =>
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Master Boot Record");
|
||||
|
||||
public override string[] TestFiles => new[]
|
||||
{
|
||||
"concurrentdos_6.0.aif", "darwin_1.4.1.aif", "darwin_6.0.2.aif", "darwin_8.0.1.aif", "drdos_3.40.aif",
|
||||
"drdos_3.41.aif", "drdos_5.00.aif", "drdos_6.00.aif", "drdos_7.02.aif", "drdos_7.03.aif", "drdos_8.0.aif",
|
||||
@@ -50,7 +49,7 @@ namespace Aaru.Tests.Partitions
|
||||
"win96osr25.aif", "winnt_3.10.aif"
|
||||
};
|
||||
|
||||
readonly Partition[][] _wanted =
|
||||
public override Partition[][] Wanted => new[]
|
||||
{
|
||||
// Concurrent DOS 6.0
|
||||
new[]
|
||||
@@ -1987,36 +1986,5 @@ namespace Aaru.Tests.Partitions
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Master Boot Record",
|
||||
_testFiles[i]);
|
||||
|
||||
IFilter filter = new ZZZNoFilter();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new AaruFormat();
|
||||
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
|
||||
List<Partition> partitions = Core.Partitions.GetAll(image);
|
||||
Assert.AreEqual(_wanted[i].Length, partitions.Count, _testFiles[i]);
|
||||
|
||||
for(int j = 0; j < partitions.Count; j++)
|
||||
{
|
||||
// Too chatty
|
||||
//Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Length * 512, partitions[j].Size, _testFiles[i]);
|
||||
|
||||
// Assert.AreEqual(wanted[i][j].Name, partitions[j].Name, testfiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Start * 512, partitions[j].Offset, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testFiles[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,25 +26,23 @@
|
||||
// Copyright © 2011-2021 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.DiscImages;
|
||||
using Aaru.Filters;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Partitions
|
||||
{
|
||||
[TestFixture]
|
||||
public class Minix
|
||||
public class Minix : PartitionSchemeTest
|
||||
{
|
||||
readonly string[] _testFiles =
|
||||
public override string DataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "MINIX");
|
||||
|
||||
public override string[] TestFiles => new[]
|
||||
{
|
||||
"minix_3.1.2a.aif"
|
||||
};
|
||||
|
||||
readonly Partition[][] _wanted =
|
||||
public override Partition[][] Wanted => new[]
|
||||
{
|
||||
// Parted
|
||||
new[]
|
||||
@@ -95,34 +93,5 @@ namespace Aaru.Tests.Partitions
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "MINIX", _testFiles[i]);
|
||||
IFilter filter = new ZZZNoFilter();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new AaruFormat();
|
||||
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
|
||||
List<Partition> partitions = Core.Partitions.GetAll(image);
|
||||
Assert.AreEqual(_wanted[i].Length, partitions.Count, _testFiles[i]);
|
||||
|
||||
for(int j = 0; j < partitions.Count; j++)
|
||||
{
|
||||
// Too chatty
|
||||
//Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Size, partitions[j].Size, _testFiles[i]);
|
||||
|
||||
// Assert.AreEqual(wanted[i][j].Name, partitions[j].Name, testfiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Offset, partitions[j].Offset, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testFiles[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,25 +26,23 @@
|
||||
// Copyright © 2011-2021 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.DiscImages;
|
||||
using Aaru.Filters;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Partitions
|
||||
{
|
||||
[TestFixture]
|
||||
public class Pc98
|
||||
public class Pc98 : PartitionSchemeTest
|
||||
{
|
||||
readonly string[] _testFiles =
|
||||
public override string DataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "PC-98");
|
||||
|
||||
public override string[] TestFiles => new[]
|
||||
{
|
||||
"msdos330.aif", "msdos330_alt.aif", "msdos500_epson.aif", "msdos500.aif", "msdos620.aif"
|
||||
};
|
||||
|
||||
readonly Partition[][] _wanted =
|
||||
public override Partition[][] Wanted => new[]
|
||||
{
|
||||
// NEC MS-DOS 3.30 (256Mb HDD)
|
||||
new[]
|
||||
@@ -377,31 +375,5 @@ namespace Aaru.Tests.Partitions
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "PC-98", _testFiles[i]);
|
||||
IFilter filter = new ZZZNoFilter();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new AaruFormat();
|
||||
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
|
||||
List<Partition> partitions = Core.Partitions.GetAll(image);
|
||||
Assert.AreEqual(_wanted[i].Length, partitions.Count, _testFiles[i]);
|
||||
|
||||
for(int j = 0; j < partitions.Count; j++)
|
||||
{
|
||||
// Too chatty
|
||||
//Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Name, partitions[j].Name, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testFiles[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
42
Aaru.Tests/Partitions/PartitionSchemeTest.cs
Normal file
42
Aaru.Tests/Partitions/PartitionSchemeTest.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.Core;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Partitions
|
||||
{
|
||||
public abstract class PartitionSchemeTest
|
||||
{
|
||||
public abstract string[] TestFiles { get; }
|
||||
public abstract Partition[][] Wanted { get; }
|
||||
public abstract string DataFolder { get; }
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
for(int i = 0; i < TestFiles.Length; i++)
|
||||
{
|
||||
string test = TestFiles[i];
|
||||
Environment.CurrentDirectory = DataFolder;
|
||||
|
||||
var filtersList = new FiltersList();
|
||||
IFilter inputFilter = filtersList.GetFilter(test);
|
||||
|
||||
Assert.IsNotNull(inputFilter, $"Filter: {test}");
|
||||
|
||||
IMediaImage image = ImageFormat.Detect(inputFilter);
|
||||
|
||||
Assert.IsNotNull(image, $"Image format: {test}");
|
||||
|
||||
Assert.AreEqual(true, image.Open(inputFilter), $"Cannot open image for {test}");
|
||||
|
||||
List<Partition> partitions = Core.Partitions.GetAll(image);
|
||||
|
||||
partitions.Should().BeEquivalentTo(Wanted[i], $"Partitions: {test}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,25 +26,24 @@
|
||||
// Copyright © 2011-2021 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.DiscImages;
|
||||
using Aaru.Filters;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Partitions
|
||||
{
|
||||
[TestFixture]
|
||||
public class Rdb
|
||||
public class Rdb : PartitionSchemeTest
|
||||
{
|
||||
readonly string[] _testFiles =
|
||||
public override string DataFolder =>
|
||||
Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Rigid Disk Block");
|
||||
|
||||
public override string[] TestFiles => new[]
|
||||
{
|
||||
"amigaos_3.9.aif", "amigaos_4.0.aif", "parted.aif"
|
||||
};
|
||||
|
||||
readonly Partition[][] _wanted =
|
||||
public override Partition[][] Wanted => new[]
|
||||
{
|
||||
// AmigaOS 3.9
|
||||
new[]
|
||||
@@ -226,35 +225,5 @@ namespace Aaru.Tests.Partitions
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Rigid Disk Block",
|
||||
_testFiles[i]);
|
||||
|
||||
IFilter filter = new ZZZNoFilter();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new AaruFormat();
|
||||
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
|
||||
List<Partition> partitions = Core.Partitions.GetAll(image);
|
||||
Assert.AreEqual(_wanted[i].Length, partitions.Count, _testFiles[i]);
|
||||
|
||||
for(int j = 0; j < partitions.Count; j++)
|
||||
{
|
||||
// Too chatty
|
||||
//Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Size, partitions[j].Size, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Name, partitions[j].Name, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Offset, partitions[j].Offset, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testFiles[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,25 +26,23 @@
|
||||
// Copyright © 2011-2021 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.DiscImages;
|
||||
using Aaru.Filters;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Partitions
|
||||
{
|
||||
[TestFixture]
|
||||
public class Sgi
|
||||
public class Sgi : PartitionSchemeTest
|
||||
{
|
||||
readonly string[] _testFiles =
|
||||
public override string DataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "SGI");
|
||||
|
||||
public override string[] TestFiles => new[]
|
||||
{
|
||||
"linux.aif", "parted.aif"
|
||||
};
|
||||
|
||||
readonly Partition[][] _wanted =
|
||||
public override Partition[][] Wanted => new[]
|
||||
{
|
||||
// Linux's fdisk
|
||||
new[]
|
||||
@@ -218,34 +216,5 @@ namespace Aaru.Tests.Partitions
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "SGI", _testFiles[i]);
|
||||
IFilter filter = new ZZZNoFilter();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new AaruFormat();
|
||||
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
|
||||
List<Partition> partitions = Core.Partitions.GetAll(image);
|
||||
Assert.AreEqual(_wanted[i].Length, partitions.Count, _testFiles[i]);
|
||||
|
||||
for(int j = 0; j < partitions.Count; j++)
|
||||
{
|
||||
// Too chatty
|
||||
//Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Length * 512, partitions[j].Size, _testFiles[i]);
|
||||
|
||||
// Assert.AreEqual(wanted[i][j].Name, partitions[j].Name, testfiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Start * 512, partitions[j].Offset, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testFiles[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,26 +26,24 @@
|
||||
// Copyright © 2011-2021 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.DiscImages;
|
||||
using Aaru.Filters;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Partitions
|
||||
{
|
||||
// TODO: Get SunOS and VTOC16 disk labels
|
||||
[TestFixture]
|
||||
public class Sun
|
||||
public class Sun : PartitionSchemeTest
|
||||
{
|
||||
readonly string[] _testFiles =
|
||||
public override string DataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Sun");
|
||||
|
||||
public override string[] TestFiles => new[]
|
||||
{
|
||||
"linux.aif", "parted.aif"
|
||||
};
|
||||
|
||||
readonly Partition[][] _wanted =
|
||||
public override Partition[][] Wanted => new[]
|
||||
{
|
||||
// Linux's fdisk
|
||||
new[]
|
||||
@@ -147,34 +145,5 @@ namespace Aaru.Tests.Partitions
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Sun", _testFiles[i]);
|
||||
IFilter filter = new ZZZNoFilter();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new AaruFormat();
|
||||
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
|
||||
List<Partition> partitions = Core.Partitions.GetAll(image);
|
||||
Assert.AreEqual(_wanted[i].Length, partitions.Count, _testFiles[i]);
|
||||
|
||||
for(int j = 0; j < partitions.Count; j++)
|
||||
{
|
||||
// Too chatty
|
||||
//Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Length * 512, partitions[j].Size, _testFiles[i]);
|
||||
|
||||
// Assert.AreEqual(wanted[i][j].Name, partitions[j].Name, testfiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Start * 512, partitions[j].Offset, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testFiles[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,25 +26,23 @@
|
||||
// Copyright © 2011-2021 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.DiscImages;
|
||||
using Aaru.Filters;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Partitions
|
||||
{
|
||||
[TestFixture]
|
||||
public class Vtoc
|
||||
public class Vtoc : PartitionSchemeTest
|
||||
{
|
||||
readonly string[] _testFiles =
|
||||
public override string DataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "UNIX VTOC");
|
||||
|
||||
public override string[] TestFiles => new[]
|
||||
{
|
||||
"att_unix_vtoc.aif"
|
||||
};
|
||||
|
||||
readonly Partition[][] _wanted =
|
||||
public override Partition[][] Wanted => new[]
|
||||
{
|
||||
// AT&T UNIX System V Release 4 Version 2.1 for 386
|
||||
new[]
|
||||
@@ -195,36 +193,5 @@ namespace Aaru.Tests.Partitions
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "UNIX VTOC",
|
||||
_testFiles[i]);
|
||||
|
||||
IFilter filter = new ZZZNoFilter();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new AaruFormat();
|
||||
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
|
||||
List<Partition> partitions = Core.Partitions.GetAll(image);
|
||||
Assert.AreEqual(_wanted[i].Length, partitions.Count, _testFiles[i]);
|
||||
|
||||
for(int j = 0; j < partitions.Count; j++)
|
||||
{
|
||||
// Too chatty
|
||||
//Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Length * 512, partitions[j].Size, _testFiles[i]);
|
||||
|
||||
// Assert.AreEqual(wanted[i][j].Name, partitions[j].Name, testfiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Start * 512, partitions[j].Offset, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testFiles[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,25 +26,23 @@
|
||||
// Copyright © 2011-2021 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.DiscImages;
|
||||
using Aaru.Filters;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Aaru.Tests.Partitions
|
||||
{
|
||||
[TestFixture]
|
||||
public class Xbox
|
||||
public class Xbox : PartitionSchemeTest
|
||||
{
|
||||
readonly string[] _testFiles =
|
||||
public override string DataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Xbox");
|
||||
|
||||
public override string[] TestFiles => new[]
|
||||
{
|
||||
"microsoft256mb.aif"
|
||||
};
|
||||
|
||||
readonly Partition[][] _wanted =
|
||||
public override Partition[][] Wanted => new[]
|
||||
{
|
||||
new[]
|
||||
{
|
||||
@@ -68,31 +66,5 @@ namespace Aaru.Tests.Partitions
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
for(int i = 0; i < _testFiles.Length; i++)
|
||||
{
|
||||
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Xbox", _testFiles[i]);
|
||||
IFilter filter = new ZZZNoFilter();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new AaruFormat();
|
||||
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
|
||||
List<Partition> partitions = Core.Partitions.GetAll(image);
|
||||
Assert.AreEqual(_wanted[i].Length, partitions.Count, _testFiles[i]);
|
||||
|
||||
for(int j = 0; j < partitions.Count; j++)
|
||||
{
|
||||
// Too chatty
|
||||
Assert.AreEqual(_wanted[i][j].Description, partitions[j].Description, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Length * 512, partitions[j].Size, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Start * 512, partitions[j].Offset, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testFiles[i]);
|
||||
Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testFiles[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user