Skip to content

Commit

Permalink
Address Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
gowerc committed Mar 4, 2024
1 parent b6b3536 commit e95d411
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/simulations.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ get_timepoints <- function(x) {
"SimGroup",
slots = c(
n = "numeric",
study = "character",
arm = "character"
arm = "character",
study = "character"
)
)

Expand Down
22 changes: 22 additions & 0 deletions tests/testthat/test-simulations.R
Original file line number Diff line number Diff line change
Expand Up @@ -252,3 +252,25 @@ test_that("simulate_joint_data correctly generates an intercept per study", {
z_score <- (ests - c(50, 70, 10)) / ests_se
expect_true(all(abs(z_score) < qnorm(0.99)))
})


test_that("SimGroup() works as expected", {
sim_group <- SimGroup(100, "Arm-A", "Study-X")
expect_s4_class(sim_group, "SimGroup")
expect_equal(sim_group@n, 100)
expect_equal(sim_group@arm, "Arm-A")
expect_equal(sim_group@study, "Study-X")

expect_error(
SimGroup(c(100, 200), "Arm-A", "Study-X"),
regexp = "`n` must be a length 1 integer"
)
expect_error(
SimGroup(100, c("Arm-A", "Arm-b"), "Study-X"),
regexp = "`arm` must be a length 1 string"
)
expect_error(
SimGroup(100, "Arm-A", c("Study-X", "Study-Z")),
regexp = "`study` must be a length 1 string"
)
})

0 comments on commit e95d411

Please sign in to comment.