diff --git a/NAMESPACE b/NAMESPACE index 88a9293..6b4bd81 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -71,6 +71,8 @@ S3method(print,epiworld_tool_fun) S3method(print,epiworld_virus) S3method(print,epiworld_virus_fun) S3method(queuing_off,epiworld_model) +S3method(queuing_off,epiworld_seirconn) +S3method(queuing_off,epiworld_sirconn) S3method(queuing_on,epiworld_model) S3method(queuing_on,epiworld_seirconn) S3method(queuing_on,epiworld_sirconn) diff --git a/R/model-methods.R b/R/model-methods.R index 57ce2f1..e02bfc4 100644 --- a/R/model-methods.R +++ b/R/model-methods.R @@ -127,6 +127,18 @@ queuing_on.epiworld_model <- function(x) { #' @export queuing_off <- function(x) UseMethod("queuing_off") +#' @export +queuing_off.epiworld_sirconn <- function(x) { + warning("SIR Connected models do not have queue.") + invisible(x) +} + +#' @export +queuing_off.epiworld_seirconn <- function(x) { + warning("SEIR Connected models do not have queue.") + invisible(x) +} + #' @export queuing_off.epiworld_model <- function(x) { invisible(queuing_off_cpp(x)) diff --git a/inst/tinytest/test-sirconn.R b/inst/tinytest/test-sirconn.R index cc480d8..48fdf47 100644 --- a/inst/tinytest/test-sirconn.R +++ b/inst/tinytest/test-sirconn.R @@ -40,7 +40,7 @@ expect_length(class(sirconn_0), 2) # Check model run with queuing ------------------------------------------------- expect_silent(verbose_off(sirconn_0)) -expect_warning(queuing_on(sirconn_0)) +expect_warning(queuing_on(sirconn_0), "SIR Connected models do not have queue.") expect_error(plot(sirconn_0), "model must be run before it can be plotted") expect_silent(run(sirconn_0, ndays = 100, seed = 131)) expect_silent(plot(sirconn_0)) # Plot succeeds after model is run @@ -51,7 +51,7 @@ tmat_queuing <- get_transition_probability(sirconn_0) test_tmat(tmat_queuing) # Check model run without queuing ---------------------------------------------- -expect_silent(queuing_off(sirconn_0)) +expect_warning(queuing_off(sirconn_0), "SIR Connected models do not have queue.") run(sirconn_0, ndays = 100, seed = 131) hist_noqueuing <- get_hist_total(sirconn_0)