diff --git a/tests/testthat/test_data.R b/tests/testthat/test_data.R index dd35a97..78b5a3b 100644 --- a/tests/testthat/test_data.R +++ b/tests/testthat/test_data.R @@ -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", { diff --git a/tests/testthat/test_validation.R b/tests/testthat/test_validation.R index a817700..6125174 100644 --- a/tests/testthat/test_validation.R +++ b/tests/testthat/test_validation.R @@ -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) @@ -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) @@ -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) + +})