Skip to content

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

vcsjones
Copy link
Member

MLDsaAlgorithm does not implement equality nor have any tests. Let's fix that.

@Copilot Copilot AI review requested due to automatic review settings June 17, 2025 15:48
@vcsjones vcsjones requested review from bartonjs and Copilot and removed request for Copilot June 17, 2025 15:49
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

@Copilot Copilot AI left a 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 for Equals, GetHashCode, ToString, and equality/inequality operators in MLDsaAlgorithm.
  • 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, and ToString.

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 with null (e.g., Assert.True((MLDsaAlgorithm?)null == null) and Assert.True(MLDsaAlgorithm.MLDsa44 != null)), to validate null-handling behavior.
            AssertExtensions.TrueExpression(MLDsaAlgorithm.MLDsa87 != MLDsaAlgorithm.MLDsa44);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant