Skip to content

Commit

Permalink
add contributor; tests for edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
jasmineirx committed Jun 7, 2024
1 parent 9aceaf8 commit 8c43c2d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Authors@R: c(
person("Jasmine", "Hughes", email = "[email protected]", role = "aut"),
person("Dominic", "Tong", email = "[email protected]", role = "aut"),
person("Kara", "Woo", email = "[email protected]", role = c("aut")),
person("Jordan", "Brooks", email = "[email protected]", role = "aut"),
person("InsightRX", role = c("cph", "fnd")))
Depends: R (>= 3.0.2)
Imports: Rcpp (>= 0.12.9), BH, data.table, stringr, MASS,
Expand Down
21 changes: 21 additions & 0 deletions tests/testthat/test_new_regimen.R
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,28 @@ test_that("t_inf imputed correctly", {
type = c("sc", "infusion", "im", "sc", "infusion", "im","bolus","oral"),
t_inf = c(2/60, 2.5, 3/60, NA, NA, NA, NA, NA)
)
reg3 <- new_regimen(
amt = 100,
times = c(0, 12, 24, 36, 48, 60, 72, 84),
type = c("sc", "infusion", "im", "sc", "infusion", "im","bolus","oral"),
t_inf = numeric(0)
)
reg4 <- new_regimen(
amt = 100,
times = c(0, 12, 24, 36, 48, 60, 72, 84),
type = c("sc", "infusion", "im", "sc", "infusion", "im","bolus","oral"),
t_inf = NULL
)
reg5 <- new_regimen(
amt = 100,
times = c(0, 12, 24, 36),
type = c("sc", "infusion", "im", "unknown_drug_type"),
t_inf = c(2/60, 2.5, 3/60, NA)
)
expect_equal(reg1$t_inf, c(1/60, 1, 1/60, 1/60, 1, 1/60, 0, 0))
expect_equal(reg2$t_inf, c(2/60, 2.5, 3/60, 1/60, 1, 1/60, 0, 0))
expect_equal(reg3$t_inf, c(1/60, 1, 1/60, 1/60, 1, 1/60, 0, 0))
expect_equal(reg4$t_inf, c(1/60, 1, 1/60, 1/60, 1, 1/60, 0, 0))
expect_equal(reg5$t_inf, c(2/60, 2.5, 3/60, 1))
})

0 comments on commit 8c43c2d

Please sign in to comment.