tests/testthat/test-readAdat.R

context("Test setup")

zipFiles <- dir(
  system.file("extdata", package = "readat"),
  pattern = "\\.adat\\.zip$",
  full.names = TRUE
)
tmp <- tempfile("readat-tests")
adatFiles <- vapply(
  zipFiles,
  function(x) unzip(x, exdir = tmp),
  character(1)
)

context("Test readAdat")

test_that(
  "readAdat can read all files in the extdata dir",
  {
    expectedNSamples <- rep_len(20L, length(adatFiles))
    expectedNSeqs <- ifelse(grepl("1.3k", adatFiles, fixed = TRUE), 1310L, 1129L)
    actual <- lapply(adatFiles, readAdat, keepOnlyPasses = FALSE)
    for(i in seq_along(actual))
    {
      expect_is(actual[[i]], "WideSomaLogicData")
      expect_identical(nrow(actual[[i]]), expectedNSamples[i])
      expect_identical(nrow(getSequenceData(actual[[i]])), expectedNSeqs[i])
    }
  }
)

context("Test teardown")

unlink(adatFiles, force = TRUE)

Try the readat package in your browser

Any scripts or data that you put into this service are public.

readat documentation built on Oct. 31, 2019, 8:19 a.m.