-
Notifications
You must be signed in to change notification settings - Fork 5k
Add equality to MLDsaAlgorithm and add tests #116750
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
base: main
Are you sure you want to change the base?
Conversation
Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds value equality support to MLDsaAlgorithm
and introduces tests to validate the new behavior.
- Implemented
IEquatable<MLDsaAlgorithm>
, overrides forEquals
,GetHashCode
,ToString
, and equality/inequality operators inMLDsaAlgorithm
. - Added a
DebuggerDisplay
attribute for better debugging. - Created
MLDsaAlgorithmTests.cs
and wired it into both test projects to cover reference equality,Equals
, hash code consistency, operator overloads, andToString
.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/libraries/System.Security.Cryptography/tests/System.Security.Cryptography.Tests.csproj | Included MLDsaAlgorithmTests.cs in test compilation |
src/libraries/Microsoft.Bcl.Cryptography/tests/Microsoft.Bcl.Cryptography.Tests.csproj | Included MLDsaAlgorithmTests.cs in test compilation |
src/libraries/Common/src/System/Security/Cryptography/MLDsaAlgorithm.cs | Added equality members (IEquatable , overrides, operators), and DebuggerDisplay |
src/libraries/Common/tests/System/Security/Cryptography/MLDsaAlgorithmTests.cs | New tests for equality, GetHashCode , operators, and ToString |
Comments suppressed due to low confidence (1)
src/libraries/Common/tests/System/Security/Cryptography/MLDsaAlgorithmTests.cs:58
- Consider adding tests for operator
==
and!=
when comparing withnull
(e.g.,Assert.True((MLDsaAlgorithm?)null == null)
andAssert.True(MLDsaAlgorithm.MLDsa44 != null)
), to validate null-handling behavior.
AssertExtensions.TrueExpression(MLDsaAlgorithm.MLDsa87 != MLDsaAlgorithm.MLDsa44);
MLDsaAlgorithm
does not implement equality nor have any tests. Let's fix that.