Skip to content

Commit

Permalink
Update Vacamole double dose vax tests, add snapshot
Browse files Browse the repository at this point in the history
Minor update to Vacamole 2 dose vax snapshot
  • Loading branch information
pratikunterwegs committed Mar 21, 2024
1 parent 80dd8e6 commit fc28a22
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 4 deletions.
33 changes: 33 additions & 0 deletions tests/testthat/_snaps/model_vacamole.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Vacamole model: two dose vaccination and stats. correctness

Code
data[grepl("dose", data$compartment, fixed = TRUE) & time %in% seq(50, 55), ]
Output
time demography_group compartment value
<num> <char> <char> <num>
1: 50 [0,60) vaccinated_one_dose 2370379.149
2: 50 60+ vaccinated_one_dose 638905.568
3: 50 [0,60) vaccinated_two_dose 3957.270
4: 50 60+ vaccinated_two_dose 1066.626
5: 51 [0,60) vaccinated_one_dose 2394121.139
6: 51 60+ vaccinated_one_dose 645305.113
7: 51 [0,60) vaccinated_two_dose 27700.882
8: 51 60+ vaccinated_two_dose 7466.380
9: 52 [0,60) vaccinated_one_dose 2417863.063
10: 52 60+ vaccinated_one_dose 651704.650
11: 52 [0,60) vaccinated_two_dose 51444.480
12: 52 60+ vaccinated_two_dose 13866.132
13: 53 [0,60) vaccinated_one_dose 2441604.917
14: 53 60+ vaccinated_one_dose 658104.178
15: 53 [0,60) vaccinated_two_dose 75188.064
16: 53 60+ vaccinated_two_dose 20265.882
17: 54 [0,60) vaccinated_one_dose 2465346.699
18: 54 60+ vaccinated_one_dose 664503.696
19: 54 [0,60) vaccinated_two_dose 98931.632
20: 54 60+ vaccinated_two_dose 26665.630
21: 55 [0,60) vaccinated_one_dose 2489088.407
22: 55 60+ vaccinated_one_dose 670903.205
23: 55 [0,60) vaccinated_two_dose 122675.184
24: 55 60+ vaccinated_two_dose 33065.377
time demography_group compartment value

15 changes: 11 additions & 4 deletions tests/testthat/test-model_vacamole.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ uk_population <- population(
double_vaccination <- vaccination(
name = "double_vaccination",
nu = matrix(
1e-3,
nrow = 2, ncol = 2
c(1e-3, 5e-4), # fewer second doses
nrow = 2, ncol = 2, byrow = TRUE
),
time_begin = matrix(
00,
nrow = 2, ncol = 2
c(0, 50),
nrow = 2, ncol = 2, byrow = TRUE # second dose given from t = 50 onwards
),
time_end = matrix(
100,
Expand Down Expand Up @@ -336,6 +336,13 @@ test_that("Vacamole model: two dose vaccination and stats. correctness", {
expect_true(
all(epidemic_size(data_baseline) > epidemic_size(data))
)

# expect snapshot for range from t = 50:55
# second dose begins at t = 50
expect_snapshot(
data[grepl("dose", data$compartment, fixed = TRUE) &
time %in% seq(50, 55), ]
)
})

test_that("Vacamole model: time dependence", {
Expand Down

0 comments on commit fc28a22

Please sign in to comment.