Skip to content

Commit

Permalink
tests: for multiple duplicates in x (similar to issue #72)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgibb committed Oct 21, 2020
1 parent 9a67767 commit ab257ae
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/testthat/test_matching.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ test_that("closest, duplicates", {
expect_equal(closest(1:2, rep(1:2, each = 3),
tolerance = 0, duplicates = "closest"),
c(1, 4))
# multiple duplicates in x, similar to #72 above
expect_equal(closest(rep(1:2, each = 2), 1:2,
tolerance = 0, duplicates = "closest"),
c(1, NA, 2, NA))
expect_equal(closest(rep(1:2, each = 2), 1:2,
tolerance = 0, duplicates = "closest"),
c(1, NA, NA, 2, NA, NA))
})

test_that("common", {
Expand Down

0 comments on commit ab257ae

Please sign in to comment.