tests/testthat/test-overlaps.R

context("venndir overlaps")
# library(venndir)

test_that("signed_overlaps", {
   inputlist <- list(setA=factor(c("A", "B", "D")),
      setB=factor(c("A", "C", "E", "F")));
   so <- signed_overlaps(inputlist, return_items=TRUE)
   
   testthat::expect_equal(
      so$overlap,
      c("1 0", "0 1", "1 1"))
   
   testthat::expect_equal(
      so$count,
      c(2, 3, 1))
   
   so_items_expected <- list(
      `setA|1 0`=c("B", "D"),
      `setB|0 1`=c("C", "E", "F"),
      `setA&setB|1 1`=c("A"))
   testthat::expect_equal(
      so$items,
      base::I(so_items_expected))
})
jmw86069/venndir documentation built on Nov. 14, 2024, 10:12 a.m.