-
Notifications
You must be signed in to change notification settings - Fork 16
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
Conversation
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.
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
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.
I like this approach!
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.
Sorry, I meant to request changes in my previous review
Calling
all.equal
(or equivalentlyexpect_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 withnew(size=N)
would always be different compared to a bitset created withnew(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.