Skip to content

Commit

Permalink
better validation test names (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
erblast committed Jun 8, 2022
1 parent 847623b commit bd0cfe0
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 54 deletions.
52 changes: 0 additions & 52 deletions tests/testthat/test_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,58 +52,6 @@ test_that("check standard test data reproducibility", {

})

test_that("check validation test data reproducibility", {

set.seed(1)

study_025 <- sim_test_data_study(
n_pat = 200,
n_sites = 20,
frac_site_with_ur = 0.3,
ur_rate = 0.25
)

study_025$study_id <- "study_025"

study_050 <- sim_test_data_study(
n_pat = 200,
n_sites = 20,
frac_site_with_ur = 0.3,
ur_rate = 0.5
)

study_050$study_id <- "study_050"

study_075 <- sim_test_data_study(
n_pat = 200,
n_sites = 20,
frac_site_with_ur = 0.3,
ur_rate = 0.75
)

study_075$study_id <- "study_075"


study_100 <- sim_test_data_study(
n_pat = 200,
n_sites = 20,
frac_site_with_ur = 0.3,
ur_rate = 1
)

study_100$study_id <- "study_100"

df_visit_val_check <- bind_rows(
study_025,
study_050,
study_075,
study_100
)

expect_equal(df_visit_val, df_visit_val_check)

})


test_that("check portfolio performance test data reproducibility", {

Expand Down
62 changes: 60 additions & 2 deletions tests/testthat/test_validation.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
# test data is automatically loaded, check ./data-raw/generate_test_data.R


test_that("under-reporting probability must negatively correlate with low AE per visit rates", {
test_that(paste("validation requirement - under-reporting probability must",
"negatively correlate with low AE per visit rates using validation",
"test set with 25, 50, 75, 100% simulated AE under-reporting"), {

aerep <- simaerep(df_visit_val)

Expand All @@ -44,7 +46,9 @@ test_that("under-reporting probability must negatively correlate with low AE per
})


test_that("visually inspect plots for under-reporting scenarios", {
test_that(paste("validation requirement - visually inspect plotted AE under-reporting",
"and Ae under-reporting probabilities using validation",
"test set with 25, 50, 75, 100% simulated AE under-reporting"), {

aerep <- simaerep(df_visit_val)

Expand All @@ -57,3 +61,57 @@ test_that("visually inspect plots for under-reporting scenarios", {
}

})


test_that(paste("validation requirement - check reproducibililty of validation",
"test set with 25, 50, 75, 100% simulated AE under-reporting"), {

set.seed(1)

study_025 <- sim_test_data_study(
n_pat = 200,
n_sites = 20,
frac_site_with_ur = 0.3,
ur_rate = 0.25
)

study_025$study_id <- "study_025"

study_050 <- sim_test_data_study(
n_pat = 200,
n_sites = 20,
frac_site_with_ur = 0.3,
ur_rate = 0.5
)

study_050$study_id <- "study_050"

study_075 <- sim_test_data_study(
n_pat = 200,
n_sites = 20,
frac_site_with_ur = 0.3,
ur_rate = 0.75
)

study_075$study_id <- "study_075"


study_100 <- sim_test_data_study(
n_pat = 200,
n_sites = 20,
frac_site_with_ur = 0.3,
ur_rate = 1
)

study_100$study_id <- "study_100"

df_visit_val_check <- bind_rows(
study_025,
study_050,
study_075,
study_100
)

expect_equal(df_visit_val, df_visit_val_check)

})

0 comments on commit bd0cfe0

Please sign in to comment.