Skip to content

Commit

Permalink
tests: for multiple duplicates in table (issue #72)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgibb committed Oct 21, 2020
1 parent aaee4f3 commit 9a67767
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/testthat/test_matching.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ test_that("closest, duplicates", {
y <- c(4.6, 4.7, 4.8, 4.9, 5, 6, 7, 8)
expect_equal(closest(x, y, tolerance = 3, duplicates = "closest"),
c(NA, NA, NA, 1, 5, 6, 7))

# multiple duplicates in table, see
# https://github.com/rformassspectrometry/MsCoreUtils/issues/72
expect_equal(closest(1:2, rep(1:2, each = 2),
tolerance = 0, duplicates = "closest"),
c(1, 3))
expect_equal(closest(1:2, rep(1:2, each = 3),
tolerance = 0, duplicates = "closest"),
c(1, 4))
})

test_that("common", {
Expand Down

0 comments on commit 9a67767

Please sign in to comment.