antonioaversa / MoreStructures

Data structures and algorithms for .NET6.
MIT License
5 stars 0 forks source link

Fix binary search bug with array bigger than int.MaxValue / 2 #199

Closed antonioaversa closed 2 years ago

github-actions[bot] commented 2 years ago

Code Coverage

Package Line Rate Branch Rate Complexity Health
MoreStructures 100% 100% 1849
Summary 100% (4857 / 4857) 100% (1415 / 1416) 1849

Minimum allowed line rate is 99%

github-actions[bot] commented 2 years ago

Code Coverage

Package Line Rate Branch Rate Complexity Health
MoreStructures 100% 100% 1887
Summary 100% (4911 / 4911) 100% (1453 / 1454) 1887

Minimum allowed line rate is 99%

antonioaversa commented 2 years ago

A test would be appreciated. How can I know this is working?

A unit test showing the issue has been added in 1466850, together with other fixes for out-of-bounds issues, due to lack of check of indexes boundaries.

Without the fix, the test MoreStructures.Tests.Lists.Searching.BinarySearchTests.First_MiddleIndexOverflow would fail with the following exception:

System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'Invalid index: -1073741725')
github-actions[bot] commented 2 years ago

Code Coverage

Package Line Rate Branch Rate Complexity Health
MoreStructures 100% 100% 1900
Summary 100% (4941 / 4941) 100% (1465 / 1466) 1900

Minimum allowed line rate is 99%

github-actions[bot] commented 2 years ago

Code Coverage

Package Line Rate Branch Rate Complexity Health
MoreStructures 100% 100% 1903
Summary 100% (4952 / 4952) 100% (1467 / 1468) 1903

Minimum allowed line rate is 99%

github-actions[bot] commented 2 years ago

Code Coverage

Package Line Rate Branch Rate Complexity Health
MoreStructures 100% 100% 1903
Summary 100% (4952 / 4952) 100% (1467 / 1468) 1903

Minimum allowed line rate is 99%

github-actions[bot] commented 2 years ago

Code Coverage

Package Line Rate Branch Rate Complexity Health
MoreStructures 100% 100% 1903
Summary 100% (4952 / 4952) 100% (1467 / 1468) 1903

Minimum allowed line rate is 99%

sonarcloud[bot] commented 2 years ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication