Skip to content
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
20 changes: 12 additions & 8 deletions .devcontainer/r-350/.Rprofile
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ expect_identical = function(x, y, tolerance = NULL, ignore_attr = NULL, info = c
if (is.null(tolerance)) {
# NB: some tests _do_ require identical() dispatch here.
if (!identical(x, y)) {
stop(
"x and y are not identical. all.equal(x, y, tolerance=0) result:\n",
paste0(" ", all.equal(x, y, tolerance=0), collapse = "\n"),
if (length(info)) "\n", info
)
cat("all.equal(x, y, tolerance=0) result:\n")
writeLines(paste0(" ", all.equal(x, y, tolerance=0)))
cat("----\nx:\n")
print(x)
cat("----\ny:\n")
print(y)
stop("x and y are not identical.", if (length(info)) "\n", info)
}
} else {
if (!isTRUE(all.equal(x, y, tolerance=tolerance))) {
Expand Down Expand Up @@ -124,9 +126,9 @@ with_parameters_test_that <- function(desc, code, .cases = NULL, .interpret_glue
code_expr <- substitute(code)
# If .cases is not provided, build it from ... (grid expansion)
if (is.null(.cases)) {
args = list(...)
args$stringsAsFactors = FALSE
.cases <- do.call(expand.grid, args)
.cases = list(...)
for (ii in seq_along(.cases)) if (is.list(.cases[[ii]])) .cases[[ii]] = I(.cases[[ii]])
.cases = data.frame(.cases, stringsAsFactors=FALSE)
}

# Iterate over cases
Expand All @@ -145,6 +147,8 @@ with_parameters_test_that <- function(desc, code, .cases = NULL, .interpret_glue
cat(".") # print dot for progress
}, error = function(e) {
cat(sprintf("\nFAILED at case %d: %s\n", i, conditionMessage(e)))
cat(" Case parameters:\n")
print(row_vals)
stop(e)
})
}
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
1. `sortfin(integer64(), 1:10)` no longer segfaults (#164).
1. `orderfin(as.integer64(10:1), 1:3, 8:11)` enforces that `table` be sorted by `order` instead of segfaulting (#166).
1. `ordertab()` no longer segfaults when `nunique` is smaller than the actual number of unique values (#168).
1. `as.integer64.character` now returns `NA` for out of range values, with warning, e.g. `as.integer64("22222222222222222222")`. Thanks @hcirellu.
1. `as.integer64.character` now returns `NA` for out of range values, with warning, e.g. `as.integer64("22222222222222222222")` (#175). Thanks @hcirellu.
1. `quicksort()` and others no longer segfault on trivial cases (e.g. sorting 0 or 1 item, #220).

## NOTES
Expand Down
7 changes: 4 additions & 3 deletions tests/testthat/test-integer64.R
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,17 @@ test_that("Conversion from hex is supported", {
with_parameters_test_that(
"base-10 edge cases return missing",
expect_warning(
expect_identical(as.integer64(string), NA_integer64_),
expect_identical(as.integer64(string), rep(NA_integer64_, length(string))),
"NAs introduced by coercion to integer64 range", fixed=TRUE
),
string = c(
string = list(
strrep("9", 63L),
"9223372036854775808",
"-9223372036854775808",
"999x",
"-999x",
"999 "
"999 ",
c("9223372036854775809", "-9223372036854775809") # vector case from #175
)
)

Expand Down
Loading