-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
120 additions
and
0 deletions.
There are no files selected for viewing
120 changes: 120 additions & 0 deletions
120
Mutagen.Bethesda.Core.UnitTests/Plugins/HeaderVersionHelperTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |