Add majority of data extensions tests, fix minor issues

This commit is contained in:
Matt Nadareski
2026-03-21 20:09:10 -04:00
parent 8bec2087eb
commit 5544ab0b8a
16 changed files with 910 additions and 11 deletions

View File

@@ -0,0 +1,61 @@
using SabreTools.Data.Models.NewExecutable;
using Xunit;
namespace SabreTools.Data.Extensions.Test
{
public class NewExecutableExtensionsTests
{
#region IsIntegerType
[Fact]
public void IsIntegerType_RTIE_HighBitSet_True()
{
var entry = new ResourceTypeInformationEntry { TypeID = 0xFFFF };
bool actual = entry.IsIntegerType();
Assert.True(actual);
}
[Fact]
public void IsIntegerType_RTIE_HighBitClear_False()
{
var entry = new ResourceTypeInformationEntry { TypeID = 0x0000 };
bool actual = entry.IsIntegerType();
Assert.False(actual);
}
[Fact]
public void IsIntegerType_RTRE_HighBitSet_True()
{
var entry = new ResourceTypeResourceEntry { ResourceID = 0xFFFF };
bool actual = entry.IsIntegerType();
Assert.True(actual);
}
[Fact]
public void IsIntegerType_RTRE_HighBitClear_False()
{
var entry = new ResourceTypeResourceEntry { ResourceID = 0x0000 };
bool actual = entry.IsIntegerType();
Assert.False(actual);
}
#endregion
#region GetEntryType
[Theory]
[InlineData(0x00, SegmentEntryType.Unused)]
[InlineData(0x01, SegmentEntryType.FixedSegment)]
[InlineData(0xAA, SegmentEntryType.FixedSegment)]
[InlineData(0xFE, SegmentEntryType.FixedSegment)]
[InlineData(0xFF, SegmentEntryType.MoveableSegment)]
public void GetEntryTypeTest(byte segmentIndicator, SegmentEntryType expected)
{
var entry = new EntryTableBundle { SegmentIndicator = segmentIndicator };
SegmentEntryType actual = entry.GetEntryType();
Assert.Equal(expected, actual);
}
#endregion
}
}