Skip to content

Conversation

@Kryptos-FR
Copy link
Member

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

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
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.

1 participant