Files
Aaru/DiscImageChef.Tests/Filesystems/AFFS.cs

87 lines
3.6 KiB
C#
Raw Normal View History

2017-07-08 19:23:52 +01:00
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
2017-07-08 19:24:07 +01:00
// Filename : AFFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
2017-07-08 19:23:52 +01:00
//
// Component : DiscImageChef unit testing.
2017-07-08 19:23:52 +01:00
//
// --[ 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-2018 Natalia Portillo
2017-07-08 19:23:52 +01:00
// ****************************************************************************/
2017-07-08 19:23:52 +01:00
using System.IO;
using DiscImageChef.CommonTypes;
2017-12-21 14:30:38 +00:00
using DiscImageChef.DiscImages;
2017-07-08 19:23:52 +01:00
using DiscImageChef.Filesystems;
using DiscImageChef.Filters;
using NUnit.Framework;
namespace DiscImageChef.Tests.Filesystems
{
[TestFixture]
public class Affs
2017-07-08 19:23:52 +01:00
{
2017-12-21 02:52:12 +00:00
readonly string[] testfiles = {"amigaos_3.9.adf.lz", "amigaos_3.9_intl.adf.lz"};
2017-07-08 19:23:52 +01:00
2017-12-21 02:52:12 +00:00
readonly MediaType[] mediatypes = {MediaType.CBM_AMIGA_35_DD, MediaType.CBM_AMIGA_35_DD};
2017-07-08 19:23:52 +01:00
2017-12-21 02:52:12 +00:00
readonly ulong[] sectors = {1760, 1760};
2017-07-08 19:23:52 +01:00
2017-12-21 02:52:12 +00:00
readonly uint[] sectorsize = {512, 512};
2017-07-08 19:23:52 +01:00
2017-12-21 02:52:12 +00:00
readonly long[] clusters = {1760, 1760};
2017-07-08 19:23:52 +01:00
2017-12-21 02:52:12 +00:00
readonly int[] clustersize = {512, 512};
2017-07-08 19:23:52 +01:00
2017-12-21 02:52:12 +00:00
readonly string[] volumename = {"Volume label", "Volume label"};
2017-07-08 19:23:52 +01:00
2017-12-21 02:52:12 +00:00
readonly string[] volumeserial = {"A5D9FAE2", "A5DA0CC9"};
2017-07-08 19:23:52 +01:00
[Test]
public void Test()
{
for(int i = 0; i < testfiles.Length; i++)
{
2017-07-08 19:24:07 +01:00
string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "affs", testfiles[i]);
2017-07-08 19:23:52 +01:00
Filter filter = new LZip();
filter.Open(location);
ImagePlugin image = new ZZZRawImage();
Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]);
Assert.AreEqual(mediatypes[i], image.ImageInfo.MediaType, testfiles[i]);
Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]);
Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]);
2017-07-08 19:24:07 +01:00
Filesystem fs = new AmigaDOSPlugin();
Partition wholePart = new Partition
{
2017-07-19 16:37:11 +01:00
Name = "Whole device",
Length = image.ImageInfo.Sectors,
Size = image.ImageInfo.Sectors * image.ImageInfo.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]);
fs.GetInformation(image, wholePart, out _);
2017-07-08 19:23:52 +01:00
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
2017-07-08 19:24:07 +01:00
Assert.AreEqual("Amiga FFS", fs.XmlFSType.Type, testfiles[i]);
2017-07-08 19:23:52 +01:00
Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]);
Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]);
}
}
}
2017-12-19 20:33:03 +00:00
}