Skip to content
Open
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
4 changes: 3 additions & 1 deletion src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,9 @@ SEXP df_map(SEXP df, SEXP (*fn)(SEXP)) {
\
r_ssize copy_size = (size > x_size) ? x_size : size; \
\
memcpy(p_out, p_x, copy_size * sizeof(CTYPE)); \
if (copy_size > 0) { \
memcpy(p_out, p_x, copy_size * sizeof(CTYPE)); \
} \
\
UNPROTECT(1); \
return out; \
Expand Down
5 changes: 5 additions & 0 deletions tests/testthat/test-set.R
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,11 @@ test_that("works with rcrds", {
expect_identical(vec_set_union(y, x), vec_c(vec_slice(y, c(1, 2, 3, 4)), vec_slice(x, 1)))
})

test_that("works on empty inputs", {
expect_identical(vec_set_union(integer(), 12L), 12L)
expect_identical(vec_set_union(12L, integer()), 12L)
})

# vec_set_symmetric_difference --------------------------------------------

test_that("retains names of `x` and `y` elements", {
Expand Down
Loading