tests/testthat/test-biascorrection.R

prefix <- tempdir()
# prefix <- "tests/testthat/" # nolint

library(data.table)

test_that(
  desc = "correct functioning of BiasCorrection, data type 1",
  code = {

  plotdir <- paste0(prefix, "/plotdir/")
  csvdir <- paste0(prefix, "/csvdir/")

  expect_type(
    biascorrection(
      experimental = "./testdata/exp_type_1.csv",
      calibration = "./testdata/cal_type_1.csv",
      samplelocusname = "Testlocus",
      minmax = FALSE,
      correct_method = "best",
      selection_method = "SSE",
      type = 1,
      plotdir = plotdir,
      csvdir = csvdir,
      logfilename = paste0(prefix, "/log.txt"),
      seed = 1234,
      parallel = ifelse(
        tolower(Sys.info()["sysname"]) == "darwin",
        FALSE,
        TRUE
      )
    ),
    "list"
  )
  expect_length(list.files(plotdir), 50)
  expect_length(list.files(csvdir), 13)


  # cleanup
  expect_silent(clean_up(plotdir = plotdir,
                         csvdir = csvdir))
  expect_true(file.remove(paste0(prefix, "/log.txt")))
})

Try the rBiasCorrection package in your browser

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

rBiasCorrection documentation built on June 21, 2022, 1:05 a.m.