Files
Aaru/Aaru.Tests/Filesystems/AFFS2.cs

115 lines
3.9 KiB
C#
Raw Normal View History

// /***************************************************************************
2017-07-08 19:23:52 +01:00
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : AFFS2.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/>.
//
// ----------------------------------------------------------------------------
2018-12-29 17:34:38 +00:00
// Copyright © 2011-2019 Natalia Portillo
2017-07-08 19:23:52 +01:00
// ****************************************************************************/
2017-07-08 19:23:52 +01:00
using System.Collections.Generic;
using System.IO;
2020-02-27 00:33:26 +00:00
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
2017-07-08 19:23:52 +01:00
using NUnit.Framework;
2020-02-27 00:33:26 +00:00
namespace Aaru.Tests.Filesystems
2017-07-08 19:23:52 +01:00
{
[TestFixture]
public class Affs2Rdb
2017-07-08 19:23:52 +01:00
{
2020-07-20 21:11:32 +01:00
readonly string[] _testfiles =
2020-02-29 18:03:35 +00:00
{
"amigaos_4.0.aif"
2020-02-29 18:03:35 +00:00
};
2017-07-08 19:23:52 +01:00
2020-07-20 21:11:32 +01:00
readonly ulong[] _sectors =
2020-02-29 18:03:35 +00:00
{
1024128
};
2017-07-08 19:23:52 +01:00
2020-07-20 21:11:32 +01:00
readonly uint[] _sectorsize =
2020-02-29 18:03:35 +00:00
{
512
};
2017-07-08 19:23:52 +01:00
2020-07-20 21:11:32 +01:00
readonly long[] _clusters =
2020-02-29 18:03:35 +00:00
{
511040
};
2017-07-08 19:23:52 +01:00
2020-07-20 21:11:32 +01:00
readonly int[] _clustersize =
2020-02-29 18:03:35 +00:00
{
1024
};
2017-07-08 19:23:52 +01:00
2020-07-20 21:11:32 +01:00
readonly string[] _volumename =
2020-02-29 18:03:35 +00:00
{
"Volume label"
};
2017-07-08 19:23:52 +01:00
2020-07-20 21:11:32 +01:00
readonly string[] _volumeserial =
2020-02-29 18:03:35 +00:00
{
"611D85E5"
};
2017-07-08 19:23:52 +01:00
[Test]
public void Test()
{
2020-07-20 21:11:32 +01:00
for(int i = 0; i < _testfiles.Length; i++)
2017-07-08 19:23:52 +01:00
{
2020-07-20 21:11:32 +01:00
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Fast File System 2 (RDB)",
_testfiles[i]);
2020-07-08 20:02:59 +01:00
IFilter filter = new ZZZNoFilter();
2017-07-08 19:23:52 +01:00
filter.Open(location);
IMediaImage image = new AaruFormat();
2020-07-20 21:11:32 +01:00
Assert.AreEqual(true, image.Open(filter), _testfiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]);
Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
2018-06-22 08:08:38 +01:00
IFilesystem fs = new AmigaDOSPlugin();
int part = -1;
2020-02-29 18:03:35 +00:00
2017-07-08 19:23:52 +01:00
for(int j = 0; j < partitions.Count; j++)
2017-07-19 16:37:11 +01:00
if(partitions[j].Type == "\"DOS\\7\"")
2017-07-08 19:23:52 +01:00
{
part = j;
2020-02-29 18:03:35 +00:00
2017-07-08 19:23:52 +01:00
break;
}
2017-12-19 20:33:03 +00:00
2020-07-20 21:11:32 +01:00
Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}");
Assert.AreEqual(true, fs.Identify(image, partitions[part]), _testfiles[i]);
fs.GetInformation(image, partitions[part], out _, null);
2020-07-20 21:11:32 +01:00
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]);
Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]);
Assert.AreEqual("Amiga FFS2", fs.XmlFsType.Type, _testfiles[i]);
Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]);
Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]);
2017-07-08 19:23:52 +01:00
}
}
}
2017-12-19 20:33:03 +00:00
}