2021-08-10 23:44:58 +02:00
|
|
|
|
using LibHac.Common;
|
|
|
|
|
using LibHac.Fs;
|
2020-06-10 07:55:59 +02:00
|
|
|
|
using LibHac.Fs.Fsa;
|
2020-01-28 08:55:39 +01:00
|
|
|
|
using Xunit;
|
|
|
|
|
|
2021-11-14 20:08:57 +01:00
|
|
|
|
namespace LibHac.Tests.Fs.IFileSystemTestBase;
|
|
|
|
|
|
|
|
|
|
public abstract partial class IFileSystemTests
|
2020-01-28 08:55:39 +01:00
|
|
|
|
{
|
2021-11-14 20:08:57 +01:00
|
|
|
|
[Fact]
|
|
|
|
|
public void SetSize_FileSizeModified()
|
2020-01-28 08:55:39 +01:00
|
|
|
|
{
|
2021-11-14 20:08:57 +01:00
|
|
|
|
IFileSystem fs = CreateFileSystem();
|
|
|
|
|
fs.CreateFile("/file", 0, CreateFileOptions.None);
|
2020-01-28 08:55:39 +01:00
|
|
|
|
|
2021-11-14 20:08:57 +01:00
|
|
|
|
using var file = new UniqueRef<IFile>();
|
2022-12-03 20:53:30 +01:00
|
|
|
|
fs.OpenFile(ref file.Ref, "/file", OpenMode.All);
|
2022-11-10 05:33:27 +01:00
|
|
|
|
Result res = file.Get.SetSize(54321);
|
2021-11-14 20:08:57 +01:00
|
|
|
|
file.Reset();
|
2020-01-28 08:55:39 +01:00
|
|
|
|
|
2022-12-03 20:53:30 +01:00
|
|
|
|
fs.OpenFile(ref file.Ref, "/file", OpenMode.All);
|
2021-11-14 20:08:57 +01:00
|
|
|
|
file.Get.GetSize(out long fileSize);
|
2020-01-28 08:55:39 +01:00
|
|
|
|
|
2022-11-10 05:33:27 +01:00
|
|
|
|
Assert.Success(res);
|
2021-11-14 20:08:57 +01:00
|
|
|
|
Assert.Equal(54321, fileSize);
|
2020-01-28 08:55:39 +01:00
|
|
|
|
}
|
2022-11-12 02:21:07 +01:00
|
|
|
|
}
|