Skip to content

Commit

Permalink
HeaderVersionHelperTests
Browse files Browse the repository at this point in the history
  • Loading branch information
Noggog committed Apr 9, 2024
1 parent 763ffa0 commit 322e357
Showing 1 changed file with 120 additions and 0 deletions.
120 changes: 120 additions & 0 deletions Mutagen.Bethesda.Core.UnitTests/Plugins/HeaderVersionHelperTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
using FluentAssertions;
using Mutagen.Bethesda.Plugins.Utility;
using Noggog.Testing.AutoFixture;
using Xunit;

namespace Mutagen.Bethesda.UnitTests.Plugins;

public class HeaderVersionHelperTests
{
[Theory, DefaultAutoData]
public void ForceLower(
GameRelease release,
float headerVersion)
{
HeaderVersionHelper.GetNextFormId(
release,
allowedReleases: null,
headerVersion: headerVersion,
useLowerRangesVersion: headerVersion + 1,
forceUseLowerFormIDRanges: null,
higherFormIdRange: 800)
.Should().Be(800);
HeaderVersionHelper.GetNextFormId(
release,
allowedReleases: null,
headerVersion: headerVersion,
useLowerRangesVersion: headerVersion + 1,
forceUseLowerFormIDRanges: true,
higherFormIdRange: 800)
.Should().Be(1);
}

[Theory, DefaultAutoData]
public void ForceHigher(
GameRelease release,
float headerVersion)
{
HeaderVersionHelper.GetNextFormId(
release,
allowedReleases: null,
headerVersion: headerVersion,
useLowerRangesVersion: headerVersion - 1,
forceUseLowerFormIDRanges: null,
higherFormIdRange: 800)
.Should().Be(1);
HeaderVersionHelper.GetNextFormId(
release,
allowedReleases: null,
headerVersion: headerVersion,
useLowerRangesVersion: headerVersion - 1,
forceUseLowerFormIDRanges: false,
higherFormIdRange: 800)
.Should().Be(800);
}

[Theory, DefaultAutoData]
public void HeaderVersionToUseLowerRelease(
GameRelease release,
float headerVersion)
{
HeaderVersionHelper.GetNextFormId(
release,
allowedReleases: null,
headerVersion: headerVersion,
useLowerRangesVersion: headerVersion - 1,
forceUseLowerFormIDRanges: null,
higherFormIdRange: 800)
.Should().Be(1);
}

[Theory, DefaultAutoData]
public void HeaderVersionToUseHigherRelease(
GameRelease release,
float headerVersion)
{
HeaderVersionHelper.GetNextFormId(
release,
allowedReleases: null,
headerVersion: headerVersion,
useLowerRangesVersion: headerVersion + 1,
forceUseLowerFormIDRanges: null,
higherFormIdRange: 800)
.Should().Be(800);
}

[Theory, DefaultAutoData]
public void AllowedRelease(
GameRelease release,
float headerVersion)
{
HeaderVersionHelper.GetNextFormId(
release,
allowedReleases: new HashSet<GameRelease>()
{
release
},
headerVersion: headerVersion,
useLowerRangesVersion: headerVersion - 1,
forceUseLowerFormIDRanges: null,
higherFormIdRange: 800)
.Should().Be(1);
}

[Theory, DefaultAutoData]
public void DisallowedRelease(
GameRelease release,
float headerVersion)
{
HeaderVersionHelper.GetNextFormId(
release,
allowedReleases: new HashSet<GameRelease>()
{
},
headerVersion: headerVersion,
useLowerRangesVersion: headerVersion - 1,
forceUseLowerFormIDRanges: null,
higherFormIdRange: 800)
.Should().Be(800);
}
}

0 comments on commit 322e357

Please sign in to comment.