From ac3c496018e940d93b2916466f6703d773e6963e Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Mon, 3 Feb 2020 00:44:50 -0700 Subject: [PATCH] Run common tests on xts and subdir filesystems --- .../LibHac.Tests/Fs/AesXtsFileSystemTests.cs | 19 +++++++++++ .../Fs/SubdirectoryFileSystemTests.cs | 34 +++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 tests/LibHac.Tests/Fs/AesXtsFileSystemTests.cs create mode 100644 tests/LibHac.Tests/Fs/SubdirectoryFileSystemTests.cs diff --git a/tests/LibHac.Tests/Fs/AesXtsFileSystemTests.cs b/tests/LibHac.Tests/Fs/AesXtsFileSystemTests.cs new file mode 100644 index 00000000..9d02ba09 --- /dev/null +++ b/tests/LibHac.Tests/Fs/AesXtsFileSystemTests.cs @@ -0,0 +1,19 @@ +using LibHac.Fs; +using LibHac.FsSystem; +using LibHac.Tests.Fs.IFileSystemTestBase; + +namespace LibHac.Tests.Fs +{ + public class AesXtsFileSystemTests : IFileSystemTests + { + protected override IFileSystem CreateFileSystem() + { + var baseFs = new InMemoryFileSystem(); + + var keys = new byte[0x20]; + var xtsFs = new AesXtsFileSystem(baseFs, keys, 0x4000); + + return xtsFs; + } + } +} diff --git a/tests/LibHac.Tests/Fs/SubdirectoryFileSystemTests.cs b/tests/LibHac.Tests/Fs/SubdirectoryFileSystemTests.cs new file mode 100644 index 00000000..e033e095 --- /dev/null +++ b/tests/LibHac.Tests/Fs/SubdirectoryFileSystemTests.cs @@ -0,0 +1,34 @@ +using System.Diagnostics; +using LibHac.Fs; +using LibHac.FsSystem; +using LibHac.Tests.Fs.IFileSystemTestBase; + +namespace LibHac.Tests.Fs +{ + public class SubdirectoryFileSystemTests : IFileSystemTests + { + protected override IFileSystem CreateFileSystem() + { + Trace.Listeners.Clear(); + var baseFs = new InMemoryFileSystem(); + baseFs.CreateDirectory("/sub"); + baseFs.CreateDirectory("/sub/path"); + + var subFs = new SubdirectoryFileSystem(baseFs, "/sub/path"); + + return subFs; + } + } + public class SubdirectoryFileSystemTestsRoot : IFileSystemTests + { + protected override IFileSystem CreateFileSystem() + { + Trace.Listeners.Clear(); + var baseFs = new InMemoryFileSystem(); + + var subFs = new SubdirectoryFileSystem(baseFs, "/"); + + return subFs; + } + } +}