tests/testthat/test-parser-layout.R

library(testthat)

test_that("Empty file triggers an error", {
  path <- "incorrect_filepath.csv"
  expect_error(read_layout_data(path, separator = ","))
})

test_that("Test reading layout from CSV file", {
  path <- system.file("extdata", "CovidOISExPONTENT_layout.csv", package = "SerolyzeR", mustWork = TRUE)
  layout_data <- read_layout_data(path, separator = ",")
  expect_is(layout_data, "matrix")
  expect_equal(layout_data["A", 1], "B") # BLANK
})

test_that("Test reading layout from a excel file", {
  path <- system.file("extdata", "CovidOISExPONTENT_layout.xlsx", package = "SerolyzeR", mustWork = TRUE)
  layout_data <- read_layout_data(path, separator = ",")
  expect_is(layout_data, "matrix")
  expect_equal(layout_data["A", 1], "B") # BLANK
})

Try the SerolyzeR package in your browser

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

SerolyzeR documentation built on April 12, 2025, 2:11 a.m.