Skip to content
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

Implement TryFrom for the decimals' respective integers #2075

Merged
merged 4 commits into from
Mar 27, 2024

Conversation

aumetra
Copy link
Member

@aumetra aumetra commented Mar 27, 2024

Closes #2069

Copy link
Member

@webmaster128 webmaster128 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

While we are here, could you do the same for the signed version? I.e. add

  • Int256 -> SignedDecimal256
  • Int128 -> SignedDecimal

using the same pattern

@aumetra
Copy link
Member Author

aumetra commented Mar 27, 2024

Oh sure, completely overlooked those

@webmaster128
Copy link
Member

webmaster128 commented Mar 27, 2024

CI is complaining about test coverage and kinda has a point here. Could you add a simple test for each of the functions? The majority of cases is handled by from_atomics tests.

@aumetra
Copy link
Member Author

aumetra commented Mar 27, 2024

Could you add a simple test for each of the functions?

Sure, the tests now assert the conversion was lossless (i.e. the Display impl of the decimal == Display impl of the integer)

Copy link
Member

@webmaster128 webmaster128 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, nice. This tests the numeric value to be the same 👍

@aumetra aumetra merged commit 092d222 into main Mar 27, 2024
29 checks passed
@aumetra aumetra deleted the aw/tryfrom-decimals branch March 27, 2024 11:29
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.

Conversion of Uint to Decimal too verbose
2 participants