From 1597f05b27eb6bd07db26837bdcf7ee3e8f92fda Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Thu, 3 Feb 2022 18:38:27 -0700 Subject: [PATCH] Actually assign _entryCount field in BucketTree --- src/LibHac/FsSystem/BucketTree.cs | 1 + tests/LibHac.Tests/FsSystem/BucketTreeTests.cs | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/LibHac/FsSystem/BucketTree.cs b/src/LibHac/FsSystem/BucketTree.cs index 44898782..9ecd8b65 100644 --- a/src/LibHac/FsSystem/BucketTree.cs +++ b/src/LibHac/FsSystem/BucketTree.cs @@ -541,6 +541,7 @@ public partial class BucketTree : IDisposable _entryStorage.Set(in entryStorage); _nodeSize = nodeSize; _entrySize = entrySize; + _entryCount = entryCount; _offsetCount = offsetCount; _entrySetCount = entrySetCount; _offsetCache.IsInitialized = true; diff --git a/tests/LibHac.Tests/FsSystem/BucketTreeTests.cs b/tests/LibHac.Tests/FsSystem/BucketTreeTests.cs index 988fe454..6445db32 100644 --- a/tests/LibHac.Tests/FsSystem/BucketTreeTests.cs +++ b/tests/LibHac.Tests/FsSystem/BucketTreeTests.cs @@ -182,4 +182,12 @@ public class BucketTreeTests : IClassFixture Assert.Equal(expectedEntry.StorageIndex, actualEntry.StorageIndex); } } + + [Theory, MemberData(nameof(BucketTreeTestTheoryData))] + private void GetEntryCount_ReturnsCorrectCount(int treeIndex) + { + BucketTree tree = _treeData[treeIndex].CreateBucketTree(); + + Assert.Equal(_treeData[treeIndex].EntryCount, tree.GetEntryCount()); + } } \ No newline at end of file