Skip to content

Commit

Permalink
add test for same time of admission and discharge
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmackintosh committed Nov 5, 2020
1 parent 3fb560a commit 5803b86
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/testthat/test_errors_interval_census.R
Original file line number Diff line number Diff line change
Expand Up @@ -326,4 +326,29 @@ test_that("non datetime discharge column throws error", {



test_that("same start and end time causes warning", {
checkDT <- data.table(bed = c("A","B"),
patient = c(3,4),
start_time = c("2020-01-01 11:34:00",
"2020-01-01 11:34:00"),
end_time = c("2020-01-01 11:34:00",
"2020-01-02 17:34:00"))

checkDT$start_time <- lubridate::as_datetime(checkDT$start_time)
checkDT$end_time <- lubridate::as_datetime(checkDT$end_time)


expect_message(interval_census(checkDT,
identifier = "patient",
admit = "start_time",
discharge = 'end_time',
group_var = 'bed',
time_unit = "1 hour",
results = "total",
uniques = TRUE))




})

0 comments on commit 5803b86

Please sign in to comment.