Skip to content

feat: Add more unit tests in Core to increase coverage - #2996

Merged
Kryptos-FR merged 8 commits into
stride3d:masterfrom
Kryptos-FR:feature/core-unit-tests
May 7, 2026
Merged

feat: Add more unit tests in Core to increase coverage#2996
Kryptos-FR merged 8 commits into
stride3d:masterfrom
Kryptos-FR:feature/core-unit-tests

Conversation

@Kryptos-FR

@Kryptos-FR Kryptos-FR commented Dec 5, 2025

Copy link
Copy Markdown
Member

PR Details

Improve the code coverage of Stride.Core.AssemblyProcessor, Stride.Core.Yaml, Stride.Core and Stride.Core.IO.

Related PR

#2967

Details

A few bugs were identified during testing and fixed.

MultiValueSortedList<TKey, TValue>

Bug 1: Binary search in Add() method failed to maintain sorted order

  • Cause: Loop condition while (greater - lower > 1) prevented proper sorting for lists with 0-1 elements
  • Impact: Items were not inserted in sorted order (e.g., adding 5,2,8,1 resulted in [5,2,8,1] instead of [1,2,5,8])
  • Fix: Replaced with standard binary search algorithm using while (lower < upper) pattern

Bug 2: Indexer returned incomplete results for duplicate keys

  • Cause: BinarySearch returns an arbitrary matching index, not necessarily the first occurrence
  • Impact: When multiple values shared the same key, only a subset was returned (e.g., 1-2 values instead of all 3)
  • Fix: Added backward scan to find first occurrence before returning values: while (index > 0 && keys[index - 1].Equals(key)) index--;

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have built and run the editor to try this change out.

@Kryptos-FR Kryptos-FR added enhancement New feature or request area-Core Issue of the engine unrelated to other defined areas labels Dec 5, 2025
@Kryptos-FR
Kryptos-FR marked this pull request as draft December 6, 2025 11:27
@Kryptos-FR
Kryptos-FR force-pushed the feature/core-unit-tests branch from 3914766 to 787cfe6 Compare December 6, 2025 12:26
@Kryptos-FR
Kryptos-FR marked this pull request as ready for review December 6, 2025 13:15
@xen2

xen2 commented Feb 26, 2026

Copy link
Copy Markdown
Member

LGTM, thanks!
I can merge it once conflicts are resolved.

@Kryptos-FR

Copy link
Copy Markdown
Member Author

LGTM, thanks! I can merge it once conflicts are resolved.

I forgot about that one. I have merged master and fixed the conflicts.

@Kryptos-FR
Kryptos-FR requested review from Eideren and xen2 April 9, 2026 09:43
@xen2
xen2 force-pushed the master branch 2 times, most recently from ab329f3 to 482bd28 Compare April 16, 2026 07:56
@Kryptos-FR

Kryptos-FR commented Apr 29, 2026

Copy link
Copy Markdown
Member Author

@xen2 I merged master again. All CI pass.

@Kryptos-FR
Kryptos-FR merged commit af4dff2 into stride3d:master May 7, 2026
25 checks passed
@Kryptos-FR
Kryptos-FR deleted the feature/core-unit-tests branch May 7, 2026 16:40
xen2 pushed a commit to xen2/stride that referenced this pull request Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Core Issue of the engine unrelated to other defined areas bug-fix enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants