Skip to content

Commit

Permalink
#2510 enhance_derive_param_computed: style files
Browse files Browse the repository at this point in the history
  • Loading branch information
bundfussr committed Oct 29, 2024
1 parent 77a1b9c commit b99d063
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions tests/testthat/test-derive_param_computed.R
Original file line number Diff line number Diff line change
Expand Up @@ -423,10 +423,10 @@ test_that("derive_param_computed Test 10: specify variables for keep_nas", {
expected <- bind_rows(
advs,
tibble::tribble(
~USUBJID, ~AVISIT, ~AVAL,
"01-701-1015", "BASELINE", (121 + 2*51)/3,
"01-701-1015", "WEEK 2", (121 + 2*50)/3,
"01-701-1028", "BASELINE", (130 + 2*79)/3
~USUBJID, ~AVISIT, ~AVAL,
"01-701-1015", "BASELINE", (121 + 2 * 51) / 3,
"01-701-1015", "WEEK 2", (121 + 2 * 50) / 3,
"01-701-1028", "BASELINE", (130 + 2 * 79) / 3
) %>%
mutate(
PARAMCD = "MAP",
Expand Down Expand Up @@ -475,21 +475,20 @@ test_that("derive_param_computed Test 11: error if keep_nas is invalid", {
)

expect_snapshot(
derive_param_computed(
advs,
by_vars = exprs(USUBJID, AVISIT),
parameters = c("SYSBP", "DIABP"),
set_values_to = exprs(
AVAL = (AVAL.SYSBP + 2 * AVAL.DIABP) / 3,
PARAMCD = "MAP",
PARAM = "Mean Arterial Pressure (mmHg)"
derive_param_computed(
advs,
by_vars = exprs(USUBJID, AVISIT),
parameters = c("SYSBP", "DIABP"),
set_values_to = exprs(
AVAL = (AVAL.SYSBP + 2 * AVAL.DIABP) / 3,
PARAMCD = "MAP",
PARAM = "Mean Arterial Pressure (mmHg)"
),
keep_nas = 3
),
keep_nas = 3
),
error = TRUE
error = TRUE
)
}
)
})

# assert_parameters_argument ----
## Test 12: error if argument is of wrong type ----
Expand Down

0 comments on commit b99d063

Please sign in to comment.