Skip to content

Commit 37f154f

Browse files
committed
add edge case of bolus then infusion
1 parent 9d1b8cb commit 37f154f

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

tests/testthat/test_nm_to_regimen.R

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,21 @@ test_that("Doses in different compartments handled", {
103103
expect_equal(reg2$t_inf, c(1, 1, 1, 0.5, 0, 0))
104104
expect_equal(reg2$cmt, c(2, 2, 2, 2, 1, 1))
105105
})
106+
107+
test_that("Different rates handled correctly", {
108+
pt2 <- data.frame(
109+
ID = 1,
110+
EVID = c(1, 1, 0),
111+
CMT = 2,
112+
AMT = c(100, 200, 0),
113+
TIME = c(0, 6, 23),
114+
RATE = c(0, 100, 0),
115+
DV = c(0, 0, 5)
116+
)
117+
reg2 <- nm_to_regimen(pt2)
118+
expect_true(inherits(reg2, "regimen"))
119+
expect_equal(reg2$dose_amts, c(100, 200))
120+
expect_equal(reg2$dose_times, c(0, 6))
121+
expect_equal(reg2$t_inf, c(0, 2))
122+
expect_equal(reg2$cmt, c(2, 2))
123+
})

0 commit comments

Comments
 (0)