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

Get tests passing on old R #82

Merged
merged 3 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@

1. Package documentation is now managed with {roxygen2}, #61. I tried to retain everything in the original documentation, but the diff required to do so was quite unmanageable (5,000+ lines), so please alert me if anything looks amiss. Most importantly, I ensured the NAMESPACE remains unchanged.

1. The signature of `identical.integer64()` loses `extptr.as.ref=`, which is unavailable for R<4.2.0, but gains `...` to allow this argument in newer versions, #37. This retains the transparency of having all arguments named in the signature (and thus in `?identical.integer64` as well as available for tab-completion) while also retaining the old R version dependency R 3.3.0.

# bit64 NEWS for versions 0.8-3 through 4.5.2 are now in [NEWS.0](https://github.com/r-lib/bit64/blob/master/NEWS.0)
24 changes: 11 additions & 13 deletions R/integer64.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,15 @@
#'
#' This will discover any deviation between objects containing integer64 vectors.
#'
#' @param x atomic vector of class 'integer64'
#' @param y atomic vector of class 'integer64'
#' @param num.eq see [identical()]
#' @param single.NA see [identical()]
#' @param attrib.as.set see [identical()]
#' @param ignore.bytecode see [identical()]
#' @param ignore.environment see [identical()]
#' @param ignore.srcref see [identical()]
#' @param extptr.as.ref see [identical()]
#'
#' @details This is simply a wrapper to [identical()] with default arguments
#' This is simply a wrapper to [identical()] with default arguments
#' `num.eq = FALSE, single.NA = FALSE`.
#'
#' @param x,y Atomic vector of class 'integer64'
#' @param num.eq,single.NA,attrib.as.set,ignore.bytecode,ignore.environment,ignore.srcref
#' See [identical()].
#' @param ... Passed on to `identical()`. Only `extptr.as.ref=` is available as of R 4.4.1,
#' and then only for versions of R >= 4.2.0.
#'
#' @return A single logical value, `TRUE` or `FALSE`, never `NA` and never
#' anything other than a single value.
#' @keywords classes manip
Expand Down Expand Up @@ -587,6 +584,7 @@ if (FALSE){
}
# nocov end

# TODO(R>=4.2.0): Consider restoring extptr.as.ref= to the signature.
#' @rdname identical.integer64
#' @exportS3Method identical integer64
#' @export
Expand All @@ -597,7 +595,7 @@ identical.integer64 <- function(x, y
, ignore.bytecode = TRUE
, ignore.environment = FALSE
, ignore.srcref = TRUE
, extptr.as.ref = FALSE
, ...
)
identical(x=x, y=y
, num.eq = num.eq
Expand All @@ -606,7 +604,7 @@ identical(x=x, y=y
, ignore.bytecode = ignore.bytecode
, ignore.environment = ignore.environment
, ignore.srcref = ignore.srcref
, extptr.as.ref = extptr.as.ref
, ...
)


Expand Down
21 changes: 5 additions & 16 deletions man/identical.integer64.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions tests/testthat/test-highlevel64.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ test_that("match & %in% basics work", {
expect_identical(match(x, y), c(NA, 1:3))
expect_identical(match(y, x), c(2:4, NA))

# TODO(#85): restore these tests on old R.
skip_if(getRversion() < "4.0.0")
expect_identical(match(2:5, y), c(NA, 1:3))
expect_identical(match(as.numeric(2:5), y), c(NA, 1:3))
expect_identical(match(y, 2:5), c(2:4, NA))
Expand Down
Loading