From 449f4e619e0a535b47c0a3fa4b545bb0e1f529d7 Mon Sep 17 00:00:00 2001 From: jasmineirx Date: Tue, 2 Apr 2024 14:24:27 -0400 Subject: [PATCH] add test for multi length scale --- tests/testthat/test_apply_duration_scale.R | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/testthat/test_apply_duration_scale.R b/tests/testthat/test_apply_duration_scale.R index 4470b6f..17d94b3 100644 --- a/tests/testthat/test_apply_duration_scale.R +++ b/tests/testthat/test_apply_duration_scale.R @@ -12,6 +12,15 @@ reg_iv <- new_regimen( t_inf = 1 ) +reg_combo <- new_regimen( + amt = 1000, + n = 4, + interval = 12, + type = c("drug1", "drug2", "oral", "oral"), + cmt = c(2, 3, 1, 1), + t_inf = c(1, 1, 0, 0) +) + ## null / error checks test_that("infusion length NULL warning", { expect_warning( @@ -47,3 +56,11 @@ test_that("infusion length scaled using parameter", { ) expect_equal(dur3$t_inf, rep(1.6, 12)) }) + +test_that("infusion length scaled", { + dur4 <- apply_duration_scale( + regimen = reg_combo, + duration_scale = c(1, 1.5, 2) + ) + expect_equal(dur4$t_inf, c(1.5, 2, 0)) +})