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 equality check #275

Merged
merged 3 commits into from
Mar 5, 2024
Merged

Implement equality check #275

merged 3 commits into from
Mar 5, 2024

Conversation

frectonz
Copy link
Contributor

@frectonz frectonz commented Mar 3, 2024

Potential implementation of #229
I used the regular rust way of PartialEq and Eq to check for equality.

image

Copy link

codecov bot commented Mar 3, 2024

Codecov Report

Attention: Patch coverage is 68.75000% with 20 lines in your changes are missing coverage. Please review.

Project coverage is 83.30%. Comparing base (7dce963) to head (c3e7795).

Files Patch % Lines
core/src/ast.rs 38.09% 13 Missing ⚠️
core/src/num/unit.rs 40.00% 3 Missing ⚠️
core/src/lexer.rs 71.42% 2 Missing ⚠️
core/src/scope.rs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #275      +/-   ##
==========================================
- Coverage   83.37%   83.30%   -0.07%     
==========================================
  Files          52       52              
  Lines       14668    14721      +53     
==========================================
+ Hits        12229    12264      +35     
- Misses       2439     2457      +18     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Owner

Choose a reason for hiding this comment

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

I think a custom PartialEq/Eq impl would be better. We should be able to ignore the ‘base’, ‘exact’, ‘format’ and ‘simplifiable’ fields. It would also be nice to take units into account, so that e.g. 2m is equal to 200cm.

Copy link
Contributor Author

@frectonz frectonz Mar 3, 2024

Choose a reason for hiding this comment

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

My latest commit implements comparing values with different units although i haven't tested it thoroughly.

@printfn
Copy link
Owner

printfn commented Mar 3, 2024

Wow, you’re on a roll with all the things you’ve been implementing recently. Thanks so much for all your work!! I’ve left a small comment to improve the equality checks a bit, but otherwise your implementation looks excellent!

@frectonz
Copy link
Contributor Author

frectonz commented Mar 3, 2024

thanks for the kind words 🙏 and btw i also implemented inequality

image

@frectonz
Copy link
Contributor Author

frectonz commented Mar 3, 2024

Comparisons of different units is now implemented 🎉

image

@printfn printfn merged commit c3e7795 into printfn:main Mar 5, 2024
6 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.

None yet

2 participants