diff --git a/tests/testthat/test-get_cam_op.R b/tests/testthat/test-get_cam_op.R index 70c20435..181d9c59 100644 --- a/tests/testthat/test-get_cam_op.R +++ b/tests/testthat/test-get_cam_op.R @@ -83,7 +83,55 @@ test_that("daily effort is > 0 and < 1 for partial active days (start/end)", { expect_true(cam_op_matrix[4, end] < 1) }) +test_that( + "effort is > 1 for locations with multiple deployments active at same time", { + mica1 <- mica + mica1$deployments$start[2] <- lubridate::as_datetime("2020-07-30 21:00:00") + mica1$deployments$end[2] <- lubridate::as_datetime("2020-08-07 21:00:00") + mica1$deployments$locationName[2] <- mica1$deployments$locationName[1] + cam_op_matrix <- get_cam_op(mica1) + + first_full_day_two_deps <- as.character(as.Date(mica1$deployments$start[2]) + + lubridate::ddays(1)) + last_full_day_two_deps <- as.character(as.Date(mica1$deployments$end[2]) - + lubridate::ddays(1)) + # as many rows as locations + expect_true( + nrow(cam_op_matrix) == length(unique(mica1$deployments$locationName)) + ) + expect_true(cam_op_matrix[1, first_full_day_two_deps] > 1) + expect_true(cam_op_matrix[1, last_full_day_two_deps] > 1) +}) + +test_that( + "0