tests/testthat/test_initEmpReq.R

library(mansched)
library(readxl)

xlsxFile <- system.file("exdata", "sampleData.xlsx", package = "mansched")

empReq <- readxl::read_xlsx(path  = xlsxFile,
                            sheet = "Requirement")

sched <- readxl::read_xlsx(path      = xlsxFile,
                           sheet     = "Schedule",
                           col_types = c("text",
                                         "numeric",
                                         "numeric",
                                         "numeric",
                                         "numeric",
                                         "numeric",
                                         "numeric",
                                         "numeric",
                                         "numeric",
                                         "numeric",
                                         "numeric",
                                         "numeric",
                                         "numeric"))

empPool <- readxl::read_xlsx(path  = xlsxFile,
                             sheet = "Pool")

hol <- readxl::read_xlsx(path  = xlsxFile,
                         sheet = "hol")

manReq <- initEmpReq(empReq = as.data.frame(empReq),
                     sched  = as.data.frame(sched),
                     hol    = as.data.frame(hol),
                     year   = 2018)[[1]]

test_that("initEmpReq() works", {
  expect_equal(length(manReq), 3)
})

rm(list = ls())
basilrabi/mansched2 documentation built on May 19, 2023, 9:51 p.m.