tests/testthat/test-map_by_adist.R

context("map_by_adist")

test_that("ignore case", {

  x <- c("ABC", "cde", "adcf")
  y <- c("cdf", "abc")

  tab1 <- map_by_adist(x=x, y=y, max.norm.dist=0.5)
  tab2 <- data.frame(x=c("cde", "ABC"), y=c("cdf", "abc"))
  expect_equal(tab1, tab2)
})

test_that("not ignore case", {

  x <- c("ABC", "cde", "adcf")
  y <- c("cdf", "abc")

  tab1 <- map_by_adist(x=x, y=y, ignore.case=FALSE, max.norm.dist=0.5)
  tab2 <- data.frame(x=c("cde", "adcf"), y=c("cdf", "abc"))
  expect_equal(tab1, tab2)
})
jdreyf/jdcbioinfo documentation built on Feb. 12, 2025, 4:30 p.m.