Skip to content

Commit

Permalink
Merge pull request #285 from jdblischak/test-wlr-ratio
Browse files Browse the repository at this point in the history
Add test to confirm that wlr() uses new argument ratio
  • Loading branch information
LittleBeannie authored Sep 20, 2024
2 parents 506ce7d + f1cb865 commit 9d66e2d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/testthat/test-unvalidated-wlr.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,14 @@ test_that("wlr() rejects input object without proper class", {
x <- mtcars
expect_error(wlr(x), "no applicable method")
})

test_that("wlr() uses argument ratio", {
x <- data.frame(treatment = ifelse(ex1_delayed_effect$trt == 1, "experimental", "control"),
stratum = rep("All", nrow(ex1_delayed_effect)),
tte = ex1_delayed_effect$month,
event = ex1_delayed_effect$evntd)
class(x) <- c("tte_data", class(x))
wlr_w_ratio <- x |> wlr(weight = fh(rho = 0, gamma = 0.5), ratio = 2)
wlr_wo_ratio <- x |> wlr(weight = fh(rho = 0, gamma = 0.5))
expect_false(isTRUE(all.equal(wlr_w_ratio, wlr_wo_ratio)))
})

0 comments on commit 9d66e2d

Please sign in to comment.