-
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.
Merge pull request #516 from Mutagen-Modding/514-lower-range-id-impro…
…vements 514 lower range id improvements
- Loading branch information
Showing
39 changed files
with
1,083 additions
and
518 deletions.
There are no files selected for viewing
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
137 changes: 137 additions & 0 deletions
137
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,137 @@ | ||
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); | ||
} | ||
|
||
[Theory, DefaultAutoData] | ||
public void ForceUseLowerRangesWithNoListedLowerVersion( | ||
GameRelease release, | ||
float headerVersion) | ||
{ | ||
HeaderVersionHelper.GetNextFormId( | ||
release, | ||
allowedReleases: new HashSet<GameRelease>() | ||
{ | ||
}, | ||
headerVersion: headerVersion, | ||
useLowerRangesVersion: null, | ||
forceUseLowerFormIDRanges: true, | ||
higherFormIdRange: 800) | ||
.Should().Be(1); | ||
} | ||
} |
Oops, something went wrong.