-
Notifications
You must be signed in to change notification settings - Fork 20
fix: support extended GeneralsOnline version format with build suffixes #296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2600a2f
fix: support extended GeneralsOnline version format with build suffixes
5ef97dd
fix: handle asymmetric fallback in CompareGeneralsOnlineVersions
3702033
docs: document QFE encoding limitation in GetGeneralsOnlineSortableVe…
2953657
refactor: use QfeMarkerPrefix constant instead of hardcoded string
afff57e
fix: Include EAC plugin files in GeneralsOnline manifests
c88bdda
OpenClaw: Address code review feedback from @coderabbitai[bot]:
b981f10
OpenClaw: Address review feedback from @bobtista
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
134 changes: 134 additions & 0 deletions
134
GenHub/GenHub.Tests/GenHub.Tests.Core/Helpers/GameVersionHelperTests.cs
This file contains hidden or 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,134 @@ | ||
| using GenHub.Core.Helpers; | ||
|
|
||
| namespace GenHub.Tests.Core.Helpers; | ||
|
|
||
| /// <summary> | ||
| /// Tests for <see cref="GameVersionHelper"/> Generals Online version parsing. | ||
| /// </summary> | ||
| public class GameVersionHelperTests | ||
| { | ||
| // ==== ParseGeneralsOnlineVersion — legacy format (MMDDYY_QFE#) ==== | ||
|
|
||
| /// <summary> | ||
| /// Verifies that legacy two-segment versions parse correctly. | ||
| /// </summary> | ||
| [Fact] | ||
| public void ParseGeneralsOnlineVersion_LegacyFormat_ParsesCorrectly() | ||
| { | ||
| var result = GameVersionHelper.ParseGeneralsOnlineVersion("101525_QFE2"); | ||
|
|
||
| Assert.NotNull(result); | ||
| Assert.Equal(new DateTime(2025, 10, 15), result.Value.Date); | ||
| Assert.Equal(2, result.Value.Qfe); | ||
| } | ||
|
|
||
| // ==== ParseGeneralsOnlineVersion — extended format (MMDDYY_QFE#_SUFFIX) ==== | ||
|
|
||
| /// <summary> | ||
| /// Verifies that extended format with build suffix parses date and QFE correctly. | ||
| /// </summary> | ||
| [Fact] | ||
| public void ParseGeneralsOnlineVersion_ExtendedFormat_ParsesDateAndQfe() | ||
| { | ||
| var result = GameVersionHelper.ParseGeneralsOnlineVersion("042826_QFE3_EAC"); | ||
|
|
||
| Assert.NotNull(result); | ||
| Assert.Equal(new DateTime(2026, 4, 28), result.Value.Date); | ||
| Assert.Equal(3, result.Value.Qfe); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Verifies that versions with multiple suffix segments still parse correctly. | ||
| /// </summary> | ||
| [Fact] | ||
| public void ParseGeneralsOnlineVersion_MultipleSuffixes_ParsesDateAndQfe() | ||
| { | ||
| var result = GameVersionHelper.ParseGeneralsOnlineVersion("011526_QFE1_EAC_X86"); | ||
|
|
||
| Assert.NotNull(result); | ||
| Assert.Equal(new DateTime(2026, 1, 15), result.Value.Date); | ||
| Assert.Equal(1, result.Value.Qfe); | ||
| } | ||
|
|
||
| // ==== ParseGeneralsOnlineVersion — edge cases ==== | ||
|
|
||
| /// <summary> | ||
| /// Verifies that null or empty versions return null. | ||
| /// </summary> | ||
| /// <param name="version">The version string to test.</param> | ||
| [Theory] | ||
| [InlineData(null)] | ||
| [InlineData("")] | ||
| [InlineData(" ")] | ||
| public void ParseGeneralsOnlineVersion_NullOrEmpty_ReturnsNull(string? version) | ||
| { | ||
| var result = GameVersionHelper.ParseGeneralsOnlineVersion(version); | ||
| Assert.Null(result); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Verifies that versions missing the underscore separator return null. | ||
| /// </summary> | ||
| [Fact] | ||
| public void ParseGeneralsOnlineVersion_NoUnderscore_ReturnsNull() | ||
| { | ||
| var result = GameVersionHelper.ParseGeneralsOnlineVersion("042826"); | ||
| Assert.Null(result); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Verifies that versions with malformed dates return null. | ||
| /// </summary> | ||
| [Fact] | ||
| public void ParseGeneralsOnlineVersion_InvalidDate_ReturnsNull() | ||
| { | ||
| var result = GameVersionHelper.ParseGeneralsOnlineVersion("ABCDEF_QFE1"); | ||
| Assert.Null(result); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Verifies that versions with non-numeric QFE return null. | ||
| /// </summary> | ||
| [Fact] | ||
| public void ParseGeneralsOnlineVersion_NonNumericQfe_ReturnsNull() | ||
| { | ||
| var result = GameVersionHelper.ParseGeneralsOnlineVersion("042826_QFEx"); | ||
| Assert.Null(result); | ||
| } | ||
|
|
||
| // ==== GetGeneralsOnlineSortableVersion ==== | ||
|
|
||
| /// <summary> | ||
| /// Verifies that sortable version is computed correctly for legacy format. | ||
| /// </summary> | ||
| [Fact] | ||
| public void GetGeneralsOnlineSortableVersion_LegacyFormat_ReturnsCorrectValue() | ||
| { | ||
| // "101525_QFE2" -> date=101525, qfe=2 -> 101525*10 + 2 = 1015252 | ||
| var result = GameVersionHelper.GetGeneralsOnlineSortableVersion("101525_QFE2"); | ||
| Assert.Equal(1015252, result); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Verifies that sortable version ignores build suffixes in extended format. | ||
| /// </summary> | ||
| [Fact] | ||
| public void GetGeneralsOnlineSortableVersion_ExtendedFormat_IgnoresSuffix() | ||
| { | ||
| // "042826_QFE3_EAC" -> date=042826, qfe=3 -> 42826*10 + 3 = 428263 | ||
| var result = GameVersionHelper.GetGeneralsOnlineSortableVersion("042826_QFE3_EAC"); | ||
| Assert.Equal(428263, result); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Verifies that legacy and extended formats with same date+QFE produce the same sortable value. | ||
| /// </summary> | ||
| [Fact] | ||
| public void GetGeneralsOnlineSortableVersion_SameVersionDifferentFormat_ProducesEqualValue() | ||
| { | ||
| var legacy = GameVersionHelper.GetGeneralsOnlineSortableVersion("042826_QFE3"); | ||
| var extended = GameVersionHelper.GetGeneralsOnlineSortableVersion("042826_QFE3_EAC"); | ||
|
|
||
| Assert.Equal(legacy, extended); | ||
| } | ||
| } |
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.