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

Add an all.equal implementation for Bitset. #192

Merged
merged 3 commits into from
Mar 18, 2024
Merged

Add an all.equal implementation for Bitset. #192

merged 3 commits into from
Mar 18, 2024

Conversation

plietar
Copy link
Member

@plietar plietar commented Mar 11, 2024

Calling all.equal (or equivalently expect_equal) on bitsets has never worked correctly. For some reason, externalptr always compare as equal, thus, under the R6 implementation, any bitset with the same max size was treated as equal.

With the recent switch to a named list and bitsets would sometimes be considered different, even where their contents were the same. More precisely, the arguments of Bitset$new now happen to be captured by all of the methods' environments and were being included in the comparison. A bitset created with new(size=N) would always be different compared to a bitset created with new(from=ptr).

malariasimulation has some tests that use mockery::expect_args to compare bitset arguments, and these tests are now broken by the new individual version.

Calling `all.equal` (or equivalently `expect_equal`) on bitsets has
never worked correctly. For some reason, externalptr always compare as
equal, thus, under the R6 implementation, any bitset with the same max
size was treated as equal.

With the recent switch to a named list and bitsets would sometimes be
considered different, even where their contents were the same. More
precisely, the arguments of `Bitset$new` now happen to be captured by
all of the methods' environments and were being included in the
comparison. A bitset created with `new(size=N)` would always be
different compared to a bitset created with `new(from=ptr)`.

malariasimulation has some tests that use `mockery::expect_args` to
compare bitset arguments, and these tests are now broken by the new
individual version.
Copy link

codecov bot commented Mar 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.13%. Comparing base (c9cdee3) to head (b99d893).
Report is 21 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #192      +/-   ##
==========================================
- Coverage   96.28%   96.13%   -0.15%     
==========================================
  Files          36       36              
  Lines        1722     1839     +117     
==========================================
+ Hits         1658     1768     +110     
- Misses         64       71       +7     

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

Copy link
Member

@giovannic giovannic left a comment

Choose a reason for hiding this comment

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

I like this approach!

R/bitset.R Show resolved Hide resolved
Copy link
Member

@giovannic giovannic left a comment

Choose a reason for hiding this comment

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

Sorry, I meant to request changes in my previous review

@plietar plietar merged commit 740696f into dev Mar 18, 2024
8 checks passed
@plietar plietar deleted the bitset-equal branch March 18, 2024 14:04
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.

2 participants