LibHac/tests/LibHac.Tests/Fs/IFileSystemTestBase/IFileSystemTests.IFile.Size.cs

27 lines
693 B
C#
Raw Normal View History

using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
using Xunit;
2021-11-14 20:08:57 +01:00
namespace LibHac.Tests.Fs.IFileSystemTestBase;
public abstract partial class IFileSystemTests
{
2021-11-14 20:08:57 +01:00
[Fact]
public void SetSize_FileSizeModified()
{
2021-11-14 20:08:57 +01:00
IFileSystem fs = CreateFileSystem();
fs.CreateFile("/file", 0, CreateFileOptions.None);
2021-11-14 20:08:57 +01:00
using var file = new UniqueRef<IFile>();
fs.OpenFile(ref file.Ref, "/file", OpenMode.All);
Result res = file.Get.SetSize(54321);
2021-11-14 20:08:57 +01:00
file.Reset();
fs.OpenFile(ref file.Ref, "/file", OpenMode.All);
2021-11-14 20:08:57 +01:00
file.Get.GetSize(out long fileSize);
Assert.Success(res);
2021-11-14 20:08:57 +01:00
Assert.Equal(54321, fileSize);
}
}