Skip to content

Positive or negative number sample: .NET 11, fixed benchmark, edge-case tests - #2444

Merged
vladimir-pecanac-main merged 3 commits into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/109404-csharp-check-positive-negative-number
Dec 1, 2026
Merged

vladimir-pecanac-main merged 3 commits into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/109404-csharp-check-positive-negative-number

Conversation

@vladimir-pecanac-main

Copy link
Copy Markdown
Collaborator

Moves numbers-csharp/ValidateNumberIsPositiveOrNegative to net11.0 with BenchmarkDotNet 0.15.8, NUnit 5.0.0, NUnit3TestAdapter 6.3.1, NUnit.Analyzers 4.15.0, Microsoft.NET.Test.Sdk 18.12.0 and coverlet.collector 10.1.1. The benchmark now runs in process, uses numbers from -500 to 499 instead of only negative ones, and returns the summed results so the calls are not discarded. Program.cs uses top-level statements and prints the zero, negative zero and NaN cases the article shows, and two new tests cover Math.Abs on int.MinValue and Math.Sign on NaN.

@vladimir-pecanac-main
vladimir-pecanac-main merged commit 1e5cc28 into CodeMazeBlog:main Dec 1, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant