-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create test-sis.R and populate with tests
- Loading branch information
1 parent
061f026
commit cd3f06f
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Test just this file: tinytest::run_test_file("inst/tinytest/test-sis.R") | ||
|
||
# Create small world population SIS Model -------------------------------------- | ||
expect_silent(sis_0 <- ModelSIS( | ||
name = "SIS", | ||
prevalence = .1, | ||
transmission_rate = .3, | ||
recovery_rate = .3 | ||
)) | ||
|
||
# Check model initialization | ||
expect_inherits(sis_0, "epiworld_sis") | ||
expect_inherits(sis_0, "epiworld_model") | ||
expect_silent(agents_smallworld( | ||
sis_0, | ||
n = 2000, | ||
k = 5, | ||
d = FALSE, | ||
p = .01 | ||
)) | ||
|
||
# Check model run -------------------------------------------------------------- | ||
expect_silent(verbose_off(sis_0)) | ||
expect_warning(expect_error(plot(sis_0))) # Plot fails before model is run | ||
expect_silent(run_multiple( | ||
sis_0, | ||
ndays=100, | ||
nsims=10, | ||
seed=1231, | ||
reset=TRUE, | ||
verbose = TRUE, | ||
nthreads = 1 | ||
)) | ||
expect_silent(plot(sis_0)) # Plot succeeds after model is run |