Skip to content

Commit

Permalink
test relative and absolute dates give same answers
Browse files Browse the repository at this point in the history
  • Loading branch information
hillalex committed Oct 7, 2024
1 parent f01e8fe commit a156add
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/testthat/test-relative-dates.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ test_that("Using relative and absolute dates gives the same answer", {
iter_sampling = 100,
seed = 100)

min_date <- min(dat_absolute$day)

set.seed(1)
trajectories_relative <- mod_relative$simulate_individual_trajectories()
trajectories_relative$calendar_day <- as.integer(mindate + trajectories_relative$calendar_day, units = "days")

# convert relative days to absolute
min_date <- min(dat_absolute$day)
trajectories_relative$calendar_day <- min_date + trajectories_relative$calendar_day

expect_equal(trajectories_relative, trajectories_absolute)
})

0 comments on commit a156add

Please sign in to comment.